From: saerome.kim Date: Tue, 16 Jan 2018 01:38:01 +0000 (+0900) Subject: mot-agent: Fixed the issue of multiple MOT at once X-Git-Tag: submit/tizen/20190131.065036~215 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=78495c37b4314bba7b458427d0337e18adaea787;p=platform%2Fcore%2Fapi%2Fmulti-device-group.git mot-agent: Fixed the issue of multiple MOT at once --- diff --git a/src/companion-manager/include/comp_mot_agent.h b/src/companion-manager/include/comp_mot_agent.h index 53c4980..8288ba5 100755 --- a/src/companion-manager/include/comp_mot_agent.h +++ b/src/companion-manager/include/comp_mot_agent.h @@ -20,7 +20,11 @@ #ifndef __COMP_MOT_AGENT_H__ #define __COMP_MOT_AGENT_H__ - int agent_dbus_start(); +#ifdef __cplusplus +extern "C" { +#endif + +int agent_dbus_start(); int agent_dbus_stop(); int agent_enable(); @@ -36,4 +40,8 @@ int agent_remove_mo_at_device(char* uuid_str); int agent_remove_cred_at_local(char* uuid_str); int agent_remove_myowned_device(char* uuid_str); - #endif /* __COMP_MOT_AGENT_H__ */ \ No newline at end of file +#ifdef __cplusplus +} +#endif + + #endif /* __COMP_MOT_AGENT_H__ */ diff --git a/src/mot-agent/ma-subowner.c b/src/mot-agent/ma-subowner.c index ecfd201..7934bbc 100644 --- a/src/mot-agent/ma-subowner.c +++ b/src/mot-agent/ma-subowner.c @@ -941,6 +941,7 @@ static gpointer _mot_func(gpointer data) ma_req_cb_s *con = (ma_req_cb_s *)data; OCProvisionDev_t *src_dev = NULL; + OCProvisionDev_t *clone_dev = NULL; OicUuid_t *uuid_target = NULL; if (!con->uuid_target_str) { @@ -954,11 +955,15 @@ static gpointer _mot_func(gpointer data) MA_LOGE("We can't find in MOT dev list"); goto MOT_ENDED; } + /* Copy subject device and related information */ + clone_dev = PMCloneOCProvisionDev(src_dev); + /* To do ACL provisioning only one */ + clone_dev->next = NULL; g_client->g_doneCB = false; OCProvisionDev_t* dev = NULL; - LL_FOREACH(src_dev, dev) { + LL_FOREACH(clone_dev, dev) { if(OIC_PRECONFIG_PIN == dev->doxm->oxmSel) { /* Pre-Configured PIN initialization */ const char* testPreconfigPin = con->pin;/* Ex) "12341234" */ @@ -971,7 +976,7 @@ static gpointer _mot_func(gpointer data) } } - ret = OCDoMultipleOwnershipTransfer(g_client, src_dev, _mot_cb); + ret = OCDoMultipleOwnershipTransfer(g_client, clone_dev, _mot_cb); if (OC_STACK_OK != ret ) { MA_LOGE( "OCDoMultipleOwnershipTransfer: ret = %d (%s)", ret, _error_to_string(ret)); goto MOT_ENDED; @@ -990,6 +995,8 @@ MOT_ENDED: net_ma_emit_mot_done(ma_dbus_get_object(), (int)ret); if (uuid_target) g_free(uuid_target); + if (clone_dev) + PMDeleteDeviceList(clone_dev); _request_cleanup(data); g_thread_exit(GINT_TO_POINTER (1));