tizen 2.4 release
[framework/context/place-context-provider.git] / src / place_context_provider.cpp
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 #include <types_internal.h>
18 #include <context_mgr.h>
19 #include <provider_iface.h>
20 #include <place_context_provider.h>
21
22 #ifdef _MOBILE_
23 #include "geofence/place_geofence.h"
24 #endif
25
26 template<typename provider>
27 void register_provider(const char *subject, const char *privilege)
28 {
29         if (!provider::is_supported())
30                 return;
31
32         ctx::context_provider_info provider_info(provider::create, provider::destroy, NULL, privilege);
33         ctx::context_manager::register_provider(subject, provider_info);
34         provider::submit_trigger_item();
35 }
36
37 EXTAPI bool ctx::init_place_context_provider()
38 {
39 #ifdef _MOBILE_
40         register_provider<place_geofence_provider>(PLACE_SUBJ_GEOFENCE, PLACE_PRIV_GEOFENCE);
41 #endif
42         return true;
43 }