BT 5.0: Add APIs to check Extended feature support
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / services / include / bt-service-core-adapter-le.h
1 /*
2  * Copyright (c) 2016 - 2017 Samsung Electronics Co., Ltd. All rights reserved.
3  *
4  * Contact:  Anupam Roy <anupam.r@samsung.com>
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
21 #ifndef _BT_SERVICE_CORE_ADAPTER_LE_H_
22 #define _BT_SERVICE_CORE_ADAPTER_LE_H_
23
24 #include <glib.h>
25 #include <sys/types.h>
26 #include "bluetooth-api.h"
27
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31
32 typedef enum {
33         LE_DISCOVERY_STOPPED,
34         LE_DISCOVERY_STARTED,
35         LE_DISCOVERY_STARTING,
36         LE_DISCOVERY_STOPPING,
37 } bt_le_discovery_state_t;
38
39 typedef enum {
40         BT_LE_DEACTIVATED,
41         BT_LE_ACTIVATED,
42         BT_LE_ACTIVATING,
43         BT_LE_DEACTIVATING,
44 } bt_le_status_t;
45
46 typedef enum {
47         BT_LE_AD_TYPE_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02,
48         BT_LE_AD_TYPE_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03,
49         BT_LE_AD_TYPE_INCOMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x06,
50         BT_LE_AD_TYPE_COMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x07,
51         BT_LE_AD_TYPE_SHORTENED_LOCAL_NAME = 0x08,
52         BT_LE_AD_TYPE_COMPLETE_LOCAL_NAME = 0x09,
53         BT_LE_AD_TYPE_LIST_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14,
54         BT_LE_AD_TYPE_LIST_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15,
55         BT_LE_AD_TYPE_SERVICE_DATA = 0x16,
56         BT_LE_AD_TYPE_TRANSPORT_DISCOVERY_DATA = 0x26,
57         BT_LE_AD_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF,
58 } bt_le_ad_type_t;
59
60 typedef enum {
61         BT_LE_PASSIVE_SCAN = 0x00,
62         BT_LE_ACTIVE_SCAN
63 } bt_le_scan_type_t;
64
65 int _bt_enable_adapter_le(void);
66
67 int _bt_disable_adapter_le(void);
68
69 int _bt_le_init(void);
70
71 void _bt_le_deinit(void);
72
73 int _bt_is_advertising(void);
74 int _bt_set_advertising(const char *sender, int adv_handle, gboolean enable, gboolean use_reserved_slot);
75
76 int _bt_set_custom_advertising(const char *sender, int adv_handle, gboolean enable, bluetooth_advertising_params_t *params, gboolean use_reserved_slot);
77
78 int _bt_set_advertising_data(const char *sender, int adv_handle, bluetooth_advertising_data_t *data, int length, gboolean use_reserved_slot);
79
80 int _bt_set_scan_response_data(const char *sender, int adv_handle, bluetooth_scan_resp_data_t *response, int length, gboolean use_reserved_slot);
81
82 int _bt_get_advertising_data(char *sender, int adv_handle, bluetooth_advertising_data_t *adv, int *length);
83
84 int _bt_get_scan_response_data(char *sender, int adv_handle, bluetooth_scan_resp_data_t *adv, int *length);
85
86 int _bt_start_le_scan(const char *sender, uid_t uid, pid_t pid);
87
88 int _bt_stop_le_scan(const char *sender);
89
90 void _bt_hold_le_scan(void);
91
92 void _bt_restart_le_scan(void);
93
94 int _bt_set_scan_parameters(bluetooth_le_scan_params_t *params);
95
96 int _bt_prepare_scan_parameters(bluetooth_le_scan_params_t *params, int scan_type);
97
98 gboolean _bt_is_le_scanning(void);
99
100 void _bt_check_le_scanner_app_termination(const char *sender);
101
102 void _bt_adapter_set_le_status(bt_le_status_t status);
103
104 bt_le_status_t _bt_adapter_get_le_status(void);
105
106 int _bt_service_le_init(void);
107
108 void _bt_service_le_deinit(void);
109
110 gboolean _bt_is_le_2m_phy_supported(void);
111
112 gboolean _bt_is_le_coded_phy_supported(void);
113
114 gboolean _bt_is_scan_filter_supported(void);
115
116 gboolean _bt_is_le_extended_advertising_supported(void);
117
118 gboolean _bt_is_le_extended_scan_supported(void);
119
120 int _bt_le_get_maximum_advertising_len(void);
121
122 int _bt_set_le_static_random_address(gboolean is_enable);
123
124 bool _bt_is_le_static_random_address_enabled(void);
125
126 int _bt_set_le_privacy(gboolean set_privacy);
127
128 int _bt_set_allow_list(bluetooth_device_address_t *device_address, int address_type, bool is_add);
129
130 int _bt_set_manufacturer_data(bluetooth_manufacturer_data_t *m_data);
131
132 int _bt_unregister_all_scan_filters(const char *sender);
133
134 int _bt_register_scan_filter(const char *sender, bluetooth_le_scan_filter_t *filter);
135 #ifdef __cplusplus
136 }
137 #endif /* __cplusplus */
138 #endif /*_BT_SERVICE_CORE_ADAPTER_LE_H_*/