- This is for Tizen 4.0.
: Tizen 4.0 Configurability and Build Blocks require
to remove all profile-depending build options in spec files.
(No More profile macros)
- It is recommended to distinguish features/profiles at runtime.
unless it incurs too much overhead, which requires you to
create multiple binaries and subpackages.
However, because there are different service files per profile,
- Please create JIRA-TRE issue when you SR this commit:
- Add bluetooth-frwk-profile_common for common profile if common has bluetooth-frwk
- Add bluetooth-frwk-profile_mobile for mobile profile if mobile has bluetooth-frwk
- Add bluetooth-frwk-profile_wearable for wearable profile if wearable has bluetooth-frwk
- Add bluetooth-frwk-profile_tv for tv profile if tv has bluetooth-frwk
- Add bluetooth-frwk-profile_ivi for ivi profile if ivi has bluetooth-frwk
Conflicts:
bt-api/CMakeLists.txt
bt-core/CMakeLists.txt
bt-service/bt-service-adapter.c
packaging/bluetooth-frwk.spec
Change-Id: I813f9f9351571bfad6c437e073da92117fdc80eb
Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
PROJECT(bt-service-api C)
SET(SRCS
+../include/bt-internal-types.c
bt-common.c
bt-adapter.c
bt-adapter-le.c
glib-2.0
gio-2.0
gio-unix-2.0
+ capi-system-info
)
INCLUDE(FindPkgConfig)
return result;
}
-#ifdef TIZEN_PROFILE_WEARABLE
gboolean __bluetooth_is_privileged_process(void)
{
FILE *fp = NULL;
fclose(fp);
return FALSE;
}
-#endif
BT_EXPORT_API int bluetooth_set_advertising(int handle, gboolean enable)
{
BT_CHECK_ENABLED_ANY(return);
-#ifdef TIZEN_PROFILE_WEARABLE
- use_reserved_slot = __bluetooth_is_privileged_process();
-#endif
+ if (TIZEN_PROFILE_WEARABLE)
+ use_reserved_slot = __bluetooth_is_privileged_process();
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
BT_CHECK_ENABLED_ANY(return);
-#ifdef TIZEN_PROFILE_WEARABLE
+ if (TIZEN_PROFILE_WEARABLE)
use_reserved_slot = __bluetooth_is_privileged_process();
-#endif
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
if (length > BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX - 3)
return BLUETOOTH_ERROR_INVALID_PARAM;
-#ifdef TIZEN_PROFILE_WEARABLE
- use_reserved_slot = __bluetooth_is_privileged_process();
-#endif
+ if (TIZEN_PROFILE_WEARABLE)
+ use_reserved_slot = __bluetooth_is_privileged_process();
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
if (length > BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX)
return BLUETOOTH_ERROR_INVALID_PARAM;
-#ifdef TIZEN_PROFILE_WEARABLE
- use_reserved_slot = __bluetooth_is_privileged_process();
-#endif
+ if (TIZEN_PROFILE_WEARABLE)
+ use_reserved_slot = __bluetooth_is_privileged_process();
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
BT_CHECK_PARAMETER(discoverable_mode_ptr, return);
-#ifndef TIZEN_PROFILE_WEARABLE
- int timeout = 0;
- /* Requirement in OSP */
- if (bluetooth_check_adapter() == BLUETOOTH_ADAPTER_DISABLED) {
- if (vconf_get_int(BT_FILE_VISIBLE_TIME, &timeout) != 0) {
- BT_ERR("Fail to get the timeout value");
- return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
- }
+ if (!TIZEN_PROFILE_WEARABLE) {
+ int timeout = 0;
+ /* Requirement in OSP */
+ if (bluetooth_check_adapter() == BLUETOOTH_ADAPTER_DISABLED) {
+ if (vconf_get_int(BT_FILE_VISIBLE_TIME, &timeout) != 0) {
+ BT_ERR("Fail to get the timeout value");
+ return BLUETOOTH_ERROR_DEVICE_NOT_ENABLED;
+ }
- if (timeout == -1)
- *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
- else
- *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
+ if (timeout == -1)
+ *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE;
+ else
+ *discoverable_mode_ptr = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
- return BLUETOOTH_ERROR_NONE;
+ return BLUETOOTH_ERROR_NONE;
+ }
+ } else {
+ BT_CHECK_ENABLED(return);
}
-#else
- BT_CHECK_ENABLED(return);
-#endif
BT_INIT_PARAMS();
BT_ALLOC_PARAMS(in_param1, in_param2, in_param3, in_param4, out_param);
#include "bt-common.h"
#include "bluetooth-telephony-api.h"
#include "marshal.h"
+#include "bt-internal-types.h"
#define BT_SCO_TIMEOUT 3000
const char *interface, const char *method,
GError **err, GVariant *parameters)
{
-#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
- int timeout = 4000;
-#else
int timeout = -1;
-#endif
+
+ if (TIZEN_PROFILE_WEARABLE || TIZEN_PROFILE_IVI)
+ timeout = 4000;
+
GVariant *reply;
GDBusProxy *proxy;
GDBusConnection *conn;
return BLUETOOTH_TELEPHONY_ERROR_NONE;
}
-#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
static void __bluetooth_telephony_init_headset_state(void)
{
GVariant *reply;
FN_END;
}
-#endif
static gboolean __bluetooth_telephony_is_headset(uint32_t device_class)
{
goto fail;
}
-#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
- __bluetooth_telephony_init_headset_state();
-#endif
+ if (TIZEN_PROFILE_WEARABLE || TIZEN_PROFILE_IVI)
+ __bluetooth_telephony_init_headset_state();
FN_END;
return ret;
g_variant_get(reply, "(b)", &status);
g_variant_unref(reply);
-#if defined(TIZEN_PROFILE_WEARABLE) || defined(TIZEN_PROFILE_IVI)
- if (status == TRUE && telephony_info.headset_state != BLUETOOTH_STATE_PLAYING)
- telephony_info.headset_state = BLUETOOTH_STATE_PLAYING;
-#endif
+ if (TIZEN_PROFILE_WEARABLE || TIZEN_PROFILE_IVI)
+ if (status == TRUE && telephony_info.headset_state != BLUETOOTH_STATE_PLAYING)
+ telephony_info.headset_state = BLUETOOTH_STATE_PLAYING;
BT_INFO("SCO Connected Status = [%d]", status);
return status;
PROJECT(bt-core C)
SET(SRCS
+../include/bt-internal-types.c
bt-core-main.c
bt-core-adapter.c
bt-core-dbus-handler.c
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}/include)
INCLUDE(FindPkgConfig)
-pkg_check_modules(pkgs REQUIRED dlog vconf gio-2.0 gio-unix-2.0 eventsystem)
+pkg_check_modules(pkgs REQUIRED dlog vconf gio-2.0 gio-unix-2.0 eventsystem capi-system-info)
FOREACH(flag ${pkgs_CFLAGS})
SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
gboolean _bt_core_is_flight_mode_enabled(void)
{
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
int isFlightMode = 0;
int ret = -1;
- ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &isFlightMode);
- if (ret != 0)
- BT_ERR("vconf_get_bool failed");
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &isFlightMode);
+ if (ret != 0)
+ BT_ERR("vconf_get_bool failed");
- return isFlightMode;
-#else
- return FALSE;
-#endif
+ return isFlightMode;
+ } else {
+ return FALSE;
+ }
}
static int __execute_command(const char *cmd, char *const arg_list[])
#endif
__bt_core_set_status(BT_ACTIVATING);
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
- ret = __execute_command("/usr/bin/hciconfig", argv_up);
-#else
- ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL);
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
+ ret = __execute_command("/usr/bin/hciconfig", argv_up);
+ } else {
+ ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL);
+ }
if (ret < 0) {
BT_ERR("running script failed");
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
- ret = __execute_command("/usr/bin/hciconfig", argv_down);
-#else
- ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh", NULL);
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
+ ret = __execute_command("/usr/bin/hciconfig", argv_down);
+ } else {
+ ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh", NULL);
+ }
__bt_core_set_status(BT_DEACTIVATED);
return -1;
}
status = _bt_core_get_status();
if (status == BT_ACTIVATING) {
/* Forcely terminate */
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
- if (__execute_command("/usr/bin/hciconfig", argv_down) < 0)
- BT_ERR("running script failed");
-#else
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
+ if (__execute_command("/usr/bin/hciconfig", argv_down) < 0)
+ BT_ERR("running script failed");
+ } else {
#ifdef TIZEN_FEATURE_RADIO
- int radio_status = VCONFKEY_RADIO_STATUS_OFF;
+ int radio_status = VCONFKEY_RADIO_STATUS_OFF;
- /* Check if radio status on or off */
- if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
- BT_ERR("Fail to get radio status");
+ /* Check if radio status on or off */
+ if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
+ BT_ERR("Fail to get radio status");
- BT_DBG("Radio status: %d", radio_status);
+ BT_DBG("Radio status: %d", radio_status);
- if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0)
- BT_ERR("running script failed");
- } else {
+ if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
+ if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0)
+ BT_ERR("running script failed");
+ } else {
+ if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0)
+ BT_ERR("running script failed");
+ }
+#else
if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0)
BT_ERR("running script failed");
- }
-#else
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0)
- BT_ERR("running script failed");
-#endif
#endif
+ }
_bt_core_terminate();
return 0;
} else if (status != BT_ACTIVATED) {
}
__bt_core_set_status(BT_DEACTIVATING);
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
- if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
- BT_ERR("running script failed");
- __bt_core_set_status(BT_ACTIVATED);
- return -1;
- }
-#else
-#ifdef TIZEN_FEATURE_RADIO
- int radio_status = VCONFKEY_RADIO_STATUS_OFF;
-
- /* Check if radio status on or off */
- if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
- BT_ERR("Fail to get radio status");
-
- BT_DBG("Radio status: %d", radio_status);
-
- if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0) {
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
+ if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
BT_ERR("running script failed");
__bt_core_set_status(BT_ACTIVATED);
return -1;
}
} else {
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
- BT_ERR("running script failed");
- __bt_core_set_status(BT_ACTIVATED);
- return -1;
+#ifdef TIZEN_FEATURE_RADIO
+ int radio_status = VCONFKEY_RADIO_STATUS_OFF;
+
+ /* Check if radio status on or off */
+ if (vconf_get_int(VCONFKEY_RADIO_STATUS, &radio_status) < 0)
+ BT_ERR("Fail to get radio status");
+
+ BT_DBG("Radio status: %d", radio_status);
+
+ if (radio_status == VCONFKEY_RADIO_STATUS_ON) {
+ if (__execute_command("/usr/etc/bluetooth/bt-stack-down-with-radio.sh", NULL) < 0) {
+ BT_ERR("running script failed");
+ __bt_core_set_status(BT_ACTIVATED);
+ return -1;
+ }
+ } else {
+ if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
+ BT_ERR("running script failed");
+ __bt_core_set_status(BT_ACTIVATED);
+ return -1;
+ }
}
- }
#else
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
- BT_ERR("running script failed");
- __bt_core_set_status(BT_ACTIVATED);
- return -1;
- }
-#endif
+ if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
+ BT_ERR("running script failed");
+ __bt_core_set_status(BT_ACTIVATED);
+ return -1;
+ }
#endif
+ }
return 0;
}
if (status == BT_DEACTIVATED) {
__bt_core_set_le_status(BT_LE_ACTIVATING);
BT_DBG("Activate BT");
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
- ret = __execute_command("/usr/bin/hciconfig", argv_up);
-#else
- ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL);
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_up[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "up", NULL};
+ ret = __execute_command("/usr/bin/hciconfig", argv_up);
+ } else {
+ ret = __execute_command("/usr/etc/bluetooth/bt-stack-up.sh", NULL);
+ }
if (ret < 0) {
BT_ERR("running script failed");
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
- ret = __execute_command("/usr/bin/hciconfig", argv_down);
-#else
- ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh &", NULL);
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
+ ret = __execute_command("/usr/bin/hciconfig", argv_down);
+ } else {
+ ret = __execute_command("/usr/etc/bluetooth/bt-dev-end.sh &", NULL);
+ }
__bt_core_set_status(BT_DEACTIVATED);
__bt_core_set_le_status(BT_LE_DEACTIVATED);
return -1;
if (status == BT_DEACTIVATED) {
__bt_core_set_le_status(BT_LE_DEACTIVATING);
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
- if (__execute_command("/usr/bin/hciconfig", argv_down) < 0) {
-#else
- if (__execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL) < 0) {
-#endif
+ int ret;
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ char *argv_down[] = {"/usr/bin/hciconfig", "/usr/bin/hciconfig", "hci0", "down", NULL};
+ ret = __execute_command("/usr/bin/hciconfig", argv_down);
+ } else {
+ ret = __execute_command("/usr/etc/bluetooth/bt-stack-down.sh", NULL);
+ }
+ if (ret < 0) {
BT_ERR("running script failed");
__bt_core_set_le_status(BT_LE_ACTIVATED);
return -1;
/* Enable the BT */
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter();
} else if (bt_status == VCONFKEY_BT_STATUS_OFF &&
(flight_mode_deactivation == 1 || ps_mode_deactivation > 0)) {
_bt_core_handle_flight_mode_noti();
/* Enable the BT LE */
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER_LE);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter_le();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter_le();
} else {
status = _bt_core_get_status();
le_status = _bt_core_get_le_status();
#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
#endif
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_disable_adapter();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter();
}
if (adapter_status_le == BT_LE_ACTIVATED) {
#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
#endif
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_disable_adapter_le();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter_le();
}
} else {
int flight_mode_value = 0;
_bt_core_get_bt_status(BT_FLIGHT_MODE) != 0) {
_bt_core_set_bt_status(BT_FLIGHT_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter();
}
if (adapter_status_le == BT_LE_DEACTIVATED &&
_bt_core_get_bt_le_status(BT_FLIGHT_MODE) != 0) {
_bt_core_set_bt_le_status(BT_FLIGHT_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER_LE);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter_le();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter_le();
}
}
}
#ifdef TIZEN_FEATURE_BUSACT
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER);
#endif
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_disable_adapter();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter();
}
if (adapter_status_le == BT_LE_ACTIVATED) {
int bt_le_status_before_mode = 0;
/* Disable the BT LE */
_bt_core_service_request_adapter(BT_DISABLE_ADAPTER_LE);
#endif
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_disable_adapter_le();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_disable_adapter_le();
}
} else {
int ps_mode_value = 0;
if (adapter_status == BT_DEACTIVATED && (_bt_core_get_bt_status(BT_POWER_SAVING_MODE) != 0)) {
_bt_core_set_bt_status(BT_POWER_SAVING_MODE, 0);
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter();
}
BT_DBG("BT LE status before Emergency mode() :%d", _bt_core_get_bt_le_status(BT_POWER_SAVING_MODE));
if (adapter_status_le == BT_LE_DEACTIVATED && _bt_core_get_bt_le_status(BT_POWER_SAVING_MODE) != 0) {
_bt_core_set_bt_le_status(BT_POWER_SAVING_MODE, 0);
/* Enable the BT LE */
_bt_core_service_request_adapter(BT_ENABLE_ADAPTER_LE);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_enable_adapter_le();
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_enable_adapter_le();
}
}
}
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
+
static void __bt_core_flight_mode_cb(keynode_t *node, void *data)
{
gboolean flight_mode = FALSE;
__bt_core_handle_adapter_with_flight_mode(flight_mode);
}
-#endif
-#ifndef TIZEN_PROFILE_WEARABLE
#ifdef ENABLE_TIZEN_2_4
static void __bt_core_power_saving_mode_cb(keynode_t *node, void *data)
{
__bt_core_handle_adapter_with_power_saving_mode(power_saving_mode);
}
#endif
-#endif
void _bt_core_init_vconf_value(void)
{
flight_mode = _bt_core_is_flight_mode_enabled();
-#ifndef TIZEN_PROFILE_WEARABLE
#ifndef ENABLE_TIZEN_2_4
- if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_saving_mode) != 0)
- BT_ERR("Fail to get the power_saving_mode status value");
- BT_DBG("flight_mode = %d, power_saving_mode = %d", flight_mode, power_saving_mode);
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_get_int(VCONFKEY_SETAPPL_PSMODE, &power_saving_mode) != 0)
+ BT_ERR("Fail to get the power_saving_mode status value");
+ BT_DBG("flight_mode = %d, power_saving_mode = %d", flight_mode, power_saving_mode);
+ }
#endif
BT_DBG("flight_mode = %d, power_saving_mode = %d", flight_mode, power_saving_mode);
void _bt_core_handle_flight_mode_noti(void)
{
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
int ret;
- BT_DBG("+");
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ BT_DBG("+");
- ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_core_flight_mode_cb, NULL);
- if (ret < 0)
- BT_ERR("Unable to register key handler");
-#else
- BT_DBG("Telephony is disabled");
-#endif
+ ret = vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_core_flight_mode_cb, NULL);
+ if (ret < 0)
+ BT_ERR("Unable to register key handler");
+ } else {
+ BT_DBG("Telephony is disabled");
+ }
}
void _bt_core_handle_power_saving_mode_noti(void)
{
-#ifndef TIZEN_PROFILE_WEARABLE
int ret = 0;
+ if (TIZEN_PROFILE_WEARABLE)
+ return;
+
BT_DBG("+");
#ifdef ENABLE_TIZEN_2_4
ret = vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
#endif
if (ret < 0)
BT_ERR("Unable to register key handler");
-#endif
}
void _bt_core_unregister_vconf_handler(void)
{
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
- vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_core_flight_mode_cb);
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_core_flight_mode_cb);
+ }
-#ifndef TIZEN_PROFILE_WEARABLE
#ifdef ENABLE_TIZEN_2_4
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
- (vconf_callback_fn)__bt_core_power_saving_mode_cb);
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ (vconf_callback_fn)__bt_core_power_saving_mode_cb);
+ }
#endif
return;
PROJECT(bt-service C)
SET(SRCS
+../include/bt-internal-types.c
marshal.c
bt-service-main.c
bt-service-event-sender.c
cynara-client
cynara-creds-gdbus
eventsystem
+ capi-system-info
)
INCLUDE(FindPkgConfig)
# install booting script
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf)
-IF (TIZEN_PROFILE_WEARABLE)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wearable/stack_info DESTINATION /usr/etc/bluetooth/)
-ELSE ()
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobile/stack_info DESTINATION /usr/etc/bluetooth/)
-ENDIF (TIZEN_PROFILE_WEARABLE)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wearable/stack_info DESTINATION /usr/etc/bluetooth/wearable)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobile/stack_info DESTINATION /usr/etc/bluetooth/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d)
visible_timer.event_id = 0;
visible_timer.timeout = 0;
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
- BT_ERR("Set vconf failed\n");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+ BT_ERR("Set vconf failed\n");
+ }
return FALSE;
}
visible_timer.event_id = 0;
visible_timer.timeout = 0;
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
- BT_ERR("Set vconf failed\n");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+ BT_ERR("Set vconf failed\n");
+ }
}
/* Switch Off visibility in Bluez */
_bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0);
visible_timer.timeout = timeout;
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
- BT_ERR("Set vconf failed");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
+ BT_ERR("Set vconf failed");
+ }
if (timeout <= 0)
return BLUETOOTH_ERROR_NONE;
}
}
-#ifdef TIZEN_PROFILE_MOBILE
static void __bt_set_visible_mode(void)
{
int timeout = 0;
}
}
}
-#endif
static void __bt_set_local_name(void)
{
BT_DBG("+");
int result = BLUETOOTH_ERROR_NONE;
-#ifdef TIZEN_PROFILE_MOBILE
- __bt_set_visible_mode();
-#else
-#ifdef TIZEN_PROFILE_TV
- if (_bt_set_discoverable_mode(
- BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0) != BLUETOOTH_ERROR_NONE)
- BT_ERR("Fail to set discoverable mode");
-#endif
-#endif
+ if (TIZEN_PROFILE_MOBILE) {
+ __bt_set_visible_mode();
+ } else if (TIZEN_PROFILE_TV) {
+ if (_bt_set_discoverable_mode(
+ BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to set discoverable mode");
+ }
__bt_set_local_name();
/* Update Bluetooth Status to notify other modules */
g_variant_new_int32(result));
}
-#if defined(TIZEN_FEATURE_FLIGHTMODE_ENABLED) || (!defined(TIZEN_PROFILE_WEARABLE) && defined(ENABLE_TIZEN_2_4))
static void __bt_service_flight_ps_mode_cb(keynode_t *node, void *data)
{
gboolean flight_mode = FALSE;
return;
}
}
-#endif
void _bt_service_register_vconf_handler(void)
{
BT_DBG("+");
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
- if (vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
- BT_ERR("Unable to register key handler");
-#else
- BT_DBG("Telephony is disabled");
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ if (vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
+ BT_ERR("Unable to register key handler");
+ } else {
+ BT_DBG("Telephony is disabled");
+ }
-#ifndef TIZEN_PROFILE_WEARABLE
#ifdef ENABLE_TIZEN_2_4
- if (vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ if (!TIZEN_PROFILE_WEARABLE && vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
(vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
BT_ERR("Unable to register key handler");
#endif
-#endif
}
void _bt_service_unregister_vconf_handler(void)
{
BT_DBG("+");
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
- vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
+ }
-#ifndef TIZEN_PROFILE_WEARABLE
#ifdef ENABLE_TIZEN_2_4
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
-#endif
+ if (!TIZEN_PROFILE_WEARABLE)
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
#endif
}
{
bt_status_t status = BT_DEACTIVATED;
bt_le_status_t le_status = BT_LE_DEACTIVATED;
-#ifndef TIZEN_PROFILE_TV
int bt_status = VCONFKEY_BT_STATUS_OFF;
int bt_le_status = VCONFKEY_BT_LE_STATUS_OFF;
-#endif
status = _bt_adapter_get_status();
le_status = _bt_adapter_get_le_status();
BT_DBG("State: %d, LE State: %d", status, le_status);
-#ifdef TIZEN_PROFILE_TV
- _bt_enable_adapter();
-#else
+ if (TIZEN_PROFILE_TV) {
+ _bt_enable_adapter();
+ return FALSE;
+ }
if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status) < 0)
BT_DBG("no bluetooth device info, so BT was disabled at previous session");
_bt_terminate_service(NULL);
}
}
-#endif
return FALSE;
}
#define BT_AGENT_NEW_LINE "\r\n"
#define BT_MAX_DBUS_TIMEOUT 45000
-#ifndef TIZEN_PROFILE_TV
-#define BT_ENABLE_TIMEOUT 20000 /* 20 seconds */
-#else
-#define BT_ENABLE_TIMEOUT 5000 /* 5 seconds */
-#endif
+
+#define BT_ENABLE_TIMEOUT ((TIZEN_PROFILE_TV)?5000:20000) /* 5(TV) / 20(others) seconds */
#define BT_DISCOVERY_FINISHED_DELAY 200
#define MANAGER_EVENT_MATCH_RULE \
PROJECT(bt-service C)
SET(SRCS
+../include/bt-internal-types.c
marshal.c
bt-service-main.c
bt-service-event-sender.c
cynara-creds-gdbus
eventsystem
storage
-)
-
-IF("$ENV{CFLAGS}" MATCHES "-DTIZEN_FEATURE_NETWORK_TETHERING_ENABLE")
-SET(PKG_MODULES ${PKG_MODULES}
capi-network-tethering
+ capi-system-info
)
-ENDIF()
INCLUDE(FindPkgConfig)
pkg_check_modules(service_pkgs REQUIRED ${PKG_MODULES})
# install booting script
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf.in ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf)
-IF (TIZEN_PROFILE_WEARABLE)
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wearable/stack_info DESTINATION /usr/etc/bluetooth/)
-ELSE ()
- INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobile/stack_info DESTINATION /usr/etc/bluetooth/)
-ENDIF (TIZEN_PROFILE_WEARABLE)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/wearable/stack_info DESTINATION /usr/etc/bluetooth/wearable/)
+INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/mobile/stack_info DESTINATION /usr/etc/bluetooth/)
INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/bluetooth-frwk-service.conf DESTINATION /etc/dbus-1/system.d)
#include <vconf.h>
#include <syspopup_caller.h>
#include <aul.h>
+#include <dbus/dbus-glib.h>
+#include <dbus/dbus.h>
#include <bundle.h>
#include <eventsystem.h>
#include <bundle_internal.h>
visible_timer.event_id = 0;
visible_timer.timeout = 0;
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
- BT_ERR("Set vconf failed\n");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+ BT_ERR("Set vconf failed\n");
+ }
return FALSE;
}
visible_timer.event_id = 0;
visible_timer.timeout = 0;
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
- BT_ERR("Set vconf failed\n");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, 0) != 0)
+ BT_ERR("Set vconf failed\n");
+ }
}
/* Switch Off visibility in Bluez */
_bt_set_discoverable_mode(BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0);
{
int result;
alarm_id_t alarm_id;
-#ifndef TIZEN_PROFILE_WEARABLE
#ifdef TIZEN_FEATURE_BT_DPM
int discoverable_state = DPM_BT_ERROR;
#endif
-#endif
__bt_visibility_alarm_remove();
visible_timer.timeout = timeout;
-#ifndef TIZEN_PROFILE_WEARABLE
+ if (!TIZEN_PROFILE_WEARABLE) {
#ifdef TIZEN_FEATURE_BT_DPM
- _bt_dpm_get_bluetooth_limited_discoverable_state(&discoverable_state);
- if(discoverable_state != DPM_RESTRICTED) {
+ _bt_dpm_get_bluetooth_limited_discoverable_state(&discoverable_state);
+ if(discoverable_state != DPM_RESTRICTED) {
#endif
- if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
- BT_ERR("Set vconf failed");
+ if (vconf_set_int(BT_FILE_VISIBLE_TIME, timeout) != 0)
+ BT_ERR("Set vconf failed");
#ifdef TIZEN_FEATURE_BT_DPM
- }
-#endif
+ }
#endif
+ }
if (timeout <= 0)
return BLUETOOTH_ERROR_INTERNAL;
}
-#if defined(TIZEN_PROFILE_MOBILE) || defined(TIZEN_PROFILE_IVI)
- /* BT setting UI will control Mobile's visible mode. So in the FRWK...set the visible mode as off: */
- if (_bt_set_discoverable_mode(
- BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0) != BLUETOOTH_ERROR_NONE)
- BT_ERR("Set connectable mode failed");
-#else
-#ifdef TIZEN_PROFILE_TV
- if (_bt_set_discoverable_mode(
- BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0) != BLUETOOTH_ERROR_NONE)
- BT_ERR("Fail to set discoverable mode");
-#endif
-#endif
+ if (TIZEN_PROFILE_MOBILE || TIZEN_PROFILE_IVI) {
+ /* BT setting UI will control Mobile's visible mode. So in the FRWK...set the visible mode as off: */
+ if (_bt_set_discoverable_mode(
+ BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, 0) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Set connectable mode failed");
+ } else if (TIZEN_PROFILE_TV) {
+ if (_bt_set_discoverable_mode(
+ BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE, 0) != BLUETOOTH_ERROR_NONE)
+ BT_ERR("Fail to set discoverable mode");
+ }
/* Update Bluetooth Status to notify other modules */
if (vconf_set_int(VCONFKEY_BT_STATUS, VCONFKEY_BT_STATUS_ON) != 0)
_bt_adapter_set_status(BT_DEACTIVATED);
_bt_set_discovery_status(FALSE);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- if (_bt_adapter_get_le_status() != BT_LE_DEACTIVATED) {
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE ||
+ _bt_adapter_get_le_status() != BT_LE_DEACTIVATED) {
/* Send disabled event */
_bt_send_event(BT_ADAPTER_EVENT, BLUETOOTH_EVENT_DISABLED,
g_variant_new("(i)", result));
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
}
-#endif
BT_INFO("Adapter disabled");
}
return BLUETOOTH_ERROR_NONE;
}
-#if defined(TIZEN_FEATURE_FLIGHTMODE_ENABLED) || (!defined(TIZEN_PROFILE_WEARABLE))
static void __bt_service_flight_ps_mode_cb(keynode_t *node, void *data)
{
gboolean flight_mode = FALSE;
_bt_enable_core();
}
-#endif
void _bt_service_register_vconf_handler(void)
{
BT_DBG("+");
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
- if (vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
- BT_ERR("Unable to register key handler");
-#else
- BT_DBG("Telephony is disabled");
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ if (vconf_notify_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
+ BT_ERR("Unable to register key handler");
+ } else {
+ BT_DBG("Telephony is disabled");
+ }
-#ifndef TIZEN_PROFILE_WEARABLE
- if (vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
- BT_ERR("Unable to register key handler");
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ if (vconf_notify_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb, NULL) < 0)
+ BT_ERR("Unable to register key handler");
+ }
}
void _bt_service_unregister_vconf_handler(void)
{
BT_DBG("+");
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
- vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
-#endif
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ vconf_ignore_key_changed(VCONFKEY_TELEPHONY_FLIGHT_MODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
+ }
-#ifndef TIZEN_PROFILE_WEARABLE
- vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
- (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
-#endif
+ if (!TIZEN_PROFILE_WEARABLE) {
+ vconf_ignore_key_changed(VCONFKEY_SETAPPL_PSMODE,
+ (vconf_callback_fn)__bt_service_flight_ps_mode_cb);
+ }
}
static void __bt_state_event_handler(const char *event_name, bundle *data, void *user_data)
BT_DBG("status : %d", status);
BT_DBG("le_status : %d", le_status);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- adapter_agent = _bt_create_agent(BT_ADAPTER_AGENT_PATH, TRUE);
- if (!adapter_agent) {
- BT_ERR("Fail to register agent");
- return;
- }
-#else
- if (adapter_agent == NULL) {
+ if (!TIZEN_FEATURE_BT_USB_DONGLE) {
adapter_agent = _bt_create_agent(BT_ADAPTER_AGENT_PATH, TRUE);
if (!adapter_agent) {
BT_ERR("Fail to register agent");
return;
}
+ } else {
+ if (adapter_agent == NULL) {
+ adapter_agent = _bt_create_agent(BT_ADAPTER_AGENT_PATH, TRUE);
+ if (!adapter_agent) {
+ BT_ERR("Fail to register agent");
+ return;
+ }
+ }
}
-#endif
if (_bt_register_media_player() != BLUETOOTH_ERROR_NONE)
BT_ERR("Fail to register media player");
if (0 != ret)
ERR("vconf_ignore_key_changed failed\n");
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_destroy_agent(adapter_agent);
- adapter_agent = NULL;
+ if (!TIZEN_FEATURE_BT_USB_DONGLE) {
+ _bt_destroy_agent(adapter_agent);
+ adapter_agent = NULL;
- if (is_recovery_mode == TRUE) {
- /* Send disabled event */
- _bt_set_disabled(BLUETOOTH_ERROR_NONE);
+ if (is_recovery_mode == TRUE) {
+ /* Send disabled event */
+ _bt_set_disabled(BLUETOOTH_ERROR_NONE);
- /* Will recover BT by bt-core, so set the mode as activating */
- _bt_adapter_set_status(BT_ACTIVATING);
- is_recovery_mode = FALSE;
+ /* Will recover BT by bt-core, so set the mode as activating */
+ _bt_adapter_set_status(BT_ACTIVATING);
+ is_recovery_mode = FALSE;
+ } else {
+ _bt_reliable_terminate_service(NULL);
+ }
} else {
- _bt_reliable_terminate_service(NULL);
+ _bt_set_disabled(BLUETOOTH_ERROR_NONE);
}
-#else
- _bt_set_disabled(BLUETOOTH_ERROR_NONE);
-#endif
if (eventsystem_unregister_event(status_reg_id) != ES_R_OK)
BT_ERR("Fail to unregister system event");
g_variant_unref(result);
_bt_set_disabled(BLUETOOTH_ERROR_TIMEOUT);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_terminate_service(NULL);
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_terminate_service(NULL);
return FALSE;
}
return;
}
-#ifdef TIZEN_PROFILE_TV
static gboolean __bt_adapter_enabled_cb(gpointer user_data)
{
BT_DBG("+");
return FALSE;
}
-#endif
int _bt_enable_adapter_check_status(void)
{
_bt_adapter_set_status(BT_ACTIVATING);
-#ifdef TIZEN_PROFILE_TV
+if (TIZEN_PROFILE_TV)
{
int adapter_status = BT_ADAPTER_DISABLED;
return BLUETOOTH_ERROR_NONE;
}
}
-#endif
proxy = __bt_get_core_proxy();
if (!proxy)
g_clear_error(&error);
}
g_variant_unref(result);
-#ifndef TIZEN_FEATURE_BT_USB_DONGLE
/* Terminate myself */
- g_idle_add((GSourceFunc)_bt_terminate_service, NULL);
-#endif
+ if (!TIZEN_FEATURE_BT_USB_DONGLE)
+ g_idle_add((GSourceFunc)_bt_terminate_service, NULL);
return BLUETOOTH_ERROR_INTERNAL;
}
g_variant_unref(result);
return BLUETOOTH_ERROR_NONE;
}
-#ifndef TIZEN_PROFILE_TV
int _bt_check_adapter(int *status)
{
-
+if (!TIZEN_PROFILE_TV) {
char *adapter_path = NULL;
BT_CHECK_PARAMETER(status, return);
g_free(adapter_path);
return BLUETOOTH_ERROR_NONE;
-}
-#else
-int _bt_check_adapter(int *status)
-{
+} else {
GDBusProxy *proxy;
GError *error = NULL;
GVariant *result;
g_variant_unref(temp);
return BLUETOOTH_ERROR_NONE;
}
-#endif
+}
int _bt_enable_adapter_le(void)
{
return BLUETOOTH_ERROR_NONE;
}
-#ifdef TIZEN_PROFILE_TV
int _bt_get_enable_timer_id(void)
{
return timer_id;
}
-#endif
#include <vconf.h>
#include <bundle_internal.h>
-#ifdef TIZEN_FEATURE_NETWORK_TETHERING_ENABLE
#include <tethering.h>
-#endif
#include "bt-internal-types.h"
#include "bt-service-common.h"
GVariant *reply = NULL;
GVariant *reply_temp = NULL;
GVariant *tmp_value;
-#ifdef TIZEN_FEATURE_NETWORK_TETHERING_ENABLE
bool enabled;
- tethering_h tethering = NULL;
-#endif
int result = BLUETOOTH_ERROR_NONE;
int request_type = BT_AGENT_EVENT_AUTHORIZE_REQUEST;
+ tethering_h tethering = NULL;
BT_DBG("+");
!strcasecmp(uuid, BNEP_UUID)) {
BT_DBG("Network connection request: %s", uuid);
-#ifdef TIZEN_FEATURE_NETWORK_TETHERING_ENABLE
- if (nap_connected_device_count >=
- BT_PAN_MAX_CONNECTION) {
- BT_ERR("Max connection exceeded");
- goto fail;
- }
- int ret;
- ret = tethering_create(&tethering);
+ if (TIZEN_FEATURE_NETWORK_TETHERING_ENABLE) {
+ if (nap_connected_device_count >=
+ BT_PAN_MAX_CONNECTION) {
+ BT_ERR("Max connection exceeded");
+ goto fail;
+ }
+ int ret;
+ ret = tethering_create(&tethering);
- if (ret != TETHERING_ERROR_NONE) {
- BT_ERR("Fail to create tethering: %d", ret);
- goto fail;
- }
+ if (ret != TETHERING_ERROR_NONE) {
+ BT_ERR("Fail to create tethering: %d", ret);
+ goto fail;
+ }
- enabled = tethering_is_enabled(tethering, TETHERING_TYPE_BT);
+ enabled = tethering_is_enabled(tethering, TETHERING_TYPE_BT);
- ret = tethering_destroy(tethering);
+ ret = tethering_destroy(tethering);
- if (ret != TETHERING_ERROR_NONE)
- BT_ERR("Fail to create tethering: %d", ret);
+ if (ret != TETHERING_ERROR_NONE)
+ BT_ERR("Fail to create tethering: %d", ret);
- if (enabled != true) {
- BT_ERR("BT tethering is not enabled");
- goto fail;
+ if (enabled != true) {
+ BT_ERR("BT tethering is not enabled");
+ goto fail;
+ }
}
-#endif
gap_agent_reply_authorize(agent, GAP_AGENT_ACCEPT,
NULL);
goto done;
-#ifdef TIZEN_FEATURE_NETWORK_TETHERING_ENABLE
fail:
gap_agent_reply_authorize(agent, GAP_AGENT_REJECT,
NULL);
goto done;
-#endif
}
reply_temp = __bt_service_getall(device, BT_DEVICE_INTERFACE);
#include "bt-service-headset-connection.h"
#ifdef TIZEN_SUPPORT_DUAL_HF
-#ifdef TIZEN_PROFILE_WEARABLE
#define VCONF_KEY_BT_HOST_BT_MAC_ADDR "db/wms/host_bt_mac"
#endif
-#endif
typedef struct {
unsigned int type;
#ifdef TIZEN_SUPPORT_DUAL_HF
gboolean __bt_is_companion_device(const char *addr)
{
-#ifdef TIZEN_PROFILE_WEARABLE
- char *host_device_address = NULL;
- host_device_address = vconf_get_str(VCONF_KEY_BT_HOST_BT_MAC_ADDR);
+ if (TIZEN_PROFILE_WEARABLE) {
+ char *host_device_address = NULL;
+ host_device_address = vconf_get_str(VCONF_KEY_BT_HOST_BT_MAC_ADDR);
- if (!host_device_address) {
- BT_INFO("Failed to get a companion device address");
- return FALSE;
- }
+ if (!host_device_address) {
+ BT_INFO("Failed to get a companion device address");
+ return FALSE;
+ }
+
+ if (g_strcmp0(host_device_address, addr) == 0) {
+ BT_INFO("Found companion device");
+ free(host_device_address);
+ return TRUE;
+ }
- if (g_strcmp0(host_device_address, addr) == 0) {
- BT_INFO("Found companion device");
free(host_device_address);
- return TRUE;
+ return FALSE;
+ } else {
+ /* TODO : Need to add companion device check condition for Phone models */
+ return FALSE;
}
-
- free(host_device_address);
- return FALSE;
-#else
- /* TODO : Need to add companion device check condition for Phone models */
- return FALSE;
-#endif
}
#endif
BT_DBG("-");
} */
-#ifdef TIZEN_PROFILE_WEARABLE
static gboolean __bt_syspopup_timer_cb(gpointer user_data)
{
int ret;
BT_DBG("-");
return TRUE;
}
-#endif
gboolean _bt_is_device_creating(void)
{
result == BLUETOOTH_ERROR_AUTHENTICATION_FAILED ||
result == BLUETOOTH_ERROR_TIMEOUT ||
result == BLUETOOTH_ERROR_HOST_DOWN) {
-#ifdef TIZEN_PROFILE_WEARABLE
- int is_sw_running = 0;
+ if (TIZEN_PROFILE_WEARABLE) {
+ int is_sw_running = 0;
- if (vconf_get_int(VCONFKEY_SETUP_WIZARD_STATE, &is_sw_running))
- BT_ERR("vconf_get_int for setup wizard state failed");
+ if (vconf_get_int(VCONFKEY_SETUP_WIZARD_STATE, &is_sw_running))
+ BT_ERR("vconf_get_int for setup wizard state failed");
- if (!is_sw_running)
- __bt_launch_unable_to_pairing_syspopup(result);
- else
- BT_ERR("Unable to pair");
-#endif
+ if (!is_sw_running)
+ __bt_launch_unable_to_pairing_syspopup(result);
+ else
+ BT_ERR("Unable to pair");
+ }
bonding_info->result = result;
}
gboolean __bt_handle_is_flight_mode_enabled(void)
{
-#ifdef TIZEN_FEATURE_FLIGHTMODE_ENABLED
int is_flight_mode = 0;
int ret = -1;
- ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight_mode);
- if (ret != 0)
- BT_ERR("vconf_get_bool failed");
+ if (TIZEN_FEATURE_FLIGHTMODE_ENABLED) {
+ ret = vconf_get_bool(VCONFKEY_TELEPHONY_FLIGHT_MODE, &is_flight_mode);
+ if (ret != 0)
+ BT_ERR("vconf_get_bool failed");
- return (is_flight_mode == 0) ? FALSE : TRUE;
-#else
- return FALSE;
-#endif
+ return (is_flight_mode == 0) ? FALSE : TRUE;
+ } else {
+ return FALSE;
+ }
}
void _bt_handle_adapter_event(GVariant *msg, const char *member)
g_variant_get(val, "b", &powered);
BT_DBG("Powered = %d", powered);
if (powered == FALSE) {
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_handle_adapter_removed();
-#else
- if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_state) == 0 &&
- bt_state != VCONFKEY_BT_STATUS_OFF) {
- if (__bt_handle_is_flight_mode_enabled() == FALSE)
- _bt_disable_adapter();
- else
- _bt_handle_adapter_removed();
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ _bt_handle_adapter_removed();
+ } else {
+ if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_state) == 0 &&
+ bt_state != VCONFKEY_BT_STATUS_OFF) {
+ if (__bt_handle_is_flight_mode_enabled() == FALSE)
+ _bt_disable_adapter();
+ else
+ _bt_handle_adapter_removed();
+ }
}
-#endif
if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_state) == 0 &&
bt_state != VCONFKEY_BT_LE_STATUS_OFF) {
_bt_set_le_disabled(BLUETOOTH_ERROR_NONE);
}
} else {
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- _bt_handle_adapter_added();
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE)
+ _bt_handle_adapter_added();
}
} else if (strcasecmp(property, "Connectable") == 0) {
gboolean connectable = FALSE;
g_variant_get(parameters, "(&o@a{sa{sv}})", &obj_path, &value);
if (strcasecmp(obj_path, BT_BLUEZ_HCI_PATH) == 0) {
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- BT_DBG("Enable Adapter");
- _bt_enable_adapter();
-#else
- _bt_handle_adapter_added();
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ BT_DBG("Enable Adapter");
+ _bt_enable_adapter();
+ } else {
+ _bt_handle_adapter_added();
+ }
} else {
bt_event = __bt_parse_event(value);
if (bt_event == BT_DEVICE_EVENT) {
}
g_variant_unref(value);
} else if (strcasecmp(signal_name, "InterfacesRemoved") == 0) {
-#ifdef TIZEN_FEATURE_BT_USB_DONGLE
- BT_DBG("InterfacesRemoved");
- _bt_handle_adapter_removed();
-#endif
+ if (TIZEN_FEATURE_BT_USB_DONGLE) {
+ BT_DBG("InterfacesRemoved");
+ _bt_handle_adapter_removed();
+ }
if (g_strcmp0(interface_name, BT_MEDIATRANSPORT_INTERFACE) == 0)
bt_event = BT_MEDIA_TRANSFER_EVENT;
else if (g_strcmp0(interface_name, BT_DEVICE_INTERFACE) == 0)
static int __bt_init_obexd_receiver(void)
{
BT_DBG("+");
-#ifndef TIZEN_PROFILE_TV /* TODO: obexd doesn't work in TV profile. It should be resolved later. */
- GError *error = NULL;
+ if (!TIZEN_PROFILE_TV) { /* TODO: obexd doesn't work in TV profile. It should be resolved later. */
+ GError *error = NULL;
- if (obexd_conn == NULL) {
- obexd_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
- if (error != NULL) {
- BT_ERR("ERROR: Can't get on session bus [%s]", error->message);
- g_clear_error(&error);
+ if (obexd_conn == NULL) {
+ obexd_conn = g_bus_get_sync(G_BUS_TYPE_SESSION, NULL, &error);
+ if (error != NULL) {
+ BT_ERR("ERROR: Can't get on session bus [%s]", error->message);
+ g_clear_error(&error);
+ }
+ retv_if(obexd_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
}
- retv_if(obexd_conn == NULL, BLUETOOTH_ERROR_INTERNAL);
- }
- if (_bt_register_service_event(obexd_conn,
- BT_OPP_SERVER_EVENT) != BLUETOOTH_ERROR_NONE) {
- BT_ERR("Error while registering service event");
- g_object_unref(obexd_conn);
- obexd_conn = NULL;
- return BLUETOOTH_ERROR_INTERNAL;
+ if (_bt_register_service_event(obexd_conn,
+ BT_OPP_SERVER_EVENT) != BLUETOOTH_ERROR_NONE) {
+ BT_ERR("Error while registering service event");
+ g_object_unref(obexd_conn);
+ obexd_conn = NULL;
+ return BLUETOOTH_ERROR_INTERNAL;
+ }
}
-#endif
BT_DBG("-");
return BLUETOOTH_ERROR_NONE;
{
BT_INFO("signal [%d] is sent by [%d]", signo, info->si_pid);
-#ifndef TIZEN_PROFILE_TV
- int ret;
- ret = _bt_recover_adapter();
- if (ret != BLUETOOTH_ERROR_NONE)
- BT_ERR("_bt_recover_adapter is failed : %d", ret);
-#endif
+ if (!TIZEN_PROFILE_TV) {
+ int ret;
+ ret = _bt_recover_adapter();
+ if (ret != BLUETOOTH_ERROR_NONE)
+ BT_ERR("_bt_recover_adapter is failed : %d", ret);
+ }
return;
}
{
bt_status_t status = BT_DEACTIVATED;
bt_le_status_t le_status = BT_LE_DEACTIVATED;
-#ifndef TIZEN_PROFILE_TV
int bt_status = VCONFKEY_BT_STATUS_OFF;
int bt_le_status = VCONFKEY_BT_LE_STATUS_OFF;
int flight_mode_deactivation = 0;
int bt_off_due_to_timeout = 0;
-#endif
#if 0
int ps_mode_deactivation = 0;
#endif
le_status = _bt_adapter_get_le_status();
BT_DBG("State: %d, LE State: %d", status, le_status);
-#ifdef TIZEN_PROFILE_TV
- if (_bt_get_enable_timer_id() == 0)
- _bt_enable_adapter();
-#else
- if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status) < 0)
- BT_DBG("no bluetooth device info, so BT was disabled at previous session");
+ if (TIZEN_PROFILE_TV) {
+ if (_bt_get_enable_timer_id() == 0)
+ _bt_enable_adapter();
+ } else {
+ if (vconf_get_int(VCONFKEY_BT_STATUS, &bt_status) < 0)
+ BT_DBG("no bluetooth device info, so BT was disabled at previous session");
- if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_le_status) < 0)
- BT_ERR("no bluetooth le info, so BT LE was disabled at previous session");
+ if (vconf_get_int(VCONFKEY_BT_LE_STATUS, &bt_le_status) < 0)
+ BT_ERR("no bluetooth le info, so BT LE was disabled at previous session");
- if (vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE, &flight_mode_deactivation) != 0)
- BT_ERR("Fail to get the flight_mode_deactivation value");
+ if (vconf_get_int(BT_OFF_DUE_TO_FLIGHT_MODE, &flight_mode_deactivation) != 0)
+ BT_ERR("Fail to get the flight_mode_deactivation value");
#if 0
if (vconf_get_int(BT_OFF_DUE_TO_POWER_SAVING_MODE, &ps_mode_deactivation) != 0)
BT_ERR("Fail to get the ps_mode_deactivation value");
+ }
#endif
- if (vconf_get_int(BT_OFF_DUE_TO_TIMEOUT, &bt_off_due_to_timeout) != 0)
- BT_ERR("Fail to get BT_OFF_DUE_TO_TIMEOUT");
+ if (vconf_get_int(BT_OFF_DUE_TO_TIMEOUT, &bt_off_due_to_timeout) != 0)
+ BT_ERR("Fail to get BT_OFF_DUE_TO_TIMEOUT");
- if ((bt_status != VCONFKEY_BT_STATUS_OFF || bt_off_due_to_timeout) &&
- (status == BT_DEACTIVATED)) {
- BT_DBG("Previous session was enabled.");
+ if ((bt_status != VCONFKEY_BT_STATUS_OFF || bt_off_due_to_timeout) &&
+ (status == BT_DEACTIVATED)) {
+ BT_DBG("Previous session was enabled.");
- /* Enable the BT */
- _bt_enable_adapter();
- } else if (bt_status == VCONFKEY_BT_STATUS_OFF && flight_mode_deactivation == 1) {
- _bt_enable_core();
- }
+ /* Enable the BT */
+ _bt_enable_adapter();
+ } else if (bt_status == VCONFKEY_BT_STATUS_OFF && flight_mode_deactivation == 1) {
+ _bt_enable_core();
+ }
- if ((bt_le_status == VCONFKEY_BT_LE_STATUS_ON) && (le_status == BT_LE_DEACTIVATED)) {
- BT_DBG("Previous session was le enabled. Turn BT LE on automatically.");
+ if ((bt_le_status == VCONFKEY_BT_LE_STATUS_ON) && (le_status == BT_LE_DEACTIVATED)) {
+ BT_DBG("Previous session was le enabled. Turn BT LE on automatically.");
- /* Enable the BT LE */
- _bt_enable_adapter_le();
- } else {
- status = _bt_adapter_get_status();
- le_status = _bt_adapter_get_le_status();
- BT_DBG("State: %d, LE State: %d", status, le_status);
+ /* Enable the BT LE */
+ _bt_enable_adapter_le();
+ } else {
+ status = _bt_adapter_get_status();
+ le_status = _bt_adapter_get_le_status();
+ BT_DBG("State: %d, LE State: %d", status, le_status);
- if ((status != BT_ACTIVATING && status != BT_ACTIVATED) &&
- (le_status != BT_LE_ACTIVATING && le_status != BT_LE_ACTIVATED)) {
- _bt_terminate_service(NULL);
+ if ((status != BT_ACTIVATING && status != BT_ACTIVATED) &&
+ (le_status != BT_LE_ACTIVATING && le_status != BT_LE_ACTIVATED)) {
+ _bt_terminate_service(NULL);
+ }
}
}
-#endif
return FALSE;
}
#define BT_MAX_EVENT_STR_LENGTH 50
-#ifndef TIZEN_PROFILE_WEARABLE
#define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
-#endif
typedef enum {
HS_PROFILE_UUID = ((unsigned short)0x1108), /**<HS*/
#include <gio/gio.h>
#include "bluetooth-api.h"
+#include "bt-internal-types.h"
#ifdef __cplusplus
extern "C" {
#define LOG_COLOR_PURPLE "\033[35m"
-#ifndef TIZEN_PROFILE_TV
#define BT_DBG(fmt, args...) \
- SLOGD(fmt, ##args)
+ ((TIZEN_PROFILE_TV) ? (LOGI(fmt, ##args)) : (SLOGD(fmt, ##args)))
#define BT_INFO(fmt, args...) \
- SLOGI(fmt, ##args)
+ ((TIZEN_PROFILE_TV) ? (LOGI(fmt, ##args)) : (SLOGI(fmt, ##args)))
#define BT_ERR(fmt, args...) \
- SLOGE(fmt, ##args)
-#else
-#define BT_DBG(fmt, args...) \
- LOGI(fmt, ##args)
-#define BT_INFO(fmt, args...) \
- LOGI(fmt, ##args)
-#define BT_ERR(fmt, args...) \
- LOGE(fmt, ##args)
-#endif
+ ((TIZEN_PROFILE_TV) ? (LOGE(fmt, ##args)) : (SLOGE(fmt, ##args)))
#define BT_INFO_C(fmt, arg...) \
SLOGI_IF(TRUE, LOG_COLOR_GREEN" "fmt" "LOG_COLOR_RESET, ##arg)
#define BT_AGENT_NEW_LINE "\r\n"
#define BT_MAX_DBUS_TIMEOUT 45000
-#ifndef TIZEN_PROFILE_TV
-#define BT_ENABLE_TIMEOUT 20000 /* 20 seconds */
-#else
-#define BT_ENABLE_TIMEOUT 5000 /* 5 seconds */
-#endif
+#define BT_ENABLE_TIMEOUT ((TIZEN_PROFILE_TV) ? 5000 : 20000) /* 5(TV),20(others) seconds */
#define BT_DISCOVERY_FINISHED_DELAY 200
#define BT_SESSION_BUS_GET_TIMEOUT 200 /* 200 ms */
--- /dev/null
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+/* This is infrastructral, shared functino for all bt-* / *.c files. */
+
+#include "bt-internal-types.h"
+
+tizen_profile_t profile = _PROFILE_UNKNOWN;
#define BT_DPM_SYSPOPUP "dpm-syspopup"
#endif
-#ifndef TIZEN_PROFILE_WEARABLE
#define BT_FILE_VISIBLE_TIME "file/private/libug-setting-bluetooth-efl/visibility_time"
-#endif
#define BT_OFF_DUE_TO_FLIGHT_MODE "file/private/bt-core/flight_mode_deactivated"
#define BT_OFF_DUE_TO_POWER_SAVING_MODE "file/private/bt-core/powersaving_mode_deactivated"
#define BT_LE_DATA_LENGTH_CHANGED "LEDataLengthChanged"
#define BT_PXP_PROPERTY_CHANGED "PxpValueChanged"
+typedef enum {
+ _PROFILE_UNKNOWN = 0,
+ _PROFILE_MOBILE = 0x1,
+ _PROFILE_WEARABLE = 0x2,
+ _PROFILE_TV = 0x4,
+ _PROFILE_IVI = 0x8,
+ _PROFILE_COMMON = 0x10,
+} tizen_profile_t;
+
+/* For optimization, make this extern and define in a shared C file */
+extern tizen_profile_t profile;
+
+/* Accessing system info */
+int system_info_get_platform_string(const char *key, char **value);
+
+static inline tizen_profile_t get_tizen_profile()
+{
+ char *profileName = NULL;
+
+ if (__builtin_expect(profile != _PROFILE_UNKNOWN, 1))
+ return profile;
+
+ system_info_get_platform_string("http://tizen.org/feature/profile", &profileName);
+
+ /* To pass the checking of g_ir */
+ if (!profileName)
+ return _PROFILE_UNKNOWN;
+
+ switch (*profileName) {
+ case 'm':
+ case 'M':
+ profile = _PROFILE_MOBILE;
+ break;
+ case 'w':
+ case 'W':
+ profile = _PROFILE_WEARABLE;
+ break;
+ case 't':
+ case 'T':
+ profile = _PROFILE_TV;
+ break;
+ case 'i':
+ case 'I':
+ profile = _PROFILE_IVI;
+ break;
+ default: // common or unknown ==> ALL ARE COMMON.
+ profile = _PROFILE_COMMON;
+ }
+ free(profileName);
+
+ return profile;
+}
+#define TIZEN_PROFILE_WEARABLE (get_tizen_profile() == _PROFILE_WEARABLE)
+#define TIZEN_PROFILE_IVI (get_tizen_profile() == _PROFILE_IVI)
+#define TIZEN_PROFILE_TV (get_tizen_profile() == _PROFILE_TV)
+#define TIZEN_PROFILE_MOBILE (get_tizen_profile() == _PROFILE_MOBILE)
+
+#define TIZEN_FEATURE_NETWORK_TETHERING_ENABLE (get_tizen_profile() & (_PROFILE_MOBILE))
+#define TIZEN_FEATURE_TELEPHONY_ENABLED (get_tizen_profile() & (_PROFILE_MOBILE))
+#define TIZEN_FEATURE_FLIGHTMODE_ENABLED (get_tizen_profile() & (_PROFILE_MOBILE | _PROFILE_WEARABLE))
+#define TIZEN_FEATURE_BT_USB_DONGLE (get_tizen_profile() & (_PROFILE_TV))
+
#ifdef __cplusplus
}
#endif /* __cplusplus */
Name: bluetooth-frwk
Summary: Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
-Version: 0.2.156
+Version: 0.2.157
Release: 1
Group: Network & Connectivity/Bluetooth
License: Apache-2.0
#BuildRequires: pkgconfig(journal)
BuildRequires: pkgconfig(eventsystem)
BuildRequires: pkgconfig(libsoup-2.4)
-%if "%{?profile}" == "mobile"
BuildRequires: pkgconfig(capi-network-tethering)
-%endif
BuildRequires: cmake
BuildRequires: pkgconfig(cynara-client)
BuildRequires: pkgconfig(cynara-creds-gdbus)
BuildRequires: pkgconfig(libtzplatform-config)
BuildRequires: pkgconfig(storage)
+BuildRequires: pkgconfig(capi-system-info)
Requires(post): /usr/bin/vconftool
Requires(post): /sbin/ldconfig
Requires(postun): /sbin/ldconfig
Requires: psmisc
+Requires: %{name}-servicescript = %{version}-%{release}
+Recommends: %{name}-profile_common = %{version}-%{release}
%description
Bluetooth framework for BlueZ and Obexd. This package is Bluetooth framework based on BlueZ and Obexd stack.
This package contains API set for BT GAP, BT SDP, and BT RFCOMM.
+%package profile_common
+Summary: bluetooth-frwk service and conf files for common profile
+Provides: %{name}-servicescript = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_common
+Bluetooth framework configuration and service files for Tizen common profile
+
+%package profile_mobile
+Summary: bluetooth-frwk service and conf files for mobile profile
+Provides: %{name}-servicescript = %{version}-%{release}
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_mobile
+Bluetooth framework configuration and service files for Tizen mobile profile
+
+%package profile_wearable
+Summary: bluetooth-frwk service and conf files for wearable profile
+Provides: %{name}-servicescript = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_ivi
+%description profile_wearable
+Bluetooth framework configuration and service files for Tizen wearable profile
+
+%package profile_tv
+Summary: bluetooth-frwk service and conf files for tv profile
+Provides: %{name}-servicescript = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_common
+Conflicts: %{name}-profile_ivi
+%description profile_tv
+Bluetooth framework configuration and service files for Tizen tv profile
+
+%package profile_ivi
+Summary: bluetooth-frwk service and conf files for ivi profile
+Provides: %{name}-servicescript = %{version}-%{release}
+Conflicts: %{name}-profile_mobile
+Conflicts: %{name}-profile_wearable
+Conflicts: %{name}-profile_tv
+Conflicts: %{name}-profile_common
+%description profile_ivi
+Bluetooth framework configuration and service files for Tizen ivi profile
%package devel
Summary: Bluetooth framework for BlueZ and Obexd
export CXXFLAGS="$CXXFLAGS -DTIZEN_DEBUG_ENABLE"
export FFLAGS="$FFLAGS -DTIZEN_DEBUG_ENABLE"
-%define _servicefile packaging/bluetooth-frwk-common.service
-%define _servicedir starter.target.wants
-
-%if "%{?profile}" == "mobile"
-export CFLAGS="$CFLAGS -DTIZEN_FEATURE_NETWORK_TETHERING_ENABLE -DTIZEN_FEATURE_FLIGHTMODE_ENABLED -DTIZEN_PROFILE_MOBILE -DTIZEN_FEATURE_TELEPHONY_ENABLED"
-%if "%{?tizen_target_name}" == "TM1"
-%define _servicefile packaging/bluetooth-frwk-mobile-sprd.service
-%else
-%define _servicefile packaging/bluetooth-frwk-mobile.service
-%endif
-%define _servicedir multi-user.target.wants
-%endif
-
-%if "%{?profile}" == "wearable"
-export CFLAGS="$CFLAGS -DTIZEN_PROFILE_WEARABLE -DTIZEN_FEATURE_FLIGHTMODE_ENABLED"
-%define _servicefile packaging/bluetooth-frwk-wearable.service
-%define _servicedir multi-user.target.wants
-%endif
-
-%if "%{?profile}" == "tv"
-export CFLAGS="$CFLAGS -DTIZEN_FEATURE_BT_USB_DONGLE -DTIZEN_PROFILE_TV"
-%define _servicefile packaging/bluetooth-frwk-tv.service
-%define _servicedir multi-user.target.wants
-%endif
-
-%if "%{?profile}" == "ivi"
-export CFLAGS="$CFLAGS -DTIZEN_PROFILE_IVI"
-%define _servicefile packaging/bluetooth-frwk-wearable.service
-%define _servicedir multi-user.target.wants
-%endif
-
%ifarch x86_64
export CFLAGS="$CFLAGS -Wall -g -fvisibility=hidden -fPIC"
%else
-DLIBNOTIFICATION_SUPPORT=Off
make
-%cmake \
-%if "%{?profile}" == "wearable"
- -DTIZEN_PROFILE_WEARABLE=YES \
-%else
- -DTIZEN_PROFILE_WEARABLE=NO \
-%endif
-%if "%{?profile}" == "common"
- -DTIZEN_PROFILE_WEARABLE=NO \
-%endif
+%cmake
%install
rm -rf %{buildroot}
install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-httpproxy
install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/bluetooth-frwk-devel
-#mkdir -p %{buildroot}%{_libdir}/systemd/user
-#install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_libdir}/systemd/user
-mkdir -p %{buildroot}%{_unitdir}/%{_servicedir}
-install -m 0644 %{_servicefile} %{buildroot}%{_unitdir}/bluetooth-frwk.service
-ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/%{_servicedir}/bluetooth-frwk.service
+mkdir -p %{buildroot}%{_unitdir}/starter.target.wants
+mkdir -p %{buildroot}%{_unitdir}/multi-user.target.wants
-# On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
-%if "%{profile}"=="ivi"
-sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+# Rename the postfix (.mobile, .tv, ..) at post script
+# mobile
+%if "%{?tizen_target_name}" == "TM1"
+install -m 0644 packaging/bluetooth-frwk-mobile-sprd.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.mobile
+%else
+install -m 0644 packaging/bluetooth-frwk-mobile.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.mobile
%endif
+# wearable / ivi
+install -m 0644 packaging/bluetooth-frwk-wearable.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.wearable
+# On IVI bt-service needs to be run as 'app' even if there is a 'guest' user.
+cp %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+sed -i 's/%TZ_SYS_DEFAULT_USER/app/' %{buildroot}%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+
+# tv
+install -m 0644 packaging/bluetooth-frwk-tv.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.tv
+
+# common
+install -m 0644 packaging/bluetooth-frwk-common.service %{buildroot}%{_unitdir}/bluetooth-frwk.service.common
-#%post
-#/sbin/ldconfig
-#%if "%{?profile}" == "wearable"
-#vconftool set -f -t int db/bluetooth/status "1" -g 6520
-#%endif
-#%if "%{?profile}" == "mobile"
-#vconftool set -f -t int db/bluetooth/status "0" -g 6520
-#%endif
-#%if "%{?profile}" == "common"
-#vconftool set -f -t int db/bluetooth/status "0" -g 6520
-#%endif
-
-#vconftool set -f -t int db/bluetooth/status "0" -s User
-#vconftool set -f -t int db/bluetooth/lestatus "0" -s User
-#vconftool set -f -t int file/private/bt-core/flight_mode_deactivated "0" -s User
-#vconftool set -f -t int file/private/bt-core/powersaving_mode_deactivated "0" -s User
-#vconftool set -f -t int file/private/bt-service/bt_off_due_to_timeout "0" -s User
-#vconftool set -f -t string memory/bluetooth/sco_headset_name "" -g 6520 -i
-#vconftool set -f -t int memory/bluetooth/device "0" -g 6520 -i
-#vconftool set -f -t bool memory/bluetooth/btsco "0" -g 6520 -i
-#vconftool set -f -t bool memory/bluetooth/dutmode "0" -g 6520 -i
-
-
-#%post service
-#mkdir -p %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
-#ln -sf %{_libdir}/systemd/user/bluetooth-frwk.service %{_sysconfdir}/systemd/default-extra-dependencies/ignore-units.d/
+ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+ln -s ../bluetooth-frwk.service %{buildroot}%{_unitdir}/starter.target.wants/bluetooth-frwk.service
%postun -p /sbin/ldconfig
%defattr(-, root, root)
%{_libdir}/libbluetooth-api.so.*
%{_datadir}/license/bluetooth-frwk
-%{_unitdir}/%{_servicedir}/bluetooth-frwk.service
-%{_unitdir}/bluetooth-frwk.service
%files devel
%defattr(-, root, root)
%files service
%manifest %{name}.manifest
%defattr(-, root, root)
-%{_datadir}/dbus-1/system-services/org.projectx.bt.service
%{_bindir}/bt-service
-#%{_libdir}/systemd/user/bluetooth-frwk-tv.service
-%{_unitdir}/%{_servicedir}/bluetooth-frwk.service
%{_sysconfdir}/dbus-1/system.d/bluetooth-frwk-service.conf
%{_bindir}/bluetooth-frwk-test
-#%{_bindir}/bluetooth-gatt-test
-#%{_bindir}/bluetooth-advertising-test
%{_varlibdir}/bluetooth
%{_prefix}/etc/bluetooth
-#%attr(0666,-,-) %{_varlibdir}/bluetooth/auto-pair-blacklist
-#%attr(0666,-,-) %{_prefix}/etc/bluetooth/stack_info
-#%{_dumpdir}/bluetooth_log_dump.sh
%{_datadir}/license/bluetooth-frwk-service
%files httpproxy
%manifest %{name}.manifest
%defattr(-, root, root)
%{_bindir}/bluetooth-frwk-test
-#%{_bindir}/bluetooth-gatt-test
-#%{_bindir}/bluetooth-advertising-test
+#{_bindir}/bluetooth-gatt-test
+#{_bindir}/bluetooth-advertising-test
+
+%post profile_common
+pushd %{_unitdir}
+mv bluetooth-frwk.service.common bluetooth-frwk.service
+popd
+%preun profile_common
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.common
+popd
+%files profile_common
+%{_unitdir}/starter.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.common
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+%post profile_mobile
+pushd %{_unitdir}
+mv bluetooth-frwk.service.mobile bluetooth-frwk.service
+popd
+%preun profile_mobile
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.mobile
+popd
+%files profile_mobile
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.mobile
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+%post profile_wearable
+pushd %{_unitdir}
+mv bluetooth-frwk.service.wearable bluetooth-frwk.service
+popd
+%preun profile_wearable
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.wearable
+popd
+%files profile_wearable
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.wearable
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+%post profile_tv
+pushd %{_unitdir}
+mv bluetooth-frwk.service.tv bluetooth-frwk.service
+popd
+%preun profile_tv
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.tv
+popd
+%files profile_tv
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.tv
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service
+
+# Note: ivi reuses bluetooth-frwk.service.wearable
+%post profile_ivi
+pushd %{_unitdir}
+mv bluetooth-frwk.service.wearable bluetooth-frwk.service
+popd
+pushd %{_datadir}/dbus-1/system-services
+mv org.projectx.bt.service.ivi org.projectx.bt.service
+popd
+%preun profile_ivi
+pushd %{_unitdir}
+mv bluetooth-frwk.service bluetooth-frwk.service.wearable
+popd
+pushd %{_datadir}/dbus-1/system-services
+mv org.projectx.bt.service org.projectx.bt.service.ivi
+popd
+%files profile_ivi
+%{_unitdir}/multi-user.target.wants/bluetooth-frwk.service
+%{_unitdir}/bluetooth-frwk.service.wearable
+%{_datadir}/dbus-1/system-services/org.projectx.bt.service.ivi
+
+### added /usr/etc/bluetooth/wearable/stack_info (others: /usr/etc/bluetooth/stack_info))
+# (for PROFILE WEARABLE)
+