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
36 BT_LE_AD_TYPE_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02,
37 BT_LE_AD_TYPE_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03,
38 BT_LE_AD_TYPE_INCOMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x06,
39 BT_LE_AD_TYPE_COMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x07,
40 BT_LE_AD_TYPE_SHORTENED_LOCAL_NAME = 0x08,
41 BT_LE_AD_TYPE_COMPLETE_LOCAL_NAME = 0x09,
42 BT_LE_AD_TYPE_LIST_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14,
43 BT_LE_AD_TYPE_LIST_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15,
44 BT_LE_AD_TYPE_SERVICE_DATA = 0x16,
45 BT_LE_AD_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF,
46 } bt_le_advertising_data_type_e;
49 BT_LE_PASSIVE_SCAN = 0x00,
62 int _bt_service_adapter_le_init(void);
64 void _bt_service_adapter_le_deinit(void);
66 gboolean _bt_update_le_feature_support(const char *item, const char *value);
68 const char* _bt_get_adv_slot_owner(int slot_id);
70 int _bt_get_adv_slot_adv_handle(int slot_id);
72 void _bt_set_advertising_status(int slot_id, gboolean mode);
74 gboolean _bt_is_advertising(void);
76 void _bt_stop_advertising_by_terminated_process(const char* terminated_name);
78 int _bt_set_advertising(const char *sender, int adv_handle, gboolean enable, gboolean use_reserved_slot);
80 int _bt_set_custom_advertising(const char *sender, int adv_handle, gboolean enable, bluetooth_advertising_params_t *params, gboolean use_reserved_slot);
82 int _bt_hold_current_advertising(void);
84 int _bt_get_advertising_data(bluetooth_advertising_data_t *adv, int *length);
86 int _bt_set_advertising_data(const char *sender, int adv_handle, bluetooth_advertising_data_t *data, int length, gboolean use_reserved_slot);
88 int _bt_get_scan_response_data(bluetooth_scan_resp_data_t *response, int *length);
90 int _bt_set_scan_response_data(const char *sender, int adv_handle, bluetooth_scan_resp_data_t *response, int length, gboolean use_reserved_slot);
92 int _bt_set_scan_parameters(bluetooth_le_scan_params_t *params);
94 gboolean _bt_is_scan_filter_supported(void);
96 int _bt_register_scan_filter(const char *sender, bluetooth_le_scan_filter_t *filter, int *slot_id);
98 int _bt_unregister_scan_filter(const char *sender, int slot_id);
100 int _bt_unregister_all_scan_filters(const char *sender);
102 int _bt_start_le_scan(const char *sender);
104 int _bt_stop_le_scan(const char *sender);
106 void _bt_disable_all_scanner_status(void);
108 void _bt_set_le_scan_status(gboolean mode);
110 gboolean _bt_is_le_scanning(void);
112 void _bt_set_le_scan_type(bt_le_scan_type_t type);
114 bt_le_scan_type_t _bt_get_le_scan_type(void);
116 void _bt_send_scan_result_event(const bt_remote_le_dev_info_t *le_dev_info, const bt_le_adv_info_t *adv_info);
118 void _bt_send_ibeacon_scan_result_event(const bt_remote_ibeacon_dev_info_t *ibeacon_dev_info);
120 int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
122 int _bt_remove_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
124 int _bt_clear_white_list(void);
126 int _bt_le_read_maximum_data_length(bluetooth_le_read_maximum_data_length_t *max_le_datalength);
128 int _bt_le_write_host_suggested_default_data_length(const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
130 int _bt_le_read_host_suggested_default_data_length(bluetooth_le_read_host_suggested_data_length_t *def_data_length);
132 int _bt_le_set_data_length(bluetooth_device_address_t *device_address, const unsigned int max_tx_Octets, const unsigned int max_tx_Time);
134 int _bt_initialize_ipsp(void);
136 int _bt_deinitialize_ipsp(void);
138 void _bt_init_gatt_client_senders(void);
140 int _bt_insert_gatt_client_sender(char *sender);
142 int _bt_delete_gatt_client_sender(char *sender);
144 void _bt_clear_gatt_client_senders(void);
146 void _bt_send_char_value_changed_event(void *param);
148 gboolean _bt_is_set_scan_parameter(void);
150 void _bt_unregister_adv_slot_owner(int slot_id);
154 #endif /* __cplusplus */
155 #endif /*_BT_SERVICE_ADAPTER_LE_H_*/