Tizen 2.1 base
[apps/native/ug-bluetooth-efl.git] / include / bt-main-ug.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_MAIN_UG_H__
18 #define __BT_MAIN_UG_H__
19
20 #ifdef __cplusplus
21 extern "C" {
22 #endif
23
24 #include <stdbool.h>
25 #include <libintl.h>
26 #include <appcore-efl.h>
27 #include <Elementary.h>
28 #include <ui-gadget-module.h>
29 #include <dlog.h>
30 #include <E_DBus.h>
31 #include <bundle.h>
32
33 #include "bt-type-define.h"
34 #include "bt-profile-view.h"
35
36 #ifndef UG_MODULE_API
37 #define UG_MODULE_API __attribute__ ((visibility("default")))
38 #endif
39
40 #define PKGNAME "ug-setting-bluetooth-efl"
41
42 #ifdef PREFIX
43 #undef PREFIX
44 #endif
45 #define PREFIX "/usr/ug/"
46
47 #define LOCALEDIR PREFIX"res/locale"
48
49 #define _EDJ(o)                 elm_layout_edje_get(o)
50
51 #ifdef _
52 #undef _
53 #endif
54 #define _(s)                    dgettext(PKGNAME, s)
55
56 #define dgettext_noop(s)        (s)
57
58 #ifdef N_
59 #undef N_
60 #endif
61 #define N_(s)                   dgettext_noop(s)
62
63 #define BT_UG_VCONF_PRINTSETTING                "memory/bluetooth/printsetting"
64
65 typedef struct {
66         /* UI gadget data */
67         ui_gadget_h ug;
68         Evas_Object *base;
69         Evas_Object *win_main;
70         bt_launch_mode_t bt_launch_mode;
71
72         /* Request timer */
73         Ecore_Timer *request_timer;
74
75         /*************************
76         *          Main View objects
77         ************************ */
78         Evas_Object *navi_bar;
79         Evas_Object *main_layout;
80         Elm_Object_Item *navi_it;
81         Elm_Object_Item *service_navi_it;
82
83         /* Genlist */
84         Evas_Object *main_genlist;
85
86         Evas_Object *selectioninfo;
87
88         /* Paired / Searched devices */
89         Evas_Object *paired_dlggrp;
90         Evas_Object *searched_dlggrp;
91
92         /* Selected device's genlist items */
93         Elm_Object_Item *paired_item;
94         Elm_Object_Item *searched_item;
95
96         /* Paired / Searched device list */
97         Eina_List *paired_device;
98         Eina_List *searched_device;
99
100         /* Button */
101         Evas_Object *onoff_btn;
102         Evas_Object *scan_btn;
103         Evas_Object *radio_main;
104
105         /* Genlist Item class */
106         Elm_Genlist_Item_Class *sp_itc;
107         Elm_Genlist_Item_Class *status_itc;
108         Elm_Genlist_Item_Class *visible_itc;
109         Elm_Genlist_Item_Class *paired_title_itc;
110         Elm_Genlist_Item_Class *searched_title_itc;
111         Elm_Genlist_Item_Class *timeout_value_itc;
112         Elm_Genlist_Item_Class *searched_itc;
113         Elm_Genlist_Item_Class *no_device_itc;
114         Elm_Genlist_Item_Class *device_itc;
115
116         /* Genlist Items */
117         Elm_Object_Item *status_item;
118         Elm_Object_Item *visible_item;
119         Elm_Object_Item *paired_title;
120         Elm_Object_Item *searched_title;
121         Elm_Object_Item *no_device_item;
122         Elm_Object_Item *paired_padding;
123         Elm_Object_Item *searched_padding;
124
125         /*************************
126         *           Popup objects
127         ************************ */
128         Evas_Object *popup;
129         Evas_Object *popup_menu;
130
131         /*************************
132         *          Status Variables
133         ************************ */
134         bool waiting_service_response;
135         bool auto_service_search;
136         bool connect_req;
137         bool search_req;
138         bool aul_launching_req;
139         bool aul_pairing_req;
140         unsigned int op_status;
141         unsigned int ug_status;
142         unsigned int search_type;
143
144         /*************************
145         *          Grobal variables
146         ************************ */
147         Elm_Genlist_Item_Class popup_menu_itc;
148         service_h service;
149         bundle *popup_bundle;
150         int handle;
151         char phone_name[BT_DEVICE_NAME_LENGTH_MAX + 1];
152         int unbonding_count;
153         int selected_radio;
154         int remain_time;
155         bool visible;
156         int timeout_id;
157         int popup_timer;
158         int visibility_timeout;
159         bt_rotate_mode_t rotation;
160         bt_dev_t *pick_device;
161         void *connection;
162
163         /* IPC handler */
164         E_DBus_Connection *EDBusHandle;
165         E_DBus_Signal_Handler *sh;
166         E_DBus_Signal_Handler *popup_sh;
167
168         /* Dbus connection / proxy */
169         void *conn;
170
171         /* End key callback */
172         bt_app_back_cb back_cb;
173
174         /*************************
175         *           Profile  View Data
176         ************************ */
177         bt_profile_view_data *profile_vd;
178         bt_confirm_req_t confirm_req;
179 } bt_ug_data;
180
181 void _bt_ug_destroy(void *data, void *result);
182
183 #ifdef __cplusplus
184 }
185 #endif
186 #endif                          /* __BT_MAIN_UG_H__ */