d2d-manager: add doc.h and change of copyright enforcement year
authorsaerome.kim <saerome.kim@samsung.com>
Thu, 29 Mar 2018 02:26:19 +0000 (11:26 +0900)
committersaerome.kim <saerome.kim@samsung.com>
Mon, 2 Jul 2018 10:38:49 +0000 (19:38 +0900)
Signed-off-by: saerome.kim <saerome.kim@samsung.com>
47 files changed:
capi/demo/common.h
capi/demo/comp-manager.c
capi/demo/companion_demo.c
capi/demo/main.c
capi/demo/menu.c
capi/demo/menu.h
capi/doc/companion_doc.h [new file with mode: 0644]
capi/include/companion.h
capi/src/companion.c
capi/src/companion_dbus.c
capi/src/companion_dbus.h
capi/src/companion_debug.h
capi/src/companion_private.h
capi/src/companion_util.c
capi/src/companion_util.h
capi/unittest/companion_unit_test.cpp
src/companion-manager/include/comp_context.h
src/companion-manager/include/comp_enum.h
src/companion-manager/include/comp_gdbus.h
src/companion-manager/include/comp_gdbus_group.h
src/companion-manager/include/comp_group.h
src/companion-manager/include/comp_iot.h
src/companion-manager/include/comp_log.h
src/companion-manager/include/comp_manager.h
src/companion-manager/include/comp_mot_agent.h
src/companion-manager/include/comp_resource.h
src/companion-manager/src/comp_context.c
src/companion-manager/src/comp_gdbus.c
src/companion-manager/src/comp_gdbus_group.c
src/companion-manager/src/comp_group.c
src/companion-manager/src/comp_iot.cpp
src/companion-manager/src/comp_log.c
src/companion-manager/src/comp_manager.c
src/companion-manager/src/comp_mot_agent.c
src/companion-manager/src/comp_resource.c
src/include/d2d-log.h
src/mot-agent/ma-log.h
src/mot-agent/ma-service-interface.c
src/mot-agent/ma-service-interface.h
src/mot-agent/ma-service.c
src/mot-agent/ma-service.h
src/mot-agent/ma-subowner.c
src/mot-agent/ma-subowner.h
src/mot-agent/ma-util.c
src/mot-agent/ma-util.h
src/mot-agent/ma.c
src/mot-agent/ma.h

index a14df5089c985645278a7cde16ced3783de6e42a..dd2997649e16cff01d831ee3808ee79136fded16 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index fc4004218f2c4ef0993cf0699c3ef80da8a9b61e..4263878e221a0361dfe90c91b91c8db667f720ee 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 9fd72a28ed01d6500b0b92e9707459ba9dea5a1a..a0c878d6810fe116d5df59ba8e4bce9d508007e9 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 41e5372dcc6734b4370c5d4889949d94b94f1363..4dca2d64392c340cf4a3f32d97a4c103c6cad3d2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index e3a38d37a02a9faf99aa9265b6896b60a3758185..c217f6ba407e629e2e5179a713dd262bfa526a0e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 5959d553044c48f9d362ef46acb13ff88c48e690..728d36cf1f0fbedc9b41c5ce0c56d3db5d4b196a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
diff --git a/capi/doc/companion_doc.h b/capi/doc/companion_doc.h
new file mode 100644 (file)
index 0000000..5a8d097
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+#ifndef __TIZEN_NETWORK_COMPANION_DOC_H__
+#define __TIZEN_NETWORK_COMPANION_DOC_H__
+
+/**
+ * @ingroup CAPI_NETWORK_FRAMEWORK
+ * @defgroup CAPI_NETWORK_COMPANION_MODULE Companion Manager
+ * @brief The Companion API provides functions for group management of devices.
+ *
+ * @section CAPI_NETWORK_COMPANION_MODULE_HEADER Required Header
+ *   \#include <companion.h>
+ *
+ * @section CAPI_NETWORK_COMPANION_MODULE_OVERVIEW Overview
+ * Companion Device Management(CDM) is a term for the group managenet of smart devices, such as smartphones, wearable devices, televisions, spakers and home appliances in a local network.
+ * The CDM is implemented with the use of an open souce project 'IoTivity' that has D2D management features for various vendors of smart devices.
+ * The CDM functionality can provide groupe management of devices, sending data securely and configuraion settings for all types of smart devices baseed on 'OCF', including smartphones, wearable devices, TVs, home appliances, speakers, IoT things, etc.
+ *
+ * @section CAPI_NETWORK_COMPANION_MODULE_FEATURE Related Features
+ * This API is related with the following features:\n
+ * - http://tizen.org/feature/network.d2d.companion\n
+ *
+ * It is recommended to design applications with regard to features, for reliability.\n
+ *
+ * You can check if a device supports the related features for this API by using @ref CAPI_SYSTEM_SYSTEM_INFO_MODULE, and control your application's actions accordingly.\n
+ *
+ * To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.\n
+ *
+ * More details on featuring your application can be found from <a href="https://developer.tizen.org/development/tizen-studio/native-tools/configuring-your-app/manifest-text-editor#feature"><b>Feature Element</b>.</a>
+ *
+ */
+
+#endif /* __TIZEN_NETWORK_COMPANION_DOC_H__ */
index 9e7bb332c2e27d529222b8ea1b85adb53a51c984..9bc2f1a09d0f114406aa72b0387d6ac1d3e84b72 100644 (file)
@@ -16,8 +16,8 @@
  * limitations under the License.
  *
  */
-#ifndef __TIZEN_NETWORK_COMMON_COMPANION_H__
-#define __TIZEN_NETWORK_COMMON_COMPANION_H__
+#ifndef __TIZEN_NETWORK_COMPANION_H__
+#define __TIZEN_NETWORK_COMPANION_H__
 
 #include <tizen.h>
 
@@ -30,7 +30,7 @@ extern "C" {
  */
 
 /**
- * @addtogroup CAPI_NETWORK_COMMON_COMPANION_MODULE
+ * @addtogroup CAPI_NETWORK_COMPANION_MODULE
  * @{
  */
 
@@ -1065,8 +1065,9 @@ int companion_request_create_group(companion_h handle,
 
 /**
  * @brief Requests to invite a device to the group.
- * @details This function invites a remote device to a specific group. At the time of invitation,
- * user can enter the authentication information (i.e., PIN) or use the certificate.
+ * @details This function invites a remote device to a specific group. At the time of
+ * invitation, user can enter the authentication information (i.e., PIN) or use the
+ * certificate.
  *
  * @since_tizen 5.0
  *
@@ -1172,4 +1173,4 @@ int companion_request_result_callback(companion_h handle,
 }
 #endif
 
-#endif /* __TIZEN_NETWORK_COMMON_COMPANION_H__ */
\ No newline at end of file
+#endif /* __TIZEN_NETWORK_COMPANION_H__ */
\ No newline at end of file
index 1455ade674833d26d3ef85ac305ca8bf9f0fa539..2775ce0bf099145b269c2ba8bb8e4c53828b0f0c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 7a7a43fa56bade6fe1349d950d751924abec4c6b..e911c8774bcbf8300854bfb267258b406ff04763 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index b77b296ca20c0bcd50eea89d8d92c116f2c10911..fdc5f069d66eee889cc16f0813722b4698d87458 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  *
  */
 
-#ifndef __TIZEN_NETWORK_COMMON_COMPANION_DBUS_INTERNAL_H__
-#define __TIZEN_NETWORK_COMMON_COMPANION_DBUS_INTERNAL_H__
+#ifndef __TIZEN_NETWORK_COMPANION_DBUS_INTERNAL_H__
+#define __TIZEN_NETWORK_COMPANION_DBUS_INTERNAL_H__
 
 #include <companion_private.h>
 
 int gdbus_initialize(comp_manager_s *handle);
 int gdbus_deinitialize(comp_manager_s *handle);
 
-#endif /* __TIZEN_NETWORK_COMMON_COMPANION_DBUS_INTERNAL_H__ */
+#endif /* __TIZEN_NETWORK_COMPANION_DBUS_INTERNAL_H__ */
index 7ab82937e877babfc6245c2e4d2aadd129ae2401..ec8958607d0e578d091db926669685612458931c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -15,8 +15,8 @@
  *
  */
 
-#ifndef __TIZEN_NETWORK_COMMON_COMPANION_DEBUG_H__
-#define __TIZEN_NETWORK_COMMON_COMPANION_DEBUG_H__
+#ifndef __TIZEN_NETWORK_COMPANION_DEBUG_H__
+#define __TIZEN_NETWORK_COMPANION_DEBUG_H__
 
 #include <dlog.h>
 
 #define PRT(format, args...) printf("%s:%d() "format, __FUNCTION__, __LINE__, ##args)
 #define TC_PRT(format, args...) PRT(format"\n", ##args)
 
-#endif /* __TIZEN_NETWORK_COMMON_COMPANION_DEBUG_H__ */
+#endif /* __TIZEN_NETWORK_COMPANION_DEBUG_H__ */
index 44c8a8c885f047c89dbfbb514dd5844f61679b98..26f6463c0a952d367620c3191cea809fddcf8a02 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,7 +26,7 @@
 
 #include <system_info.h>
 
-#define COMPANION_FEATURE "http://tizen.org/feature/network.companion"
+#define COMPANION_FEATURE "http://tizen.org/feature/network.d2d.companion"
 
 #define CHECK_INPUT_PARAMETER(arg) \
        if (arg == NULL) { \
index 497735d74c858e88050540e2550b881733de4a80..84a8e637b822520e25a8b6867df62f59cd3efd54 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index db7314e2abcf81a4753e4c005bfe57a64eac2017..6fbb6358359ccfcca58c05ffec385ae69e148f68 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 2bab208d50b3063e1b9c593b1000ea813054c971..2a5414acf4375b6e89d36651dc02de54740ae0bd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 573edbdad77b40868bd0fb9b7d896d973d5d449a..e1c9c5ce9ec14f02c2458e59862acf76b0da08a5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 577766ce4d39651ad57e832470528f66935c0168..87dc9a24a1925e40b3c548de3aa58a5d941c31a7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 77ac1ea68f45600ad73be050e69a7f01d41ca2db..059e08e111570491750aa9e4c5d44bc5829e24a2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index c12b1e64eeb2dd5f2305578c6790ef637ee2bf97..ebb8fe0487fcdfb963598964a53775fe2b80f194 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 22d86ac11e556ba624330598c25fe0b91a3bd8e4..468c33746e6a725c91feb7fd12232b7389a17a7b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index dfdccdf59edbcbb2f4ec4a0e593ad4fc1317a11c..cc31b3a7742ff16268e6314888654330c9f70605 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 90f60b8cc6a387f9d0c5518cc21b80c0fcb799e1..9aaf01772381245b2afee7edfc113dce5003483e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 50ae7482f17498add51a4e1f12efe37afab01722..b09017903d8163c753e2483f60570b168347567d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index d647610ff684aa14e635537c31ef8cc51f7553b1..c4537a200a1aa6e6bf323438c83a165fb394cd24 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index e767838a4354ce6c1619a6b7287143c5d5b483ac..f5d78854b4f6b883aa06c3d07de02686f3508322 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 6a5b3ec56d62554b966ec8329f0512faca0a60ae..7aeb82f0cb674a29d1da039d903d2a4216736c07 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 5ed046853666e682bab15c1c63716b13acdfacab..1c05cbbd2c84f1f7fae46d12f1ac80ef052ce81f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index a66a5d8b7654e6fc0e217b0a16cdc45975fd505e..21ab0c686233cb9f083092820df8397270dc1810 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index accf31a600e69ed37e69516e9b5f3ef53e887829..001829a77e733146d2a2ff90a4aa351494497d9d 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index cc8c2819cf3c197cc3df69da6a440e4bb61854d1..9acbd68c223586e682318bf5d7f0d86dd42c377b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 23346d093dc35c04546d606414ce450ea6b81344..0e3238d6f89da7d9c8287d788bc3829b062aa933 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index e9eff6cb1b0d9adb003823ba33537f69d924ebee..ddc8c67d5176f56d71de74f85d96fbf45435cd3b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index a43bda4fe4a70aadec34cbb0a7e4ca567716c7c5..e2016f3b8a4954e18a669606645aecc6ac613cde 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 7502b0c64188faa299e51e945bdc9331f5d85614..1c189fae5898904cf77f846fd31f2c373e09424c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 3898a246c195381ed0ee52ac982a774307a06011..acf6448332328c0726cc2e0f26693f513e2ffd40 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-\r
-#ifndef __D2D_LOG_H__\r
-#define __D2D_LOG_H__\r
-\r
-#ifdef LOG_TAG\r
-#undef LOG_TAG\r
-#endif\r
-\r
-#ifdef USE_DLOG\r
-#include <dlog.h>\r
-\r
-#undef LOG_TAG\r
-#define LOG_TAG "D2D_COMMON"\r
-\r
-#define D2D_LOGV(format, args...) LOGV(format, ##args)\r
-#define D2D_LOGD(format, args...) LOGD(format, ##args)\r
-#define D2D_LOGI(format, args...) LOGI(format, ##args)\r
-#define D2D_LOGW(format, args...) LOGW(format, ##args)\r
-#define D2D_LOGE(format, args...) LOGE(format, ##args)\r
-#define D2D_LOGF(format, args...) LOGF(format, ##args)\r
-\r
-#define __D2D_LOG_FUNC_ENTER__ LOGD("Enter")\r
-#define __D2D_LOG_FUNC_EXIT__ LOGD("Quit")\r
-\r
-#define D2D_SECLOGI(format, args...) SECURE_LOG(LOG_INFO, LOG_TAG, format, ##args)\r
-#define D2D_SECLOGD(format, args...) SECURE_LOG(LOG_DEBUG, LOG_TAG, format, ##args)\r
-\r
-#else /* USE_DLOG */\r
-\r
-#define D2D_LOGV(format, args...)\r
-#define D2D_LOGD(format, args...)\r
-#define D2D_LOGI(format, args...)\r
-#define D2D_LOGW(format, args...)\r
-#define D2D_LOGE(format, args...)\r
-#define D2D_LOGF(format, args...)\r
-\r
-#define __D2D_LOG_FUNC_ENTER__\r
-#define __D2D_LOG_FUNC_EXIT__\r
-\r
-#define D2D_SECLOGI(format, args...)\r
-#define D2D_SECLOGD(format, args...)\r
-\r
-#endif /* USE_DLOG */\r
-\r
-#endif /* __D2D_LOG_H__ */\r
+ */
+
+#ifndef __D2D_LOG_H__
+#define __D2D_LOG_H__
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#ifdef USE_DLOG
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "D2D_COMMON"
+
+#define D2D_LOGV(format, args...) LOGV(format, ##args)
+#define D2D_LOGD(format, args...) LOGD(format, ##args)
+#define D2D_LOGI(format, args...) LOGI(format, ##args)
+#define D2D_LOGW(format, args...) LOGW(format, ##args)
+#define D2D_LOGE(format, args...) LOGE(format, ##args)
+#define D2D_LOGF(format, args...) LOGF(format, ##args)
+
+#define __D2D_LOG_FUNC_ENTER__ LOGD("Enter")
+#define __D2D_LOG_FUNC_EXIT__ LOGD("Quit")
+
+#define D2D_SECLOGI(format, args...) SECURE_LOG(LOG_INFO, LOG_TAG, format, ##args)
+#define D2D_SECLOGD(format, args...) SECURE_LOG(LOG_DEBUG, LOG_TAG, format, ##args)
+
+#else /* USE_DLOG */
+
+#define D2D_LOGV(format, args...)
+#define D2D_LOGD(format, args...)
+#define D2D_LOGI(format, args...)
+#define D2D_LOGW(format, args...)
+#define D2D_LOGE(format, args...)
+#define D2D_LOGF(format, args...)
+
+#define __D2D_LOG_FUNC_ENTER__
+#define __D2D_LOG_FUNC_EXIT__
+
+#define D2D_SECLOGI(format, args...)
+#define D2D_SECLOGD(format, args...)
+
+#endif /* USE_DLOG */
+
+#endif /* __D2D_LOG_H__ */
index edc8713f3034f7d406b73439027174412eb0f575..ec20a2473199eff14fba8a7688f230cf9bb77e73 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-\r
-#ifndef __MA_LOG_H__\r
-#define __MA_LOG_H__\r
-\r
-#ifdef LOG_TAG\r
-#undef LOG_TAG\r
-#endif\r
-\r
-#ifdef USE_DLOG\r
-#include <dlog.h>\r
-\r
-#undef LOG_TAG\r
-#define LOG_TAG "MOT_AGENT"\r
-\r
-#define COLOR_RED "\033[0;31m"\r
-#define COLOR_GREEN "\033[0;32m"\r
-#define COLOR_BROWN "\033[0;33m"\r
-#define COLOR_BLUE "\033[0;34m"\r
-#define COLOR_PURPLE "\033[0;35m"\r
-#define COLOR_CYAN "\033[0;36m"\r
-#define COLOR_LIGHTBLUE "\033[0;37m"\r
-#define COLOR_END "\033[0;m"\r
-\r
-#define MA_LOGV(format, args...) LOGV(format, ##args)\r
-#define MA_LOGD(format, args...) LOGD(COLOR_LIGHTBLUE" "format COLOR_END, ##args)\r
-#define MA_LOGI(format, args...) LOGI(COLOR_GREEN" "format COLOR_END, ##args)\r
-#define MA_LOGW(format, args...) LOGW(COLOR_CYAN" "format COLOR_END, ##args)\r
-#define MA_LOGE(format, args...) LOGE(COLOR_RED" "format COLOR_END, ##args)\r
-#define MA_LOGF(format, args...) LOGF(format, ##args)\r
-\r
-#define __MA_LOG_FUNC_ENTER__ LOGD("Enter")\r
-#define __MA_LOG_FUNC_EXIT__ LOGD("Quit")\r
-\r
-#define MA_SECLOGI(format, args...) SECURE_LOG(LOG_INFO, MA_LOG_TAG, format, ##args)\r
-#define MA_SECLOGD(format, args...) SECURE_LOG(LOG_DEBUG, MA_LOG_TAG, format, ##args)\r
-\r
-#else /* USE_DLOG */\r
-\r
-#define MA_LOGV(format, args...)\r
-#define MA_LOGD(format, args...)\r
-#define MA_LOGI(format, args...)\r
-#define MA_LOGW(format, args...)\r
-#define MA_LOGE(format, args...)\r
-#define MA_LOGF(format, args...)\r
-\r
-#define __MA_LOG_FUNC_ENTER__\r
-#define __MA_LOG_FUNC_EXIT__\r
-\r
-#define MA_SECLOGI(format, args...)\r
-#define MA_SECLOGD(format, args...)\r
-\r
-#endif /* USE_DLOG */\r
-\r
-#endif /* __MA_LOG_H__ */\r
+ */
+
+#ifndef __MA_LOG_H__
+#define __MA_LOG_H__
+
+#ifdef LOG_TAG
+#undef LOG_TAG
+#endif
+
+#ifdef USE_DLOG
+#include <dlog.h>
+
+#undef LOG_TAG
+#define LOG_TAG "MOT_AGENT"
+
+#define COLOR_RED "\033[0;31m"
+#define COLOR_GREEN "\033[0;32m"
+#define COLOR_BROWN "\033[0;33m"
+#define COLOR_BLUE "\033[0;34m"
+#define COLOR_PURPLE "\033[0;35m"
+#define COLOR_CYAN "\033[0;36m"
+#define COLOR_LIGHTBLUE "\033[0;37m"
+#define COLOR_END "\033[0;m"
+
+#define MA_LOGV(format, args...) LOGV(format, ##args)
+#define MA_LOGD(format, args...) LOGD(COLOR_LIGHTBLUE" "format COLOR_END, ##args)
+#define MA_LOGI(format, args...) LOGI(COLOR_GREEN" "format COLOR_END, ##args)
+#define MA_LOGW(format, args...) LOGW(COLOR_CYAN" "format COLOR_END, ##args)
+#define MA_LOGE(format, args...) LOGE(COLOR_RED" "format COLOR_END, ##args)
+#define MA_LOGF(format, args...) LOGF(format, ##args)
+
+#define __MA_LOG_FUNC_ENTER__ LOGD("Enter")
+#define __MA_LOG_FUNC_EXIT__ LOGD("Quit")
+
+#define MA_SECLOGI(format, args...) SECURE_LOG(LOG_INFO, MA_LOG_TAG, format, ##args)
+#define MA_SECLOGD(format, args...) SECURE_LOG(LOG_DEBUG, MA_LOG_TAG, format, ##args)
+
+#else /* USE_DLOG */
+
+#define MA_LOGV(format, args...)
+#define MA_LOGD(format, args...)
+#define MA_LOGI(format, args...)
+#define MA_LOGW(format, args...)
+#define MA_LOGE(format, args...)
+#define MA_LOGF(format, args...)
+
+#define __MA_LOG_FUNC_ENTER__
+#define __MA_LOG_FUNC_EXIT__
+
+#define MA_SECLOGI(format, args...)
+#define MA_SECLOGD(format, args...)
+
+#endif /* USE_DLOG */
+
+#endif /* __MA_LOG_H__ */
index 694daf91cee85140a355fac8b8e7da9f2ce727cc..d1b026600f9a370ea7d6a441a56c46e6f73f48c5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-#include <glib.h>\r
-\r
-#include "ma.h"\r
-#include "ma-log.h"\r
-#include "ma-util.h"\r
-#include "ma-service.h"\r
-#include "ma-subowner.h"\r
-#include "ma-service-interface.h"\r
-#include "ma-generated-code.h"\r
-\r
-static NetMa *ma_dbus_object;\r
-static Enabler *ma_activator_dbus_object;\r
-\r
-/* global list to care resource handle for each client */\r
-static GList *ma_dbus_client_list;\r
-static GMutex ma_dbus_client_list_mutex;\r
-\r
-typedef struct _ma_dbus_client_s {\r
-       gchar *bus_name;\r
-} ma_dbus_client_s;\r
-\r
-NetMa* ma_dbus_get_object()\r
-{\r
-       return ma_dbus_object;\r
-}\r
-\r
-static int _ma_dbus_client_list_cleanup(GList *client_list)\r
-{\r
-       ma_dbus_client_s *client;\r
-\r
-       ma_check_null_ret_error("client_list", client_list, FALSE);\r
-\r
-       client = client_list->data;\r
-\r
-       g_free(client->bus_name);\r
-       client->bus_name = NULL;\r
-       g_free(client);\r
-       g_list_free(client_list);\r
-\r
-       return MA_ERROR_NONE;\r
-}\r
-\r
-static int _ma_dbus_client_list_compare_bus_name(const void *a, const void *b)\r
-{\r
-       const ma_dbus_client_s *client = a;\r
-       return g_strcmp0(client->bus_name, b);\r
-}\r
-\r
-static inline GList* _ma_dbus_client_list_find_client(const gchar *owner)\r
-{\r
-       return g_list_find_custom(ma_dbus_client_list, owner,\r
-                       _ma_dbus_client_list_compare_bus_name);\r
-}\r
-\r
-static void _ma_dbus_name_owner_changed_cb(GDBusConnection *conn,\r
-               const gchar *sender_name,\r
-               const gchar *object_path,\r
-               const gchar *interface_name,\r
-               const gchar *signal_name,\r
-               GVariant *parameters,\r
-               gpointer user_data)\r
-{\r
-       int ret;\r
-       GList *client = NULL;\r
-       gchar *name, *old_owner, *new_owner;\r
-\r
-       NOTUSED(conn);\r
-       NOTUSED(sender_name);\r
-       NOTUSED(object_path);\r
-       NOTUSED(interface_name);\r
-       NOTUSED(signal_name);\r
-       NOTUSED(user_data);\r
-\r
-       g_variant_get(parameters, "(&s&s&s)", &name, &old_owner, &new_owner);\r
-\r
-       if (0 == strlen(new_owner)) {\r
-               g_mutex_lock(&ma_dbus_client_list_mutex);\r
-               client = _ma_dbus_client_list_find_client(old_owner);\r
-               if (client) { /* found bus name in our bus list */\r
-                       MA_LOGD("bus(%s) stopped", old_owner);\r
-                       ma_dbus_client_list = g_list_remove_link(ma_dbus_client_list, client);\r
-               }\r
-               g_mutex_unlock(&ma_dbus_client_list_mutex);\r
-\r
-               if (client) {\r
-                       ret = _ma_dbus_client_list_cleanup(client);\r
-                       if (MA_ERROR_NONE != ret)\r
-                               MA_LOGE("_ma_dbus_client_list_cleanup() Fail(%d)", ret);\r
-               }\r
-       }\r
-}\r
-\r
-static int _ma_dbus_subscribe_name_owner_changed(GDBusConnection *conn)\r
-{\r
-       unsigned int id;\r
-\r
-       id = g_dbus_connection_signal_subscribe(conn,\r
-                       "org.freedesktop.DBus", /* bus name */\r
-                       "org.freedesktop.DBus", /* interface */\r
-                       "NameOwnerChanged", /* member */\r
-                       "/org/freedesktop/DBus", /* path */\r
-                       NULL, /* arg0 */\r
-                       G_DBUS_SIGNAL_FLAGS_NONE,\r
-                       _ma_dbus_name_owner_changed_cb,\r
-                       NULL,\r
-                       NULL);\r
-       if (0 == id) {\r
-               MA_LOGE("g_dbus_connection_signal_subscribe() Fail");\r
-               return MA_ERROR_IO_ERROR;\r
-       }\r
-\r
-       return MA_ERROR_NONE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_get_ownerid(NetMa *object,\r
-               GDBusMethodInvocation *invocation,\r
-               gpointer user_data)\r
-{\r
-       gchar *uuid_str = NULL;\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       ret = ma_request_get_ownerid(service, &uuid_str);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_get_ownerid = %d", ret);\r
-\r
-       net_ma_complete_get_ownerid(object, invocation, uuid_str, ret);\r
-\r
-       if (uuid_str)\r
-               g_free(uuid_str);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_disc_mot_enb_devs(NetMa *object,\r
-               GDBusMethodInvocation *invocation,\r
-               gint timeout,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       ret = ma_request_disc_mot_enb_devs(service, timeout);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_disc_mot_enb_devs !");\r
-\r
-       net_ma_complete_disc_mot_enb_devs(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_disc_mowned_devs(NetMa *object,\r
-               GDBusMethodInvocation *invocation,\r
-               gint timeout,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_disc_owned_devs(service, timeout);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_disc_owned_devs !");\r
-\r
-       net_ma_complete_disc_mowned_devs(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_mot(NetMa *object,\r
-               GDBusMethodInvocation *invocation,  gchar *arg_target, gchar *arg_pin,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_mot(service, arg_target, arg_pin);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_disc_moted_devs !");\r
-\r
-       net_ma_complete_mot(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_acl(NetMa *object,\r
-               GDBusMethodInvocation *invocation, gchar *arg_target, gchar *arg_subject,\r
-               gchar *arg_uri, gchar *arg_rt, gchar *arg_interface, gint arg_permission,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_prov_acl(service, arg_target, arg_subject, arg_uri, arg_rt,\r
-               arg_interface, arg_permission);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_prov_acl !");\r
-\r
-       net_ma_complete_acl(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_cred(NetMa *object,\r
-               GDBusMethodInvocation *invocation, gchar *arg_dev1, gchar *arg_dev2,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_prov_cred(service, arg_dev1, arg_dev2);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_prov_cred !");\r
-\r
-       net_ma_complete_cred(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_pairwise(NetMa *object,\r
-                                         GDBusMethodInvocation *invocation, gchar *target_1,\r
-                                         gchar *subject_1, gchar *uri_1, gchar *rt_1,\r
-                                         gchar *interface_1, int permission_1, gchar *target_2,\r
-                                         gchar *subject_2, gchar *uri_2, gchar *rt_2,\r
-                                         gchar *interface_2, int permission_2, gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_rsrc_pairwise(service, target_1, subject_1, uri_1, rt_1,\r
-                                       interface_1, permission_1, target_2, subject_2, uri_2,\r
-                                       rt_2, interface_2, permission_2);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_pairwise = %d", ret);\r
-\r
-       net_ma_complete_pairwise(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_unlink(NetMa *object,\r
-               GDBusMethodInvocation *invocation, gchar *uuid_dev1, gchar *uuid_dev2,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       ret = ma_request_unlink_rsrc(service, uuid_dev1, uuid_dev2);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_unpair = %d", ret);\r
-\r
-       net_ma_complete_unpair(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_remove_subowner(NetMa *object,\r
-               GDBusMethodInvocation *invocation,  gchar *arg_target, gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_remove_subowner(service, arg_target);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_remove_subowner !");\r
-\r
-       net_ma_complete_remove_subowner(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_remove_device(NetMa *object,\r
-               GDBusMethodInvocation *invocation,  gchar *arg_target, gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_remove_device(service, arg_target);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_remove_subowner !");\r
-\r
-       net_ma_complete_remove_device(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_pair(NetMa *object,\r
-         GDBusMethodInvocation *invocation, gchar *pin,\r
-         gchar *target_1, gchar *subject_1, gchar *uri_1,\r
-         gchar *rt_1, gchar *interface_1, int permission_1,\r
-         gchar *target_2, gchar *subject_2, gchar *uri_2,\r
-         gchar *rt_2, gchar *interface_2, int permission_2,\r
-         gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-\r
-       ret = ma_request_pair(service, pin, target_1, subject_1, uri_1, rt_1,\r
-                                       interface_1, permission_1, target_2, subject_2, uri_2,\r
-                                       rt_2, interface_2, permission_2);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_pair = %d", ret);\r
-\r
-       net_ma_complete_pair(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_unpair(NetMa *object,\r
-               GDBusMethodInvocation *invocation, gchar *uuid_owner, gchar *uuid_owned,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       ret = ma_request_unpair(service, uuid_owner, uuid_owned);\r
-       if (MA_ERROR_NONE != ret)\r
-               MA_LOGE("Failed to ma_request_unpair = %d", ret);\r
-\r
-       net_ma_complete_unpair(object, invocation, ret);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static void _ma_dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name,\r
-               gpointer user_data)\r
-{\r
-       gboolean ret;\r
-       GError *error = NULL;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       NOTUSED(name);\r
-\r
-       ma_dbus_object = net_ma_skeleton_new();\r
-       if (NULL == ma_dbus_object) {\r
-               MA_LOGE("net_ma_skeleton_new() Fail");\r
-               return;\r
-       }\r
-       g_signal_connect(ma_dbus_object, "handle-get-ownerid",\r
-                       G_CALLBACK(_ma_dbus_handle_get_ownerid), service);\r
-       g_signal_connect(ma_dbus_object, "handle-disc-mot-enb-devs",\r
-                       G_CALLBACK(_ma_dbus_handle_disc_mot_enb_devs), service);\r
-       g_signal_connect(ma_dbus_object, "handle-disc-mowned-devs",\r
-                       G_CALLBACK(_ma_dbus_handle_disc_mowned_devs), service);\r
-       g_signal_connect(ma_dbus_object, "handle-mot",\r
-                       G_CALLBACK(_ma_dbus_handle_mot), service);\r
-       g_signal_connect(ma_dbus_object, "handle-pairwise",\r
-                       G_CALLBACK(_ma_dbus_handle_pairwise), service);\r
-       g_signal_connect(ma_dbus_object, "handle-unlink",\r
-                       G_CALLBACK(_ma_dbus_handle_unlink), service);\r
-       g_signal_connect(ma_dbus_object, "handle-remove-subowner",\r
-                       G_CALLBACK(_ma_dbus_handle_remove_subowner), service);\r
-       g_signal_connect(ma_dbus_object, "handle-remove-device",\r
-                       G_CALLBACK(_ma_dbus_handle_remove_device), service);\r
-       g_signal_connect(ma_dbus_object, "handle-acl",\r
-                       G_CALLBACK(_ma_dbus_handle_acl), service);\r
-       g_signal_connect(ma_dbus_object, "handle-cred",\r
-                       G_CALLBACK(_ma_dbus_handle_cred), service);\r
-       g_signal_connect(ma_dbus_object, "handle-pair",\r
-                       G_CALLBACK(_ma_dbus_handle_pair), service);\r
-       g_signal_connect(ma_dbus_object, "handle-unpair",\r
-                       G_CALLBACK(_ma_dbus_handle_unpair), service);\r
-\r
-       ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(ma_dbus_object),\r
-                       conn, MA_DBUS_OBJPATH, &error);\r
-       if (FALSE == ret) {\r
-               MA_LOGE("g_dbus_interface_skeleton_export() Fail(%s)", error->message);\r
-               g_error_free(error);\r
-       }\r
-\r
-       ret = _ma_dbus_subscribe_name_owner_changed(conn);\r
-       if (MA_ERROR_NONE != ret) {\r
-               MA_LOGE("_ma_dbus_subscribe_name_owner_changed() Fail(%d)", ret);\r
-               return;\r
-       }\r
-}\r
-\r
-static void _ma_dbus_on_name_lost(GDBusConnection *conn, const gchar *name,\r
-               gpointer user_data)\r
-{\r
-       NOTUSED(conn);\r
-       NOTUSED(user_data);\r
-\r
-       MA_LOGD("Lost the name %s", name);\r
-}\r
-\r
-static void _ma_dbus_on_name_acquired(GDBusConnection *conn, const gchar *name,\r
-               gpointer user_data)\r
-{\r
-       NOTUSED(conn);\r
-       NOTUSED(user_data);\r
-\r
-       MA_LOGD("Acquired the name %s", name);\r
-}\r
-\r
-static gboolean _ma_dbus_handle_enable(Enabler *object,\r
-               GDBusMethodInvocation *invocation,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       __MA_LOG_FUNC_ENTER__;\r
-\r
-       /* Do API response first */\r
-       enabler_complete_enable(object, invocation, ret);\r
-       service->ma_activated = TRUE;\r
-\r
-       /* Intialize subowner client */\r
-       ret = ma_request_enable(service);\r
-       if (MA_ERROR_NONE != ret) {\r
-               MA_LOGE("ma_request_enable() Fail(%d)", ret);\r
-               return FALSE;\r
-       }\r
-\r
-       /* Notify d2ds enabled */\r
-       net_ma_emit_subowner_enabled(ma_dbus_get_object(), ret);\r
-\r
-       __MA_LOG_FUNC_EXIT__;\r
-\r
-       return TRUE;\r
-}\r
-\r
-static gboolean _ma_dbus_handle_disable(Enabler *object,\r
-               GDBusMethodInvocation *invocation,\r
-               gpointer user_data)\r
-{\r
-       int ret = MA_ERROR_NONE;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       __MA_LOG_FUNC_ENTER__;\r
-\r
-       /* Make response first */\r
-       enabler_complete_disable(object, invocation, ret);\r
-\r
-       /* De-Intialize subowner client */\r
-       ret = ma_request_disable(service);\r
-       if (MA_ERROR_NONE != ret) {\r
-               MA_LOGE("ma_request_disable() Fail(%d)", ret);\r
-               return FALSE;\r
-       }\r
-\r
-       /* Terminate daemon */\r
-       ma_service_exit(service);\r
-\r
-       return TRUE;\r
-}\r
-\r
-static void _ma_dbus_on_activator_bus_acquired(GDBusConnection *conn,\r
-               const gchar *name, gpointer user_data)\r
-{\r
-       gboolean ret;\r
-       GError *error = NULL;\r
-       ma_service *service = (ma_service *)user_data;\r
-\r
-       NOTUSED(name);\r
-\r
-       __MA_LOG_FUNC_ENTER__;\r
-\r
-       ma_activator_dbus_object = enabler_skeleton_new();\r
-       if (NULL == ma_activator_dbus_object) {\r
-               MA_LOGE("enabler_skeleton_new() Fail");\r
-               return;\r
-       }\r
-\r
-       g_signal_connect(ma_activator_dbus_object, "handle-enable",\r
-                       G_CALLBACK(_ma_dbus_handle_enable), service);\r
-       g_signal_connect(ma_activator_dbus_object, "handle-disable",\r
-                       G_CALLBACK(_ma_dbus_handle_disable), service);\r
-\r
-       ret = g_dbus_interface_skeleton_export(\r
-                               G_DBUS_INTERFACE_SKELETON(ma_activator_dbus_object),\r
-                               conn, MA_DBUS_ENABLER_OBJPATH, &error);\r
-       if (FALSE == ret) {\r
-               MA_LOGE("g_dbus_interface_skeleton_export() Fail(%s)", error->message);\r
-               g_error_free(error);\r
-       }\r
-\r
-       __MA_LOG_FUNC_EXIT__;\r
-\r
-}\r
-\r
-static gboolean _ma_dbus_interface_init(ma_service *service)\r
-{\r
-       guint id;\r
-       guint activation_dbus_id;\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       id = g_bus_own_name(G_BUS_TYPE_SYSTEM,\r
-                       MA_DBUS_INTERFACE,\r
-                       G_BUS_NAME_OWNER_FLAGS_REPLACE,\r
-                       _ma_dbus_on_bus_acquired,\r
-                       _ma_dbus_on_name_acquired,\r
-                       _ma_dbus_on_name_lost,\r
-                       service,\r
-                       NULL);\r
-       if (0 == id) {\r
-               MA_LOGE("g_bus_own_name() Fail");\r
-               return FALSE;\r
-       }\r
-\r
-       /* Get D-Bus owner to activate subowner service daemon */\r
-       activation_dbus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,\r
-                       MA_DBUS_INTERFACE".enabler",\r
-                       G_BUS_NAME_OWNER_FLAGS_REPLACE,\r
-                       _ma_dbus_on_activator_bus_acquired,\r
-                       NULL,\r
-                       NULL,\r
-                       service,\r
-                       NULL);\r
-\r
-       service->dbus_id = id;\r
-       service->activation_dbus_id = activation_dbus_id;\r
-\r
-       return TRUE;\r
-}\r
-\r
-void ma_notify_mot_env_devs(GVariant *devices)\r
-{\r
-       /* Notify d2ds enabled */\r
-       net_ma_emit_disc_mot_enb_devs_done(ma_dbus_get_object(), devices);\r
-}\r
-\r
-void ma_notify_mowned_devs(GVariant *devices)\r
-{\r
-       /* Notify d2ds enabled */\r
-       net_ma_emit_disc_mowned_devs_done(ma_dbus_get_object(), devices);\r
-}\r
-\r
-static void _ma_dbus_deinit(ma_service *service)\r
-{\r
-       ma_check_null_ret("service", service);\r
-\r
-       g_bus_unown_name(service->dbus_id);\r
-       g_bus_unown_name(service->activation_dbus_id);\r
-}\r
-\r
-gboolean ma_service_interface_init(ma_service *service)\r
-{\r
-       guint ret;\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-\r
-       __MA_LOG_FUNC_ENTER__;\r
-\r
-       /* Initialize dbus interface */\r
-       ret = _ma_dbus_interface_init(service);\r
-       if (FALSE == ret) {\r
-               MA_LOGE("%s failed!!!", __func__);\r
-               return FALSE;\r
-       }\r
-\r
-       __MA_LOG_FUNC_EXIT__;\r
-\r
-       return TRUE;\r
-}\r
-\r
-void ma_service_interface_deinit(ma_service *service)\r
-{\r
-       ma_check_null_ret("service", service);\r
-\r
-       /* De-initialize dbus interface */\r
-       _ma_dbus_deinit(service);\r
-       /* De-initialize mot-agent instance */\r
-       ma_delete_mot_agent(service);\r
-}\r
-\r
+ */
+#include <glib.h>
+
+#include "ma.h"
+#include "ma-log.h"
+#include "ma-util.h"
+#include "ma-service.h"
+#include "ma-subowner.h"
+#include "ma-service-interface.h"
+#include "ma-generated-code.h"
+
+static NetMa *ma_dbus_object;
+static Enabler *ma_activator_dbus_object;
+
+/* global list to care resource handle for each client */
+static GList *ma_dbus_client_list;
+static GMutex ma_dbus_client_list_mutex;
+
+typedef struct _ma_dbus_client_s {
+       gchar *bus_name;
+} ma_dbus_client_s;
+
+NetMa* ma_dbus_get_object()
+{
+       return ma_dbus_object;
+}
+
+static int _ma_dbus_client_list_cleanup(GList *client_list)
+{
+       ma_dbus_client_s *client;
+
+       ma_check_null_ret_error("client_list", client_list, FALSE);
+
+       client = client_list->data;
+
+       g_free(client->bus_name);
+       client->bus_name = NULL;
+       g_free(client);
+       g_list_free(client_list);
+
+       return MA_ERROR_NONE;
+}
+
+static int _ma_dbus_client_list_compare_bus_name(const void *a, const void *b)
+{
+       const ma_dbus_client_s *client = a;
+       return g_strcmp0(client->bus_name, b);
+}
+
+static inline GList* _ma_dbus_client_list_find_client(const gchar *owner)
+{
+       return g_list_find_custom(ma_dbus_client_list, owner,
+                       _ma_dbus_client_list_compare_bus_name);
+}
+
+static void _ma_dbus_name_owner_changed_cb(GDBusConnection *conn,
+               const gchar *sender_name,
+               const gchar *object_path,
+               const gchar *interface_name,
+               const gchar *signal_name,
+               GVariant *parameters,
+               gpointer user_data)
+{
+       int ret;
+       GList *client = NULL;
+       gchar *name, *old_owner, *new_owner;
+
+       NOTUSED(conn);
+       NOTUSED(sender_name);
+       NOTUSED(object_path);
+       NOTUSED(interface_name);
+       NOTUSED(signal_name);
+       NOTUSED(user_data);
+
+       g_variant_get(parameters, "(&s&s&s)", &name, &old_owner, &new_owner);
+
+       if (0 == strlen(new_owner)) {
+               g_mutex_lock(&ma_dbus_client_list_mutex);
+               client = _ma_dbus_client_list_find_client(old_owner);
+               if (client) { /* found bus name in our bus list */
+                       MA_LOGD("bus(%s) stopped", old_owner);
+                       ma_dbus_client_list = g_list_remove_link(ma_dbus_client_list, client);
+               }
+               g_mutex_unlock(&ma_dbus_client_list_mutex);
+
+               if (client) {
+                       ret = _ma_dbus_client_list_cleanup(client);
+                       if (MA_ERROR_NONE != ret)
+                               MA_LOGE("_ma_dbus_client_list_cleanup() Fail(%d)", ret);
+               }
+       }
+}
+
+static int _ma_dbus_subscribe_name_owner_changed(GDBusConnection *conn)
+{
+       unsigned int id;
+
+       id = g_dbus_connection_signal_subscribe(conn,
+                       "org.freedesktop.DBus", /* bus name */
+                       "org.freedesktop.DBus", /* interface */
+                       "NameOwnerChanged", /* member */
+                       "/org/freedesktop/DBus", /* path */
+                       NULL, /* arg0 */
+                       G_DBUS_SIGNAL_FLAGS_NONE,
+                       _ma_dbus_name_owner_changed_cb,
+                       NULL,
+                       NULL);
+       if (0 == id) {
+               MA_LOGE("g_dbus_connection_signal_subscribe() Fail");
+               return MA_ERROR_IO_ERROR;
+       }
+
+       return MA_ERROR_NONE;
+}
+
+static gboolean _ma_dbus_handle_get_ownerid(NetMa *object,
+               GDBusMethodInvocation *invocation,
+               gpointer user_data)
+{
+       gchar *uuid_str = NULL;
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+       ret = ma_request_get_ownerid(service, &uuid_str);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_get_ownerid = %d", ret);
+
+       net_ma_complete_get_ownerid(object, invocation, uuid_str, ret);
+
+       if (uuid_str)
+               g_free(uuid_str);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_disc_mot_enb_devs(NetMa *object,
+               GDBusMethodInvocation *invocation,
+               gint timeout,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+       ret = ma_request_disc_mot_enb_devs(service, timeout);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_disc_mot_enb_devs !");
+
+       net_ma_complete_disc_mot_enb_devs(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_disc_mowned_devs(NetMa *object,
+               GDBusMethodInvocation *invocation,
+               gint timeout,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_disc_owned_devs(service, timeout);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_disc_owned_devs !");
+
+       net_ma_complete_disc_mowned_devs(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_mot(NetMa *object,
+               GDBusMethodInvocation *invocation,  gchar *arg_target, gchar *arg_pin,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_mot(service, arg_target, arg_pin);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_disc_moted_devs !");
+
+       net_ma_complete_mot(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_acl(NetMa *object,
+               GDBusMethodInvocation *invocation, gchar *arg_target, gchar *arg_subject,
+               gchar *arg_uri, gchar *arg_rt, gchar *arg_interface, gint arg_permission,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_prov_acl(service, arg_target, arg_subject, arg_uri, arg_rt,
+               arg_interface, arg_permission);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_prov_acl !");
+
+       net_ma_complete_acl(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_cred(NetMa *object,
+               GDBusMethodInvocation *invocation, gchar *arg_dev1, gchar *arg_dev2,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_prov_cred(service, arg_dev1, arg_dev2);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_prov_cred !");
+
+       net_ma_complete_cred(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_pairwise(NetMa *object,
+                                         GDBusMethodInvocation *invocation, gchar *target_1,
+                                         gchar *subject_1, gchar *uri_1, gchar *rt_1,
+                                         gchar *interface_1, int permission_1, gchar *target_2,
+                                         gchar *subject_2, gchar *uri_2, gchar *rt_2,
+                                         gchar *interface_2, int permission_2, gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_rsrc_pairwise(service, target_1, subject_1, uri_1, rt_1,
+                                       interface_1, permission_1, target_2, subject_2, uri_2,
+                                       rt_2, interface_2, permission_2);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_pairwise = %d", ret);
+
+       net_ma_complete_pairwise(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_unlink(NetMa *object,
+               GDBusMethodInvocation *invocation, gchar *uuid_dev1, gchar *uuid_dev2,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+       ret = ma_request_unlink_rsrc(service, uuid_dev1, uuid_dev2);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_unpair = %d", ret);
+
+       net_ma_complete_unpair(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_remove_subowner(NetMa *object,
+               GDBusMethodInvocation *invocation,  gchar *arg_target, gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_remove_subowner(service, arg_target);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_remove_subowner !");
+
+       net_ma_complete_remove_subowner(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_remove_device(NetMa *object,
+               GDBusMethodInvocation *invocation,  gchar *arg_target, gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_remove_device(service, arg_target);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_remove_subowner !");
+
+       net_ma_complete_remove_device(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_pair(NetMa *object,
+         GDBusMethodInvocation *invocation, gchar *pin,
+         gchar *target_1, gchar *subject_1, gchar *uri_1,
+         gchar *rt_1, gchar *interface_1, int permission_1,
+         gchar *target_2, gchar *subject_2, gchar *uri_2,
+         gchar *rt_2, gchar *interface_2, int permission_2,
+         gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+
+       ret = ma_request_pair(service, pin, target_1, subject_1, uri_1, rt_1,
+                                       interface_1, permission_1, target_2, subject_2, uri_2,
+                                       rt_2, interface_2, permission_2);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_pair = %d", ret);
+
+       net_ma_complete_pair(object, invocation, ret);
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_unpair(NetMa *object,
+               GDBusMethodInvocation *invocation, gchar *uuid_owner, gchar *uuid_owned,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       ma_check_null_ret_error("service", service, FALSE);
+
+       ret = ma_request_unpair(service, uuid_owner, uuid_owned);
+       if (MA_ERROR_NONE != ret)
+               MA_LOGE("Failed to ma_request_unpair = %d", ret);
+
+       net_ma_complete_unpair(object, invocation, ret);
+
+       return TRUE;
+}
+
+static void _ma_dbus_on_bus_acquired(GDBusConnection *conn, const gchar *name,
+               gpointer user_data)
+{
+       gboolean ret;
+       GError *error = NULL;
+       ma_service *service = (ma_service *)user_data;
+
+       NOTUSED(name);
+
+       ma_dbus_object = net_ma_skeleton_new();
+       if (NULL == ma_dbus_object) {
+               MA_LOGE("net_ma_skeleton_new() Fail");
+               return;
+       }
+       g_signal_connect(ma_dbus_object, "handle-get-ownerid",
+                       G_CALLBACK(_ma_dbus_handle_get_ownerid), service);
+       g_signal_connect(ma_dbus_object, "handle-disc-mot-enb-devs",
+                       G_CALLBACK(_ma_dbus_handle_disc_mot_enb_devs), service);
+       g_signal_connect(ma_dbus_object, "handle-disc-mowned-devs",
+                       G_CALLBACK(_ma_dbus_handle_disc_mowned_devs), service);
+       g_signal_connect(ma_dbus_object, "handle-mot",
+                       G_CALLBACK(_ma_dbus_handle_mot), service);
+       g_signal_connect(ma_dbus_object, "handle-pairwise",
+                       G_CALLBACK(_ma_dbus_handle_pairwise), service);
+       g_signal_connect(ma_dbus_object, "handle-unlink",
+                       G_CALLBACK(_ma_dbus_handle_unlink), service);
+       g_signal_connect(ma_dbus_object, "handle-remove-subowner",
+                       G_CALLBACK(_ma_dbus_handle_remove_subowner), service);
+       g_signal_connect(ma_dbus_object, "handle-remove-device",
+                       G_CALLBACK(_ma_dbus_handle_remove_device), service);
+       g_signal_connect(ma_dbus_object, "handle-acl",
+                       G_CALLBACK(_ma_dbus_handle_acl), service);
+       g_signal_connect(ma_dbus_object, "handle-cred",
+                       G_CALLBACK(_ma_dbus_handle_cred), service);
+       g_signal_connect(ma_dbus_object, "handle-pair",
+                       G_CALLBACK(_ma_dbus_handle_pair), service);
+       g_signal_connect(ma_dbus_object, "handle-unpair",
+                       G_CALLBACK(_ma_dbus_handle_unpair), service);
+
+       ret = g_dbus_interface_skeleton_export(G_DBUS_INTERFACE_SKELETON(ma_dbus_object),
+                       conn, MA_DBUS_OBJPATH, &error);
+       if (FALSE == ret) {
+               MA_LOGE("g_dbus_interface_skeleton_export() Fail(%s)", error->message);
+               g_error_free(error);
+       }
+
+       ret = _ma_dbus_subscribe_name_owner_changed(conn);
+       if (MA_ERROR_NONE != ret) {
+               MA_LOGE("_ma_dbus_subscribe_name_owner_changed() Fail(%d)", ret);
+               return;
+       }
+}
+
+static void _ma_dbus_on_name_lost(GDBusConnection *conn, const gchar *name,
+               gpointer user_data)
+{
+       NOTUSED(conn);
+       NOTUSED(user_data);
+
+       MA_LOGD("Lost the name %s", name);
+}
+
+static void _ma_dbus_on_name_acquired(GDBusConnection *conn, const gchar *name,
+               gpointer user_data)
+{
+       NOTUSED(conn);
+       NOTUSED(user_data);
+
+       MA_LOGD("Acquired the name %s", name);
+}
+
+static gboolean _ma_dbus_handle_enable(Enabler *object,
+               GDBusMethodInvocation *invocation,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       __MA_LOG_FUNC_ENTER__;
+
+       /* Do API response first */
+       enabler_complete_enable(object, invocation, ret);
+       service->ma_activated = TRUE;
+
+       /* Intialize subowner client */
+       ret = ma_request_enable(service);
+       if (MA_ERROR_NONE != ret) {
+               MA_LOGE("ma_request_enable() Fail(%d)", ret);
+               return FALSE;
+       }
+
+       /* Notify d2ds enabled */
+       net_ma_emit_subowner_enabled(ma_dbus_get_object(), ret);
+
+       __MA_LOG_FUNC_EXIT__;
+
+       return TRUE;
+}
+
+static gboolean _ma_dbus_handle_disable(Enabler *object,
+               GDBusMethodInvocation *invocation,
+               gpointer user_data)
+{
+       int ret = MA_ERROR_NONE;
+       ma_service *service = (ma_service *)user_data;
+
+       __MA_LOG_FUNC_ENTER__;
+
+       /* Make response first */
+       enabler_complete_disable(object, invocation, ret);
+
+       /* De-Intialize subowner client */
+       ret = ma_request_disable(service);
+       if (MA_ERROR_NONE != ret) {
+               MA_LOGE("ma_request_disable() Fail(%d)", ret);
+               return FALSE;
+       }
+
+       /* Terminate daemon */
+       ma_service_exit(service);
+
+       return TRUE;
+}
+
+static void _ma_dbus_on_activator_bus_acquired(GDBusConnection *conn,
+               const gchar *name, gpointer user_data)
+{
+       gboolean ret;
+       GError *error = NULL;
+       ma_service *service = (ma_service *)user_data;
+
+       NOTUSED(name);
+
+       __MA_LOG_FUNC_ENTER__;
+
+       ma_activator_dbus_object = enabler_skeleton_new();
+       if (NULL == ma_activator_dbus_object) {
+               MA_LOGE("enabler_skeleton_new() Fail");
+               return;
+       }
+
+       g_signal_connect(ma_activator_dbus_object, "handle-enable",
+                       G_CALLBACK(_ma_dbus_handle_enable), service);
+       g_signal_connect(ma_activator_dbus_object, "handle-disable",
+                       G_CALLBACK(_ma_dbus_handle_disable), service);
+
+       ret = g_dbus_interface_skeleton_export(
+                               G_DBUS_INTERFACE_SKELETON(ma_activator_dbus_object),
+                               conn, MA_DBUS_ENABLER_OBJPATH, &error);
+       if (FALSE == ret) {
+               MA_LOGE("g_dbus_interface_skeleton_export() Fail(%s)", error->message);
+               g_error_free(error);
+       }
+
+       __MA_LOG_FUNC_EXIT__;
+
+}
+
+static gboolean _ma_dbus_interface_init(ma_service *service)
+{
+       guint id;
+       guint activation_dbus_id;
+       ma_check_null_ret_error("service", service, FALSE);
+
+       id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                       MA_DBUS_INTERFACE,
+                       G_BUS_NAME_OWNER_FLAGS_REPLACE,
+                       _ma_dbus_on_bus_acquired,
+                       _ma_dbus_on_name_acquired,
+                       _ma_dbus_on_name_lost,
+                       service,
+                       NULL);
+       if (0 == id) {
+               MA_LOGE("g_bus_own_name() Fail");
+               return FALSE;
+       }
+
+       /* Get D-Bus owner to activate subowner service daemon */
+       activation_dbus_id = g_bus_own_name(G_BUS_TYPE_SYSTEM,
+                       MA_DBUS_INTERFACE".enabler",
+                       G_BUS_NAME_OWNER_FLAGS_REPLACE,
+                       _ma_dbus_on_activator_bus_acquired,
+                       NULL,
+                       NULL,
+                       service,
+                       NULL);
+
+       service->dbus_id = id;
+       service->activation_dbus_id = activation_dbus_id;
+
+       return TRUE;
+}
+
+void ma_notify_mot_env_devs(GVariant *devices)
+{
+       /* Notify d2ds enabled */
+       net_ma_emit_disc_mot_enb_devs_done(ma_dbus_get_object(), devices);
+}
+
+void ma_notify_mowned_devs(GVariant *devices)
+{
+       /* Notify d2ds enabled */
+       net_ma_emit_disc_mowned_devs_done(ma_dbus_get_object(), devices);
+}
+
+static void _ma_dbus_deinit(ma_service *service)
+{
+       ma_check_null_ret("service", service);
+
+       g_bus_unown_name(service->dbus_id);
+       g_bus_unown_name(service->activation_dbus_id);
+}
+
+gboolean ma_service_interface_init(ma_service *service)
+{
+       guint ret;
+       ma_check_null_ret_error("service", service, FALSE);
+
+       __MA_LOG_FUNC_ENTER__;
+
+       /* Initialize dbus interface */
+       ret = _ma_dbus_interface_init(service);
+       if (FALSE == ret) {
+               MA_LOGE("%s failed!!!", __func__);
+               return FALSE;
+       }
+
+       __MA_LOG_FUNC_EXIT__;
+
+       return TRUE;
+}
+
+void ma_service_interface_deinit(ma_service *service)
+{
+       ma_check_null_ret("service", service);
+
+       /* De-initialize dbus interface */
+       _ma_dbus_deinit(service);
+       /* De-initialize mot-agent instance */
+       ma_delete_mot_agent(service);
+}
+
index 79b332ce407893913287f94c124f062ec3280d6f..69decf3876cecd41e39f891cd35d4043c5a7a7cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-\r
-#ifndef __MA_SERVICE_INTERFACE_H__\r
-#define __MA_SERVICE_INTERFACE_H__\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-/**< Mesh D-BUS service*/\r
-#define MA_DBUS_SERVICE "net.ma"\r
-\r
-/**< Mesh D-BUS service path */\r
-#define MA_DBUS_PATH "/net/ma"\r
-\r
-#ifndef MA_DBUS_INTERFACE\r
-#define MA_DBUS_INTERFACE "net.ma"\r
-#endif\r
-\r
-#ifndef MA_DBUS_OBJPATH\r
-#define MA_DBUS_OBJPATH "/net/ma"\r
-#endif\r
-\r
-#ifndef MA_DBUS_ENABLER_OBJPATH\r
-#define MA_DBUS_ENABLER_OBJPATH "/net/ma/enabler"\r
-#endif\r
-\r
-struct _NetMa;\r
-typedef struct _NetMa NetMa;\r
-\r
-NetMa* ma_dbus_get_object();\r
-gboolean ma_service_interface_init(ma_service *service);\r
-void ma_service_interface_deinit(ma_service *service);\r
-void ma_notify_mot_env_devs(GVariant *devices);\r
-void ma_notify_mowned_devs(GVariant *devices);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __MA_SERVICE_INTERFACE_H__ */\r
-\r
+ */
+
+#ifndef __MA_SERVICE_INTERFACE_H__
+#define __MA_SERVICE_INTERFACE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/**< Mesh D-BUS service*/
+#define MA_DBUS_SERVICE "net.ma"
+
+/**< Mesh D-BUS service path */
+#define MA_DBUS_PATH "/net/ma"
+
+#ifndef MA_DBUS_INTERFACE
+#define MA_DBUS_INTERFACE "net.ma"
+#endif
+
+#ifndef MA_DBUS_OBJPATH
+#define MA_DBUS_OBJPATH "/net/ma"
+#endif
+
+#ifndef MA_DBUS_ENABLER_OBJPATH
+#define MA_DBUS_ENABLER_OBJPATH "/net/ma/enabler"
+#endif
+
+struct _NetMa;
+typedef struct _NetMa NetMa;
+
+NetMa* ma_dbus_get_object();
+gboolean ma_service_interface_init(ma_service *service);
+void ma_service_interface_deinit(ma_service *service);
+void ma_notify_mot_env_devs(GVariant *devices);
+void ma_notify_mowned_devs(GVariant *devices);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MA_SERVICE_INTERFACE_H__ */
+
index 749fe387f3453f29444a7f0dee893022615b016d..7b252c23dd1fd9fb95c06042fd216c6fe2562e90 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-#include <glib.h>\r
-\r
-#include "ma.h"\r
-#include "ma-log.h"\r
-#include "ma-util.h"\r
-\r
-ma_service *ma_service_new()\r
-{\r
-       ma_service *service;\r
-\r
-       service = g_malloc0(sizeof(struct _ma_service));\r
-\r
-       /* Create g-main loop */\r
-       service->main_loop = g_main_loop_new(NULL, FALSE);\r
-       if (G_UNLIKELY(NULL == service->main_loop)) {\r
-               MA_LOGE("g-main loop creation failed!!!");\r
-               g_free(service);\r
-               return NULL;\r
-       }\r
-\r
-       return service;\r
-}\r
-\r
-void ma_service_free(ma_service *service)\r
-{\r
-       ma_check_null_ret("service", service);\r
-\r
-       /* Unref 'g-main loop' */\r
-       if (service->main_loop)\r
-               g_main_loop_unref(service->main_loop);\r
-\r
-       g_free(service);\r
-}\r
-\r
-gboolean ma_service_run(ma_service *service)\r
-{\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-       ma_check_null_ret_error("service->main_loop", service->main_loop, FALSE);\r
-\r
-       g_main_loop_run(service->main_loop);\r
-\r
-       return TRUE;\r
-}\r
-\r
-gboolean ma_service_exit(ma_service *service)\r
-{\r
-       ma_check_null_ret_error("service", service, FALSE);\r
-       ma_check_null_ret_error("service->main_loop", service->main_loop, FALSE);\r
-\r
-       g_main_loop_quit(service->main_loop);\r
-\r
-       return TRUE;\r
-}\r
+ */
+#include <glib.h>
+
+#include "ma.h"
+#include "ma-log.h"
+#include "ma-util.h"
+
+ma_service *ma_service_new()
+{
+       ma_service *service;
+
+       service = g_malloc0(sizeof(struct _ma_service));
+
+       /* Create g-main loop */
+       service->main_loop = g_main_loop_new(NULL, FALSE);
+       if (G_UNLIKELY(NULL == service->main_loop)) {
+               MA_LOGE("g-main loop creation failed!!!");
+               g_free(service);
+               return NULL;
+       }
+
+       return service;
+}
+
+void ma_service_free(ma_service *service)
+{
+       ma_check_null_ret("service", service);
+
+       /* Unref 'g-main loop' */
+       if (service->main_loop)
+               g_main_loop_unref(service->main_loop);
+
+       g_free(service);
+}
+
+gboolean ma_service_run(ma_service *service)
+{
+       ma_check_null_ret_error("service", service, FALSE);
+       ma_check_null_ret_error("service->main_loop", service->main_loop, FALSE);
+
+       g_main_loop_run(service->main_loop);
+
+       return TRUE;
+}
+
+gboolean ma_service_exit(ma_service *service)
+{
+       ma_check_null_ret_error("service", service, FALSE);
+       ma_check_null_ret_error("service->main_loop", service->main_loop, FALSE);
+
+       g_main_loop_quit(service->main_loop);
+
+       return TRUE;
+}
index 172b04ceae00ba6bfd6616f43ef1f5b27d6f4842..fc6fe4ef2c6c72a1c8c29592f245b88328c5f4f0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-\r
-#ifndef __MA_SERVICE_H__\r
-#define __MA_SERVICE_H__\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-ma_service* ma_service_new();\r
-void ma_service_free(ma_service *service);\r
-gboolean ma_service_run(ma_service *service);\r
-gboolean ma_service_exit(ma_service *service);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-\r
-#endif /* __MA_SERVICE_H__ */\r
-\r
+ */
+
+#ifndef __MA_SERVICE_H__
+#define __MA_SERVICE_H__
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+ma_service* ma_service_new();
+void ma_service_free(ma_service *service);
+gboolean ma_service_run(ma_service *service);
+gboolean ma_service_exit(ma_service *service);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* __MA_SERVICE_H__ */
+
index 097334a279f67c9e9b161a2c63ace9f60a9dcd72..8c2731d7b4b7aeb7b1f43f4cb69c709b98e26663 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 60692788fb30c44207d7db5bfbf2a16c2473bd8c..e3415077554961290a71fcf71bf626acf00b7f46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 48137488e3ed60f875a81965e14472ee1d7b2722..7ace0385f7229127554c8da9a9efa8460a28c870 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index c8de9ef74ac49bb07bffe57e2774c4a6d3ad93ae..6a0af3190225727d538b02298ddfbf838bfec133 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index d55f026e96c4dbd8bf5cc08b8349b5ef49ad4f92..fcd6b41e598ac5171a49e65a6ec2461de1e103aa 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
index 94cd320981c43639eeaabd57343b22b9705d880f..7d5cdb99c935ef63561fa69e83978f7a6cc18522 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 Samsung Electronics Co., Ltd. All rights reserved.
+ * Copyright (c) 2018 Samsung Electronics Co., Ltd. All rights reserved.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * See the License for the specific language governing permissions and
  * limitations under the License.
  *
- */\r
-#ifndef __MA_AGENT_H__\r
-#define __MA_AGENT_H__\r
-\r
-#include <glib.h>\r
-#include <gio/gio.h>\r
-#include <tizen.h>\r
-\r
-/**< Internal error code with d2ds daemon. It should be matched with API side */\r
-typedef enum {\r
-       MA_ERROR_NONE = 0, /**< Successful */\r
-       MA_ERROR_IO_ERROR, /**< I/O error */\r
-       MA_ERROR_NO_DATA, /**< Data not exists */\r
-       MA_ERROR_OUT_OF_MEMORY, /**< out of memory */\r
-       MA_ERROR_OPERATION_FAILED, /**< operation failed */\r
-       MA_ERROR_INVALID_PARAMETER, /**< Invalid parameter */\r
-       MA_ERROR_ALREADY_REGISTERED, /**< Request already registered */\r
-       MA_ERROR_IN_PROGRESS /**< operation is in progress */\r
-} ma_error_e;\r
-\r
-/**< d2d-subowner service structure */\r
-typedef struct _ma_service {\r
-       GMainLoop *main_loop; /**< Service main-loop */\r
-       guint dbus_id; /**< D-Bus id */\r
-       guint activation_dbus_id; /**< D-Bus id for activation */\r
-       gpointer connection; /**< Connection handle for D-Bus call to other process */\r
-       GCancellable *ca; /**< Cancellable object for D-Bus call (Daemon->other) */\r
-       GList *dbus_sub_ids; /**< The list of subscribed signals */\r
-       gboolean ma_activated; /**< Whether d2d-manager enabled or not */\r
-} ma_service;\r
-\r
-#endif /* __MA_AGENT_H__ */\r
-\r
+ */
+#ifndef __MA_AGENT_H__
+#define __MA_AGENT_H__
+
+#include <glib.h>
+#include <gio/gio.h>
+#include <tizen.h>
+
+/**< Internal error code with d2ds daemon. It should be matched with API side */
+typedef enum {
+       MA_ERROR_NONE = 0, /**< Successful */
+       MA_ERROR_IO_ERROR, /**< I/O error */
+       MA_ERROR_NO_DATA, /**< Data not exists */
+       MA_ERROR_OUT_OF_MEMORY, /**< out of memory */
+       MA_ERROR_OPERATION_FAILED, /**< operation failed */
+       MA_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
+       MA_ERROR_ALREADY_REGISTERED, /**< Request already registered */
+       MA_ERROR_IN_PROGRESS /**< operation is in progress */
+} ma_error_e;
+
+/**< d2d-subowner service structure */
+typedef struct _ma_service {
+       GMainLoop *main_loop; /**< Service main-loop */
+       guint dbus_id; /**< D-Bus id */
+       guint activation_dbus_id; /**< D-Bus id for activation */
+       gpointer connection; /**< Connection handle for D-Bus call to other process */
+       GCancellable *ca; /**< Cancellable object for D-Bus call (Daemon->other) */
+       GList *dbus_sub_ids; /**< The list of subscribed signals */
+       gboolean ma_activated; /**< Whether d2d-manager enabled or not */
+} ma_service;
+
+#endif /* __MA_AGENT_H__ */
+