1 /******************************************************************************
3 * Copyright (C) 2009-2012 Broadcom Corporation
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at:
9 * http://www.apache.org/licenses/LICENSE-2.0
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
17 ******************************************************************************/
19 #ifndef BTIF_STORAGE_H
20 #define BTIF_STORAGE_H
24 /*******************************************************************************
26 ********************************************************************************/
27 #define BTIF_STORAGE_FILL_PROPERTY(p_prop, t, l, p_v) \
28 (p_prop)->type = t;(p_prop)->len = l; (p_prop)->val = (p_v);
30 /*******************************************************************************
32 ********************************************************************************/
34 /*******************************************************************************
36 ** Function btif_storage_get_adapter_property
38 ** Description BTIF storage API - Fetches the adapter property->type
39 ** from NVRAM and fills property->val.
40 ** Caller should provide memory for property->val and
41 ** set the property->val
43 ** Returns BT_STATUS_SUCCESS if the fetch was successful,
44 ** BT_STATUS_FAIL otherwise
46 *******************************************************************************/
47 bt_status_t btif_storage_get_adapter_property(bt_property_t *property);
49 /*******************************************************************************
51 ** Function btif_storage_set_adapter_property
53 ** Description BTIF storage API - Stores the adapter property
56 ** Returns BT_STATUS_SUCCESS if the store was successful,
57 ** BT_STATUS_FAIL otherwise
59 *******************************************************************************/
60 bt_status_t btif_storage_set_adapter_property(bt_property_t *property);
62 /*******************************************************************************
64 ** Function btif_storage_get_remote_device_property
66 ** Description BTIF storage API - Fetches the remote device property->type
67 ** from NVRAM and fills property->val.
68 ** Caller should provide memory for property->val and
69 ** set the property->val
71 ** Returns BT_STATUS_SUCCESS if the fetch was successful,
72 ** BT_STATUS_FAIL otherwise
74 *******************************************************************************/
75 bt_status_t btif_storage_get_remote_device_property(bt_bdaddr_t *remote_bd_addr,
76 bt_property_t *property);
78 /*******************************************************************************
80 ** Function btif_storage_set_remote_device_property
82 ** Description BTIF storage API - Stores the remote device property
85 ** Returns BT_STATUS_SUCCESS if the store was successful,
86 ** BT_STATUS_FAIL otherwise
88 *******************************************************************************/
89 bt_status_t btif_storage_set_remote_device_property(bt_bdaddr_t *remote_bd_addr,
90 bt_property_t *property);
92 /*******************************************************************************
94 ** Function btif_storage_add_remote_device
96 ** Description BTIF storage API - Adds a newly discovered device to NVRAM
97 ** along with the timestamp. Also, stores the various
98 ** properties - RSSI, BDADDR, NAME (if found in EIR)
100 ** Returns BT_STATUS_SUCCESS if the store was successful,
101 ** BT_STATUS_FAIL otherwise
103 *******************************************************************************/
104 bt_status_t btif_storage_add_remote_device(bt_bdaddr_t *remote_bd_addr,
105 uint32_t num_properties,
106 bt_property_t *properties);
108 /*******************************************************************************
110 ** Function btif_storage_add_bonded_device
112 ** Description BTIF storage API - Adds the newly bonded device to NVRAM
113 ** along with the link-key, Key type and Pin key length
115 ** Returns BT_STATUS_SUCCESS if the store was successful,
116 ** BT_STATUS_FAIL otherwise
118 *******************************************************************************/
119 bt_status_t btif_storage_add_bonded_device(bt_bdaddr_t *remote_bd_addr,
124 /*******************************************************************************
126 ** Function btif_storage_remove_bonded_device
128 ** Description BTIF storage API - Deletes the bonded device from NVRAM
130 ** Returns BT_STATUS_SUCCESS if the deletion was successful,
131 ** BT_STATUS_FAIL otherwise
133 *******************************************************************************/
134 bt_status_t btif_storage_remove_bonded_device(bt_bdaddr_t *remote_bd_addr);
136 /*******************************************************************************
138 ** Function btif_storage_remove_bonded_device
140 ** Description BTIF storage API - Deletes the bonded device from NVRAM
142 ** Returns BT_STATUS_SUCCESS if the deletion was successful,
143 ** BT_STATUS_FAIL otherwise
145 *******************************************************************************/
146 bt_status_t btif_storage_load_bonded_devices(void);
148 /*******************************************************************************
150 ** Function btif_storage_read_hl_apps_cb
152 ** Description BTIF storage API - Read HL application control block from NVRAM
154 ** Returns BT_STATUS_SUCCESS if the operation was successful,
155 ** BT_STATUS_FAIL otherwise
157 *******************************************************************************/
158 bt_status_t btif_storage_read_hl_apps_cb(char *value, int value_size);
160 /*******************************************************************************
162 ** Function btif_storage_write_hl_apps_cb
164 ** Description BTIF storage API - Write HL application control block to NVRAM
166 ** Returns BT_STATUS_SUCCESS if the operation was successful,
167 ** BT_STATUS_FAIL otherwise
169 *******************************************************************************/
170 bt_status_t btif_storage_write_hl_apps_cb(char *value, int value_size);
172 /*******************************************************************************
174 ** Function btif_storage_read_hl_apps_cb
176 ** Description BTIF storage API - Read HL application configuration from NVRAM
178 ** Returns BT_STATUS_SUCCESS if the operation was successful,
179 ** BT_STATUS_FAIL otherwise
181 *******************************************************************************/
182 bt_status_t btif_storage_read_hl_app_data(UINT8 app_idx, char *value, int value_size);
184 /*******************************************************************************
186 ** Function btif_storage_write_hl_app_data
188 ** Description BTIF storage API - Write HL application configuration to NVRAM
190 ** Returns BT_STATUS_SUCCESS if the operation was successful,
191 ** BT_STATUS_FAIL otherwise
193 *******************************************************************************/
194 bt_status_t btif_storage_write_hl_app_data(UINT8 app_idx, char *value, int value_size);
196 /*******************************************************************************
198 ** Function btif_storage_read_hl_mdl_data
200 ** Description BTIF storage API - Read HL application MDL configuration from NVRAM
202 ** Returns BT_STATUS_SUCCESS if the operation was successful,
203 ** BT_STATUS_FAIL otherwise
205 *******************************************************************************/
206 bt_status_t btif_storage_read_hl_mdl_data(UINT8 app_idx, char *value, int value_size);
208 /*******************************************************************************
210 ** Function btif_storage_write_hl_mdl_data
212 ** Description BTIF storage API - Write HL application MDL configuration from NVRAM
214 ** Returns BT_STATUS_SUCCESS if the operation was successful,
215 ** BT_STATUS_FAIL otherwise
217 *******************************************************************************/
218 bt_status_t btif_storage_write_hl_mdl_data(UINT8 app_idx, char *value, int value_size);
220 /*******************************************************************************
222 ** Function btif_storage_add_hid_device_info
224 ** Description BTIF storage API - Adds the hid information of bonded hid devices-to NVRAM
226 ** Returns BT_STATUS_SUCCESS if the store was successful,
227 ** BT_STATUS_FAIL otherwise
229 *******************************************************************************/
231 bt_status_t btif_storage_add_hid_device_info(bt_bdaddr_t *remote_bd_addr,
232 UINT16 attr_mask, UINT8 sub_class,
233 UINT8 app_id, UINT16 vendor_id,
234 UINT16 product_id, UINT16 version,
235 UINT8 ctry_code, UINT16 ssr_max_latency,
236 UINT16 ssr_min_tout, UINT16 dl_len, UINT8 *dsc_list);
238 /*******************************************************************************
240 ** Function btif_storage_load_bonded_hid_info
242 ** Description BTIF storage API - Loads hid info for all the bonded devices from NVRAM
243 ** and adds those devices to the BTA_HH.
245 ** Returns BT_STATUS_SUCCESS if successful, BT_STATUS_FAIL otherwise
247 *******************************************************************************/
248 bt_status_t btif_storage_load_bonded_hid_info(void);
250 /*******************************************************************************
252 ** Function btif_storage_remove_hid_info
254 ** Description BTIF storage API - Deletes the bonded hid device info from NVRAM
256 ** Returns BT_STATUS_SUCCESS if the deletion was successful,
257 ** BT_STATUS_FAIL otherwise
259 *******************************************************************************/
260 bt_status_t btif_storage_remove_hid_info(bt_bdaddr_t *remote_bd_addr);
262 /*******************************************************************************
264 ** Function btif_storage_load_autopair_device_list
266 ** Description BTIF storage API - Populates auto pair device list
268 ** Returns BT_STATUS_SUCCESS if the auto pair blacklist is successfully populated
269 ** BT_STATUS_FAIL otherwise
271 *******************************************************************************/
272 bt_status_t btif_storage_load_autopair_device_list();
274 /*******************************************************************************
276 ** Function btif_storage_is_device_autopair_blacklisted
278 ** Description BTIF storage API Checks if the given device is blacklisted for auto pairing
280 ** Returns TRUE if the device is found in the auto pair blacklist
283 *******************************************************************************/
285 BOOLEAN btif_storage_is_device_autopair_blacklisted(bt_bdaddr_t *remote_bd_addr);
287 /*******************************************************************************
289 ** Function btif_storage_add_device_to_autopair_blacklist
291 ** Description BTIF storage API - Add a remote device to the auto pairing blacklist
293 ** Returns BT_STATUS_SUCCESS if the device is successfully added to the auto pair blacklist
294 ** BT_STATUS_FAIL otherwise
296 *******************************************************************************/
298 bt_status_t btif_storage_add_device_to_autopair_blacklist(bt_bdaddr_t *remote_bd_addr);
300 /*******************************************************************************
302 ** Function btif_storage_is_fixed_pin_zeros_keyboard
304 ** Description BTIF storage API - checks if this device has fixed PIN key device list
306 ** Returns TRUE if the device is found in the fixed pin keyboard device list
309 *******************************************************************************/
310 BOOLEAN btif_storage_is_fixed_pin_zeros_keyboard(bt_bdaddr_t *remote_bd_addr);
312 #if (BLE_INCLUDED == TRUE)
313 bt_status_t btif_storage_add_ble_bonding_key( bt_bdaddr_t *remote_bd_addr,
317 bt_status_t btif_storage_get_ble_bonding_key(bt_bdaddr_t *remote_bd_addr,
322 bt_status_t btif_storage_add_ble_local_key(char *key,
325 bt_status_t btif_storage_remove_ble_bonding_keys(bt_bdaddr_t *remote_bd_addr);
326 bt_status_t btif_storage_remove_ble_local_keys(void);
327 bt_status_t btif_storage_get_ble_local_key(UINT8 key_type,
331 bt_status_t btif_storage_get_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
334 bt_status_t btif_storage_set_remote_addr_type(bt_bdaddr_t *remote_bd_addr,
338 /*******************************************************************************
340 ** Function btif_storage_get_remote_version
342 ** Description Fetch remote version info on cached remote device
344 ** Returns BT_STATUS_SUCCESS if found
345 ** BT_STATUS_FAIL otherwise
347 *******************************************************************************/
349 bt_status_t btif_storage_get_remote_version(const bt_bdaddr_t *remote_bd_addr,
350 bt_remote_version_t *p_ver);
352 #endif /* BTIF_STORAGE_H */