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_TRIGGER_RULE_H_
18 #define _CONTEXT_TRIGGER_RULE_H_
23 #include "IContextListener.h"
31 class Rule : public IContextListener {
36 ContextItem(ctx::Json item) {
37 std::list<std::string> keyList;
38 item.getKeys(&keyList);
39 name = *keyList.begin();
42 if (item.get(name.c_str(), TRIG_RULE_KEY_OPTION, &o))
47 ctx::Json __statement;
49 std::list<ContextItem*> __condition;
54 static RuleManager* __ruleMgr;
56 void __clearResult(void);
57 bool __setConditionOptionBasedOnEvent(ctx::Json& option);
58 void __onContextDataPrepared(void);
60 static gboolean __handleUninstalledRule(gpointer data);
66 Rule(int i, ctx::Json& d, const char* p, RuleManager* rm);
72 void onEventReceived(std::string name, ctx::Json option, ctx::Json data);
73 void onConditionReceived(std::string name, ctx::Json option, ctx::Json data);
77 } /* namespace trigger */
80 #endif /* End of _CONTEXT_TRIGGER_RULE_H_ */