[cleanup] revise file location
[platform/core/connectivity/bluetooth-share.git] / app / bt-share-ipc.h
1 /*
2  * bluetooth-share
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 __DEF_BLUETOOTH_SHARE_IPC_H_
21 #define __DEF_BLUETOOTH_SHARE_IPC_H_
22
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
26
27 #include <glib.h>
28 #include "bluetooth-api.h"
29 #include "bt-share-main.h"
30
31 #define BT_BLUEZ_INTERFACE "org.freedesktop.DBus"
32 #define BT_BLUEZ_SIGNAL_NAME_OWNER_CHANGED "NameOwnerChanged"
33
34 #define BT_SYSPOPUP_INTERFACE "User.Bluetooth.syspopup"
35 #define BT_SYSPOPUP_METHOD_RESPONSE "Response"
36
37 #define BT_UG_IPC_INTERFACE "User.Bluetooth.UG"
38 #define BT_UG_IPC_METHOD_SEND "Send"
39
40 #define BT_SHARE_UI_INTERFACE "User.BluetoothShare.UI"
41 #define BT_SHARE_UI_SIGNAL_OPPABORT "opp_abort"
42 #define BT_SHARE_UI_SIGNAL_SEND_FILE "send_file"
43 #define BT_SHARE_UI_SIGNAL_INFO_UPDATE "info_update"
44
45 #define BT_SHARE_ENG_INTERFACE "User.BluetoothShare.Engine"
46 #define BT_SHARE_ENG_OBJECT "/org/projectx/transfer_info"
47 #define BT_SHARE_ENG_SIGNAL_UPDATE_VIEW "update_view"
48 #define BT_SHARE_ENG_SIGNAL_OPP_CLIENT_DISCONNECTED "ShareOppClientDisconnected"
49 #define BT_SHARE_ENG_SIGNAL_OPP_SERVER_DISCONNECTED "ShareOppServerDisconnected"
50 #define BT_SHARE_FRWK_INTERFACE "User.Bluetooth.FRWK"
51 #define BT_SHARE_FRWK_SIGNAL_DEINIT "deinit"
52
53 #define BT_CORE_NAME "org.projectx.bt_core"
54 #define BT_CORE_PATH "/org/projectx/bt_core"
55 #define BT_CORE_INTERFACE "org.projectx.btcore"
56
57 #define BT_IPC_STRING_SIZE 256
58 #define BT_ADDR_STR_LEN_MAX     18
59 #define BT_MIME_TYPE_MAX_LEN    20
60
61 #define BT_INBOUND_TABLE        "inbound"
62 #define BT_OUTBOUND_TABLE       "outbound"
63
64 typedef enum {
65         BT_TR_PENDING = -2,
66         BT_TR_ONGOING = -1,
67         BT_TR_SUCCESS,
68         BT_TR_FAIL
69 } bt_app_tr_status_e;
70
71 typedef enum {
72         BT_TR_OUTBOUND,
73         BT_TR_INBOUND
74 } bt_share_tr_type_e;
75
76 typedef struct {
77         int file_cnt;
78         char addr[BLUETOOTH_ADDRESS_LENGTH];
79         char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX];
80         char *mode;
81         char **file_path;
82         char **content;
83         char **type;
84         unsigned int *size;
85 } opc_transfer_info_t;
86
87 gboolean _bt_init_dbus_signal(void);
88 void _bt_deinit_dbus_signal(void);
89
90 void _remove_transfer_info(opc_transfer_info_t *node);
91
92 void _bt_create_warning_popup(int error_type, char *msg);
93 gboolean _bt_update_sent_data_status(int uid,
94                                 bt_app_tr_status_e status, char *db_sid);
95
96 gboolean _bt_update_recv_data_status(int uid,
97                 bt_app_tr_status_e status, char *db_sid,
98                 unsigned int filesize, const char *mime_type);
99
100 gboolean _bt_update_multiple_sent_data_status(int *uids, int uid_cnt,
101                                 bt_app_tr_status_e status, char *db_sid);
102
103 void _bt_update_transfer_list_view(char *db);
104 void _bt_send_disconnected_signal(char *signal, int result, char *address,
105                 int transfer_id);
106 gboolean _bt_add_recv_transfer_status_data(char *device_name,
107                         char *address, char *filepath, char *type,
108                         unsigned int size, int status, char *db_sid);
109 int _bt_share_get_unique_id(int db_table, const char *db_sid);
110 int _bt_set_eventsystem_transfer_value(gboolean value);
111
112 #ifdef __cplusplus
113 }
114 #endif
115 #endif                          /* __DEF_BLUETOOTH_SHARE_IPC_H_ */