agent_lib IPC was refactored to use klay.
authorLomtev Dmytro <d.lomtev@samsung.com>
Wed, 1 Nov 2017 09:50:29 +0000 (11:50 +0200)
committerLomtev Dmytro <d.lomtev@samsung.com>
Wed, 1 Nov 2017 10:00:21 +0000 (12:00 +0200)
55 files changed:
device_core/CMakeLists.txt
device_core/agent_lib/CMakeLists.txt
device_core/agent_lib/inc/agentpolicyadapter.h
device_core/agent_lib/inc/iagentpolicy.h
device_core/agent_lib/src/agentpolicyadapter.cpp
device_core/agent_lib/src/iagentpolicy.cpp
device_core/nmdaemon/CMakeLists.txt
device_core/nmdaemon/agentpolicyservice.cpp
device_core/nmdaemon/agentpolicyservice.h
device_core/nmdaemon/main_thread.cpp
device_core/nmdaemon/report_service.cpp
device_core/nmdaemon/report_service.h
device_core/packaging/ioswsec.spec
device_core/scripts/bin_copy.sh
device_core/ubuntu-klay/CMakeLists.txt [moved from device_core/agent_lib/rmi/CMakeLists.txt with 87% similarity]
device_core/ubuntu-klay/klay/array.h [moved from device_core/agent_lib/rmi/inc/array.h with 100% similarity]
device_core/ubuntu-klay/klay/data-type.h [moved from device_core/agent_lib/rmi/inc/data-type.h with 100% similarity]
device_core/ubuntu-klay/klay/error.h [moved from device_core/agent_lib/rmi/inc/error.h with 100% similarity]
device_core/ubuntu-klay/klay/eventfd.h [moved from device_core/agent_lib/rmi/inc/eventfd.h with 100% similarity]
device_core/ubuntu-klay/klay/exception.h [moved from device_core/agent_lib/rmi/inc/exception.h with 100% similarity]
device_core/ubuntu-klay/klay/file-descriptor.h [moved from device_core/agent_lib/rmi/inc/file-descriptor.h with 100% similarity]
device_core/ubuntu-klay/klay/filesystem.h [moved from device_core/agent_lib/rmi/inc/filesystem.h with 100% similarity]
device_core/ubuntu-klay/klay/mainloop.h [moved from device_core/agent_lib/rmi/inc/mainloop.h with 100% similarity]
device_core/ubuntu-klay/klay/object-latch.h [moved from device_core/agent_lib/rmi/inc/object-latch.h with 100% similarity]
device_core/ubuntu-klay/klay/pam.h [moved from device_core/agent_lib/rmi/inc/pam.h with 100% similarity]
device_core/ubuntu-klay/klay/preprocessor.h [moved from device_core/agent_lib/rmi/inc/preprocessor.h with 100% similarity]
device_core/ubuntu-klay/klay/process.h [moved from device_core/agent_lib/rmi/inc/process.h with 100% similarity]
device_core/ubuntu-klay/klay/reflection.h [moved from device_core/agent_lib/rmi/inc/reflection.h with 100% similarity]
device_core/ubuntu-klay/klay/rmi/callback-holder.h [moved from device_core/agent_lib/rmi/inc/rmi/callback-holder.h with 100% similarity]
device_core/ubuntu-klay/klay/rmi/client.h [moved from device_core/agent_lib/rmi/inc/rmi/client.h with 99% similarity]
device_core/ubuntu-klay/klay/rmi/connection.h [moved from device_core/agent_lib/rmi/inc/rmi/connection.h with 98% similarity]
device_core/ubuntu-klay/klay/rmi/message-composer.h [moved from device_core/agent_lib/rmi/inc/rmi/message-composer.h with 100% similarity]
device_core/ubuntu-klay/klay/rmi/message.h [moved from device_core/agent_lib/rmi/inc/rmi/message.h with 98% similarity]
device_core/ubuntu-klay/klay/rmi/notification.h [moved from device_core/agent_lib/rmi/inc/rmi/notification.h with 100% similarity]
device_core/ubuntu-klay/klay/rmi/service.h [moved from device_core/agent_lib/rmi/inc/rmi/service.h with 94% similarity]
device_core/ubuntu-klay/klay/rmi/socket.h [moved from device_core/agent_lib/rmi/inc/rmi/socket.h with 98% similarity]
device_core/ubuntu-klay/klay/serialize.h [moved from device_core/agent_lib/rmi/inc/serialize.h with 100% similarity]
device_core/ubuntu-klay/klay/smack.h [moved from device_core/agent_lib/rmi/inc/smack.h with 100% similarity]
device_core/ubuntu-klay/klay/thread-pool.h [moved from device_core/agent_lib/rmi/inc/thread-pool.h with 100% similarity]
device_core/ubuntu-klay/src/error.cpp [moved from device_core/agent_lib/rmi/src/error.cpp with 100% similarity]
device_core/ubuntu-klay/src/eventfd.cpp [moved from device_core/agent_lib/rmi/src/eventfd.cpp with 100% similarity]
device_core/ubuntu-klay/src/filesystem.cpp [moved from device_core/agent_lib/rmi/src/filesystem.cpp with 100% similarity]
device_core/ubuntu-klay/src/mainloop.cpp [moved from device_core/agent_lib/rmi/src/mainloop.cpp with 100% similarity]
device_core/ubuntu-klay/src/process.cpp [moved from device_core/agent_lib/rmi/src/process.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/client.cpp [moved from device_core/agent_lib/rmi/src/rmi/client.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/connection.cpp [moved from device_core/agent_lib/rmi/src/rmi/connection.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/message-composer.cpp [moved from device_core/agent_lib/rmi/src/rmi/message-composer.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/message.cpp [moved from device_core/agent_lib/rmi/src/rmi/message.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/notification.cpp [moved from device_core/agent_lib/rmi/src/rmi/notification.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/service.cpp [moved from device_core/agent_lib/rmi/src/rmi/service.cpp with 100% similarity]
device_core/ubuntu-klay/src/rmi/socket.cpp [moved from device_core/agent_lib/rmi/src/rmi/socket.cpp with 100% similarity]
device_core/ubuntu-klay/src/thread-pool.cpp [moved from device_core/agent_lib/rmi/src/thread-pool.cpp with 100% similarity]
device_core/utest/CMakeLists.txt
device_core/utest/test_report_service.cpp
device_core/utest/test_rmi.cpp

index 2be0faf..f455a76 100644 (file)
@@ -5,7 +5,7 @@ SET (CTRL_APP_LIB ${PROJECT_ROOT}/ctrl_app_lib)
 SET (CTRL_APP_LIB_PROJECT_NAME nmlib)
 SET (IOTIVITY_LIB_PROJECT_NAME iotivity)
 SET (AGENT_LIB_PROJECT_NAME agent_policy)
-SET (RMI_PROJECT_NAME rmi)
+SET (RMI_PROJECT_NAME ubuntu-klay)
 
 IF(NOT CMAKE_BUILD_TYPE)
        SET(CMAKE_BUILD_TYPE "DEBUG")
@@ -112,6 +112,7 @@ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_CFLAGS} -std=c++11")
 
 if("${FLAVOR}" STREQUAL "UBUNTU")
        add_definitions(-D__BUILD_UBUNTU__)
+       add_subdirectory(ubuntu-klay)
 endif()
 
 add_subdirectory(agent_lib)
@@ -132,7 +133,7 @@ if(${LCOV} STREQUAL "LCOV-NOTFOUND")
     message(STATUS "LCOV not found, using GCOVR")
     add_custom_target(coverage
                   COMMAND mkdir -p ${COV_FOLDER}
-                  COMMAND ../scripts/gcovr -r ../ --html --html-details -o ${COV_FOLDER}/report.html -eutest.* -eagent_lib/rmi.* -s -e.*main.cpp
+                                 COMMAND ../scripts/gcovr -r ../ --html --html-details -o ${COV_FOLDER}/report.html -eutest.* -emock.* -eubuntu-klay.* -s -e.*main.cpp
                   COMMAND echo "Coverage calculated."
                   COMMENT "Coverage stat with GCOVR.\n")
 else()
@@ -140,7 +141,7 @@ else()
     add_custom_target(coverage
                   COMMAND mkdir -p ${COV_FOLDER}
                   COMMAND lcov -t "result" -o ${COV_FOLDER}/utest.info -c -d .. --rc lcov_branch_coverage=1 -q
-                  COMMAND lcov --remove ${COV_FOLDER}/utest.info '*utest/*' '$ENV{IOTIVITY_HOME}/*' '*agent_lib/rmi*' '/usr/include/*' '*iotivity/*' '*main.cpp' --rc lcov_branch_coverage=1 -o ${COV_FOLDER}/utest_filtered.info -q
+                                 COMMAND lcov --remove ${COV_FOLDER}/utest.info '*utest/*' '$ENV{IOTIVITY_HOME}/*' '*mock/*' '*ubuntu-klay/*' '/usr/include/*' '*iotivity/*' '*main.cpp' --rc lcov_branch_coverage=1 -o ${COV_FOLDER}/utest_filtered.info -q
                   COMMAND genhtml -o ${COV_FOLDER} ${COV_FOLDER}/utest_filtered.info
                   COMMAND echo "Coverage calculated."
                   COMMENT "Coverage stat with LCOV.\n")
index 4abdc75..a9462da 100644 (file)
@@ -1,21 +1,31 @@
 project(${AGENT_LIB_PROJECT_NAME})
 
-add_subdirectory(${RMI_PROJECT_NAME})
+if ("${FLAVOR}" STREQUAL "UBUNTU")
+       include_directories (../ubuntu-klay)
+else ()
+       pkg_check_modules(pkgs REQUIRED klay)
 
-include_directories (
-       inc
-       rmi/inc
-)
+       FOREACH(flag ${pkgs_CFLAGS})
+               SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
+       ENDFOREACH(flag)
+endif ()
+
+include_directories (inc)
 
 FILE(GLOB SRCS src/*.cpp)
 
 add_library (${PROJECT_NAME} SHARED ${SRCS})
 
-target_link_libraries(${PROJECT_NAME} ${RMI_PROJECT_NAME})
+if ("${FLAVOR}" STREQUAL "UBUNTU")
+       add_dependencies(${PROJECT_NAME} ${RMI_PROJECT_NAME})
+       target_link_libraries(${PROJECT_NAME} ${RMI_PROJECT_NAME})
+else ()
+       target_link_libraries(${PROJECT_NAME} klay)
+endif ()
+
 install(TARGETS ${PROJECT_NAME} DESTINATION ${LIBDIR})
 install(FILES inc/agentpolicyadapter.h DESTINATION ${LIB_INCLUDE_DIR})
 install(FILES inc/iagentpolicy.h DESTINATION ${LIB_INCLUDE_DIR})
-#install(FILES tests.manifest DESTINATION ${MANIFESTDIR})
 
 message(STATUS "Configuring: " ${PROJECT_NAME})
 message(STATUS "CMAKE_CXX_FLAGS: " ${CMAKE_CXX_FLAGS})
index f6fb82c..ec5d5b7 100644 (file)
 
 #include <string>
 #include <memory>
+#include <klay/rmi/client.h>
 #include "iagentpolicy.h"
 
-namespace rmi
-{
-class Client;
-}
-
 class AgentPolicyAdapter: public IAgentPolicy
 {
 public:
index 3e42d29..d2ad40a 100644 (file)
@@ -44,12 +44,12 @@ public:
     /**
      * @brief RMI_ADDRESS is path to file. Contact point of adapter and service on a filesystem.
      */
-    static const std::string RMI_ADDRESS;
+    const std::string RMI_ADDRESS{"/tmp/.rmi_agent_policy"};
 
     /**
      * @brief RMI_SERVICE_NAME is default name of service class. Adapter implementation use it call service
      */
-    static const std::string RMI_SERVICE_NAME;
+    const std::string RMI_SERVICE_NAME{"AgentPolicyService"};
 };
 
 #endif // IAGENTPOLICY_H
index 25e41db..7fd5d29 100644 (file)
@@ -8,7 +8,6 @@
  * @author Mail to: <A HREF="mailto:a.gudz@samsung.com">Andriy Gudz, a.gudz@samsung.com</A>
  */
 #include "agentpolicyadapter.h"
-#include "rmi/client.h"
 
 #include <stdexcept>
 
index 8e03029..73136f1 100644 (file)
@@ -11,5 +11,5 @@
 #include "iagentpolicy.h"
 
 // TODO change not to temp dir
-const std::string IAgentPolicy::RMI_ADDRESS = "/tmp/.rmi_agent_policy";
-const std::string IAgentPolicy::RMI_SERVICE_NAME = "AgentPolicyService";
+//const std::string IAgentPolicy::RMI_ADDRESS = "/tmp/.rmi_agent_policy";
+//const std::string IAgentPolicy::RMI_SERVICE_NAME = "AgentPolicyService";
index 19e9f3e..495c5a0 100644 (file)
@@ -8,24 +8,20 @@ include_directories(
        ../.
        ../ctrl_app_lib/inc
        ../iotivity_lib/inc
-#      ../agent_lib/inc
-#      ../agent_lib/rmi/inc
+       ../agent_lib/inc
        dpm
 )
 
 file(GLOB DPM_SOURCES dpm/*.cpp)
 file(GLOB NMDAEMON_SOURCES *.cpp)
 
-FILE(GLOB NMDAEMON_SRC_EX_1 agentpolicyservice.cpp)
-FILE(GLOB NMDAEMON_SRC_EX_2 report_service.cpp)
-list(REMOVE_ITEM NMDAEMON_SOURCES ${NMDAEMON_SRC_EX_1})
-list(REMOVE_ITEM NMDAEMON_SOURCES ${NMDAEMON_SRC_EX_2})
-
 if("${FLAVOR}" STREQUAL "UBUNTU")
-               include_directories(../mock)
-               file(GLOB DPM_MOCK ../mock/*.cpp)
-               list(APPEND NMDAEMON_SOURCES ${DPM_MOCK})
+       include_directories(../mock ../ubuntu-klay)
+       file(GLOB DPM_MOCK ../mock/*.cpp)
+       list(APPEND NMDAEMON_SOURCES ${DPM_MOCK})
 else()
+       pkg_check_modules(pkgs REQUIRED klay)
+
        FOREACH(flag ${pkgs_CFLAGS})
                SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
        ENDFOREACH(flag)
@@ -40,9 +36,10 @@ SET (SOURCES
 add_executable (${PROJECT_NAME} ${SOURCES})
 
 if ("${FLAVOR}" STREQUAL "UBUNTU")
-       set (DPM_LIB "")
+       add_dependencies(${PROJECT_NAME} ${RMI_PROJECT_NAME})
+       target_link_libraries (${PROJECT_NAME} ${RMI_PROJECT_NAME})
 else()
-       set (DPM_LIB dpm)
+       target_link_libraries (${PROJECT_NAME} klay dpm dlog audit-trail)
 endif()
 
 target_link_libraries (${PROJECT_NAME}
@@ -50,15 +47,11 @@ target_link_libraries (${PROJECT_NAME}
        c_common oc octbstack oc_logger resource_directory connectivity_abstraction
        ESEnrolleeSDK
        ESMediatorRich
-#      ${AGENT_LIB_PROJECT_NAME}
        jsoncpp
        ${IOTIVITY_LIB_PROJECT_NAME}
        boost_system boost_thread boost_serialization
-       ${DPM_LIB}
 )
 
-target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
-
 # systemd dependency handling
 find_library(LIBSYSTEMD_DEV systemd)
 if (LIBSYSTEMD_DEV)
@@ -73,11 +66,6 @@ else()
        endif()
 endif()
 
-if (NOT "${FLAVOR}" STREQUAL "UBUNTU")
-    target_link_libraries(${PROJECT_NAME} dlog)
-    target_link_libraries(${PROJECT_NAME} audit-trail)
-endif()
-
 install(TARGETS ${PROJECT_NAME} DESTINATION ${TESTS_DIR})
 install(FILES nmdaemon.manifest DESTINATION ${MANIFESTDIR})
 install(FILES nmdaemon.service DESTINATION ${SERVICE_INSTALL_DIR})
index f769734..cd02c75 100644 (file)
@@ -7,6 +7,7 @@
  *         Copyright: (c) Samsung Electronics Co, Ltd 2017. All rights reserved.
  * @author Mail to: <A HREF="mailto:a.gudz@samsung.com">Andriy Gudz, a.gudz@samsung.com</A>
  */
+#include <unistd.h>
 #include "agentpolicyservice.h"
 #include "logging.h"
 
@@ -19,8 +20,8 @@ AgentPolicyService::AgentPolicyService(EnforcePolicyHandler enforcePolicyHandler
 {
     LOG_D(TAG, "AgentPolicyService constructor <-");
     service.reset(new rmi::Service(RMI_ADDRESS));
-    service->registerParametricMethod(this, (int)(AgentPolicyService::enforcePolicy)(std::string, std::string));
-    service->registerNonparametricMethod(this, (pid_t)(AgentPolicyService::getServicePid)());
+    service->registerParametricMethod(this, "", (int)(AgentPolicyService::enforcePolicy)(std::string, std::string));
+    service->registerNonparametricMethod(this, "", (pid_t)(AgentPolicyService::getServicePid)());
     LOG_D(TAG, "AgentPolicyService constructor -> OK");
 }
 
index 621bd1a..66b9c9c 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef AGENTPOLICYSERVICE_H
 #define AGENTPOLICYSERVICE_H
 
-#include "rmi/service.h"
+#include <klay/rmi/service.h>
 #include "iagentpolicy.h"
 
 namespace NMD
index 78581a7..5f10994 100644 (file)
 #include "proxythread.h"
 #include "iotivity.h"
 #include "control_resource.h"
-//#include "agentpolicyservice.h"
+#include "agentpolicyservice.h"
 #include "report_stub.h"  // TODO: Remove after migration on report service
 #ifndef __BUILD_UBUNTU__
 #include "audit_trail_client.h"
-//#include "report_service.h"
+#include "report_service.h"
 #endif
 #include "registration_mq.h"
 #include "application_service.h"
@@ -154,9 +154,8 @@ void MainThread::routine()
             iotivity->publishResources(rhandles);
         }
 
-//        AgentPolicyService agent_policy_service(std::bind(&PolicyHandler::enforceCallback, policy_handler.get(), PH::_1,
-//                                                PH::_2));
-//        std::thread rmi_thread(&AgentPolicyService::run, &agent_policy_service);
+        AgentPolicyService agent_policy_service(std::bind(&PolicyHandler::enforceCallback, policy_handler.get(), PH::_1, PH::_2));
+        std::thread rmi_thread(&AgentPolicyService::run, &agent_policy_service);
 
 #ifndef __BUILD_UBUNTU__
         std::shared_ptr<AuditTrailClient> audit_trail_client = nullptr;
@@ -164,14 +163,16 @@ void MainThread::routine()
         if (ApplicationService::get_process_id_by_name("audit-trail") != -1) {
             audit_trail_client = std::make_shared<AuditTrailClient>(iotivity->getDeviceID(), &proxy_thread, report_handler,
                                  g_working_mode);
-            LOG_D(TAG, "audit_trail start_auditing");
+            LOG_D(TAG, "audit_trail start auditing");
             audit_trail_client->start_auditing();
+            LOG_D(TAG, "auditing started");
         }
 
-//        ReportService report_service(iotivity->getDeviceID(), &proxy_thread, report_handler, g_working_mode);
-//        LOG_D(TAG, "ReportService start");
+        LOG_D(TAG, "ReportService try to start");
+        ReportService report_service(iotivity->getDeviceID(), &proxy_thread, report_handler, g_working_mode);
+        LOG_D(TAG, "ReportService started");
 
-//        std::thread report_thread(&ReportService::start, &report_service);
+        std::thread report_thread(&ReportService::start, &report_service);
 #endif
 
         while (m_running) {
@@ -185,11 +186,11 @@ void MainThread::routine()
 
 #ifndef __BUILD_UBUNTU__
         LOG_D(TAG, "Stop report sevice");
-//        report_service.stop();
+        report_service.stop();
 
-//        if (report_thread.joinable()) {
-//            report_thread.join();
-//        }
+        if (report_thread.joinable()) {
+            report_thread.join();
+        }
 
         LOG_D(TAG, "Stop auditing");
 
index f0fb9d5..80a73a1 100644 (file)
@@ -35,7 +35,7 @@ ReportService::ReportService(const std::string& device_id, ProxyThread* proxy_th
     assert(m_report_handler);
 
     m_service.reset(new rmi::Service(RMI_ADDRESS));
-    m_service->registerParametricMethod(this, (int)(ReportService::sendReport)(std::string, std::string));
+    m_service->registerParametricMethod(this, "", (int)(ReportService::sendReport)(std::string, std::string));
 }
 
 ReportService::~ReportService()
index a625891..2928b7d 100644 (file)
 
 #include <string>
 #include <memory>
+#include <klay/rmi/service.h>
 
 #include "proxythread.h"
 #include "reporthandler.h"
 #include "utils.h"
 
-#include "rmi/service.h"
-
 namespace NMD
 {
 
index 3b1f304..14bd15f 100644 (file)
@@ -11,6 +11,8 @@ BuildRequires: iotivity
 BuildRequires: iotivity-devel
 BuildRequires: iotivity-service
 
+BuildRequires: pkgconfig(klay)
+BuildRequires: pkgconfig(glib-2.0)
 BuildRequires: pkgconfig(libcurl)
 BuildRequires: pkgconfig(dpm)
 BuildRequires: pkgconfig(dlog)
index f897e0e..080c271 100755 (executable)
@@ -73,6 +73,8 @@ sdb shell mount -o remount,rw /
 
 mkdir /tmp/bins
 cp ${GBS_RPMS_DIR}/nwmanager-nmdaemon${WORKING_MODE_PACKAGE}-1.0.0-* /tmp/bins/
+cp ${GBS_RPMS_DIR}/nwmanager-test-* /tmp/bins/
 bash -c "cd /tmp/bins && rpm2cpio nwmanager-nmdaemon${WORKING_MODE_PACKAGE}-1.0.0-* | cpio -dium"
+bash -c "cd /tmp/bins && rpm2cpio nwmanager-test-* | cpio -dium"
 sdb push /tmp/bins/usr/apps/network-manager/* /usr/apps/network-manager/
 rm -rf /tmp/bins
similarity index 87%
rename from device_core/agent_lib/rmi/CMakeLists.txt
rename to device_core/ubuntu-klay/CMakeLists.txt
index abab2ab..b8378a2 100644 (file)
@@ -4,7 +4,7 @@ SET (CMAKE_CXX_FLAGS " ${CMAKE_CXX_FLAGS} -fPIC ")
 
 FILE(GLOB SRCS src/*.cpp src/rmi/*.cpp)
 
-include_directories(inc inc/rmi)
+include_directories(./ klay klay/rmi)
 
 add_library (${PROJECT_NAME} STATIC ${SRCS})
 
similarity index 99%
rename from device_core/agent_lib/rmi/inc/rmi/client.h
rename to device_core/ubuntu-klay/klay/rmi/client.h
index 2828b02..77deabd 100644 (file)
@@ -24,7 +24,7 @@
 #include "error.h"
 #include "message.h"
 #include "connection.h"
-#include "mainloop.h"
+#include "klay/mainloop.h"
 #include "callback-holder.h"
 
 namespace rmi
@@ -21,7 +21,7 @@
 #include <mutex>
 
 #include "socket.h"
-#include "serialize.h"
+#include "klay/serialize.h"
 #include "message.h"
 
 namespace rmi
similarity index 98%
rename from device_core/agent_lib/rmi/inc/rmi/message.h
rename to device_core/ubuntu-klay/klay/rmi/message.h
index edbf7dc..7f17496 100644 (file)
@@ -26,9 +26,9 @@
 
 #include "message-composer.h"
 
-#include "reflection.h"
-#include "serialize.h"
-#include "file-descriptor.h"
+#include "klay/reflection.h"
+#include "klay/serialize.h"
+#include "klay/file-descriptor.h"
 
 namespace rmi
 {
similarity index 94%
rename from device_core/agent_lib/rmi/inc/rmi/service.h
rename to device_core/ubuntu-klay/klay/rmi/service.h
index 2aba3e3..9a73a59 100644 (file)
@@ -25,9 +25,9 @@
 #include <unordered_map>
 #include <thread>
 
-#include "preprocessor.h"
-#include "thread-pool.h"
-#include "mainloop.h"
+#include "klay/preprocessor.h"
+#include "klay/thread-pool.h"
+#include "klay/mainloop.h"
 #include "connection.h"
 #include "message.h"
 #include "callback-holder.h"
 #define PROTOTYPE_(D, N) SEQUENCE(D, N)
 #define PROTOTYPE(...)   PROTOTYPE_(PLACEHOLDER, VAR_ARGS_SIZE(__VA_ARGS__))
 
-#define registerMethod(T, M, ...)                                             \
+#define registerMethod(T, P, M, ...)                                             \
 setMethodHandler<TYPEOF(M), TYPEOF(STRIP(STRIP(M)))>                          \
                 (STRINGIFY(TYPEOF(STRIP(M))), std::bind(&TYPEOF(STRIP(M)), T, \
                 PROTOTYPE(TYPEOF(STRIP(STRIP(M))))))
 
-#define registerParametricMethod(T, M, ...)                                   \
+#define registerParametricMethod(T, P, M, ...)                                   \
 setMethodHandler<TYPEOF(M), TYPEOF(STRIP(STRIP(M)))>                          \
                 (STRINGIFY(TYPEOF(STRIP(M))), std::bind(&TYPEOF(STRIP(M)), T, \
                 PROTOTYPE(TYPEOF(STRIP(STRIP(M))))))
 
-#define registerNonparametricMethod(T, M, ...)                                \
+#define registerNonparametricMethod(T, P, M, ...)                                \
 setMethodHandler<TYPEOF(M)>                                                   \
                 (STRINGIFY(TYPEOF(STRIP(M))), std::bind(&TYPEOF(STRIP(M)), T))
 
similarity index 98%
rename from device_core/agent_lib/rmi/inc/rmi/socket.h
rename to device_core/ubuntu-klay/klay/rmi/socket.h
index 2159ec0..8dc3244 100644 (file)
@@ -17,7 +17,7 @@
 #ifndef __RMI_SOCKET_H__
 #define __RMI_SOCKET_H__
 
-#include "exception.h"
+#include "klay/exception.h"
 
 namespace rmi
 {
index 186e2d2..1e23075 100644 (file)
@@ -14,12 +14,11 @@ include_directories (
        ../ctrl_app_lib/inc
        ../iotivity_lib/inc
 
-       ../agent_lib/inc
-       ../agent_lib/rmi/inc
-
        ../nmdaemon
        ../nmdaemon/dpm
 
+       ../agent_lib/inc
+
        ../.
 )
 
@@ -47,6 +46,8 @@ add_executable (${PROJECT_NAME} ${SRCS})
 
 if ("${FLAVOR}" STREQUAL "UBUNTU")
        set (LINK_DLOG "")
+
+       include_directories(../ubuntu-klay)
 else()
        set (LINK_DLOG dlog)
 endif()
@@ -61,6 +62,12 @@ set (TEST_LINK_LIBRARIES ${GTEST_LIB}
        curl
 )
 
+if ("${FLAVOR}" STREQUAL "UBUNTU")
+       target_link_libraries (${PROJECT_NAME} ${AGENT_LIB_PROJECT_NAME})
+else()
+       target_link_libraries (${PROJECT_NAME} klay glib-2.0)
+endif()
+
 target_link_libraries(${PROJECT_NAME} ${TEST_LINK_LIBRARIES})
 
 find_library(LIBSYSTEMD_DEV systemd)
index 77373ee..ebe83c5 100644 (file)
@@ -9,14 +9,11 @@
  */
 #include <iostream>
 #include <string>
-
 #include <gtest/gtest.h>
-
+#include <klay/rmi/service.h>
+#include <klay/rmi/client.h>
 #include "report_service.h"
 
-#include "rmi/service.h"
-#include "rmi/client.h"
-
 using namespace NMD;
 
 /**
index feb31a5..05e92b0 100644 (file)
@@ -1,3 +1,4 @@
+#if 0
 /**
  * @brief  Tests for RMI
  * @date   Created 17.05.2017
@@ -209,3 +210,5 @@ TEST(DISABLED_test_rmi, agentPolicyServiceCorrect)
         FAIL();
     }
 }
+
+#endif