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.
20 #ifndef _OAL_INTERNAL_H_
21 #define _OAL_INTERNAL_H_
24 #include <sys/types.h>
26 #include <bluetooth.h>
28 #include <oal-event.h>
29 #include "oal-manager.h"
30 #include "oal-utils.h"
36 #define OAL_VERSION_STR "Samsung OAL Version v0.1"
38 #define PR_TASK_PERF_USER_TRACE 666
39 #define BT_ADDRESS_STRING_SIZE 18
40 #define BT_UUID_STRING_MAX 50
43 #define LOG_TAG "BLUETOOTH_OAL"
46 #define BT_DBG(fmt, args...) \
48 #define BT_ERR(fmt, args...) \
49 SLOGE(RED(fmt), ##args)
50 #define BT_INFO(fmt, args...) \
52 #define BT_VBS(fmt, args...) \
53 {SLOGI(fmt, ##args); LOGI(fmt, ##args); }
54 #define BT_WARN(fmt, args...) \
55 SLOGW(YELLOW(fmt), ##args)
56 #define NO_SUPP_CHK(status, fmt, args...) do {\
57 if (status == BT_STATUS_UNSUPPORTED) \
58 BT_WARN(fmt, ##args); \
60 BT_ERR(fmt, ##args); \
64 #define API_TRACE(fmt, args...) SLOGI(GREEN("[OAL_API]"fmt), ##args)
66 #define send_event_trace(e, d, l, a, fmt, args...) do {\
68 send_event_no_trace(e, d, l); \
69 SLOGI(GREEN("[OAL_EVENT]"fmt" [%s] %s"), ##args, bdt_bd2str(a, &bdstr), str_event[event]);\
73 #define ret_if(expr) \
76 BT_ERR("(%s) return", #expr); \
81 #define retv_if(expr, val) \
84 BT_ERR("(%s) return", #expr); \
89 #define OAL_CHECK_PARAMETER(arg, func) \
92 BT_ERR("INVALID PARAMETER"); \
93 func OAL_STATUS_INVALID_PARAM; \
97 #define CHECK_OAL_INITIALIZED() \
99 if (blued_api == NULL) { \
100 BT_ERR("OAL Not Initialized"); \
101 return OAL_STATUS_NOT_READY; \
105 #define BT_ADDRESS_STRING_SIZE 18
112 /* Adapter manager */
113 void oal_mgr_cleanup(void);
114 void oal_mgr_stack_reload(void);
117 void device_mgr_init(const bt_interface_t * stack_if);
118 void device_mgr_cleanup(void);
120 oal_status_t adapter_mgr_init(const bt_interface_t * stack_if);
121 const bt_interface_t* adapter_get_stack_interface(void);
124 /* Use this when Address is to be printed */
125 void send_event_bda_trace(oal_event_t event, gpointer event_data, gsize len, bt_address_t *address);
127 void send_event_no_trace(oal_event_t event, gpointer event_data, gsize len);
129 /* Use this when no address printing is required */
130 #define _bt_dispatch_event send_event
131 void send_event(oal_event_t event, gpointer event_data, gsize len);
132 void _bt_event_dispatcher_init(oal_event_callback cb);
133 void _bt_event_dispatcher_deinit(void);
137 #endif /* __cplusplus */
138 #endif /*_OAL_HARDWARE_H_*/