2 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
17 #include <types_internal.h>
19 #include <provider_iface.h>
20 #include <context_mgr.h>
21 #include <context_mgr_iface.h>
23 static ctx::context_manager_iface *_instance = NULL;
25 void ctx::context_manager::set_instance(context_manager_iface* mgr)
30 bool ctx::context_manager::register_provider(const char* subject, ctx::context_provider_info &provider_info)
32 IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
33 return _instance->register_provider(subject, provider_info);
36 bool ctx::context_manager::register_trigger_item(const char *subject, int operation, ctx::json attributes, ctx::json options)
38 IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
39 return _instance->register_trigger_item(subject, operation, attributes, options);
42 bool ctx::context_manager::publish(const char* subject, ctx::json option, int error, ctx::json data_updated)
44 IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
45 return _instance->publish(subject, option, error, data_updated);
48 bool ctx::context_manager::reply_to_read(const char* subject, ctx::json option, int error, ctx::json data_read)
50 IF_FAIL_RETURN_TAG(_instance, false, _E, "Not initialized");
51 return _instance->reply_to_read(subject, option, error, data_read);