Code Sync [Tizen3.0]: Applied tizen.org patches 27/35627/1
authorh.sandeep <h.sandeep@samsung.com>
Thu, 19 Feb 2015 15:26:30 +0000 (20:56 +0530)
committerh.sandeep <h.sandeep@samsung.com>
Fri, 20 Feb 2015 03:05:55 +0000 (08:35 +0530)
1> Applied the tizen branch patches
2> Fix for x86_64 compatibility
3> Remove placeholders and cleanup spec
4> resetting manifest requested domain to floor
5> Fix manifests
6> do not return an error when user stops discovery
7> handle device disappear event
8> src/bluetooth-hdp: Fix unsigned var check
9> src/bluetooth-adapter: Fix variable reassigning issue
10> src/bluetooth-common: Fix variable reassigning issue
11> Merge the CAPI's header files from tizen 2.3 to tizen 3.0

Change-Id: Ic68449c544925230c9e27b8891704d209fbe5534
Signed-off-by: h.sandeep <h.sandeep@samsung.com>
include/bluetooth_type.h
packaging/capi-network-bluetooth.spec
src/bluetooth-adapter.c
src/bluetooth-common.c
src/bluetooth-hdp.c
src/bluetooth-socket.c
test/bt_unit_test.c

index d569dc6..8935102 100755 (executable)
@@ -44,22 +44,22 @@ typedef enum
        BT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */
        BT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timeout error */
        BT_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /**< Operation now in progress */
-       BT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NOT_SUPPORTED, /**< Not Supported */
-       BT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_PERMISSION_DENIED, /**< Permission denied */
-       BT_ERROR_QUOTA_EXCEEDED = TIZEN_ERROR_QUOTA_EXCEEDED, /**< Quota exceeded */
-       BT_ERROR_NOT_INITIALIZED = TIZEN_ERROR_BLUETOOTH|0x0101, /**< Local adapter not initialized */
-       BT_ERROR_NOT_ENABLED = TIZEN_ERROR_BLUETOOTH|0x0102, /**< Local adapter not enabled */
-       BT_ERROR_ALREADY_DONE = TIZEN_ERROR_BLUETOOTH|0x0103, /**< Operation already done  */
-       BT_ERROR_OPERATION_FAILED = TIZEN_ERROR_BLUETOOTH|0x0104, /**< Operation failed */
-       BT_ERROR_NOT_IN_PROGRESS = TIZEN_ERROR_BLUETOOTH|0x0105, /**< Operation not in progress */
-       BT_ERROR_REMOTE_DEVICE_NOT_BONDED = TIZEN_ERROR_BLUETOOTH|0x0106, /**< Remote device not bonded */
-       BT_ERROR_AUTH_REJECTED = TIZEN_ERROR_BLUETOOTH|0x0107, /**< Authentication rejected */
-       BT_ERROR_AUTH_FAILED = TIZEN_ERROR_BLUETOOTH|0x0108, /**< Authentication failed */
-       BT_ERROR_REMOTE_DEVICE_NOT_FOUND = TIZEN_ERROR_BLUETOOTH|0x0109, /**< Remote device not found */
-       BT_ERROR_SERVICE_SEARCH_FAILED = TIZEN_ERROR_BLUETOOTH|0x010A, /**< Service search failed */
-       BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED = TIZEN_ERROR_BLUETOOTH|0x010B, /**< Remote device is not connected */
-       BT_ERROR_AGAIN = TIZEN_ERROR_BLUETOOTH|0x010C, /**< Resource temporarily unavailable */
-       BT_ERROR_SERVICE_NOT_FOUND = TIZEN_ERROR_BLUETOOTH|0x010D, /**< Service Not Found */
+       BT_ERROR_NOT_SUPPORTED = TIZEN_ERROR_NETWORK_CLASS|0x0111, /**< Not Supported */
+       BT_ERROR_PERMISSION_DENIED = TIZEN_ERROR_NETWORK_CLASS|0x0112, /**< Permission denied */
+       BT_ERROR_QUOTA_EXCEEDED = TIZEN_ERROR_NETWORK_CLASS|0x0113, /**< Quota exceeded */
+       BT_ERROR_NOT_INITIALIZED = TIZEN_ERROR_NETWORK_CLASS|0x0101, /**< Local adapter not initialized */
+       BT_ERROR_NOT_ENABLED = TIZEN_ERROR_NETWORK_CLASS|0x0102, /**< Local adapter not enabled */
+       BT_ERROR_ALREADY_DONE = TIZEN_ERROR_NETWORK_CLASS|0x0103, /**< Operation already done  */
+       BT_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0104, /**< Operation failed */
+       BT_ERROR_NOT_IN_PROGRESS = TIZEN_ERROR_NETWORK_CLASS|0x0105, /**< Operation not in progress */
+       BT_ERROR_REMOTE_DEVICE_NOT_BONDED = TIZEN_ERROR_NETWORK_CLASS|0x0106, /**< Remote device not bonded */
+       BT_ERROR_AUTH_REJECTED = TIZEN_ERROR_NETWORK_CLASS|0x0107, /**< Authentication rejected */
+       BT_ERROR_AUTH_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0108, /**< Authentication failed */
+       BT_ERROR_REMOTE_DEVICE_NOT_FOUND = TIZEN_ERROR_NETWORK_CLASS|0x0109, /**< Remote device not found */
+       BT_ERROR_SERVICE_SEARCH_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x010A, /**< Service search failed */
+       BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED = TIZEN_ERROR_NETWORK_CLASS|0x010B, /**< Remote device is not connected */
+       BT_ERROR_AGAIN = TIZEN_ERROR_NETWORK_CLASS|0x010C, /**< Resource temporarily unavailable */
+       BT_ERROR_SERVICE_NOT_FOUND = TIZEN_ERROR_NETWORK_CLASS|0x010D, /**< Service Not Found */
 } bt_error_e;
 
 /**
index 1441171..8fbdf55 100755 (executable)
@@ -1,15 +1,14 @@
-#sbs-git:slp/api/bluetooth capi-network-bluetooth 0.1.0 686c444083e4197845c768e5dd034022b1dfa250
 Name:       capi-network-bluetooth
 Summary:    Network Bluetooth Framework
 Version:    0.1.52
 Release:    1
 Group:      Connectivity/API
-License:    Apache License, Version 2.0
+License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 Source1001:    %{name}.manifest
 Source1002:    %{name}-devel.manifest
-Requires(post): /sbin/ldconfig
-Requires(postun): /sbin/ldconfig
+#Requires(post): /sbin/ldconfig
+#Requires(postun): /sbin/ldconfig
 
 BuildRequires:  pkgconfig(dbus-glib-1)
 BuildRequires:  pkgconfig(dlog)
@@ -89,7 +88,6 @@ cmake . -DCMAKE_INSTALL_PREFIX=/usr -DFULLVER=%{version} -DMAJORVER=${MAJORVER}
 make %{?jobs:-j%jobs}
 
 %install
-rm -rf %{buildroot}
 %make_install
 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/capi-network-bluetooth
 install -D -m 0644 LICENSE %{buildroot}%{_datadir}/license/capi-network-bluetooth-devel
index 2cc9cb1..db11a0b 100755 (executable)
@@ -31,7 +31,7 @@
 
 int bt_adapter_enable(void)
 {
-       int error_code = BT_ERROR_NONE;
+       int error_code;
 #ifdef TIZEN_WEARABLE
        static const char* PRIVILEGE_ID_BLUETOOTH_ADMIN = "http://tizen.org/privilege/bluetooth.admin";
 
@@ -54,7 +54,7 @@ int bt_adapter_enable(void)
 
 int bt_adapter_disable(void)
 {
-       int error_code = BT_ERROR_NONE;
+       int error_code;
 
        BT_CHECK_INIT_STATUS();
        error_code = _bt_get_error_code(bluetooth_disable_adapter());
@@ -78,7 +78,7 @@ int bt_adapter_recover(void)
 
 int bt_adapter_reset(void)
 {
-       int error_code = BT_ERROR_NONE;
+       int error_code;
 
        BT_CHECK_INIT_STATUS();
        error_code = _bt_get_error_code(bluetooth_reset_adapter());
@@ -373,7 +373,7 @@ ERROR:
 
 int bt_adapter_get_name(char **name)
 {
-       int ret = BT_ERROR_NONE;
+       int ret;
        bluetooth_device_name_t loc_name = { {0} };
 
        BT_CHECK_INIT_STATUS();
@@ -397,7 +397,7 @@ int bt_adapter_get_name(char **name)
 int bt_adapter_set_name(const char *name)
 {
        bluetooth_device_name_t loc_name = { {0} };
-       int ret = BT_ERROR_NONE;
+       int ret;
 
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(name);
@@ -416,7 +416,7 @@ int bt_adapter_set_name(const char *name)
 int bt_adapter_get_visibility(bt_adapter_visibility_mode_e *mode, int *duration)
 {
        bluetooth_discoverable_mode_t discoverable_mode = BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE;
-       int ret = BT_ERROR_NONE;
+       int ret;
 
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(mode);
@@ -792,7 +792,7 @@ int bt_adapter_le_unset_device_discovery_state_changed_cb(void)
 
 int bt_adapter_start_device_discovery(void)
 {
-       int error_code = BT_ERROR_NONE;
+       int error_code;
 
        BT_CHECK_INIT_STATUS();
        error_code = _bt_get_error_code(bluetooth_start_discovery(0, 0, BLUETOOTH_DEVICE_MAJOR_MASK_MISC));
@@ -804,7 +804,7 @@ int bt_adapter_start_device_discovery(void)
 
 int bt_adapter_stop_device_discovery(void)
 {
-       int error_code = BT_ERROR_NONE;
+       int error_code;
 
        BT_CHECK_INIT_STATUS();
        error_code = _bt_get_error_code(bluetooth_cancel_discovery());
index 1ee14df..65687aa 100755 (executable)
@@ -596,7 +596,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
        telephony_event_callid_t *call_data = NULL;
        char *device_addr = NULL;
        int error_code = BT_ERROR_NONE;
-       int event_index = -1;
+       int event_index;
        bluetooth_network_device_info_t *dev_info = NULL;
        bt_hdp_connected_t *hdp_conn_info = NULL;
        bt_hdp_disconnected_t *hdp_disconn_info = NULL;
@@ -651,7 +651,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
        case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
                BT_INFO("bt_adapter_device_discovery_state_changed_cb() will be called with BT_ADAPTER_DEVICE_DISCOVERY_FINISHED");
                ((bt_adapter_device_discovery_state_changed_cb)bt_event_slot_container[event_index].callback)
-                   (_bt_get_error_code(param->result), BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, NULL, bt_event_slot_container[event_index].user_data);
+                   (BT_ERROR_NONE, BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, NULL, bt_event_slot_container[event_index].user_data);
                break;
        case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
                BT_INFO("bt_adapter_device_discovery_state_changed_cb() will be called with BT_ADAPTER_DEVICE_DISCOVERY_FOUND");
@@ -664,6 +664,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                            (_bt_get_error_code(param->result), BT_ADAPTER_DEVICE_DISCOVERY_FOUND, NULL, bt_event_slot_container[event_index].user_data);
                }
                break;
+       case BLUETOOTH_EVENT_REMOTE_DEVICE_DISAPPEARED:
+       break;
        case BLUETOOTH_EVENT_BONDING_FINISHED:
                BT_INFO("bt_device_bond_created_cb() will be called");
                _bt_get_bt_device_info_s(&bonded_device, (bluetooth_device_info_t *)(param->param_data));
index 6a553d6..cdca1f1 100755 (executable)
@@ -65,7 +65,7 @@ int bt_hdp_send_data(unsigned int channel, const char *data, unsigned int size)
        int error = BT_ERROR_NONE;
 
        BT_CHECK_INIT_STATUS();
-       if (NULL == data || 0 >= size) {
+       if (NULL == data) {
                BT_ERR("%s", _bt_convert_error_to_string(BT_ERROR_INVALID_PARAMETER));
        }
        error = bluetooth_hdp_send_data(channel, data, size);
index 8ba0adc..56ecc4a 100755 (executable)
@@ -98,21 +98,7 @@ int bt_socket_listen(int socket_fd, int max_pending_connections)
 
 int bt_socket_accept(int socket_fd)
 {
-#ifdef ENABLE_TIZEN_2_4
-       int error_code = BT_ERROR_NONE;
-
-       BT_CHECK_INIT_STATUS();
-
-       error_code = _bt_get_error_code(bluetooth_rfcomm_accept_connection(socket_fd));
-       if (error_code != BT_ERROR_NONE) {
-               BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code),
-                               error_code);
-       }
-
-       return error_code;
-#else
        return BT_ERROR_NOT_SUPPORTED;
-#endif
 }
 
 int bt_socket_reject(int socket_fd)
index ea2e28c..b3c80b9 100755 (executable)
@@ -1305,8 +1305,10 @@ int test_input_callback(void *data)
                        break;
 
                case BT_UNIT_TEST_FUNCTION_DEVICE_SET_CONNECTION_STAET_CHANGED_CB:
+#if 0
                        ret = bt_device_set_connection_state_changed_cb(__bt_device_connection_state_changed_cb, NULL);
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
+#endif
                        break;
 
                case BT_UNIT_TEST_FUNCTION_DEVICE_UNSET_CONNECTION_STAET_CHANGED_CB:
@@ -1991,8 +1993,8 @@ static gboolean key_event_cb(GIOChannel *chan,
 {
        char buf[BUFFER_LEN] = { 0 };
 
-       unsigned int len = 0;
-       int test_id;
+       gsize len = 0;
+       long test_id;
        bool is_call_api = false;
 
        if (is_sub_index)