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"
45 #define BT_DBG(fmt, args...) \
47 #define BT_ERR(fmt, args...) \
48 LOGE(RED(fmt), ##args)
49 #define BT_INFO(fmt, args...) \
51 #define BT_VBS(fmt, args...) \
52 {SLOGI(fmt, ##args); LOGI(fmt, ##args); }
53 #define BT_WARN(fmt, args...) \
54 LOGW(YELLOW(fmt), ##args)
55 #define NO_SUPP_CHK(status, fmt, args...) do {\
56 if (status == BT_STATUS_UNSUPPORTED) \
57 BT_WARN(fmt, ##args); \
59 BT_ERR(fmt, ##args); \
63 #define API_TRACE(fmt, args...) {LOG_(LOG_ID_SYSTEM, DLOG_INFO, "OAL_API", GREEN(fmt), ##args); \
64 LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, 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 LOG_(LOG_ID_SYSTEM, DLOG_INFO, "OAL_EVENT", GREEN(fmt" [%s] %s"), ##args, bdt_bd2str(a, &bdstr), str_event[event]); \
70 LOG_(LOG_ID_MAIN, DLOG_INFO, LOG_TAG, GREEN("[OAL_EVENT]"fmt" [%s] %s"), ##args, bdt_bd2str(a, &bdstr), str_event[event]);\
74 #define ret_if(expr) \
77 BT_ERR("(%s) return", #expr); \
82 #define retv_if(expr, val) \
85 BT_ERR("(%s) return", #expr); \
90 #define OAL_CHECK_PARAMETER(arg, func) \
93 BT_ERR("INVALID PARAMETER"); \
94 func OAL_STATUS_INVALID_PARAM; \
98 #define CHECK_OAL_INITIALIZED() \
100 if (blued_api == NULL) { \
101 BT_ERR("OAL Not Initialized"); \
102 return OAL_STATUS_NOT_READY; \
106 #define BT_ADDRESS_STRING_SIZE 18
113 /* Adapter manager */
114 void oal_mgr_cleanup(void);
115 void oal_mgr_stack_reload(void);
118 void device_mgr_init(const bt_interface_t * stack_if);
119 void device_mgr_cleanup(void);
121 oal_status_t adapter_mgr_init(const bt_interface_t * stack_if);
122 const bt_interface_t* adapter_get_stack_interface(void);
125 /* Use this when Address is to be printed */
126 void send_event_bda_trace(oal_event_t event, gpointer event_data, gsize len, bt_address_t *address);
128 void send_event_no_trace(oal_event_t event, gpointer event_data, gsize len);
130 /* Use this when no address printing is required */
131 #define _bt_dispatch_event send_event
132 void send_event(oal_event_t event, gpointer event_data, gsize len);
133 void _bt_event_dispatcher_init(oal_event_callback cb);
134 void _bt_event_dispatcher_deinit(void);
138 #endif /* __cplusplus */
139 #endif /*_OAL_HARDWARE_H_*/