mot-agent: fixed a problem that MOT fails
authorsaerome.kim <saerome.kim@samsung.com>
Fri, 19 Jan 2018 05:01:59 +0000 (14:01 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:44 +0000 (19:38 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
capi/demo/comp-manager.c [changed mode: 0755->0644]
src/mot-agent/ma-subowner.c

old mode 100755 (executable)
new mode 100644 (file)
index d60fa8b..aa30db4
@@ -455,7 +455,6 @@ static int run_devices_find(MManager *mm, struct menu_data *menu)
 int run_device_get_my_device(MManager *mm, struct menu_data *menu)
 {
        int ret = 0;
-       int count = 0;
        companion_device_h device = NULL;
 
        msg("Get My Device");
index 4cd0328c3faf6dbf8fc37e2c26148491e33d8ca9..b8a3f5eaa23da6306078891ae4e219144a27ec3b 100644 (file)
@@ -862,7 +862,7 @@ static int _disc_owned_devs(ma_service *service)
 
 static void _mot_cb(void* ctx, int num, OCProvisionResult_t* arr, bool has_error)
 {
-#if MANIPULATE_LOCAL_PDM
+#ifdef MANIPULATE_LOCAL_PDM
        int i = 0;
        int ret = OC_STACK_OK;
 #endif
@@ -874,7 +874,7 @@ static void _mot_cb(void* ctx, int num, OCProvisionResult_t* arr, bool has_error
                MA_LOGD( "Multiple Ownership Transfer FAILED ");
 
                _print_result_list((const OCProvisionResult_t*) arr, num);
-#if MANIPULATE_LOCAL_PDM
+#ifdef MANIPULATE_LOCAL_PDM
                ret = ma_open_db();
                if (OC_STACK_OK  != ret)
                        MA_LOGE( "openDB: ret = %d (%s)", ret, _error_to_string(ret));
@@ -916,11 +916,11 @@ static gpointer _mot_func(gpointer data)
 
 #ifdef MULTIPLE_OWN_AT_ONCE
        OCProvisionDev_t* dev = NULL;
-       LL_FOREACH(src_dev, dev) {
+       LL_FOREACH(g_client->g_motdev_list, dev) {
                if(OIC_PRECONFIG_PIN == dev->doxm->oxmSel) {
                        /* Pre-Configured PIN initialization */
                        const char* testPreconfigPin = con->pin;/* Ex) "12341234" */
-                       ret = OCAddPreconfigPin(src_dev, testPreconfigPin, strlen(testPreconfigPin));
+                       ret = OCAddPreconfigPin(dev, testPreconfigPin, strlen(testPreconfigPin));
                        if(OC_STACK_OK != ret) {
                                MA_LOGE("Failed to save the pre-configured PIN");
                                MA_LOGE("You can't use the pre-configured PIN OxM for MOT");
@@ -928,6 +928,12 @@ static gpointer _mot_func(gpointer data)
                        }
                }
        }
+       ret = OCDoMultipleOwnershipTransfer(g_client, g_client->g_motdev_list, _mot_cb);
+       if (OC_STACK_OK != ret )  {
+               MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)", ret, _error_to_string(ret));
+               goto MOT_ENDED;
+       }
+
 #else
        if(OIC_PRECONFIG_PIN == src_dev->doxm->oxmSel) {
                /* Pre-Configured PIN initialization */
@@ -939,13 +945,13 @@ static gpointer _mot_func(gpointer data)
                        goto MOT_ENDED;
                }
        }
-#endif
-
        ret = OCDoMultipleOwnershipTransfer(g_client, src_dev, _mot_cb);
        if (OC_STACK_OK != ret )  {
                MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)", ret, _error_to_string(ret));
                goto MOT_ENDED;
        }
+#endif
+
 
        ret = _wait_cb_ret(CALLBACK_TIMEOUT_5S);
        if(ret)  {
@@ -1049,7 +1055,7 @@ static gpointer _remove_mo_func(gpointer data)
                MA_LOGE("GetDoxmDevOwnerId faild = [%d][%s]", ret, _error_to_string(ret));
                goto MOT_ENDED;
        }
-#if MANIPULATE_LOCAL_PDM
+#ifdef MANIPULATE_LOCAL_PDM
        ret = ma_open_db();
        if (OC_STACK_OK  != ret)
                MA_LOGE( "openDB: ret = %d (%s)", ret, _error_to_string(ret));