Handle connection changed event with actual disconnect reason values 19/128019/2
authorparas.kumar <paras.kumar@samsung.com>
Sat, 26 Sep 2015 05:52:39 +0000 (14:52 +0900)
committerSeungyoun Ju <sy39.ju@samsung.com>
Thu, 4 May 2017 08:10:23 +0000 (17:10 +0900)
[Model] COMMON
[BinType] AP
[Customer] OPEN

[Issue#] N/A
[Request] Internal
[Occurrence Version] N/A

[Problem] Wrong disconnect reason is passed to applications
[Cause & Measure] Passed value from framework was not converted.
 This patch converts the reason to Core API defined enum.
[Checking Method] Code review

[Team] Basic connection
[Developer] Seungyoun Ju
[Solution company] Samsung
[Change Type] Specification change

Change-Id: If19c4eef0d3d2b02a1f7994cd6bc01dc20d4ade9
Signed-off-by: paras.kumar <paras.kumar@samsung.com>
include/mobile/bluetooth_type.h
include/wearable/bluetooth_type.h
src/bluetooth-common.c

index 7118c9a5aeb4a0bb081f10386a63e09228396bf2..e3b3137ed2e041397bdaed4e2832a2193de2c31e 100644 (file)
@@ -207,6 +207,10 @@ typedef enum {
        BT_DEVICE_DISCONNECT_REASON_TIMEOUT, /**< Disconnected by timeout */
        BT_DEVICE_DISCONNECT_REASON_LOCAL_HOST, /**< Disconnected by local host */
        BT_DEVICE_DISCONNECT_REASON_REMOTE, /**< Disconnected by remote */
+/* After ACR for BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED, will enable this code */
+#if 0
+       BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED, /**< Disconnected by remote during pairing */
+#endif
 } bt_device_disconnect_reason_e;
 
 /**
index 2eed7850b2a3c868e3ba0daa60301be81087cf97..f6b9111427a9ef93e780f8e2ae3edcc2acfd2dfd 100644 (file)
@@ -206,6 +206,10 @@ typedef enum {
        BT_DEVICE_DISCONNECT_REASON_TIMEOUT, /**< Disconnected by timeout */
        BT_DEVICE_DISCONNECT_REASON_LOCAL_HOST, /**< Disconnected by local host */
        BT_DEVICE_DISCONNECT_REASON_REMOTE, /**< Disconnected by remote */
+/* After ACR for BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED, will enable this code */
+#if 0
+       BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED, /**< Disconnected by remote during pairing */
+#endif
 } bt_device_disconnect_reason_e;
 
 /**
index 097bbce487119d10e8b373a62a3b33564aa61917..cbc293788d86fdd3f9d3e88d5e3ecbca2e041a3c 100644 (file)
@@ -776,7 +776,28 @@ static int __bt_get_bt_device_connection_info_s(bt_device_connection_info_s **de
                break;
        }
 
-       (*dest)->disconn_reason = source->disc_reason;
+       switch (source->disc_reason) {
+/* After ACR for BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED, will enable this code */
+#if 0
+       case (int)BLUETOOTH_ERROR_AUTH_FAILURE:
+               (*dest)->disconn_reason = BT_DEVICE_DISCONNECT_REASON_AUTH_FAILED;
+               break;
+#endif
+       case (int)BLUETOOTH_ERROR_CONNECTION_TIMEOUT:
+               (*dest)->disconn_reason = BT_DEVICE_DISCONNECT_REASON_TIMEOUT;
+               break;
+       case (int)BLUETOOTH_ERROR_REMOTE_USER_TERM:
+       case (int)BLUETOOTH_ERROR_REMOTE_LOW_RESOURCES:
+       case (int)BLUETOOTH_ERROR_REMOTE_POWER_OFF:
+               (*dest)->disconn_reason = BT_DEVICE_DISCONNECT_REASON_REMOTE;
+               break;
+       case (int)BLUETOOTH_ERROR_LOCAL_HOST_TERM:
+               (*dest)->disconn_reason = BT_DEVICE_DISCONNECT_REASON_LOCAL_HOST;
+               break;
+       default:
+               (*dest)->disconn_reason = BT_DEVICE_DISCONNECT_REASON_UNKNOWN;
+               break;
+       }
 
        return BT_ERROR_NONE;
 }