Set a default LE(LL) TX packet length to maximum
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-adapter-le.h
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  * Licensed under the Apache License, Version 2.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://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * 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
18
19 #ifndef _BT_SERVICE_ADAPTER_LE_H_
20 #define _BT_SERVICE_ADAPTER_LE_H_
21
22 #include <glib.h>
23 #include <sys/types.h>
24 #include "bluetooth-api.h"
25
26 #ifdef __cplusplus
27 extern "C" {
28 #endif
29
30 #define BT_LE_SCAN_INTERVAL_MIN 2.5
31 #define BT_LE_SCAN_INTERVAL_MAX 10240
32 #define BT_LE_SCAN_WINDOW_MIN 2.5
33 #define BT_LE_SCAN_WINDOW_MAX 10240
34
35 #define BT_LE_TX_LEN_DEFAULT    0x001b
36 #define BT_LE_TX_TIME_DEFAULT   0x0148
37 #define BT_LE_TX_LEN_MAX        0x00fb
38 #define BT_LE_TX_TIME_MAX       0x0848
39
40 typedef enum {
41         BT_LE_AD_TYPE_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02,
42         BT_LE_AD_TYPE_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03,
43         BT_LE_AD_TYPE_INCOMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x06,
44         BT_LE_AD_TYPE_COMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x07,
45         BT_LE_AD_TYPE_SHORTENED_LOCAL_NAME = 0x08,
46         BT_LE_AD_TYPE_COMPLETE_LOCAL_NAME = 0x09,
47         BT_LE_AD_TYPE_LIST_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14,
48         BT_LE_AD_TYPE_LIST_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15,
49         BT_LE_AD_TYPE_SERVICE_DATA = 0x16,
50         BT_LE_AD_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF,
51 } bt_le_advertising_data_type_e;
52
53 typedef enum {
54         BT_LE_PASSIVE_SCAN = 0x00,
55         BT_LE_ACTIVE_SCAN
56 } bt_le_scan_type_t;
57
58 typedef struct {
59         char *addr;
60         int addr_type;
61         int rssi;
62         int data_len;
63         char *data;
64         guint timer_id;
65 } bt_le_adv_info_t;
66
67 int _bt_service_adapter_le_init(void);
68
69 void _bt_service_adapter_le_deinit(void);
70
71 gboolean _bt_update_le_feature_support(const char *item, const char *value);
72
73 const char* _bt_get_adv_slot_owner(int slot_id);
74
75 int _bt_get_adv_slot_adv_handle(int slot_id);
76
77 void _bt_set_advertising_status(int slot_id, gboolean mode);
78
79 gboolean _bt_is_advertising(void);
80
81 void _bt_stop_advertising_by_terminated_process(const char* terminated_name);
82
83 int _bt_set_advertising(const char *sender, int adv_handle, gboolean enable, gboolean use_reserved_slot);
84
85 int _bt_set_custom_advertising(const char *sender, int adv_handle, gboolean enable, bluetooth_advertising_params_t *params, gboolean use_reserved_slot);
86
87 int _bt_hold_current_advertising(void);
88
89 int _bt_get_advertising_data(bluetooth_advertising_data_t *adv, int *length);
90
91 int _bt_set_advertising_data(const char *sender, int adv_handle, bluetooth_advertising_data_t *data, int length, gboolean use_reserved_slot);
92
93 int _bt_get_scan_response_data(bluetooth_scan_resp_data_t *response, int *length);
94
95 int _bt_set_scan_response_data(const char *sender, int adv_handle, bluetooth_scan_resp_data_t *response, int length, gboolean use_reserved_slot);
96
97 int _bt_set_scan_parameters(bluetooth_le_scan_params_t *params);
98
99 gboolean _bt_is_scan_filter_supported(void);
100
101 int _bt_register_scan_filter(const char *sender, bluetooth_le_scan_filter_t *filter, int *slot_id);
102
103 int _bt_unregister_scan_filter(const char *sender, int slot_id);
104
105 int _bt_unregister_all_scan_filters(const char *sender);
106
107 int _bt_start_le_scan(const char *sender);
108
109 int _bt_stop_le_scan(const char *sender);
110
111 void _bt_disable_all_scanner_status(void);
112
113 void _bt_set_le_scan_status(gboolean mode);
114
115 gboolean _bt_is_le_scanning(void);
116
117 void _bt_set_le_scan_type(bt_le_scan_type_t type);
118
119 bt_le_scan_type_t _bt_get_le_scan_type(void);
120
121 void _bt_send_scan_result_event(const bt_remote_le_dev_info_t *le_dev_info, const bt_le_adv_info_t *adv_info);
122
123 void _bt_send_ibeacon_scan_result_event(const bt_remote_ibeacon_dev_info_t *ibeacon_dev_info);
124
125 int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
126
127 int _bt_remove_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
128
129 int _bt_clear_white_list(void);
130
131 int _bt_le_read_maximum_data_length(bluetooth_le_read_maximum_data_length_t *max_le_datalength);
132
133 int _bt_le_write_host_suggested_default_data_length(const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
134
135 int _bt_le_read_host_suggested_default_data_length(bluetooth_le_read_host_suggested_data_length_t *def_data_length);
136
137 int _bt_le_set_data_length(bluetooth_device_address_t *device_address, const unsigned int max_tx_Octets, const unsigned int max_tx_Time);
138
139 int _bt_le_set_max_packet_len(void);
140
141 int _bt_initialize_ipsp(void);
142
143 int _bt_deinitialize_ipsp(void);
144
145 void _bt_init_gatt_client_senders(void);
146
147 int _bt_insert_gatt_client_sender(char *sender);
148
149 int _bt_delete_gatt_client_sender(char *sender);
150
151 void _bt_clear_gatt_client_senders(void);
152
153 void _bt_send_char_value_changed_event(void *param);
154
155 gboolean _bt_is_set_scan_parameter(void);
156
157 void _bt_unregister_adv_slot_owner(int slot_id);
158
159 #ifdef __cplusplus
160 }
161 #endif /* __cplusplus */
162 #endif /*_BT_SERVICE_ADAPTER_LE_H_*/
163