cd3ea101845e9ab6a9f87de51a56f5674a16a0d1
[platform/core/connectivity/bluetooth-frwk.git] / bt-api / include / bt-event-handler.h
1 /*
2  * bluetooth-frwk
3  *
4  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5  *
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
9  *
10  *              http://www.apache.org/licenses/LICENSE-2.0
11  *
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.
17  *
18  */
19
20 #ifndef _BT_EVENT_HANDLER_H_
21 #define _BT_EVENT_HANDLER_H_
22
23 #include <sys/types.h>
24 #include <dbus/dbus.h>
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define EVENT_MATCH_RULE \
31         "type='signal'," \
32         "interface='%s'," \
33         "path='%s'"
34
35 typedef struct {
36         int event_type;
37         DBusConnection *conn;
38         DBusHandleMessageFunction func;
39         char *match_rule;
40         void *cb;
41         void *user_data;
42 } bt_event_info_t;
43
44
45 int _bt_init_event_handler(void);
46
47 int _bt_deinit_event_handler(void);
48
49 int _bt_register_event(int event_type, void *event_cb, void *user_data);
50
51 int _bt_unregister_event(int event_type);
52
53 void _bt_add_server(int server_fd);
54
55 void _bt_remove_server(int server_fd);
56
57 void _bt_add_push_request_id(int request_id);
58
59 void _bt_set_obex_server_id(int server_type);
60
61 int _bt_get_obex_server_id(void);
62
63 #ifdef __cplusplus
64 }
65 #endif
66
67 #endif /* _BT_EVENT_HANDLER_H_ */