2 * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the License);
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an AS IS BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef __TIZEN_NETWORK_BLUETOOTH_PRIVATE_H__
19 #define __TIZEN_NETWORK_BLUETOOTH_PRIVATE_H__
23 #include <bluetooth-api.h>
24 #include <bluetooth-audio-api.h>
25 #include <bluetooth-telephony-api.h>
26 #include <bluetooth-media-control.h>
27 #include <bluetooth-hid-api.h>
29 #include "bluetooth.h"
36 #define LOG_TAG "CAPI_NETWORK_BLUETOOTH"
38 #define BT_INFO(fmt, args...) SLOGI(fmt, ##args)
39 #define BT_DBG(fmt, args...) SLOGD(fmt, ##args)
40 #define BT_ERR(fmt, args...) SLOGE(fmt, ##args)
42 #define OPP_UUID "00001105-0000-1000-8000-00805f9b34fb"
46 * @brief Bluetooth callback.
50 BT_EVENT_STATE_CHANGED = 0x00, /**< Adapter state is changed */
51 BT_EVENT_NAME_CHANGED, /**< Adapter name is changed */
52 BT_EVENT_VISIBILITY_MODE_CHANGED, /**< Adapter visibility mode is changed */
53 BT_EVENT_DEVICE_DISCOVERY_STATE_CHANGED, /**< Device discovery state is changed */
54 BT_EVENT_BOND_CREATED, /**< A bond is created */
55 BT_EVENT_BOND_DESTROYED, /**< A bond is destroyed */
56 BT_EVENT_AUTHORIZATION_CHANGED, /**< Authorization is changed */
57 BT_EVENT_SERVICE_SEARCHED, /**< Service search finish */
58 BT_EVENT_DATA_RECEIVED, /**< Data is received */
59 BT_EVENT_CONNECTION_STATE_CHANGED, /**< Connection state is changed */
60 BT_EVENT_RFCOMM_CONNECTION_REQUESTED, /**< RFCOMM connection is requested */
61 BT_EVENT_OPP_CONNECTION_REQUESTED, /**< OPP connection is requested */
62 BT_EVENT_OPP_PUSH_REQUESTED, /**< OPP push is requested */
63 BT_EVENT_OPP_SERVER_TRANSFER_PROGRESS, /**< OPP transfer progress */
64 BT_EVENT_OPP_SERVER_TRANSFER_FINISHED, /**< OPP transfer is completed */
65 BT_EVENT_OPP_CLIENT_PUSH_RESPONSED, /**< OPP client connection is reponsed */
66 BT_EVENT_OPP_CLIENT_PUSH_PROGRESS, /**< OPP client push progress */
67 BT_EVENT_OPP_CLIENT_PUSH_FINISHED, /**< OPP client push is finished */
68 BT_EVENT_PAN_CONNECTION_STATE_CHANGED, /**< PAN connection change */
69 BT_EVENT_NAP_CONNECTION_STATE_CHANGED, /**< NAP connection change */
70 BT_EVENT_HDP_CONNECTED, /**< HDP connection change */
71 BT_EVENT_HDP_DISCONNECTED, /**< HDP disconnection change */
72 BT_EVENT_HDP_DATA_RECEIVED, /**< HDP Data receive Callabck */
73 BT_EVENT_AUDIO_CONNECTION_STATUS, /**< Audio Connection change callback */
74 BT_EVENT_AG_SCO_CONNECTION_STATUS, /**< Audio - AG SCO Connection state change callback */
75 BT_EVENT_AG_CALL_HANDLING_EVENT, /**< Audio - AG call event callback */
76 BT_EVENT_AG_MULTI_CALL_HANDLING_EVENT, /**< Audio - AG 3-way call event callback */
77 BT_EVENT_AG_DTMF_TRANSMITTED, /**< Audio - DTMF tone sending request */
78 BT_EVENT_AG_MICROPHONE_GAIN_CHANGE, /**< Audio Microphone change callback */
79 BT_EVENT_AG_SPEAKER_GAIN_CHANGE, /**< Audio Speaker gain change callback */
80 BT_EVENT_AVRCP_CONNECTION_STATUS, /**< AVRCP connection change callback */
81 BT_EVENT_AVRCP_EQUALIZER_STATE_CHANGED, /**< AVRCP equalizer state change callback */
82 BT_EVENT_AVRCP_REPEAT_MODE_CHANGED, /**< AVRCP repeat mode change callback */
83 BT_EVENT_AVRCP_SHUFFLE_MODE_CHANGED, /**< AVRCP equalizer mode change callback */
84 BT_EVENT_AVRCP_SCAN_MODE_CHANGED, /**< AVRCP scan mode change callback */
85 BT_EVENT_HID_CONNECTION_STATUS, /**< HID connection status callback */
86 BT_EVENT_DEVICE_CONNECTION_STATUS, /**< Device connection status callback */
87 BT_EVENT_GATT_CHARACTERISTIC_DISCOVERED, /**< GATT characteristic discovered callback */
88 BT_EVENT_GATT_VALUE_CHANGED, /**< GATT characteristic value changed callback */
94 typedef struct bt_event_sig_event_slot_s
99 } bt_event_sig_event_slot_s;
102 #define BT_CHECK_INPUT_PARAMETER(arg) \
105 LOGE("[%s] INVALID_PARAMETER(0x%08x)", __FUNCTION__, BT_ERROR_INVALID_PARAMETER); \
106 return BT_ERROR_INVALID_PARAMETER; \
111 * @brief Check the initialzating status
113 int _bt_check_init_status(void);
115 #define BT_CHECK_INIT_STATUS() \
116 if (_bt_check_init_status() == BT_ERROR_NOT_INITIALIZED) \
118 LOGE("[%s] NOT_INITIALIZED(0x%08x)", __FUNCTION__, BT_ERROR_NOT_INITIALIZED); \
119 return BT_ERROR_NOT_INITIALIZED; \
124 * @brief Set the event callback.
126 void _bt_set_cb(int events, void *callback, void *user_data);
130 * @brief Unset the event callback.
132 void _bt_unset_cb(int events);
136 * @brief Check if the event callback exist or not.
138 bool _bt_check_cb(int events);
142 * @brief Convert Bluetooth F/W error codes to capi Bluetooth error codes.
144 int _bt_get_error_code(int origin_error);
149 * @brief Convert Bluetooth F/W bluetooth_device_info_t to capi bt_device_info_s.
151 int _bt_get_bt_device_info_s(bt_device_info_s **dest_dev, bluetooth_device_info_t *source_dev);
156 * @brief Free bt_device_info_s.
158 void _bt_free_bt_device_info_s(bt_device_info_s *device_info);
162 * @brief Convert Bluetooth F/W bluetooth_device_address_t to string.
164 int _bt_convert_address_to_string(char **addr_str, bluetooth_device_address_t *addr_hex);
169 * @brief Convert string to Bluetooth F/W bluetooth_device_address_t.
171 void _bt_convert_address_to_hex(bluetooth_device_address_t *addr_hex, const char *addr_str);
176 * @brief Convert error code to string.
178 char* _bt_convert_error_to_string(int error);
182 * @brief Convert the visibility mode
184 bt_adapter_visibility_mode_e _bt_get_bt_visibility_mode_e(bluetooth_discoverable_mode_t mode);
188 * @brief Since the Audio call back and event proxy call backs have different prototype it is wrapper function.
190 void _bt_audio_event_proxy(int event, bt_audio_event_param_t *param, void *user_data);
194 * @brief Since the Telephony call back and event proxy call backs have different prototype it is wrapper function.
196 void _bt_telephony_event_proxy(int event, telephony_event_param_t *param, void *user_data);
200 * @brief Since the AVRCP call back and event proxy call backs have different prototype it is wrapper function.
202 void _bt_avrcp_event_proxy(int event, media_event_param_t *param, void *user_data);
206 * @brief Since the HID call back and event proxy call backs have different prototype it is wrapper function.
208 void _bt_hid_event_proxy(int event, hid_event_param_t *param, void *user_data);
215 #endif /* __TIZEN_NETWORK_BLUETOOTH_PRIVATE_H__ */