1572c7ed758447a946ed9417eb4123e5464fc256
[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         Elm_Object_Item *bottom_padding;
125         Elm_Object_Item *visible_exp_item[5];
126
127         /*************************
128         *           Popup objects
129         ************************ */
130         Evas_Object *popup;
131         Evas_Object *popup_menu;
132
133         /*************************
134         *          Status Variables
135         ************************ */
136         bool waiting_service_response;
137         bool auto_service_search;
138         bool connect_req;
139         bool search_req;
140         bool aul_launching_req;
141         bool aul_pairing_req;
142         unsigned int op_status;
143         unsigned int ug_status;
144         unsigned int search_type;
145
146         /*************************
147         *          Grobal variables
148         ************************ */
149         Elm_Genlist_Item_Class popup_menu_itc;
150         service_h service;
151         bundle *popup_bundle;
152         int handle;
153         char phone_name[BT_DEVICE_NAME_LENGTH_MAX + 1];
154         int unbonding_count;
155         int selected_radio;
156         int remain_time;
157         time_t start_time;
158         bool visible;
159         int timeout_id;
160         int popup_timer;
161         int visibility_timeout;
162         bt_rotate_mode_t rotation;
163         bt_dev_t *pick_device;
164         void *connection;
165
166         /* IPC handler */
167         E_DBus_Connection *EDBusHandle;
168         E_DBus_Signal_Handler *sh;
169         E_DBus_Signal_Handler *popup_sh;
170
171         /* Dbus connection / proxy */
172         void *conn;
173
174         /* End key callback */
175         bt_app_back_cb back_cb;
176
177         /*************************
178         *           Profile  View Data
179         ************************ */
180         bt_profile_view_data *profile_vd;
181         bt_confirm_req_t confirm_req;
182 } bt_ug_data;
183
184 void _bt_ug_destroy(void *data, void *result);
185
186 #ifdef __cplusplus
187 }
188 #endif
189 #endif                          /* __BT_MAIN_UG_H__ */