Tizen 2.1 base
[apps/native/ug-bluetooth-efl.git] / include / bt-ipc-handler.h
1 /*
2  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Flora License, Version 1.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://floralicense.org/license/
9  *
10  * Unless required by applicable law or agreed to in writing,
11  * software 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 __BT_IPC_HANDLER_H__
18 #define __BT_IPC_HANDLER_H__
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include "bt-type-define.h"
25
26 /* ================= IPC interface define  ================= */
27
28 #define BT_UG_IPC_INTERFACE "User.Bluetooth.UG"
29 #define BT_UG_IPC_RECIEVER "org.projectx.bluetooth"
30 #define BT_UG_IPC_REQUEST_OBJECT "/org/projectx/connect_device"
31 #define BT_UG_IPC_RESPONSE_OBJECT "/org/projectx/response_event"
32 #define BT_UG_IPC_METHOD_CONNECT "Connect"
33 #define BT_UG_IPC_METHOD_DISCONNECT "Disconnect"
34 #define BT_UG_IPC_METHOD_RESPONSE "Response"
35 #define BT_UG_IPC_METHOD_SEND "Send"
36 #define BT_UG_IPC_EVENT_CONNECTED "Connected"
37 #define BT_UG_IPC_EVENT_DISCONNECTED    "Disconnected"
38
39 #define BT_SYSPOPUP_IPC_RESPONSE_OBJECT "/org/projectx/bt_syspopup_res"
40 #define BT_SYSPOPUP_INTERFACE "User.Bluetooth.syspopup"
41 #define BT_SYSPOPUP_METHOD_RESPONSE "Response"
42
43 #define BT_UG_IPC_MSG_LEN                               256
44
45 typedef enum {
46         BT_AUDIO_DEVICE,
47         BT_HEADSET_DEVICE,
48         BT_STEREO_HEADSET_DEVICE,
49         BT_HID_DEVICE,
50         BT_NETWORK_DEVICE,
51         BT_DEVICE_MAX,
52 } bt_device_type;
53
54 typedef enum {
55         BT_IPC_AG_CONNECT_RESPONSE,
56         BT_IPC_AG_DISCONNECT_RESPONSE,
57         BT_IPC_AV_CONNECT_RESPONSE,
58         BT_IPC_AV_DISCONNECT_RESPONSE,
59         BT_IPC_HID_CONNECT_RESPONSE,
60         BT_IPC_HID_DISCONNECT_RESPONSE,
61         BT_IPC_SENDING_RESPONSE,
62         BT_IPC_BROWSING_RESPONSE,
63         BT_IPC_PRINTING_RESPONSE,
64         BT_IPC_PAIRING_RESPONSE,
65 } bt_ipc_response_t;
66
67 typedef enum {
68         BT_IPC_SUCCESS,
69         BT_IPC_FAIL,
70 } bt_ipc_result_t;
71
72 typedef struct {
73         int param1; /* Connect type: Headset / Stereo Headset / HID device */
74         char param2[BT_UG_IPC_MSG_LEN]; /* Device address */
75 } __attribute__ ((packed)) bt_ug_ipc_param_t;
76
77 typedef struct {
78         int param1;             /* Reserved */
79         char param2[BT_UG_IPC_MSG_LEN]; /* Device address */
80         int param3;             /* file count */
81         char *param4;           /* File path */
82         char *param5;           /* mode */
83         char *param6;   /* Device name */
84 } __attribute__ ((packed)) obex_ipc_param_t;
85
86 /**
87   * Structure to pass notification from BT application
88   */
89 typedef struct {
90         int param1;
91         int param2;
92 } bt_ug_param_info_t;
93
94 int _bt_ipc_init_event_signal(void *data);
95
96 int _bt_ipc_deinit_event_signal(void *data);
97
98 int _bt_ipc_register_popup_event_signal(E_DBus_Connection *conn,
99                                         void *data);
100
101 int _bt_ipc_unregister_popup_event_signal(E_DBus_Connection *conn,
102                                           void *data);
103
104 int _bt_ipc_send_message(char *method_type, bt_ug_ipc_param_t *param,
105                          void *data);
106
107 int _bt_ipc_send_obex_message(obex_ipc_param_t *param, void *data);
108
109 void _bt_ipc_update_connected_status(bt_ug_data *ugd, int connected_type,
110                                                 bool connected, int result,
111                                                 bt_address_t *addr);
112
113
114 #ifdef __cplusplus
115 }
116 #endif
117 #endif                          /* __BT_IPC_HANDLER_H__ */