2 * Open Adaptation Layer (OAL)
4 * Copyright (c) 2014-2015 Samsung Electronics Co., Ltd.
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
10 * http://www.apache.org/licenses/LICENSE-2.0
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
27 #include <bluetooth.h>
29 #include "oal-event.h"
30 #include "oal-internal.h"
31 #include "oal-manager.h"
32 #include "oal-hardware.h"
34 #define CHECK_MAX(max, x) (((max) > (x)) ? (x) : (max))
36 static const bt_interface_t * blued_api;
38 /* Forward declarations */
39 const char * status2string(bt_status_t status);
40 oal_status_t convert_to_oal_status(bt_status_t status);
41 void parse_device_properties(int num_properties, bt_property_t *properties,
42 remote_device_t *dev_info, ble_adv_data_t * adv_info);
43 oal_status_t oal_mgr_init_internal(void);
45 static bt_callbacks_t callbacks = {
47 NULL, /* adapter_state_changed_callback */
48 NULL, /* adapter_properties_callback */
49 NULL, /* remote_device_properties_callback */
50 NULL, /* device_found_callback */
51 NULL, /* discovery_state_changed_callback */
52 NULL, /* pin_request_callback */
53 NULL, /* ssp_request_callback */
54 NULL, /* bond_state_changed_callback */
55 NULL, /* acl_state_changed_callback */
56 NULL, /* callback_thread_event */
57 NULL, /* dut_mode_recv_callback */
58 NULL, /* le_test_mode_callback*/
59 NULL, /* energy_info_callback */
62 oal_status_t adapter_mgr_init(const bt_interface_t * stack_if)
67 ret = blued_api->init(&callbacks);
69 if(ret != BT_STATUS_SUCCESS) {
70 BT_ERR("Adapter callback registration failed: [%s]", status2string(ret));
72 return convert_to_oal_status(ret);
75 return OAL_STATUS_SUCCESS;
78 const bt_interface_t* adapter_get_stack_interface(void)
83 void adapter_mgr_cleanup(void)
85 /* Nothing to clean yet , do not set blued_api NULL as it will be used to clean Bluedroid states */