Deinitialize gatt server properly 11/207611/2
authorinjun.yang <injun.yang@samsung.com>
Tue, 5 Mar 2019 07:36:29 +0000 (16:36 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Mon, 10 Jun 2019 04:26:55 +0000 (13:26 +0900)
[Model] All
[BinType] AP
[Customer] OPEN

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

[Problem] register gatt server -> bluetoothd terminated abnormally -> unregister gatt server ->
     bt-frwk recovery BT-> register gatt server -> crash
[Cause & Measure] After BT disabled, gatt server is not deinitialized properly.
[Checking Method] n/a

[Team] IoT Hub
[Developer] Injun Yang
[Solution company] Samsung
[Change Type] Specification change

Change-Id: I6f4356e12e05073656d56302d7e6c39883fc96f2
Signed-off-by: injun.yang <injun.yang@samsung.com>
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
bt-api/bt-gatt-service.c
bt-api/include/bt-common.h

index 0842b8a..6a4cc6c 100644 (file)
@@ -1566,7 +1566,8 @@ BT_EXPORT_API int bluetooth_gatt_unregister_application(void)
                        if (err != NULL) {
                                BT_ERR("D-Bus API failure: errCode[%x], message[%s]",
                                                err->code, err->message);
-                               if (err->code == G_DBUS_ERROR_SERVICE_UNKNOWN) {
+                               if (err->code == G_DBUS_ERROR_SERVICE_UNKNOWN ||
+                                       g_strrstr(err->message, BT_ERROR_DOES_NOT_EXIST)) {
                                        g_clear_error(&err);
                                        goto done;
                                }
index bda9c40..75a7a13 100644 (file)
@@ -216,6 +216,7 @@ extern "C" {
 #define BT_ERROR_BUSY "InProgress"
 #define BT_ERROR_INVALID_PARAM "InvalidArguments"
 #define BT_ERROR_ALREADY_EXIST "AlreadyExists"
+#define BT_ERROR_DOES_NOT_EXIST "DoesNotExist"
 #define BT_ERROR_ALREADY_CONNECTED "Already Connected"
 #define BT_ERROR_NO_MEMORY "No memory"
 #define BT_ERROR_NO_DATA "No data"