Fix profile check logic to distinguish ivi and iot
[apps/native/ug-bluetooth-efl.git] / common / include / bt-util.h
1 /*
2 * ug-bluetooth-efl
3 *
4 * Copyright 2012 Samsung Electronics Co., Ltd
5 *
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 *           GirishAshok Joshi <girish.joshi@samsung.com>
8 *           DoHyun Pyun <dh79.pyun@samsung.com>
9 *
10 * Licensed under the Flora License, Version 1.1 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
13 *
14 * http://www.tizenopensource.org/license
15 *
16 * Unless required by applicable law or agreed to in writing,
17 * software distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
21 *
22 */
23
24 #ifndef __BT_UTIL_H__
25 #define __BT_UTIL_H__
26
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30
31 #include <glib.h>
32 #include <bundle.h>
33 #include <Elementary.h>
34
35 #include "bt-type-define.h"
36
37 /* Major Device Mask */
38 #define MISCELLANEOUS_MAJOR_DEVICE_MASK (0x000000)
39 #define COMPUTER_MAJOR_DEVICE_MASK (0x000100)
40 #define PHONE_MAJOR_DEVICE_MASK (0x000200)
41 #define LAN_MAJOR_DEVICE_MASK (0x000300)
42 #define AV_MAJOR_DEVICE_MASK (0x000400)
43 #define PERIPHERAL_MAJOR_DEVICE_MASK (0x000500)
44 #define IMAGING_MAJOR_DEVICE_MASK (0x000600)
45 #define WEARABLE_MAJOR_DEVICE_MASK (0x000700)
46 #define TOY_MAJOR_DEVICE_MASK (0x000800)
47 #define UNCLASSIFIED_MAJOR_DEVICE_MASK (0x001F00)
48 #define OBJECT_TRANSFER_MAJOR_SERVICE_MASK (0x100000)
49
50 gboolean _bt_util_update_class_of_device_by_service_list(bt_service_class_t service_list,
51                                                  bt_major_class_t *major_class,
52                                                  bt_minor_class_t *minor_class);
53
54 void _bt_util_set_value(const char *req, unsigned int *search_type,
55                         unsigned int *op_mode);
56
57 gboolean _bt_util_store_get_value(const char *key,
58                               bt_store_type_t store_type,
59                               unsigned int size, void *value);
60
61 void _bt_util_launch_no_event(void *data, void *obj, void *event);
62
63 void _bt_util_set_list_disabled(Evas_Object *genlist, Eina_Bool disable);
64
65 void _bt_util_change_discoverable_mode(bt_ug_data *ugd, gboolean discoverable);
66
67 gboolean _bt_util_is_profile_connected(int connected_type, unsigned char *addr);
68
69 int _bt_util_check_any_profile_connected(bt_dev_t *dev);
70
71 void _bt_util_set_phone_name(void);
72
73 int _bt_util_get_phone_name(char *phone_name, int size);
74
75 char * _bt_util_get_timeout_string(int timeout);
76
77 int _bt_util_get_timeout_value(int index);
78
79 int _bt_util_get_timeout_index(int timeout);
80
81 gboolean _bt_util_is_battery_low(void);
82
83 void _bt_util_addr_type_to_addr_string(char *address,
84                                                unsigned char *addr);
85
86 void _bt_util_addr_type_to_addr_result_string(char *address,
87                                                unsigned char *addr);
88
89 void _bt_util_addr_type_to_addr_net_string(char *address,
90                                                unsigned char *addr);
91
92 void _bt_util_addr_string_to_addr_type(unsigned char *addr,
93                                                   const char *address);
94
95 void _bt_util_convert_time_to_string(unsigned int remain_time,
96                                         char *text_display, char *text_read,
97                                         int size_display, int size_read);
98
99 void _bt_util_free_device_uuids(bt_dev_t *item);
100
101 void _bt_util_free_device_item(bt_dev_t *item);
102
103 gboolean _bt_util_is_space_str(const char *name_str);
104
105 void _bt_util_max_len_reached_cb(void *data, Evas_Object *obj,
106                                         void *event_info);
107
108 Eina_Bool _bt_timer_change_discoverable_mode(void *data);
109
110 char *_bt_util_vcard_create_from_id(int id, bool my_profile, const char *working_dir);
111
112 char *_bt_util_vcard_create_from_id_list(const int *id_list, int count, const char *working_dir, volatile bool *cancel);
113
114 int _bt_util_create_dpm_context(void *ug_data);
115
116 void _bt_util_destroy_dpm_context(void *ug_data);
117
118 gboolean _bt_util_is_dpm_restricted(void *handle);
119
120 typedef enum {
121         _PROFILE_UNKNOWN = 0,
122         _PROFILE_MOBILE = 0x1,
123         _PROFILE_WEARABLE = 0x2,
124         _PROFILE_TV = 0x4,
125         _PROFILE_IVI = 0x8,
126         _PROFILE_IOT = 0x10,
127         _PROFILE_COMMON = 0x20,
128 } tizen_profile_t;
129 extern tizen_profile_t _get_tizen_profile();
130 #define TIZEN_PROFILE_TV ((_get_tizen_profile()) == _PROFILE_TV)
131 #define TIZEN_HID ((_get_tizen_profile()) & (_PROFILE_MOBILE | _PROFILE_COMMON))
132 #define TIZEN_COMMON ((_get_tizen_profile()) == _PROFILE_COMMON)
133
134 #ifdef TIZEN_FEATURE_DISABLE_BT_HOG
135 #define TIZEN_FEATURE_BT_HOG (0)
136 #else
137 #define TIZEN_FEATURE_BT_HOG ((_get_tizen_profile() == _PROFILE_MOBILE))
138 #endif
139
140 #ifdef __cplusplus
141 }
142 #endif
143 #endif                          /* __BT_UTIL_H__ */