2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #ifndef _BT_SERVICE_ADAPTER_LE_H_
20 #define _BT_SERVICE_ADAPTER_LE_H_
23 #include <sys/types.h>
24 #include "bluetooth-api.h"
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
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
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;
54 BT_LE_PASSIVE_SCAN = 0x00,
67 int _bt_service_adapter_le_init(void);
69 void _bt_service_adapter_le_deinit(void);
71 gboolean _bt_update_le_feature_support(const char *item, const char *value);
73 const char* _bt_get_adv_slot_owner(int slot_id);
75 int _bt_get_adv_slot_adv_handle(int slot_id);
77 void _bt_set_advertising_status(int slot_id, gboolean mode);
79 gboolean _bt_is_advertising(void);
81 void _bt_stop_advertising_by_terminated_process(const char* terminated_name);
83 int _bt_set_advertising(const char *sender, int adv_handle, gboolean enable, gboolean use_reserved_slot);
85 int _bt_set_custom_advertising(const char *sender, int adv_handle, gboolean enable, bluetooth_advertising_params_t *params, gboolean use_reserved_slot);
87 int _bt_hold_current_advertising(void);
89 int _bt_get_advertising_data(bluetooth_advertising_data_t *adv, int *length);
91 int _bt_set_advertising_data(const char *sender, int adv_handle, bluetooth_advertising_data_t *data, int length, gboolean use_reserved_slot);
93 int _bt_get_scan_response_data(bluetooth_scan_resp_data_t *response, int *length);
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);
97 int _bt_set_scan_parameters(bluetooth_le_scan_params_t *params);
99 gboolean _bt_is_scan_filter_supported(void);
101 int _bt_register_scan_filter(const char *sender, bluetooth_le_scan_filter_t *filter, int *slot_id);
103 int _bt_unregister_scan_filter(const char *sender, int slot_id);
105 int _bt_unregister_all_scan_filters(const char *sender);
107 int _bt_start_le_scan(const char *sender);
109 int _bt_stop_le_scan(const char *sender);
111 void _bt_disable_all_scanner_status(void);
113 void _bt_set_le_scan_status(gboolean mode);
115 gboolean _bt_is_le_scanning(void);
117 void _bt_set_le_scan_type(bt_le_scan_type_t type);
119 bt_le_scan_type_t _bt_get_le_scan_type(void);
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);
123 void _bt_send_ibeacon_scan_result_event(const bt_remote_ibeacon_dev_info_t *ibeacon_dev_info);
125 int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
127 int _bt_remove_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
129 int _bt_clear_white_list(void);
131 int _bt_le_read_maximum_data_length(bluetooth_le_read_maximum_data_length_t *max_le_datalength);
133 int _bt_le_write_host_suggested_default_data_length(const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
135 int _bt_le_read_host_suggested_default_data_length(bluetooth_le_read_host_suggested_data_length_t *def_data_length);
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);
139 int _bt_le_set_max_packet_len(void);
141 int _bt_initialize_ipsp(void);
143 int _bt_deinitialize_ipsp(void);
145 void _bt_init_gatt_client_senders(void);
147 int _bt_insert_gatt_client_sender(char *sender);
149 int _bt_delete_gatt_client_sender(char *sender);
151 void _bt_clear_gatt_client_senders(void);
153 void _bt_send_char_value_changed_event(void *param);
155 gboolean _bt_is_set_scan_parameter(void);
157 void _bt_unregister_adv_slot_owner(int slot_id);
161 #endif /* __cplusplus */
162 #endif /*_BT_SERVICE_ADAPTER_LE_H_*/