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_CONTEXT_MANAGER_H_
18 #define _CONTEXT_CONTEXT_MANAGER_H_
21 #include <IContextManager.h>
22 #include <ICustomRegister.h>
26 /* Forward declaration */
30 class ContextManager : public IContextManager, ICustomRegister {
37 void assignRequest(ctx::RequestInfo *request);
38 bool isSupported(const char *subject);
39 bool isAllowed(const Credentials *creds, const char *subject);
41 /* From the interface class */
42 bool publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
43 bool replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
44 bool registerCustomProvider(const char* subject, int operation, ctx::Json &attribute, ctx::Json &option, const char* owner);
45 bool unregisterCustomProvider(const char* subject);
47 bool popTriggerTemplate(std::string &subject, int &operation, Json &attribute, Json &option);
52 static gboolean __threadSwitcher(gpointer data);
54 void __publish(const char *subject, ctx::Json &option, int error, ctx::Json &dataUpdated);
55 void __replyToRead(const char *subject, ctx::Json &option, int error, ctx::Json &dataRead);
59 }; /* class ContextManager */
63 #endif /* _CONTEXT_CONTEXT_MANAGER_H_ */