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>
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
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)
+++ /dev/null
-#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}
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
%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*
--- /dev/null
+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")
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)
--- /dev/null
+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)
* 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
/*
- * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
/*
- * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
/* 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);
--- /dev/null
+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})
#include <DatabaseManager.h>
namespace ctx {
- class StatsDbHandleBase : public IDatabaseListener {
+ class SO_EXPORT StatsDbHandleBase : public IDatabaseListener {
protected:
bool isTriggerItem;
ContextProvider *reqProvider;
+++ /dev/null
-/*
- * 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;
-}
#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 */
+++ /dev/null
-/*
- * 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;
-}
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);
return true;
}
-bool system_info::getVolume(int* systemVolume, int* mediaVolume)
+SO_EXPORT bool system_info::getVolume(int* systemVolume, int* mediaVolume)
{
int err;
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 */
#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);
/*
- * 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)
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;
-}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
--- /dev/null
+/*
+ * 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;
+}
--- /dev/null
+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)
/*
- * 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;
+}