4 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
20 #ifndef __CONTEXT_MONITOR_H__
21 #define __CONTEXT_MONITOR_H__
32 class context_monitor {
36 bool init(ctx::fact_reader* fr, ctx::context_trigger* tr);
38 int subscribe(int rule_id, std::string subject, ctx::json event, const char* zone);
39 int unsubscribe(int rule_id, std::string subject, ctx::json option, const char* zone);
40 int read(std::string subject, json option, const char* zone, ctx::json* result);
41 bool is_supported(std::string subject, const char* zone);
44 std::map<std::string, ctx::trigger_timer>::iterator get_zone_timer(std::string zone);
45 int subscribe_timer(ctx::json option, const char* zone);
46 int unsubscribe_timer(ctx::json option, const char* zone);
47 int read_day_of_month(ctx::json* result, const char* zone);
48 int read_day_of_week(ctx::json* result, const char* zone);
49 int read_time(ctx::json* result, const char* zone);
50 std::map<int, int> request_map; // <rule_id, fact_read_req_id>
51 std::map<int, int> read_req_cnt_map; // <fact_read_req_id, count>
52 ctx::context_trigger* trigger;
54 }; /* class context_monitor */
58 #endif /* End of __CONTEXT_MONITOR_H__ */