mdg-manager: translate IoTivity error message for CAPI
authorsaerome.kim <saerome.kim@samsung.com>
Thu, 26 Apr 2018 06:10:22 +0000 (15:10 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:39:37 +0000 (19:39 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
src/mdg-manager/src/mdgd_group.c

index da8db5c..4a500fc 100644 (file)
@@ -574,7 +574,7 @@ void mdgd_group_notify_group_invite(int ret)
         * ret = 0 OC_STACK_OK
         * ret = 49 OC_STACK_DUPLICATE_UUID
         */
-       if ((ret == 0 || ret == 49) && group_invite_info) {
+       if (OC_STACK_OK == ret && group_invite_info) {
                mdgd_invited_device_t *device;
                GList *iter = NULL;
                gboolean is_exist = FALSE;
@@ -627,6 +627,12 @@ void mdgd_group_notify_group_invite(int ret)
                        g_free(device->group_name);
                        g_free(device);
                }
+       } else if (OC_STACK_DUPLICATE_UUID == ret) {
+               /* Replace error code for CAPI */
+               ret = MDGD_ERROR_ALREADY_REGISTERED;
+       } else if (OC_STACK_INVALID_PARAM == ret) {
+               /* Replace error code for CAPI */
+               ret = MDGD_ERROR_OPERATION_FAILED;
        }
 
        mdgd_group_free_invite_info();
@@ -749,6 +755,10 @@ void mdgd_group_notify_group_dismiss(int result)
 {
        LOG_DEBUG("Notify group eject %d", result);
 
+       /* Replace error code for CAPI */
+       if (OC_STACK_INVALID_PARAM == result)
+               result = MDGD_ERROR_ALREADY_REGISTERED;
+
        notify_group_device_eject_result(result);
 }