19535144b2fa93796590bf2b32d560b94fc33976
[platform/core/connectivity/bluetooth-frwk.git] / bt-service / include / bt-service-adapter-le.h
1 /*
2  * Bluetooth-frwk
3  *
4  * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
5  *
6  * Contact:  Hocheol Seo <hocheol.seo@samsung.com>
7  *               Girishashok Joshi <girish.joshi@samsung.com>
8  *               Chanyeol Park <chanyeol.park@samsung.com>
9  *
10  * Licensed under the Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
15  *
16  * Unless required by applicable law or agreed to in writing, software
17  * 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
25 #ifndef _BT_SERVICE_ADAPTER_LE_H_
26 #define _BT_SERVICE_ADAPTER_LE_H_
27
28 #include <glib.h>
29 #include <sys/types.h>
30 #include "bluetooth-api.h"
31
32 #ifdef __cplusplus
33 extern "C" {
34 #endif
35
36 #define BT_LE_SCAN_INTERVAL_MIN 2.5
37 #define BT_LE_SCAN_INTERVAL_MAX 10240
38 #define BT_LE_SCAN_WINDOW_MIN 2.5
39 #define BT_LE_SCAN_WINDOW_MAX 10240
40
41 typedef enum {
42         BT_LE_AD_TYPE_INCOMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x02,
43         BT_LE_AD_TYPE_COMP_LIST_16_BIT_SERVICE_CLASS_UUIDS = 0x03,
44         BT_LE_AD_TYPE_INCOMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x06,
45         BT_LE_AD_TYPE_COMP_LIST_128_BIT_SERVICE_CLASS_UUIDS = 0x07,
46         BT_LE_AD_TYPE_SHORTENED_LOCAL_NAME = 0x08,
47         BT_LE_AD_TYPE_COMPLETE_LOCAL_NAME = 0x09,
48         BT_LE_AD_TYPE_LIST_16_BIT_SERVICE_SOLICITATION_UUIDS = 0x14,
49         BT_LE_AD_TYPE_LIST_128_BIT_SERVICE_SOLICITATION_UUIDS = 0x15,
50         BT_LE_AD_TYPE_SERVICE_DATA = 0x16,
51         BT_LE_AD_TYPE_MANUFACTURER_SPECIFIC_DATA = 0xFF,
52 } bt_le_advertising_data_type_e;
53
54 typedef enum {
55         BT_LE_PASSIVE_SCAN = 0x00,
56         BT_LE_ACTIVE_SCAN
57 } bt_le_scan_type_t;
58
59 typedef struct {
60         char *addr;
61         int data_len;
62         char *data;
63 } bt_le_adv_info_t;
64
65 int _bt_service_adapter_le_init(void);
66
67 void _bt_service_adapter_le_deinit(void);
68
69 gboolean _bt_update_le_feature_support(const char *item, const char *value);
70
71 const char* _bt_get_adv_slot_owner(int slot_id);
72
73 int _bt_get_adv_slot_adv_handle(int slot_id);
74
75 void _bt_set_advertising_status(int slot_id, gboolean mode);
76
77 gboolean _bt_is_advertising(void);
78
79 void _bt_stop_advertising_by_terminated_process(const char* terminated_name);
80
81 int _bt_set_advertising(const char *sender, int adv_handle, gboolean enable, gboolean use_reserved_slot);
82
83 int _bt_set_custom_advertising(const char *sender, int adv_handle, gboolean enable, bluetooth_advertising_params_t *params, gboolean use_reserved_slot);
84
85 int _bt_get_advertising_data(bluetooth_advertising_data_t *adv, int *length);
86
87 int _bt_set_advertising_data(const char *sender, int adv_handle, bluetooth_advertising_data_t *data, int length, gboolean use_reserved_slot);
88
89 int _bt_get_scan_response_data(bluetooth_scan_resp_data_t *response, int *length);
90
91 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
93 int _bt_set_scan_parameters(bluetooth_le_scan_params_t *params);
94
95 int _bt_register_scan_filter(const char *sender, bluetooth_le_scan_filter_t *filter, int *slot_id);
96
97 int _bt_unregister_scan_filter(const char *sender, int slot_id);
98
99 int _bt_unregister_all_scan_filters(const char *sender);
100
101 int _bt_start_le_scan(const char *sender);
102
103 int _bt_stop_le_scan(const char *sender);
104
105 void _bt_disable_all_scanner_status(void);
106
107 void _bt_set_le_scan_status(gboolean mode);
108
109 gboolean _bt_is_le_scanning(void);
110
111 void _bt_set_le_scan_type(bt_le_scan_type_t type);
112
113 bt_le_scan_type_t _bt_get_le_scan_type(void);
114
115 void _bt_send_scan_result_event(const bt_remote_le_dev_info_t *le_dev_info, const bt_le_adv_info_t *adv_info);
116
117 int _bt_add_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
118
119 int _bt_remove_white_list(bluetooth_device_address_t *device_address, bluetooth_device_address_type_t address_type);
120
121 int _bt_clear_white_list(void);
122
123 #ifdef __cplusplus
124 }
125 #endif /* __cplusplus */
126 #endif /*_BT_SERVICE_ADAPTER_LE_H_*/
127