SET(target "contextd")
# Source Lists
-FILE(GLOB_RECURSE SRCS src/*.cpp)
+FILE(GLOB SRCS src/*.cpp src/access_control/*.cpp src/policy/*.cpp)
+IF(${TRIGGER_SUPPORT})
+ FILE(GLOB SRCS ${SRCS} src/trigger/*.cpp)
+ ADD_DEFINITIONS(-DTRIGGER_SUPPORT)
+ENDIF(${TRIGGER_SUPPORT})
MESSAGE("Sources: ${SRCS}")
# Dependencies
%define SYSTEM_SERVICE 0
%define LEGACY_SECURITY 0
+%define TRIGGER_SUPPORT 1
%if "%{?BUILD_PROFILE}" == "tv"
ExcludeArch: %{arm} aarch64 %ix86 x86_64
cmake . -DCMAKE_INSTALL_PREFIX=%{_prefix} -DMAJORVER=${MAJORVER} -DFULLVER=%{version} \
-DSYSTEM_SERVICE=%{SYSTEM_SERVICE} \
- -DLEGACY_SECURITY=%{LEGACY_SECURITY}
+ -DLEGACY_SECURITY=%{LEGACY_SECURITY} \
+ -DTRIGGER_SUPPORT=%{TRIGGER_SUPPORT}
make %{?jobs:-j%jobs}
%install
#include <Types.h>
#include "DBusServer.h"
#include "ContextManager.h"
-#include "trigger/Trigger.h"
#include "policy/PolicyManager.h"
#include "Server.h"
+#ifdef TRIGGER_SUPPORT
+#include "trigger/Trigger.h"
+#endif
+
static GMainLoop *mainloop = NULL;
static bool started = false;
static ctx::ContextManager *__contextMgr = NULL;
static ctx::DBusServer *__dbusHandle = NULL;
static ctx::PolicyManager *__policyMgr = NULL;
+
+#ifdef TRIGGER_SUPPORT
static ctx::trigger::Trigger *__contextTrigger = NULL;
+#endif
/* TODO: re-organize activation & deactivation processes */
void ctx::Server::initialize()
__policyMgr = new(std::nothrow) ctx::PolicyManager(__contextMgr);
IF_FAIL_CATCH_TAG(__policyMgr, _E, "Memory allocation failed");
+#ifdef TRIGGER_SUPPORT
_I("Init Context Trigger");
__contextTrigger = new(std::nothrow) ctx::trigger::Trigger();
IF_FAIL_CATCH_TAG(__contextTrigger, _E, "Memory allocation failed");
result = __contextTrigger->init(__contextMgr);
IF_FAIL_CATCH_TAG(result, _E, "Initialization Failed");
+#endif
started = true;
_I(CYAN("Context-Service Launched"));
void ctx::Server::release()
{
_I(CYAN("Terminating Context-Service"));
+
+#ifdef TRIGGER_SUPPORT
_I("Release Context Trigger");
if (__contextTrigger)
__contextTrigger->release();
+#endif
_I("Release Policy Manager");
delete __policyMgr;
g_main_loop_unref(mainloop);
+#ifdef TRIGGER_SUPPORT
delete __contextTrigger;
+#endif
delete __contextMgr;
delete __dbusHandle;
}
return;
}
- if (!__contextTrigger->assignRequest(request)) {
- __contextMgr->assignRequest(request);
- }
+#ifdef TRIGGER_SUPPORT
+ if (__contextTrigger->assignRequest(request))
+ return;
+#endif
+
+ __contextMgr->assignRequest(request);
}
static void __signalHandler(int signo)