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 #ifndef __CONTEXT_MONITOR_H__
18 #define __CONTEXT_MONITOR_H__
29 class context_monitor {
33 bool init(ctx::fact_reader* fr, ctx::context_trigger* tr);
35 int subscribe(int rule_id, std::string subject, ctx::json event);
36 int unsubscribe(int rule_id, std::string subject, ctx::json option);
37 int read(std::string subject, json option, ctx::json* result);
38 bool is_supported(std::string subject);
39 bool is_allowed(const char *client, const char *subject);
42 int subscribe_timer(ctx::json option);
43 int unsubscribe_timer(ctx::json option);
44 int read_day_of_month(ctx::json* result);
45 int read_day_of_week(ctx::json* result);
46 int read_time(ctx::json* result);
47 std::map<int, int> request_map; // <rule_id, fact_read_req_id>
48 std::map<int, int> read_req_cnt_map; // <fact_read_req_id, count>
49 ctx::context_trigger* trigger;
50 ctx::trigger_timer* timer;
52 }; /* class context_monitor */
56 #endif /* End of __CONTEXT_MONITOR_H__ */