b0a399bc1d5833a40bf8fe141711d10ffac86868
[apps/native/ug-mobile-ap.git] / src / mh_common_utility.c
1 /*
2 * ug-mobile-ap
3 *
4 * Copyright 2012-2013  Samsung Electronics Co., Ltd
5
6 * Licensed under the Flora License, Version 1.1 (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://floralicense.org/license
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 #include "mh_common_utility.h"
21 #include "mobile_hotspot.h"
22
23 static mh_popup_type_e popup_type = MH_POPUP_NONE;
24 static Evas_Object *popup_content = NULL;
25 static char *popup_string = NULL;
26
27 static void __one_btn_popup_resp(void *data, Evas_Object *obj, void *event_info)
28 {
29         __MOBILE_AP_FUNC_ENTER__;
30
31         if (data == NULL || obj == NULL) {
32                 ERR("The param is NULL\n");
33                 return;
34         }
35
36         mh_appdata_t *ad = (mh_appdata_t *)data;
37
38         evas_object_del(ad->popup);
39         ad->popup = NULL;
40
41         DBG("popup_type : %d\n", popup_type);
42         switch (popup_type) {
43         case MH_POP_USB_CONNECT:
44                 _update_usb_item(ad, MH_STATE_NONE);
45                 vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
46                                 _handle_usb_mode_change);
47                 break;
48
49         case MH_POP_INFORMATION:
50                 break;
51
52         default:
53                 DBG("Unknown popup_type : %d\n", popup_type);
54                 break;
55         }
56
57         __MOBILE_AP_FUNC_EXIT__;
58 }
59
60 static void __alert_popup_resp(void *data, Evas_Object *obj, void *event_info)
61 {
62         __MOBILE_AP_FUNC_ENTER__;
63
64         if (data == NULL || obj == NULL) {
65                 ERR("The param is NULL\n");
66                 return;
67         }
68
69         mh_appdata_t *ad = (mh_appdata_t *)data;
70
71         evas_object_del(ad->popup);
72         ad->popup = NULL;
73
74         DBG("popup_type : %d\n", popup_type);
75         switch (popup_type) {
76         case MH_POP_INFORMATION_WO_BUTTON:
77                 break;
78
79         default:
80                 DBG("Unknown popup_type : %d\n", popup_type);
81                 break;
82         }
83
84         __MOBILE_AP_FUNC_EXIT__;
85 }
86
87 static void __popup_resp_yes(void *data, Evas_Object *obj, void *event_info)
88 {
89         __MOBILE_AP_FUNC_ENTER__;
90
91         if (data == NULL || obj == NULL) {
92                 ERR("The param is NULL\n");
93                 return;
94         }
95
96         mh_appdata_t *ad = (mh_appdata_t *)data;
97         bool wifi_state;
98         int ret = 0;
99
100         evas_object_del(ad->popup);
101         ad->popup = NULL;
102
103         DBG("popup_type : %d\n", popup_type);
104         switch (popup_type) {
105         case MH_POP_WIFI_ON_CONF:
106                 wifi_is_activated(&wifi_state);
107                 DBG("wifi_state : %d\n", wifi_state);
108                 if (wifi_state == false) {
109                         ret = vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_WIFI_STATE,
110                                         VCONFKEY_MOBILE_HOTSPOT_WIFI_PENDING_ON);
111                         if (ret < 0)
112                                 ERR("vconf_set_int() is failed : %d\n", ret);
113
114                         if (_turn_on_wifi(ad) != 0) {
115                                 ERR("_turn_on_wifi is failed\n");
116                                 _update_wifi_item(ad, MH_STATE_NONE);
117                         }
118                 } else if (_is_wifi_direct_on() == true) {
119                         if (_turn_off_wifi_direct(ad) != 0) {
120                                 ERR("_turn_off_wifi_direct is failed\n");
121                                 _update_wifi_item(ad, MH_STATE_NONE);
122                         }
123                 } else {
124                         ret = tethering_enable(ad->handle, TETHERING_TYPE_WIFI);
125                         if (ret != TETHERING_ERROR_NONE) {
126                                 ERR("wifi tethering on is failed : %d\n", ret);
127                                 _update_wifi_item(ad, MH_STATE_NONE);
128                         }
129                 }
130                 break;
131
132         case MH_POP_WIFI_OFF_CONF:
133                 ret = vconf_set_int(VCONFKEY_MOBILE_HOTSPOT_WIFI_STATE,
134                                 VCONFKEY_MOBILE_HOTSPOT_WIFI_PENDING_OFF);
135                 if (ret < 0)
136                         ERR("vconf_set_int() is failed : %d\n", ret);
137
138                 ret = tethering_disable(ad->handle, TETHERING_TYPE_WIFI);
139                 if (ret != TETHERING_ERROR_NONE) {
140                         ERR("wifi tethering off is failed : %d\n", ret);
141                         _update_wifi_item(ad, MH_STATE_NONE);
142                 }
143                 break;
144
145         case MH_POP_BT_ON_CONF:
146                 ret = tethering_enable(ad->handle, TETHERING_TYPE_BT);
147                 if (ret != TETHERING_ERROR_NONE) {
148                         ERR("Error enable bt tethering : %d\n", ret);
149                         _update_bt_item(ad, MH_STATE_NONE);
150                 }
151                 break;
152
153         case MH_POP_USB_ON_CONF:
154                 if (_get_vconf_usb_state() != VCONFKEY_SYSMAN_USB_AVAILABLE) {
155                         _prepare_popup(MH_POP_USB_CONNECT,
156                                         _("IDS_MOBILEAP_POP_CONNECT_USB_CABLE"));
157                         _create_popup(ad);
158                         vconf_notify_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
159                                         _handle_usb_mode_change, (void *)ad);
160                         break;
161                 }
162
163                 _prepare_popup(MH_POP_USB_ON_PREVCONN_CONF,
164                                 _("IDS_MOBILEAP_POP_ENABLING_USB_TETHERING_WILL_DISCONNECT_PREVIOUS_USB_CONNECTION"));
165                 _create_popup(ad);
166                 break;
167
168         case MH_POP_USB_ON_PREVCONN_CONF:
169                 ret = tethering_enable(ad->handle, TETHERING_TYPE_USB);
170                 if (ret != TETHERING_ERROR_NONE) {
171                         ERR("Error enable usb tethering : %d\n", ret);
172                         _update_usb_item(ad, MH_STATE_NONE);
173                 }
174                 break;
175
176         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
177                 _update_wifi_item(ad, MH_STATE_PROCESS);
178                 ret = tethering_disable(ad->handle, TETHERING_TYPE_WIFI);
179                 if (ret != TETHERING_ERROR_NONE) {
180                         ERR("Wi-Fi tethering off is failed : %d\n", ret);
181                         _update_wifi_item(ad, MH_STATE_NONE);
182                 } else
183                         ad->main.need_recover_wifi_tethering = true;
184
185                 mh_draw_wifi_setup_view(ad);
186                 break;
187
188         default:
189                 DBG("Unknown popup_type : %d\n", popup_type);
190                 break;
191         }
192
193         __MOBILE_AP_FUNC_EXIT__;
194 }
195
196 static void __popup_resp_no(void *data, Evas_Object *obj, void *event_info)
197 {
198         __MOBILE_AP_FUNC_ENTER__;
199
200         if (data == NULL || obj == NULL) {
201                 ERR("The param is NULL\n");
202                 return;
203         }
204
205         mh_appdata_t *ad = (mh_appdata_t *)data;
206
207         evas_object_del(ad->popup);
208         ad->popup = NULL;
209
210         DBG("popup_type : %d\n", popup_type);
211         switch (popup_type) {
212         case MH_POP_WIFI_ON_CONF:
213                 _update_wifi_item(ad, MH_STATE_NONE);
214                 break;
215
216         case MH_POP_WIFI_OFF_CONF:
217                 _update_wifi_item(ad, MH_STATE_NONE);
218                 break;
219
220         case MH_POP_BT_ON_CONF:
221                 _update_bt_item(ad, MH_STATE_NONE);
222                 break;
223
224         case MH_POP_USB_ON_CONF:
225                 _update_usb_item(ad, MH_STATE_NONE);
226                 break;
227
228         case MH_POP_USB_ON_PREVCONN_CONF:
229                 _update_usb_item(ad, MH_STATE_NONE);
230                 break;
231
232         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
233                 break;
234
235         default:
236                 DBG("Unknown popup_type : %d\n", popup_type);
237                 break;
238         }
239
240         __MOBILE_AP_FUNC_EXIT__;
241 }
242
243 static bool _count_connected_clients_cb(tethering_client_h client, void *user_data)
244 {
245         if (user_data == NULL) {
246                 ERR("user_data is NULL\n");
247                 return true;
248         }
249
250         int *count = (int *)user_data;
251
252         *count += 1;
253
254         return true;
255 }
256
257 void _prepare_popup_with_content(int type, Evas_Object *obj)
258 {
259         __MOBILE_AP_FUNC_ENTER__;
260
261         if (obj == NULL) {
262                 ERR("param is NULL\n");
263                 return;
264         }
265
266         popup_type = type;
267
268         if (popup_content)
269                 evas_object_del(popup_content);
270         popup_content = obj;
271
272         if (popup_string) {
273                 free(popup_string);
274                 popup_string = NULL;
275         }
276
277         __MOBILE_AP_FUNC_EXIT__;
278 }
279
280 void _prepare_popup(int type, const char *str)
281 {
282         __MOBILE_AP_FUNC_ENTER__;
283
284         if (str == NULL) {
285                 ERR("param is NULL\n");
286                 return;
287         }
288
289         popup_type = type;
290         popup_content = NULL;
291
292         if (popup_string)
293                 free(popup_string);
294
295         popup_string = strndup(str, MH_LABEL_LENGTH_MAX);
296         if (popup_string == NULL)
297                 ERR("strndup is failed\n");
298
299         __MOBILE_AP_FUNC_EXIT__;
300 }
301
302 Eina_Bool _create_popup(mh_appdata_t *ad)
303 {
304         __MOBILE_AP_FUNC_ENTER__;
305
306         Evas_Object *btn = NULL;
307
308         if (ad == NULL) {
309                 ERR("The param is NULL\n");
310                 if (popup_string) {
311                         free(popup_string);
312                         popup_string = NULL;
313                 }
314                 popup_content = NULL;
315
316                 return EINA_FALSE;
317         }
318
319         if (ad->popup != NULL) {
320                 DBG("Pop-up already exists. Delete it.\n");
321                 evas_object_del(ad->popup);
322                 ad->popup = NULL;
323         }
324
325         DBG("Create_popup %d\n", popup_type);
326         switch (popup_type) {
327         case MH_POP_WIFI_ON_CONF:
328                 ad->popup = elm_popup_add(ad->win);
329                 evas_object_size_hint_weight_set(ad->popup,
330                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
331
332                 if (popup_content == NULL)
333                         elm_object_text_set(ad->popup, popup_string);
334                 else
335                         elm_object_content_set(ad->popup, popup_content);
336
337                 btn = elm_button_add(ad->popup);
338                 elm_object_style_set(btn, "popup_button/default");
339                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
340                 elm_object_part_content_set(ad->popup, "button1", btn);
341                 evas_object_smart_callback_add(btn, "clicked",
342                                 __popup_resp_yes, (void *)ad);
343
344                 btn = elm_button_add(ad->popup);
345                 elm_object_style_set(btn, "popup_button/default");
346                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
347                 elm_object_part_content_set(ad->popup, "button2", btn);
348                 evas_object_smart_callback_add(btn, "clicked",
349                                 __popup_resp_no, (void *)ad);
350
351                 evas_object_show(ad->popup);
352                 break;
353
354         case MH_POP_WIFI_OFF_CONF:
355                 ad->popup = elm_popup_add(ad->win);
356                 evas_object_size_hint_weight_set(ad->popup,
357                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
358
359                 if (popup_content == NULL)
360                         elm_object_text_set(ad->popup, popup_string);
361                 else
362                         elm_object_content_set(ad->popup, popup_content);
363
364                 btn = elm_button_add(ad->popup);
365                 elm_object_style_set(btn, "popup_button/default");
366                 elm_object_text_set(btn, S_("IDS_COM_SK_YES"));
367                 elm_object_part_content_set(ad->popup, "button1", btn);
368                 evas_object_smart_callback_add(btn, "clicked",
369                                 __popup_resp_yes, (void *)ad);
370
371                 btn = elm_button_add(ad->popup);
372                 elm_object_style_set(btn, "popup_button/default");
373                 elm_object_text_set(btn, S_("IDS_COM_SK_NO"));
374                 elm_object_part_content_set(ad->popup, "button2", btn);
375                 evas_object_smart_callback_add(btn, "clicked",
376                                 __popup_resp_no, (void *)ad);
377
378                 evas_object_show(ad->popup);
379                 break;
380
381         case MH_POP_USB_CONNECT:
382                 ad->popup = elm_popup_add(ad->win);
383                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
384                                 EVAS_HINT_EXPAND);
385
386                 if (popup_content == NULL)
387                         elm_object_text_set(ad->popup, popup_string);
388                 else
389                         elm_object_content_set(ad->popup, popup_content);
390
391                 btn = elm_button_add(ad->popup);
392                 elm_object_style_set(btn, "popup_button/default");
393                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
394                 elm_object_part_content_set(ad->popup, "button1", btn);
395                 evas_object_smart_callback_add(btn, "clicked",
396                                 __one_btn_popup_resp, (void *)ad);
397
398                 evas_object_show(ad->popup);
399                 break;
400
401         case MH_POP_BT_ON_CONF:
402                 ad->popup = elm_popup_add(ad->win);
403                 evas_object_size_hint_weight_set(ad->popup,
404                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
405
406                 if (popup_content == NULL)
407                         elm_object_text_set(ad->popup, popup_string);
408                 else
409                         elm_object_content_set(ad->popup, popup_content);
410
411                 btn = elm_button_add(ad->popup);
412                 elm_object_style_set(btn, "popup_button/default");
413                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
414                 elm_object_part_content_set(ad->popup, "button1", btn);
415                 evas_object_smart_callback_add(btn, "clicked",
416                                 __popup_resp_yes, (void *)ad);
417
418                 btn = elm_button_add(ad->popup);
419                 elm_object_style_set(btn, "popup_button/default");
420                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
421                 elm_object_part_content_set(ad->popup, "button2", btn);
422                 evas_object_smart_callback_add(btn, "clicked",
423                                 __popup_resp_no, (void *)ad);
424
425                 evas_object_show(ad->popup);
426                 break;
427
428         case MH_POP_USB_ON_CONF:
429         case MH_POP_USB_ON_PREVCONN_CONF:
430                 ad->popup = elm_popup_add(ad->win);
431                 evas_object_size_hint_weight_set(ad->popup,
432                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
433
434                 if (popup_content == NULL)
435                         elm_object_text_set(ad->popup, popup_string);
436                 else
437                         elm_object_content_set(ad->popup, popup_content);
438
439                 btn = elm_button_add(ad->popup);
440                 elm_object_style_set(btn, "popup_button/default");
441                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
442                 elm_object_part_content_set(ad->popup, "button1", btn);
443                 evas_object_smart_callback_add(btn, "clicked",
444                                 __popup_resp_yes, (void *)ad);
445
446                 btn = elm_button_add(ad->popup);
447                 elm_object_style_set(btn, "popup_button/default");
448                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
449                 elm_object_part_content_set(ad->popup, "button2", btn);
450                 evas_object_smart_callback_add(btn, "clicked",
451                                 __popup_resp_no, (void *)ad);
452
453                 evas_object_show(ad->popup);
454                 break;
455
456         case MH_POP_INFORMATION:
457                 ad->popup = elm_popup_add(ad->win);
458                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
459                                 EVAS_HINT_EXPAND);
460
461                 if (popup_content == NULL)
462                         elm_object_text_set(ad->popup, popup_string);
463                 else
464                         elm_object_content_set(ad->popup, popup_content);
465
466                 btn = elm_button_add(ad->popup);
467                 elm_object_style_set(btn, "popup_button/default");
468                 elm_object_text_set(btn, S_("IDS_COM_POP_CLOSE"));
469                 elm_object_part_content_set(ad->popup, "button1", btn);
470                 evas_object_smart_callback_add(btn, "clicked",
471                                 __one_btn_popup_resp, (void *)ad);
472
473                 evas_object_show(ad->popup);
474                 break;
475
476         case MH_POP_INFORMATION_WO_BUTTON:
477                 ad->popup = elm_popup_add(ad->win);
478                 evas_object_size_hint_weight_set(ad->popup, EVAS_HINT_EXPAND,
479                                 EVAS_HINT_EXPAND);
480
481                 if (popup_content == NULL)
482                         elm_object_text_set(ad->popup, popup_string);
483                 else
484                         elm_object_content_set(ad->popup, popup_content);
485
486                 elm_popup_timeout_set(ad->popup, MH_POPUP_TIMEOUT);
487                 evas_object_smart_callback_add(ad->popup, "timeout",
488                                 __alert_popup_resp, (void *)ad);
489                 evas_object_smart_callback_add(ad->popup, "block,clicked",
490                                 __alert_popup_resp, (void *)ad);
491
492                 evas_object_show(ad->popup);
493                 break;
494
495         case MH_POP_ENTER_TO_WIFI_SETUP_CONF:
496                 ad->popup = elm_popup_add(ad->win);
497                 evas_object_size_hint_weight_set(ad->popup,
498                                 EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
499
500                 if (popup_content == NULL)
501                         elm_object_text_set(ad->popup, popup_string);
502                 else
503                         elm_object_content_set(ad->popup, popup_content);
504
505                 btn = elm_button_add(ad->popup);
506                 elm_object_style_set(btn, "popup_button/default");
507                 elm_object_text_set(btn, S_("IDS_COM_SK_OK"));
508                 elm_object_part_content_set(ad->popup, "button1", btn);
509                 evas_object_smart_callback_add(btn, "clicked",
510                                 __popup_resp_yes, (void *)ad);
511
512                 btn = elm_button_add(ad->popup);
513                 elm_object_style_set(btn, "popup_button/default");
514                 elm_object_text_set(btn, S_("IDS_COM_SK_CANCEL"));
515                 elm_object_part_content_set(ad->popup, "button2", btn);
516                 evas_object_smart_callback_add(btn, "clicked",
517                                 __popup_resp_no, (void *)ad);
518
519                 evas_object_show(ad->popup);
520                 break;
521         default:
522                 ERR("Unknown popup_type : %d\n", popup_type);
523                 break;
524         }
525
526         if (popup_string) {
527                 free(popup_string);
528                 popup_string = NULL;
529         }
530         popup_content = NULL;
531
532         __MOBILE_AP_FUNC_EXIT__;
533
534         return EINA_TRUE;
535 }
536
537 void _destroy_popup(mh_appdata_t *ad)
538 {
539         __MOBILE_AP_FUNC_ENTER__;
540
541         if (ad && ad->popup) {
542                 evas_object_del(ad->popup);
543                 ad->popup = NULL;
544         }
545
546         if (popup_string) {
547                 free(popup_string);
548                 popup_string = NULL;
549         }
550         popup_content = NULL;
551         popup_type = MH_POPUP_NONE;
552
553         __MOBILE_AP_FUNC_EXIT__;
554
555         return;
556 }
557
558 Evas_Object *_create_bg(Evas_Object *parent, const char *style)
559 {
560         __MOBILE_AP_FUNC_ENTER__;
561
562         if (parent == NULL || style == NULL) {
563                 ERR("The param is NULL\n");
564                 return NULL;
565         }
566
567         Evas_Object *bg = NULL;
568
569         bg = elm_bg_add(parent);
570         if (bg == NULL) {
571                 ERR("bg is NULL\n");
572                 return NULL;
573         }
574
575         evas_object_size_hint_weight_set(bg, EVAS_HINT_EXPAND, EVAS_HINT_EXPAND);
576         elm_object_style_set(bg, style);
577         evas_object_show(bg);
578
579         return bg;
580 }
581
582 Evas_Object *_create_win_layout(mh_appdata_t *ad)
583 {
584         __MOBILE_AP_FUNC_ENTER__;
585
586         if (ad->win == NULL) {
587                 ERR("There is no main window\n");
588                 return NULL;
589         }
590
591         Evas_Object *layout;
592         Evas_Object *bg;
593
594         layout = elm_layout_add(ad->win);
595         if (layout == NULL) {
596                 ERR("layout is NULL\n");
597                 return NULL;
598         }
599
600         elm_layout_theme_set(layout, "layout", "application", "default");
601         evas_object_size_hint_weight_set(layout, EVAS_HINT_EXPAND,
602                         EVAS_HINT_EXPAND);
603
604         bg = _create_bg(layout, "group_list");
605         if (bg == NULL) {
606                 ERR("bg is NULL\n");
607                 evas_object_del(layout);
608                 return NULL;
609         }
610         elm_object_part_content_set(layout, "elm.swallow.bg", bg);
611
612         evas_object_show(layout);
613
614         ad->layout = layout;
615         ad->bg = bg;
616
617         __MOBILE_AP_FUNC_EXIT__;
618
619         return layout;
620 }
621
622 Evas_Object *_create_naviframe(Evas_Object *parent)
623 {
624         __MOBILE_AP_FUNC_ENTER__;
625
626         if (parent == NULL) {
627                 ERR("parent is NULL\n");
628                 return NULL;
629         }
630
631         Evas_Object *naviframe;
632
633         naviframe = elm_naviframe_add(parent);
634         if (naviframe == NULL) {
635                 ERR("naviframe is NULL\n");
636                 return NULL;
637         }
638         evas_object_show(naviframe);
639
640         __MOBILE_AP_FUNC_EXIT__;
641
642         return naviframe;
643 }
644
645 void _handle_usb_mode_change(keynode_t *key, void *data)
646 {
647         mh_appdata_t *ad = (mh_appdata_t *)data;
648         int vconf_key = 0;
649
650         if (!data) {
651                 ERR("The param is NULL\n");
652                 return;
653         }
654
655         if (vconf_keynode_get_type(key) != VCONF_TYPE_INT) {
656                 ERR("Invalid vconf key\n");
657                 return;
658         }
659
660         vconf_key = vconf_keynode_get_int(key);
661         DBG("vconf_key : %d\n", vconf_key);
662         if (vconf_key == SETTING_USB_NONE_MODE) {
663                 DBG("usb-utilties is processing mode change\n");
664                 return;
665         }
666
667         vconf_ignore_key_changed(VCONFKEY_SETAPPL_USB_MODE_INT,
668                                 _handle_usb_mode_change);
669
670         evas_object_del(ad->popup);
671         ad->popup = NULL;
672
673         if (tethering_enable(ad->handle, TETHERING_TYPE_USB) != TETHERING_ERROR_NONE) {
674                 DBG("Error enable usb tethering\n");
675                 _update_usb_item(ad, MH_STATE_NONE);
676         }
677 }
678
679 int _get_vconf_hotspot_mode(void)
680 {
681         int value = VCONFKEY_MOBILE_HOTSPOT_MODE_NONE;
682
683         if (vconf_get_int(VCONFKEY_MOBILE_HOTSPOT_MODE, &value) < 0) {
684                 ERR("vconf_get_int is failed\n");
685                 return 0;
686         }
687
688         DBG("%s : %d\n", VCONFKEY_MOBILE_HOTSPOT_MODE, value);
689
690         return value;
691 }
692
693 Eina_Bool _get_no_of_connected_device(tethering_h handle, int *no, tethering_type_e type)
694 {
695         if (handle == NULL || no == NULL)
696                 return FALSE;
697
698         tethering_foreach_connected_clients(handle, type,
699                         _count_connected_clients_cb, (void *)no);
700
701         return TRUE;
702 }
703
704 Evas_Object *_create_label(Evas_Object *parent, const char *text)
705 {
706         Evas_Object *label;
707
708         label = elm_entry_add(parent);
709         if (label == NULL) {
710                 ERR("elm_entry_add is failed\n");
711                 return NULL;
712         }
713
714         elm_entry_editable_set(label, EINA_FALSE);
715         elm_entry_context_menu_disabled_set(label, EINA_TRUE);
716         elm_object_text_set(label, text);
717
718         evas_object_size_hint_weight_set(label, EVAS_HINT_EXPAND, 0.0);
719         evas_object_size_hint_align_set(label, EVAS_HINT_FILL, EVAS_HINT_FILL);
720         evas_object_show(label);
721
722         return label;
723 }
724
725 Evas_Object *_create_slide_title(Evas_Object *parent, const char *text)
726 {
727         if (parent == NULL || text == NULL)
728                 return NULL;
729
730         Evas_Object *label;
731
732         label = elm_label_add(parent);
733         elm_object_style_set(label, "naviframe_title");
734         elm_label_slide_mode_set(label, ELM_LABEL_SLIDE_MODE_AUTO);
735         elm_label_wrap_width_set(label, 1);
736         elm_label_ellipsis_set(label, EINA_TRUE);
737         elm_object_text_set(label, text);
738         evas_object_show(label);
739
740         elm_access_object_unregister(label);
741         return label;
742 }