tizen 2.4 release
[framework/context/context-common.git] / include / request_handler.h
1 /*
2  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17 #ifndef __CONTEXT_LIB_REQUEST_HANDLER_H__
18 #define __CONTEXT_LIB_REQUEST_HANDLER_H__
19
20 #include <json.h>
21
22 namespace ctx { namespace request_handler {
23
24         /*
25          */
26         typedef void(* subject_response_cb)(const char* subject, int req_id, int error, ctx::json response);
27
28         /*
29          */
30         bool register_callback(const char* subject, subject_response_cb callback);
31
32         /*
33          */
34         int subscribe(const char* subject, ctx::json* option, int* req_id, ctx::json* request_result = NULL);
35
36         /*
37          */
38         int unsubscribe(const char* subject, int req_id);
39
40         /*
41          */
42         int read(const char* subject, ctx::json* option, int* req_id, ctx::json* request_result = NULL);
43
44         /*
45          */
46         int read_sync(const char* subject, ctx::json* option, int* req_id, ctx::json* data_read);
47
48         /*
49          */
50         int write(const char* subject, ctx::json* data);
51
52         /*
53          */
54         int write_with_reply(const char* subject, ctx::json* data, ctx::json* request_result = NULL);
55
56         /*
57          */
58         int is_supported(const char* subject);
59
60 } }     /* namespace ctx::request_handler */
61
62 #endif // __CONTEXT_LIB_REQUEST_HANDLER_H__