return 0;
}
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+/* ---- HCI Error Codes ---- */
+#define HCI_ERROR_AUTH_FAILURE 0x05
+#define HCI_ERROR_PIN_OR_KEY_MISSING 0x06
+#define HCI_ERROR_MEMORY_EXCEEDED 0x07
+#define HCI_ERROR_CONNECTION_TIMEOUT 0x08
+#define HCI_ERROR_REJ_LIMITED_RESOURCES 0x0d
+#define HCI_ERROR_REJ_BAD_ADDR 0x0f
+#define HCI_ERROR_REMOTE_USER_TERM 0x13
+#define HCI_ERROR_REMOTE_LOW_RESOURCES 0x14
+#define HCI_ERROR_REMOTE_POWER_OFF 0x15
+#define HCI_ERROR_LOCAL_HOST_TERM 0x16
+#define HCI_ERROR_PAIRING_NOT_ALLOWED 0x18
+#define HCI_ERROR_INVALID_LL_PARAMS 0x1e
+#define HCI_ERROR_UNSPECIFIED 0x1f
+#define HCI_ERROR_ADVERTISING_TIMEOUT 0x3c
+
+static uint8_t mgmt_to_hci_reason(uint8_t err)
+{
+ switch (err) {
+ case MGMT_DEV_DISCONN_TIMEOUT:
+ return HCI_ERROR_CONNECTION_TIMEOUT;
+ case MGMT_DEV_DISCONN_REMOTE:
+ return HCI_ERROR_REMOTE_USER_TERM;
+ case MGMT_DEV_DISCONN_LOCAL_HOST:
+ return HCI_ERROR_LOCAL_HOST_TERM;
+ default:
+ error("No match MGMT error");
+ return err;
+ }
+}
+#endif
+
static void disconnected_callback(uint16_t index, uint16_t length,
const void *param, void *user_data)
{
else
reason = ev->reason;
+#ifdef TIZEN_FEATURE_BLUEZ_MODIFY
+ /* Use HCI error code instead of MGMT disconnection reason */
+ dev_disconnected(adapter, &ev->addr, mgmt_to_hci_reason(reason));
+#else
dev_disconnected(adapter, &ev->addr, reason);
+#endif
}
static void connected_callback(uint16_t index, uint16_t length,