Split the .a file into .so files 66/66966/4
authorMu-Woong Lee <muwoong.lee@samsung.com>
Fri, 22 Apr 2016 09:04:14 +0000 (18:04 +0900)
committerMu-Woong Lee <muwoong.lee@samsung.com>
Mon, 25 Apr 2016 10:23:21 +0000 (19:23 +0900)
Each .so provides create() function, and contextd will the function for each so.
Later, the create() will be updated to support on-demand loading of providers.

Change-Id: Icc9f204941500c5e9d95f39644d4001fba36c76b
Signed-off-by: Mu-Woong Lee <muwoong.lee@samsung.com>
42 files changed:
CMakeLists.txt
context-provider.pc.in [deleted file]
packaging/context-provider.spec
src/CMakeLists.txt [new file with mode: 0644]
src/activity/Activity.cpp
src/activity/CMakeLists.txt [new file with mode: 0644]
src/activity/create.cpp [moved from include/CustomContextProvider.h with 51% similarity]
src/app-stats/CMakeLists.txt [new file with mode: 0644]
src/app-stats/create.cpp [new file with mode: 0644]
src/call/CMakeLists.txt [new file with mode: 0644]
src/call/create.cpp [moved from include/PlaceContextProvider.h with 60% similarity]
src/contacts/CMakeLists.txt [new file with mode: 0644]
src/contacts/create.cpp [new file with mode: 0644]
src/email/CMakeLists.txt [new file with mode: 0644]
src/email/create.cpp [moved from include/StatisticsContextProvider.h with 61% similarity]
src/geofence/CMakeLists.txt [new file with mode: 0644]
src/geofence/create.cpp [new file with mode: 0644]
src/headphone/CMakeLists.txt [new file with mode: 0644]
src/headphone/create.cpp [new file with mode: 0644]
src/media-stats/CMakeLists.txt [new file with mode: 0644]
src/media-stats/create.cpp [new file with mode: 0644]
src/message/CMakeLists.txt [new file with mode: 0644]
src/message/create.cpp [new file with mode: 0644]
src/my-place/CMakeLists.txt [new file with mode: 0644]
src/my-place/create.cpp [new file with mode: 0644]
src/shared/BasicProvider.h
src/shared/CMakeLists.txt [new file with mode: 0644]
src/shared/DbHandleBase.h
src/shared/DeviceContextProvider.cpp [deleted file]
src/shared/ProviderTypes.h
src/shared/StatisticsContextProvider.cpp [deleted file]
src/shared/SystemInfo.cpp
src/shared/Util.cpp
src/shared/create.h [moved from src/shared/PlaceContextProvider.cpp with 64% similarity]
src/social-stats/CMakeLists.txt [new file with mode: 0644]
src/social-stats/create.cpp [new file with mode: 0644]
src/system/CMakeLists.txt [new file with mode: 0644]
src/system/create.cpp [new file with mode: 0644]
src/time/CMakeLists.txt [new file with mode: 0644]
src/time/create.cpp [new file with mode: 0644]
src/wifi/CMakeLists.txt [new file with mode: 0644]
src/wifi/create.cpp [moved from include/DeviceContextProvider.h with 60% similarity]

index f776afe..2865cb6 100644 (file)
@@ -1,15 +1,16 @@
 CMAKE_MINIMUM_REQUIRED(VERSION 2.6)
 PROJECT(context-provider)
 INCLUDE(GNUInstallDirs)
-SET(target "context-provider")
-SET(compile_defs "LOG_TAG=\"CONTEXT\"")
+SET(target_prefix "ctx-prvd")
 
 # Common Options
 INCLUDE_DIRECTORIES(
        ${CMAKE_CURRENT_SOURCE_DIR}/include
        ${CMAKE_CURRENT_SOURCE_DIR}/src/shared
 )
-ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections -fvisibility=hidden)
+ADD_DEFINITIONS(-O2 -Wall -fPIC -fdata-sections -ffunction-sections)
+ADD_DEFINITIONS(-fvisibility=hidden)
+ADD_DEFINITIONS(-DLOG_TAG="CONTEXT")
 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fPIC -Wl,--as-needed -Wl,--gc-section -Wl,--print-gc-section")
 
 # Profiles
@@ -21,102 +22,4 @@ IF("${PROFILE}" STREQUAL "wearable")
        ADD_DEFINITIONS("-D_WEARABLE_")
 ENDIF("${PROFILE}" STREQUAL "wearable")
 
-
-# Dependency & Source
-SET(DEPS
-       libcontext-server
-       vconf
-       capi-system-info
-       capi-system-device
-       capi-system-runtime-info
-       capi-appfw-package-manager
-       capi-appfw-application
-       capi-appfw-app-manager
-       pkgmgr
-       pkgmgr-info
-       capi-media-sound-manager
-       capi-network-bluetooth
-       capi-network-wifi
-       motion
-)
-
-FILE(GLOB SRCS
-       src/shared/*.cpp
-       src/time/*.cpp
-       src/activity/*.cpp
-       src/app-stats/*.cpp
-       src/headphone/*.cpp
-       src/system/*.cpp
-       src/wifi/*.cpp
-)
-
-IF("${PROFILE}" STREQUAL "mobile")
-SET(DEPS ${DEPS}
-       msg-service
-       contacts-service2
-       tapi
-       capi-telephony
-       capi-messaging-email
-       capi-content-media-content
-       capi-location-manager
-       capi-geofence-manager
-)
-
-FILE(GLOB SRCS ${SRCS}
-       src/call/*.cpp
-       src/contacts/*.cpp
-       src/email/*.cpp
-       src/geofence/*.cpp
-       src/media-stats/*.cpp
-       src/message/*.cpp
-       src/my-place/*.cpp
-       src/my-place/user_places/*.cpp
-       src/social-stats/*.cpp
-)
-ENDIF("${PROFILE}" STREQUAL "mobile")
-
-
-# Build
-INCLUDE(FindPkgConfig)
-PKG_CHECK_MODULES(DEPS REQUIRED ${DEPS})
-
-FOREACH(flag ${DEPS_CFLAGS})
-       SET(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${flag}")
-ENDFOREACH(flag)
-
-ADD_LIBRARY(${target} STATIC ${SRCS})
-TARGET_LINK_LIBRARIES(${target} ${DEPS_LDFLAGS})
-SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_FLAGS ${EXTRA_CFLAGS})
-SET_TARGET_PROPERTIES(${target} PROPERTIES COMPILE_DEFINITIONS "${compile_defs}")
-SET_TARGET_PROPERTIES(${target} PROPERTIES SOVERSION ${MAJORVER})
-SET_TARGET_PROPERTIES(${target} PROPERTIES VERSION ${FULLVER})
-
-# Package Config
-FOREACH(item IN LISTS DEPS)
-       SET(deps_str "${deps_str} ${item}")
-ENDFOREACH(item)
-
-SET(VERSION ${FULLVER})
-SET(PREFIX ${CMAKE_INSTALL_PREFIX})
-SET(PC_NAME ${PROJECT_NAME})
-SET(PC_DESCRIPTION "Tizen Context Framework Context Provider")
-SET(PC_INCLUDE "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}/context-service")
-SET(PC_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
-SET(PC_CFLAGS "-I\${includedir}/context-service")
-SET(PC_LDFLAGS "-l${target}")
-SET(PC_REQUIRED "${deps_str}")
-
-CONFIGURE_FILE(
-       ${PROJECT_NAME}.pc.in
-       ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc
-       @ONLY
-)
-
-# Installing
-INSTALL(
-       DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/include/
-       DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/context-service/internal
-       FILES_MATCHING PATTERN "*.h"
-)
-INSTALL(FILES ${CMAKE_CURRENT_SOURCE_DIR}/${PROJECT_NAME}.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
-INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR})
+ADD_SUBDIRECTORY(src)
diff --git a/context-provider.pc.in b/context-provider.pc.in
deleted file mode 100644 (file)
index 378b991..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#Package Information for pkg-config
-
-prefix=@PREFIX@
-exec_prefix=@PREFIX@
-libdir=@PC_LIBDIR@
-includedir=@PC_INCLUDE@
-
-Name: @PC_NAME@
-Description: @PC_DESCRIPTION@
-Version: @VERSION@
-Requires: @PC_REQUIRED@
-Libs: -L${libdir} @PC_LDFLAGS@
-Cflags: -I${includedir}
index 598eb65..cd48f58 100644 (file)
@@ -7,7 +7,6 @@ License:    Apache-2.0
 Source0:    %{name}-%{version}.tar.gz
 
 %define BUILD_PROFILE %{?profile}%{!?profile:%{?tizen_profile_name}}
-%define keepstatic 1
 
 %if "%{?BUILD_PROFILE}" == "tv"
 ExcludeArch: %{arm} aarch64 %ix86 x86_64
@@ -90,17 +89,5 @@ cp LICENSE %{buildroot}/usr/share/license/%{name}
 %manifest packaging/%{name}.manifest
 %defattr(-,root,root,-)
 /usr/share/license/%{name}
-
-%package devel
-Summary:    Context Provider (Development)
-Group:      Service/Context
-Requires:      %{name} = %{version}-%{release}
-
-%description devel
-Context Provider (Development)
-
-%files devel
-%defattr(-,root,root,-)
-%{_includedir}/context-service/internal/*.h
-%{_libdir}/pkgconfig/%{name}.pc
-%{_libdir}/*.a
+%{_libdir}/*.so*
+%{_libdir}/context/*.so*
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
new file mode 100644 (file)
index 0000000..2d1bb6a
--- /dev/null
@@ -0,0 +1,24 @@
+SET(target_shared "${target_prefix}-shared")
+SET(DEPS
+       libcontext-server
+)
+
+ADD_SUBDIRECTORY(shared)
+ADD_SUBDIRECTORY(activity)
+ADD_SUBDIRECTORY(app-stats)
+#ADD_SUBDIRECTORY(custom)
+ADD_SUBDIRECTORY(headphone)
+ADD_SUBDIRECTORY(system)
+ADD_SUBDIRECTORY(time)
+ADD_SUBDIRECTORY(wifi)
+
+IF("${PROFILE}" STREQUAL "mobile")
+ADD_SUBDIRECTORY(call)
+ADD_SUBDIRECTORY(contacts)
+ADD_SUBDIRECTORY(email)
+ADD_SUBDIRECTORY(geofence)
+ADD_SUBDIRECTORY(media-stats)
+ADD_SUBDIRECTORY(message)
+ADD_SUBDIRECTORY(my-place)
+ADD_SUBDIRECTORY(social-stats)
+ENDIF("${PROFILE}" STREQUAL "mobile")
index a71dbfb..017c061 100644 (file)
@@ -19,7 +19,7 @@
 
 using namespace ctx;
 
-ActivityProvider::ActivityProvider(const char *subject, activity_type_e type)  :
+ActivityProvider::ActivityProvider(const char *subject, activity_type_e type) :
        BasicProvider(subject),
        __activityType(type),
        __activityHandle(NULL)
diff --git a/src/activity/CMakeLists.txt b/src/activity/CMakeLists.txt
new file mode 100644 (file)
index 0000000..29e8f5d
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-activity")
+
+SET(DEPS ${DEPS}
+       motion
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_ACTIVITY REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_ACTIVITY_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_ACTIVITY_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
similarity index 51%
rename from include/CustomContextProvider.h
rename to src/activity/create.cpp
index b000fa5..5009ae3 100644 (file)
  * limitations under the License.
  */
 
-#ifndef _CONTEXT_CUSTOM_CONTEXT_PROVIDER_H_
-#define _CONTEXT_CUSTOM_CONTEXT_PROVIDER_H_
+#include <new>
+#include <create.h>
+#include "Activity.h"
 
-namespace ctx {
+using namespace ctx;
 
-       bool initCustomContextProvider();
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
 
-       namespace custom_context_provider {
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<StationaryActivityProvider>(SUBJ_ACTIVITY_STATIONARY, NULL);
+       registerProvider<WalkingActivityProvider>(SUBJ_ACTIVITY_WALKING, NULL);
+       registerProvider<RunningActivityProvider>(SUBJ_ACTIVITY_RUNNING, NULL);
+       registerProvider<InVehicleActivityProvider>(SUBJ_ACTIVITY_IN_VEHICLE, NULL);
 
-               int addItem(std::string subject, std::string name, ctx::Json tmpl, const char* owner, bool isInit = false);
-               int removeItem(std::string subject);
-               int publishData(std::string subject, ctx::Json fact);
-
-               ContextProvider* create(void* data);
-               void destroy(void* data);
-
-       }       /* namespace custom_context_provider */
-
-}      /* namespace ctx */
-
-#endif /* End of _CONTEXT_CUSTOM_CONTEXT_PROVIDER_H_ */
+       return true;
+}
diff --git a/src/app-stats/CMakeLists.txt b/src/app-stats/CMakeLists.txt
new file mode 100644 (file)
index 0000000..70b329e
--- /dev/null
@@ -0,0 +1,23 @@
+SET(target "${target_prefix}-app-stats")
+
+SET(DEPS ${DEPS}
+       capi-appfw-package-manager
+       capi-appfw-application
+       capi-appfw-app-manager
+       pkgmgr
+       pkgmgr-info
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_APP_STATS REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_APP_STATS_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_APP_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/app-stats/create.cpp b/src/app-stats/create.cpp
new file mode 100644 (file)
index 0000000..5002f9a
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "AppStatsProvider.h"
+#include "AppStatsLogger.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<AppStatsLogger>(APP_SUBJ_LOGGER, APP_HISTORY_PRIV);
+       registerProvider<RecentAppProvider>(APP_SUBJ_RECENTLY_USED, APP_HISTORY_PRIV);
+       registerProvider<FrequentAppProvider>(APP_SUBJ_FREQUENTLY_USED, APP_HISTORY_PRIV);
+       registerProvider<RareAppProvider>(APP_SUBJ_RARELY_USED, APP_HISTORY_PRIV);
+       registerProvider<AppPeakTimeProvider>(APP_SUBJ_PEAK_TIME, APP_HISTORY_PRIV);
+       registerProvider<AppSettingProvider>(APP_SUBJ_COMMON_SETTING, APP_HISTORY_PRIV);
+       registerProvider<AppFreqProvider>(APP_SUBJ_FREQUENCY, APP_HISTORY_PRIV);
+
+       return true;
+}
diff --git a/src/call/CMakeLists.txt b/src/call/CMakeLists.txt
new file mode 100644 (file)
index 0000000..8a60b79
--- /dev/null
@@ -0,0 +1,20 @@
+SET(target "${target_prefix}-call")
+
+SET(DEPS ${DEPS}
+       tapi
+       capi-telephony
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_CALL REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_CALL_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_CALL_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
similarity index 60%
rename from include/PlaceContextProvider.h
rename to src/call/create.cpp
index e7585b0..235db22 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef _CONTEXT_PLACE_CONTEXT_PROVIDER_H_
-#define _CONTEXT_PLACE_CONTEXT_PROVIDER_H_
+#include <new>
+#include <create.h>
+#include "Call.h"
 
-namespace ctx {
+using namespace ctx;
 
-       bool initPlaceContextProvider();
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
 
-}      /* namespace ctx */
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<CallStateProvider>(SUBJ_STATE_CALL, PRIV_TELEPHONY);
 
-#endif /* End of _CONTEXT_PLACE_CONTEXT_PROVIDER_H_ */
+       return true;
+}
diff --git a/src/contacts/CMakeLists.txt b/src/contacts/CMakeLists.txt
new file mode 100644 (file)
index 0000000..6773a23
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-contacts")
+
+SET(DEPS ${DEPS}
+       contacts-service2
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_CONTACTS REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_CONTACTS_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_CONTACTS_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/contacts/create.cpp b/src/contacts/create.cpp
new file mode 100644 (file)
index 0000000..b4b34b6
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "Contacts.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<ContactsChangeProvider>(SUBJ_STATE_CONTACTS, PRIV_CONTACT);
+
+       return true;
+}
diff --git a/src/email/CMakeLists.txt b/src/email/CMakeLists.txt
new file mode 100644 (file)
index 0000000..d6d6687
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-email")
+
+SET(DEPS ${DEPS}
+       capi-messaging-email
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_EMAIL REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_EMAIL_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_EMAIL_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
similarity index 61%
rename from include/StatisticsContextProvider.h
rename to src/email/create.cpp
index f356719..ac15430 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef _CONTEXT_STATISTICS_CONTEXT_PROVIDER_H_
-#define _CONTEXT_STATISTICS_CONTEXT_PROVIDER_H_
+#include <new>
+#include <create.h>
+#include "Email.h"
 
-namespace ctx {
+using namespace ctx;
 
-       bool initStatisticsContextProvider();
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
 
-}      /* namespace ctx */
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<EmailEventProvider>(SUBJ_STATE_EMAIL, NULL);
 
-#endif /* End of _CONTEXT_STATISTICS_CONTEXT_PROVIDER_H_ */
+       return true;
+}
diff --git a/src/geofence/CMakeLists.txt b/src/geofence/CMakeLists.txt
new file mode 100644 (file)
index 0000000..c52a0b0
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-geofence")
+
+SET(DEPS ${DEPS}
+       capi-geofence-manager
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_GEOFENCE REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_GEOFENCE_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_GEOFENCE_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/geofence/create.cpp b/src/geofence/create.cpp
new file mode 100644 (file)
index 0000000..6f9ccbe
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "PlaceGeofenceProvider.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<PlaceGeofenceProvider>(SUBJ_PLACE_GEOFENCE, PRIV_LOCATION);
+
+       return true;
+}
diff --git a/src/headphone/CMakeLists.txt b/src/headphone/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1730405
--- /dev/null
@@ -0,0 +1,20 @@
+SET(target "${target_prefix}-headphone")
+
+SET(DEPS ${DEPS}
+       capi-system-runtime-info
+       capi-network-bluetooth
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_HEADPHONE REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_HEADPHONE_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_HEADPHONE_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/headphone/create.cpp b/src/headphone/create.cpp
new file mode 100644 (file)
index 0000000..79fa6a7
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "Headphone.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<HeadphoneStateProvider>(SUBJ_STATE_HEADPHONE, NULL);
+
+       return true;
+}
diff --git a/src/media-stats/CMakeLists.txt b/src/media-stats/CMakeLists.txt
new file mode 100644 (file)
index 0000000..cb22916
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-media-stats")
+
+SET(DEPS ${DEPS}
+       capi-content-media-content
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_MEDIA_STATS REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_MEDIA_STATS_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_MEDIA_STATS_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/media-stats/create.cpp b/src/media-stats/create.cpp
new file mode 100644 (file)
index 0000000..48f4ee9
--- /dev/null
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "MediaStatsProvider.h"
+#include "MediaStatsLogger.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<MediaStatsLogger>(MEDIA_SUBJ_LOGGER, MEDIA_HISTORY_PRIV);
+       registerProvider<MusicPeakTimeProvider>(MEDIA_SUBJ_PEAK_TIME_FOR_MUSIC, MEDIA_HISTORY_PRIV);
+       registerProvider<VideoPeakTimeProvider>(MEDIA_SUBJ_PEAK_TIME_FOR_VIDEO, MEDIA_HISTORY_PRIV);
+       registerProvider<MusicSettingProvider>(MEDIA_SUBJ_COMMON_SETTING_FOR_MUSIC, MEDIA_HISTORY_PRIV);
+       registerProvider<VideoSettingProvider>(MEDIA_SUBJ_COMMON_SETTING_FOR_VIDEO, MEDIA_HISTORY_PRIV);
+       registerProvider<MusicFreqProvider>(MEDIA_SUBJ_MUSIC_FREQUENCY, MEDIA_HISTORY_PRIV);
+       registerProvider<VideoFreqProvider>(MEDIA_SUBJ_VIDEO_FREQUENCY, MEDIA_HISTORY_PRIV);
+
+       return true;
+}
diff --git a/src/message/CMakeLists.txt b/src/message/CMakeLists.txt
new file mode 100644 (file)
index 0000000..0de59a0
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-message")
+
+SET(DEPS ${DEPS}
+       msg-service
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_MESSAGE REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_MESSAGE_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_MESSAGE_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/message/create.cpp b/src/message/create.cpp
new file mode 100644 (file)
index 0000000..7588850
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "Message.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<MessageEventProvider>(SUBJ_STATE_MESSAGE, PRIV_MESSAGE);
+
+       return true;
+}
diff --git a/src/my-place/CMakeLists.txt b/src/my-place/CMakeLists.txt
new file mode 100644 (file)
index 0000000..5277817
--- /dev/null
@@ -0,0 +1,20 @@
+SET(target "${target_prefix}-my-place")
+
+SET(DEPS ${DEPS}
+       capi-location-manager
+       capi-network-wifi
+)
+
+FILE(GLOB_RECURSE SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_MYPLACE REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_MYPLACE_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_MYPLACE_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/my-place/create.cpp b/src/my-place/create.cpp
new file mode 100644 (file)
index 0000000..91cdaf9
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "place_recognition.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       /*
+       registerProvider<PlaceRecognitionProvider>(PLACE_SUBJ_RECOGNITION, PLACE_PRIV_RECOGNITION);
+       */
+
+       return true;
+}
index 84b0838..069cc3a 100644 (file)
@@ -24,7 +24,7 @@ namespace ctx {
        /* BasicProvider implements the very basic form of context providers,
           which has no controllable options, and does not set the requestResult
           parameter to reply to clients' requests immediately. */
-       class BasicProvider : public ContextProvider {
+       class SO_EXPORT BasicProvider : public ContextProvider {
        public:
                int subscribe(Json option, Json *requestResult);
                int unsubscribe(Json option);
diff --git a/src/shared/CMakeLists.txt b/src/shared/CMakeLists.txt
new file mode 100644 (file)
index 0000000..fc20fe4
--- /dev/null
@@ -0,0 +1,19 @@
+SET(DEPS ${DEPS}
+       capi-system-info
+       capi-system-runtime-info
+       capi-media-sound-manager
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_SHARED REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_SHARED_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target_shared} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target_shared} ${PKG_SHARED_LDFLAGS})
+
+INSTALL(TARGETS ${target_shared} DESTINATION ${CMAKE_INSTALL_LIBDIR})
index 8949550..3404821 100644 (file)
@@ -22,7 +22,7 @@
 #include <DatabaseManager.h>
 
 namespace ctx {
-       class StatsDbHandleBase : public IDatabaseListener {
+       class SO_EXPORT StatsDbHandleBase : public IDatabaseListener {
        protected:
                bool isTriggerItem;
                ContextProvider *reqProvider;
diff --git a/src/shared/DeviceContextProvider.cpp b/src/shared/DeviceContextProvider.cpp
deleted file mode 100644 (file)
index 1726c98..0000000
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <new>
-#include <DeviceContextProvider.h>
-
-#include "../time/Alarm.h"
-#include "../time/Time.h"
-#include "../activity/Activity.h"
-#include "../headphone/Headphone.h"
-#include "../system/Battery.h"
-#include "../system/Charger.h"
-#include "../system/Gps.h"
-#include "../system/Psmode.h"
-#include "../system/Usb.h"
-#include "../wifi/Wifi.h"
-
-#ifdef _MOBILE_
-#include "../call/Call.h"
-#include "../contacts/Contacts.h"
-#include "../email/Email.h"
-#include "../message/Message.h"
-#endif
-
-#define PRIV_NETWORK   "network.get"
-#define PRIV_TELEPHONY "telephony"
-#define PRIV_MESSAGE   "message.read"
-#define PRIV_CONTACT   "contact.read"
-
-template<typename Provider>
-void registerProvider(const char *subject, const char *privilege)
-{
-       Provider *provider = new(std::nothrow) Provider();
-       IF_FAIL_VOID_TAG(provider, _E, "Memory allocation failed");
-
-       if (!provider->isSupported()) {
-               delete provider;
-               return;
-       }
-
-       provider->registerProvider(privilege, provider);
-       provider->submitTriggerItem();
-}
-
-SO_EXPORT bool ctx::initDeviceContextProvider()
-{
-       registerProvider<AlarmProvider>(SUBJ_STATE_ALARM, NULL);
-       registerProvider<TimeProvider>(SUBJ_STATE_TIME, NULL);
-
-       registerProvider<WifiStateProvider>(SUBJ_STATE_WIFI, PRIV_NETWORK);
-       registerProvider<HeadphoneStateProvider>(SUBJ_STATE_HEADPHONE, NULL);
-
-       registerProvider<ChargerStateProvider>(SUBJ_STATE_CHARGER, NULL);
-       registerProvider<GpsStateProvider>(SUBJ_STATE_GPS, NULL);
-       registerProvider<UsbStateProvider>(SUBJ_STATE_USB, NULL);
-       registerProvider<BatteryStateProvider>(SUBJ_STATE_BATTERY, NULL);
-       registerProvider<PowerSaveModeProvider>(SUBJ_STATE_PSMODE, NULL);
-
-       registerProvider<StationaryActivityProvider>(SUBJ_ACTIVITY_STATIONARY, NULL);
-       registerProvider<WalkingActivityProvider>(SUBJ_ACTIVITY_WALKING, NULL);
-       registerProvider<RunningActivityProvider>(SUBJ_ACTIVITY_RUNNING, NULL);
-       registerProvider<InVehicleActivityProvider>(SUBJ_ACTIVITY_IN_VEHICLE, NULL);
-
-#ifdef _MOBILE_
-       registerProvider<CallStateProvider>(SUBJ_STATE_CALL, PRIV_TELEPHONY);
-       registerProvider<EmailEventProvider>(SUBJ_STATE_EMAIL, NULL);
-       registerProvider<MessageEventProvider>(SUBJ_STATE_MESSAGE, PRIV_MESSAGE);
-       registerProvider<ContactsChangeProvider>(SUBJ_STATE_CONTACTS, PRIV_CONTACT);
-
-       /* Create context providers, which need to be initiated before being subscribed */
-       /*
-       if (WifiStateProvider::isSupported())
-               WifiStateProvider::create(NULL);
-       */
-#endif
-
-       return true;
-}
index 03ddd38..f5d0bac 100644 (file)
 #define _CONTEXT_PROVIDER_TYPES_H_
 
 
+/* Privileges */
+#define PRIV_ALARM             "alarm.set"
+#define PRIV_NETWORK   "network.get"
+#define PRIV_TELEPHONY "telephony"
+#define PRIV_MESSAGE   "message.read"
+#define PRIV_CONTACT   "contact.read"
+#define PRIV_LOCATION  "location"
+
+
 /* FW-wide Data Logger Parameters */
 #define LOG_RETENTION_PERIOD   7776000         /* 90 days in secs */
 
diff --git a/src/shared/StatisticsContextProvider.cpp b/src/shared/StatisticsContextProvider.cpp
deleted file mode 100644 (file)
index d547b60..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
- *
- * 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.
- */
-
-#include <new>
-#include <StatisticsContextProvider.h>
-
-#include "../app-stats/AppStatsProvider.h"
-#include "../app-stats/AppStatsLogger.h"
-
-#ifdef _MOBILE_
-#include "../media-stats/MediaStatsProvider.h"
-#include "../media-stats/MediaStatsLogger.h"
-#include "../social-stats/SocialStatsProvider.h"
-#include "../social-stats/SocialStatsLogger.h"
-#endif
-
-template<typename Provider>
-void registerProvider(const char *subject, const char *privilege)
-{
-       Provider *provider = new(std::nothrow) Provider();
-       IF_FAIL_VOID_TAG(provider, _E, "Memory allocation failed");
-
-       if (!provider->isSupported()) {
-               delete provider;
-               return;
-       }
-
-       provider->registerProvider(privilege, provider);
-       provider->submitTriggerItem();
-}
-
-SO_EXPORT bool ctx::initStatisticsContextProvider()
-{
-       registerProvider<AppStatsLogger>(APP_SUBJ_LOGGER, APP_HISTORY_PRIV);
-       registerProvider<RecentAppProvider>(APP_SUBJ_RECENTLY_USED, APP_HISTORY_PRIV);
-       registerProvider<FrequentAppProvider>(APP_SUBJ_FREQUENTLY_USED, APP_HISTORY_PRIV);
-       registerProvider<RareAppProvider>(APP_SUBJ_RARELY_USED, APP_HISTORY_PRIV);
-       registerProvider<AppPeakTimeProvider>(APP_SUBJ_PEAK_TIME, APP_HISTORY_PRIV);
-       registerProvider<AppSettingProvider>(APP_SUBJ_COMMON_SETTING, APP_HISTORY_PRIV);
-       registerProvider<AppFreqProvider>(APP_SUBJ_FREQUENCY, APP_HISTORY_PRIV);
-
-#ifdef _MOBILE_
-       registerProvider<MediaStatsLogger>(MEDIA_SUBJ_LOGGER, MEDIA_HISTORY_PRIV);
-       registerProvider<MusicPeakTimeProvider>(MEDIA_SUBJ_PEAK_TIME_FOR_MUSIC, MEDIA_HISTORY_PRIV);
-       registerProvider<VideoPeakTimeProvider>(MEDIA_SUBJ_PEAK_TIME_FOR_VIDEO, MEDIA_HISTORY_PRIV);
-       registerProvider<MusicSettingProvider>(MEDIA_SUBJ_COMMON_SETTING_FOR_MUSIC, MEDIA_HISTORY_PRIV);
-       registerProvider<VideoSettingProvider>(MEDIA_SUBJ_COMMON_SETTING_FOR_VIDEO, MEDIA_HISTORY_PRIV);
-       registerProvider<MusicFreqProvider>(MEDIA_SUBJ_MUSIC_FREQUENCY, MEDIA_HISTORY_PRIV);
-       registerProvider<VideoFreqProvider>(MEDIA_SUBJ_VIDEO_FREQUENCY, MEDIA_HISTORY_PRIV);
-
-       registerProvider<SocialStatsLogger>(SOCIAL_SUBJ_LOGGER, SOCIAL_HISTORY_PRIV);
-       registerProvider<ContactFreqProvider>(SOCIAL_SUBJ_FREQUENCY, SOCIAL_HISTORY_PRIV);
-       registerProvider<TopContactsProvider>(SOCIAL_SUBJ_FREQ_ADDRESS, SOCIAL_HISTORY_PRIV);
-#endif
-
-       return true;
-}
index 63731f7..72ef4fe 100644 (file)
@@ -26,7 +26,7 @@
 
 using namespace ctx;
 
-bool system_info::getAudioJackState(int* state)
+SO_EXPORT bool system_info::getAudioJackState(int* state)
 {
        int value = NOT_CONNECTED;
        int err = runtime_info_get_value_int(RUNTIME_INFO_KEY_AUDIO_JACK_STATUS, &value);
@@ -37,7 +37,7 @@ bool system_info::getAudioJackState(int* state)
        return true;
 }
 
-bool system_info::getVolume(int* systemVolume, int* mediaVolume)
+SO_EXPORT bool system_info::getVolume(int* systemVolume, int* mediaVolume)
 {
        int err;
 
@@ -50,7 +50,7 @@ bool system_info::getVolume(int* systemVolume, int* mediaVolume)
        return true;
 }
 
-bool system_info::getWifiBssid(std::string& bssid)
+SO_EXPORT bool system_info::getWifiBssid(std::string& bssid)
 {
 #if 0
        /* NOTE: This routine does not work, because the wifi API does not support multi-sessions in one process */
index e25d0db..bc32a57 100644 (file)
@@ -18,7 +18,7 @@
 #include <Types.h>
 #include "Util.h"
 
-bool ctx::util::getSystemInfoBool(const char * key)
+SO_EXPORT bool ctx::util::getSystemInfoBool(const char * key)
 {
        bool supported = false;
        int ret = system_info_get_platform_bool(key, &supported);
similarity index 64%
rename from src/shared/PlaceContextProvider.cpp
rename to src/shared/create.h
index ec00515..2c57b7a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
+/* TODO: This is a temporary template implementation.
+   This will be removed soon. */
+
 #include <new>
 #include <Types.h>
-#include <PlaceContextProvider.h>
-
-#ifdef _MOBILE_
-#include "../geofence/PlaceGeofenceProvider.h"
-#include "../my-place/place_recognition.h"
-#endif /* _MOBILE_ */
-
-#define PRIV_LOCATION  "location"
 
 template<typename Provider>
 void registerProvider(const char *subject, const char *privilege)
@@ -39,16 +34,3 @@ void registerProvider(const char *subject, const char *privilege)
        provider->registerProvider(privilege, provider);
        provider->submitTriggerItem();
 }
-
-SO_EXPORT bool ctx::initPlaceContextProvider()
-{
-#ifdef _MOBILE_
-       registerProvider<PlaceGeofenceProvider>(SUBJ_PLACE_GEOFENCE, PRIV_LOCATION);
-
-       /*
-       registerProvider<PlaceRecognitionProvider>(PLACE_SUBJ_RECOGNITION, PLACE_PRIV_RECOGNITION);
-       */
-
-#endif /* _MOBILE_ */
-       return true;
-}
diff --git a/src/social-stats/CMakeLists.txt b/src/social-stats/CMakeLists.txt
new file mode 100644 (file)
index 0000000..004286e
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-social-stats")
+
+SET(DEPS ${DEPS}
+       contacts-service2
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_SOCIAL_STATS REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_SOCIAL_STATS_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_SOCIAL_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/social-stats/create.cpp b/src/social-stats/create.cpp
new file mode 100644 (file)
index 0000000..a498c28
--- /dev/null
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "SocialStatsProvider.h"
+#include "SocialStatsLogger.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<SocialStatsLogger>(SOCIAL_SUBJ_LOGGER, SOCIAL_HISTORY_PRIV);
+       registerProvider<ContactFreqProvider>(SOCIAL_SUBJ_FREQUENCY, SOCIAL_HISTORY_PRIV);
+       registerProvider<TopContactsProvider>(SOCIAL_SUBJ_FREQ_ADDRESS, SOCIAL_HISTORY_PRIV);
+
+       return true;
+}
diff --git a/src/system/CMakeLists.txt b/src/system/CMakeLists.txt
new file mode 100644 (file)
index 0000000..a349974
--- /dev/null
@@ -0,0 +1,22 @@
+SET(target "${target_prefix}-system")
+
+SET(DEPS ${DEPS}
+       vconf
+       capi-system-info
+       capi-system-device
+       capi-system-runtime-info
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_SYSTEM REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_SYSTEM_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_SYSTEM_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/system/create.cpp b/src/system/create.cpp
new file mode 100644 (file)
index 0000000..7add7b5
--- /dev/null
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "Battery.h"
+#include "Charger.h"
+#include "Gps.h"
+#include "Psmode.h"
+#include "Usb.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<BatteryStateProvider>(SUBJ_STATE_BATTERY, NULL);
+       registerProvider<ChargerStateProvider>(SUBJ_STATE_CHARGER, NULL);
+       registerProvider<GpsStateProvider>(SUBJ_STATE_GPS, NULL);
+       registerProvider<PowerSaveModeProvider>(SUBJ_STATE_PSMODE, NULL);
+       registerProvider<UsbStateProvider>(SUBJ_STATE_USB, NULL);
+
+       return true;
+}
diff --git a/src/time/CMakeLists.txt b/src/time/CMakeLists.txt
new file mode 100644 (file)
index 0000000..1ea12af
--- /dev/null
@@ -0,0 +1,18 @@
+SET(target "${target_prefix}-time")
+
+#SET(DEPS ${DEPS}
+#)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_TIME REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_TIME_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_TIME_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
diff --git a/src/time/create.cpp b/src/time/create.cpp
new file mode 100644 (file)
index 0000000..e0da510
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
+ *
+ * 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.
+ */
+
+#include <new>
+#include <create.h>
+#include "Alarm.h"
+#include "Time.h"
+
+using namespace ctx;
+
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
+
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<AlarmProvider>(SUBJ_STATE_ALARM, PRIV_ALARM);
+       registerProvider<TimeProvider>(SUBJ_STATE_TIME, NULL);
+
+       return true;
+}
diff --git a/src/wifi/CMakeLists.txt b/src/wifi/CMakeLists.txt
new file mode 100644 (file)
index 0000000..10ca397
--- /dev/null
@@ -0,0 +1,19 @@
+SET(target "${target_prefix}-wifi")
+
+SET(DEPS ${DEPS}
+       capi-network-wifi
+)
+
+FILE(GLOB SRCS *.cpp)
+
+INCLUDE(FindPkgConfig)
+PKG_CHECK_MODULES(PKG_WIFI REQUIRED ${DEPS})
+
+FOREACH(flag ${PKG_WIFI_CFLAGS})
+       SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${flag}")
+ENDFOREACH(flag)
+
+ADD_LIBRARY(${target} SHARED ${SRCS})
+TARGET_LINK_LIBRARIES(${target} ${PKG_WIFI_LDFLAGS} ${target_shared})
+
+INSTALL(TARGETS ${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}/context)
similarity index 60%
rename from include/DeviceContextProvider.h
rename to src/wifi/create.cpp
index 1e47323..cb8a87e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * limitations under the License.
  */
 
-#ifndef _CONTEXT_DEVICE_CONTEXT_PROVIDER_H_
-#define _CONTEXT_DEVICE_CONTEXT_PROVIDER_H_
+#include <new>
+#include <create.h>
+#include "Wifi.h"
 
-namespace ctx {
+using namespace ctx;
 
-       bool initDeviceContextProvider();
+/* TODO: This function will be changed into the following form:
+   ContextProvider* create(const char *subject) */
 
-}      /* namespace ctx */
+extern "C" SO_EXPORT bool create()
+{
+       registerProvider<WifiStateProvider>(SUBJ_STATE_WIFI, PRIV_NETWORK);
 
-#endif /* End of _CONTEXT_DEVICE_CONTEXT_PROVIDER_H_ */
+       return true;
+}