Tizen 2.0 Release
[profile/ivi/bluetooth.git] / include / bluetooth.h
1 /*
2  * Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
3  *
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
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
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.
15  */
16
17
18 #ifndef __TIZEN_NETWORK_BLUETOOTH_H__
19 #define __TIZEN_NETWORK_BLUETOOTH_H__
20
21 #include <stdlib.h>
22 #include <unistd.h>
23 #include <stdbool.h>
24 #include <tizen_error.h>
25
26 #ifdef __cplusplus
27 extern "C"
28 {
29 #endif /* __cplusplus */
30
31 /**
32  * @file        bluetooth.h
33  * @brief       API to control the Bluetooth adapter and devices and communications.
34  * @ingroup     CAPI_NETWORK_BLUETOOTH_MODULE
35  */
36
37
38 /**
39  * @addtogroup CAPI_NETWORK_BLUETOOTH_MODULE
40  * @{
41  */
42
43 /**
44  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
45  * @brief  Enumerations of connected Bluetooth device event role.
46  */
47 typedef enum
48 {
49         BT_SOCKET_UNKNOWN = 0x00, /**< Unknown role*/
50         BT_SOCKET_SERVER , /**< Server role*/
51         BT_SOCKET_CLIENT, /**< Client role*/
52 } bt_socket_role_e;
53
54 /**
55  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
56  * @brief Enumerations of Bluetooth error codes.
57  */
58 typedef enum
59 {
60         BT_ERROR_NONE = TIZEN_ERROR_NONE, /**< Successful*/
61         BT_ERROR_CANCELLED = TIZEN_ERROR_CANCELED, /**< Operation cancelled */
62         BT_ERROR_INVALID_PARAMETER = TIZEN_ERROR_INVALID_PARAMETER, /**< Invalid parameter */
63         BT_ERROR_OUT_OF_MEMORY = TIZEN_ERROR_OUT_OF_MEMORY, /**< Out of memory */
64         BT_ERROR_RESOURCE_BUSY = TIZEN_ERROR_RESOURCE_BUSY, /**< Device or resource busy */
65         BT_ERROR_TIMED_OUT = TIZEN_ERROR_TIMED_OUT, /**< Timeout error */
66         BT_ERROR_NOW_IN_PROGRESS = TIZEN_ERROR_NOW_IN_PROGRESS, /**< Operation now in progress */
67         BT_ERROR_NOT_INITIALIZED = TIZEN_ERROR_NETWORK_CLASS|0x0101, /**< Local adapter not initialized */
68         BT_ERROR_NOT_ENABLED = TIZEN_ERROR_NETWORK_CLASS|0x0102, /**< Local adapter not enabled */
69         BT_ERROR_ALREADY_DONE = TIZEN_ERROR_NETWORK_CLASS|0x0103, /**< Operation already done  */
70         BT_ERROR_OPERATION_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0104, /**< Operation failed */
71         BT_ERROR_NOT_IN_PROGRESS = TIZEN_ERROR_NETWORK_CLASS|0x0105, /**< Operation not in progress */
72         BT_ERROR_REMOTE_DEVICE_NOT_BONDED = TIZEN_ERROR_NETWORK_CLASS|0x0106, /**< Remote device not bonded */
73         BT_ERROR_AUTH_REJECTED = TIZEN_ERROR_NETWORK_CLASS|0x0107, /**< Authentication rejected */
74         BT_ERROR_AUTH_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x0108, /**< Authentication failed */
75         BT_ERROR_REMOTE_DEVICE_NOT_FOUND = TIZEN_ERROR_NETWORK_CLASS|0x0109, /**< Remote device not found */
76         BT_ERROR_SERVICE_SEARCH_FAILED = TIZEN_ERROR_NETWORK_CLASS|0x010A, /**< Service search failed */
77         BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED = TIZEN_ERROR_NETWORK_CLASS|0x010B, /**< Remote device is not connected */
78 } bt_error_e;
79
80 /**
81  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
82  * @brief  Enumerations of the Bluetooth adapter state.
83  */
84 typedef enum
85 {
86         BT_ADAPTER_DISABLED = 0x00, /**< Bluetooth adapter is disabled */
87         BT_ADAPTER_ENABLED, /**< Bluetooth adapter is enabled */
88 } bt_adapter_state_e;
89
90 /**
91  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
92  * @brief Enumerations of the Bluetooth visibility mode.
93  */
94 typedef enum
95 {
96         BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE = 0x00,  /**< Other devices cannot find your device via discovery */
97         BT_ADAPTER_VISIBILITY_MODE_GENERAL_DISCOVERABLE,  /**< Discoverable mode */
98         BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE,  /**< Discoverable mode with time limit. After specific period,
99                                                             it is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.*/
100 } bt_adapter_visibility_mode_e;
101
102 /**
103  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
104  * @brief Enumerations of the discovery state of Bluetooth device.
105  *
106  */
107 typedef enum
108 {
109         BT_ADAPTER_DEVICE_DISCOVERY_STARTED, /**< Device discovery is started */
110         BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, /**< Device discovery is finished */
111         BT_ADAPTER_DEVICE_DISCOVERY_FOUND, /**< The remote Bluetooth device is found */
112 } bt_adapter_device_discovery_state_e;
113
114 /**
115  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
116  * @brief Enumerations of device authorization state.
117  */
118 typedef enum
119 {
120         BT_DEVICE_AUTHORIZED, /**< The remote Bluetooth device is authorized */
121         BT_DEVICE_UNAUTHORIZED, /**< The remote Bluetooth device is unauthorized */
122 } bt_device_authorization_e;
123
124 /**
125  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
126  * @brief Enumerations of Bluetooth profile.
127  */
128 typedef enum
129 {
130     BT_PROFILE_RFCOMM = 0x01, /**< RFCOMM Profile */
131     BT_PROFILE_A2DP = 0x02, /**< Advanced Audio Distribution Profile */
132     BT_PROFILE_HSP = 0x04, /**< Headset Profile */
133     BT_PROFILE_HID = 0x08, /**< Human Interface Device Profile */
134 } bt_profile_e;
135
136 /**
137  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
138  * @brief  Enumerations of Bluetooth socket connection state.
139  */
140 typedef enum
141 {
142         BT_SOCKET_CONNECTED, /**< RFCOMM is connected */
143         BT_SOCKET_DISCONNECTED, /**< RFCOMM is disconnected */
144 } bt_socket_connection_state_e;
145
146 /**
147  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
148  * @brief  Enumerations of major service class.
149  */
150 typedef enum
151 {
152         BT_MAJOR_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE  = 0x002000, /**< Limited discoverable mode */
153         BT_MAJOR_SERVICE_CLASS_POSITIONING                = 0x010000, /**< Positioning class */
154         BT_MAJOR_SERVICE_CLASS_NETWORKING                 = 0x020000, /**< Networking class */
155         BT_MAJOR_SERVICE_CLASS_RENDERING                  = 0x040000, /**< Rendering class */
156         BT_MAJOR_SERVICE_CLASS_CAPTURING                  = 0x080000, /**< Capturing class */
157         BT_MAJOR_SERVICE_CLASS_OBJECT_TRANSFER            = 0x100000, /**< Object transferring class */
158         BT_MAJOR_SERVICE_CLASS_AUDIO                      = 0x200000, /**< Audio class*/
159         BT_MAJOR_SERVICE_CLASS_TELEPHONY                  = 0x400000, /**< Telephony class */
160         BT_MAJOR_SERVICE_CLASS_INFORMATION                = 0x800000, /**< Information class */
161 } bt_major_service_class_e;
162
163 /**
164  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
165  * @brief  Enumerations of major device class.
166  */
167 typedef enum
168 {
169         BT_MAJOR_DEVICE_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
170         BT_MAJOR_DEVICE_CLASS_COMPUTER = 0x01, /**< Computer major device class */
171         BT_MAJOR_DEVICE_CLASS_PHONE = 0x02, /**< Phone major device class */
172         BT_MAJOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT = 0x03, /**< LAN/Network access point major device class */
173         BT_MAJOR_DEVICE_CLASS_AUDIO_VIDEO = 0x04, /**< Audio/Video major device class */
174         BT_MAJOR_DEVICE_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class */
175         BT_MAJOR_DEVICE_CLASS_IMAGING = 0x06, /**< Imaging major device class */
176         BT_MAJOR_DEVICE_CLASS_WEARABLE = 0x07, /**< Wearable device class */
177         BT_MAJOR_DEVICE_CLASS_TOY = 0x08, /**< Toy device class */
178         BT_MAJOR_DEVICE_CLASS_HEALTH = 0x09, /**< Health device class */
179         BT_MAJOR_DEVICE_CLASS_UNCATEGORIZED = 0x1F, /**< Uncategorized major device class */
180 } bt_major_device_class_e;
181
182 /**
183  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
184  * @brief  Enumerations of minor device class.
185  */
186 typedef enum
187 {
188         BT_MINOR_DEVICE_CLASS_COMPUTER_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of computer */
189         BT_MINOR_DEVICE_CLASS_COMPUTER_DESKTOP_WORKSTATION = 0x04, /**< Desktop workstation minor device class of computer */
190         BT_MINOR_DEVICE_CLASS_COMPUTER_SERVER_CLASS = 0x08, /**< Server minor device class of computer */
191         BT_MINOR_DEVICE_CLASS_COMPUTER_LAPTOP = 0x0C, /**< Laptop minor device class of computer */
192         BT_MINOR_DEVICE_CLASS_COMPUTER_HANDHELD_PC_OR_PDA = 0x10, /**< Handheld PC/PDA minor device class of computer */
193         BT_MINOR_DEVICE_CLASS_COMPUTER_PALM_SIZED_PC_OR_PDA = 0x14, /**< Palm sized PC/PDA minor device class of computer */
194         BT_MINOR_DEVICE_CLASS_COMPUTER_WEARABLE_COMPUTER = 0x18, /**< Wearable(watch sized) minor device class of computer */
195
196         BT_MINOR_DEVICE_CLASS_PHONE_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of phone */
197         BT_MINOR_DEVICE_CLASS_PHONE_CELLULAR = 0x04, /**< Cellular minor device class of phone */
198         BT_MINOR_DEVICE_CLASS_PHONE_CORDLESS = 0x08, /**< Cordless minor device class of phone */
199         BT_MINOR_DEVICE_CLASS_PHONE_SMART_PHONE = 0x0C, /**< Smart phone minor device class of phone */
200         BT_MINOR_DEVICE_CLASS_PHONE_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10, /**< Wired modem or voice gateway minor device class of phone */
201         BT_MINOR_DEVICE_CLASS_PHONE_COMMON_ISDN_ACCESS = 0x14, /**< Common ISDN minor device class of phone */
202
203         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_FULLY_AVAILABLE = 0x04, /**< Fully available minor device class of LAN/Network access point */
204         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor device class of LAN/Network access point */
205         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor device class of LAN/Network access point */
206         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor device class of LAN/Network access point */
207         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor device class of LAN/Network access point */
208         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor device class of LAN/Network access point */
209         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor device class of LAN/Network access point */
210         BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor device class of LAN/Network access point */
211
212         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of audio/video */
213         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_WEARABLE_HEADSET = 0x04, /**< Wearable headset minor device class of audio/video */
214         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HANDS_FREE = 0x08, /**< Hands-free minor device class of audio/video */
215         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_MICROPHONE = 0x10, /**< Microphone minor device class of audio/video */
216         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_LOUDSPEAKER = 0x14, /**< Loudspeaker minor device class of audio/video */
217         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HEADPHONES = 0x18, /**< Headphones minor device class of audio/video */
218         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_PORTABLE_AUDIO = 0x1C, /**< Portable audio minor device class of audio/video */
219         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAR_AUDIO = 0x20, /**< Car audio minor device class of audio/video */
220         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_SET_TOP_BOX = 0x24, /**< Set-top box minor device class of audio/video */
221         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi audio minor device class of audio/video */
222         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VCR = 0x2C, /**< VCR minor device class of audio/video */
223         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CAMERA = 0x30, /**< Video camera minor device class of audio/video */
224         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAMCORDER = 0x34, /**< Camcorder minor device class of audio/video */
225         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_MONITOR = 0x38, /**< Video monitor minor device class of audio/video */
226         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_DISPLAY_LOUDSPEAKER = 0x3C, /**< Video display and loudspeaker minor device class of audio/video */
227         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CONFERENCING = 0x40, /**< Video conferencing minor device class of audio/video */
228         BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_GAMING_TOY = 0x48, /**< Gaming/toy minor device class of audio/video */
229
230         BT_MINOR_DEVICE_CLASS_PERIPHERA_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of peripheral */
231         BT_MINOR_DEVICE_CLASS_PERIPHERAL_KEY_BOARD = 0x40, /**< Key board minor device class of peripheral */
232         BT_MINOR_DEVICE_CLASS_PERIPHERAL_POINTING_DEVICE = 0x80, /**< Pointing device minor device class of peripheral */
233         BT_MINOR_DEVICE_CLASS_PERIPHERAL_COMBO_KEYBOARD_POINTING_DEVICE = 0xC0, /**< Combo keyboard or pointing device minor device class of peripheral */
234         BT_MINOR_DEVICE_CLASS_PERIPHERAL_JOYSTICK = 0x04, /**< Joystick minor device class of peripheral */
235         BT_MINOR_DEVICE_CLASS_PERIPHERAL_GAME_PAD = 0x08, /**< Game pad minor device class of peripheral */
236         BT_MINOR_DEVICE_CLASS_PERIPHERAL_REMOTE_CONTROL = 0x0C, /**< Remote control minor device class of peripheral */
237         BT_MINOR_DEVICE_CLASS_PERIPHERAL_SENSING_DEVICE = 0x10, /**< Sensing device minor device class of peripheral */
238         BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITIZER_TABLET = 0x14, /**< Digitizer minor device class of peripheral */
239         BT_MINOR_DEVICE_CLASS_PERIPHERAL_CARD_READER = 0x18, /**< Card reader minor device class of peripheral */
240         BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITAL_PEN = 0x1C, /**< Digital pen minor device class of peripheral */
241         BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_SCANNER = 0x20, /**< Handheld scanner minor device class of peripheral */
242         BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor device class of peripheral */
243
244         BT_MINOR_DEVICE_CLASS_IMAGING_DISPLAY = 0x10, /**< Display minor device class of imaging */
245         BT_MINOR_DEVICE_CLASS_IMAGING_CAMERA = 0x20, /**< Camera minor device class of imaging */
246         BT_MINOR_DEVICE_CLASS_IMAGING_SCANNER = 0x40, /**< Scanner minor device class of imaging */
247         BT_MINOR_DEVICE_CLASS_IMAGING_PRINTER = 0x80, /**< Printer minor device class of imaging */
248
249         BT_MINOR_DEVICE_CLASS_WEARABLE_WRIST_WATCH = 0x04, /**< Wrist watch minor device class of wearable */
250         BT_MINOR_DEVICE_CLASS_WEARABLE_PAGER = 0x08, /**< Pager minor device class of wearable */
251         BT_MINOR_DEVICE_CLASS_WEARABLE_JACKET = 0x0C, /**< Jacket minor device class of wearable */
252         BT_MINOR_DEVICE_CLASS_WEARABLE_HELMET = 0x10, /**< Helmet minor device class of wearable */
253         BT_MINOR_DEVICE_CLASS_WEARABLE_GLASSES = 0x14, /**< Glasses minor device class of wearable */
254
255         BT_MINOR_DEVICE_CLASS_TOY_ROBOT = 0x04, /**< Robot minor device class of toy */
256         BT_MINOR_DEVICE_CLASS_TOY_VEHICLE = 0x08, /**< Vehicle minor device class of toy */
257         BT_MINOR_DEVICE_CLASS_TOY_DOLL_ACTION = 0x0C, /**< Doll/Action minor device class of toy */
258         BT_MINOR_DEVICE_CLASS_TOY_CONTROLLER = 0x10, /**< Controller minor device class of toy */
259         BT_MINOR_DEVICE_CLASS_TOY_GAME = 0x14, /**< Game minor device class of toy */
260
261         BT_MINOR_DEVICE_CLASS_HEATH_UNCATEGORIZED = 0x00, /**< Uncategorized minor device class of health */
262         BT_MINOR_DEVICE_CLASS_HEATH_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood pressure monitor minor device class of health */
263         BT_MINOR_DEVICE_CLASS_HEATH_THERMOMETER = 0x08, /**< Thermometer minor device class of health */
264         BT_MINOR_DEVICE_CLASS_HEATH_WEIGHING_SCALE = 0x0C, /**< Weighing scale minor device class of health */
265         BT_MINOR_DEVICE_CLASS_HEATH_GLUCOSE_METER = 0x10, /**< Glucose minor device class of health */
266         BT_MINOR_DEVICE_CLASS_HEATH_PULSE_OXIMETER = 0x14, /**< Pulse oximeter minor device class of health */
267         BT_MINOR_DEVICE_CLASS_HEATH_HEART_PULSE_RATE_MONITOR = 0x18, /**< Heart/Pulse rate monitor minor device class of health */
268         BT_MINOR_DEVICE_CLASS_HEATH_DATA_DISPLAY = 0x1C, /**< Health data display minor device class of health */
269         BT_MINOR_DEVICE_CLASS_HEATH_STEP_COUNTER = 0x20, /**< Step counter minor device class of health */
270         BT_MINOR_DEVICE_CLASS_HEATH_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor device class of health */
271         BT_MINOR_DEVICE_CLASS_HEATH_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor device class of health */
272         BT_MINOR_DEVICE_CLASS_HEATH_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor device class of health */
273         BT_MINOR_DEVICE_CLASS_HEATH_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor device class of health */
274         BT_MINOR_DEVICE_CLASS_HEATH_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor device class of health */
275 } bt_minor_device_class_e;
276
277 /**
278  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
279  * @brief  Enumerations for the types of PAN(Personal Area Networking) service
280  */
281 typedef enum {
282     BT_PANU_SERVICE_TYPE_NAP = 0,  /**< Network Access Point */
283 } bt_panu_service_type_e;
284
285 /**
286  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
287  * @brief  Enumerations for the types of profiles related with audio
288  */
289 typedef enum {
290     BT_AUDIO_PROFILE_TYPE_ALL = 0,  /**< All supported profiles related with audio */
291     BT_AUDIO_PROFILE_TYPE_HSP_HFP,  /**< HSP(Headset Profile) and HFP(Hands-Free Profile) */
292     BT_AUDIO_PROFILE_TYPE_A2DP,  /**< A2DP(Advanced Audio Distribution Profile) */
293 } bt_audio_profile_type_e;
294
295 /**
296  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
297  * @brief  Enumerations for the equalizer state
298  */
299 typedef enum {
300     BT_AVRCP_EQUALIZER_STATE_OFF = 0x01,  /**< Equalizer Off */
301     BT_AVRCP_EQUALIZER_STATE_ON,  /**< Equalizer On */
302 } bt_avrcp_equalizer_state_e;
303
304 /**
305  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
306  * @brief  Enumerations for the repeat mode
307  */
308 typedef enum {
309     BT_AVRCP_REPEAT_MODE_OFF = 0x01,  /**< Repeat Off */
310     BT_AVRCP_REPEAT_MODE_SINGLE_TRACK,  /**< Single track repeat */
311     BT_AVRCP_REPEAT_MODE_ALL_TRACK,  /**< All track repeat */
312     BT_AVRCP_REPEAT_MODE_GROUP,  /**< Group repeat */
313 } bt_avrcp_repeat_mode_e;
314
315 /**
316  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
317  * @brief  Enumerations for the shuffle mode
318  */
319 typedef enum {
320     BT_AVRCP_SHUFFLE_MODE_OFF = 0x01,  /**< Shuffle Off */
321     BT_AVRCP_SHUFFLE_MODE_ALL_TRACK,  /**< All tracks shuffle */
322     BT_AVRCP_SHUFFLE_MODE_GROUP,  /**< Group shuffle */
323 } bt_avrcp_shuffle_mode_e;
324
325 /**
326  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
327  * @brief  Enumerations for the scan mode
328  */
329 typedef enum {
330     BT_AVRCP_SCAN_MODE_OFF = 0x01,  /**< Scan Off */
331     BT_AVRCP_SCAN_MODE_ALL_TRACK,  /**< All tracks scan */
332     BT_AVRCP_SCAN_MODE_GROUP,  /**< Group scan */
333 } bt_avrcp_scan_mode_e;
334
335 /**
336  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
337  * @brief  Enumerations for the player state
338  */
339 typedef enum {
340     BT_AVRCP_PLAYER_STATE_STOPPED = 0x00,  /**< Stopped */
341     BT_AVRCP_PLAYER_STATE_PLAYING,  /**< Playing */
342     BT_AVRCP_PLAYER_STATE_PAUSED,  /**< Paused */
343     BT_AVRCP_PLAYER_STATE_FORWARD_SEEK,  /**< Seek Forward */
344     BT_AVRCP_PLAYER_STATE_REWIND_SEEK,  /**< Seek Rewind */
345 } bt_avrcp_player_state_e;
346
347 /**
348  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
349  * @brief  Enumerations for the data channel type
350  */
351 typedef enum {
352     BT_HDP_CHANNEL_TYPE_RELIABLE  = 0x01,  /**< Reliable Data Channel */
353     BT_HDP_CHANNEL_TYPE_STREAMING,  /**< Streaming Data Channel */
354 } bt_hdp_channel_type_e;
355
356 /**
357  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
358  * @brief  Enumerations for the call state
359  */
360 typedef enum {
361     BT_AG_CALL_EVENT_IDLE = 0x00,  /**< Idle */
362     BT_AG_CALL_EVENT_ANSWERED,  /**< Answered */
363     BT_AG_CALL_EVENT_HELD,  /**< Held */
364     BT_AG_CALL_EVENT_RETRIEVED,  /**< Retrieved */
365     BT_AG_CALL_EVENT_DIALING,  /**< Dialing */
366     BT_AG_CALL_EVENT_ALERTING,  /**< Alerting */
367     BT_AG_CALL_EVENT_INCOMING,  /**< Incoming */
368 } bt_ag_call_event_e;
369
370 /**
371  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
372  * @brief  Enumerations for the call state
373  */
374 typedef enum {
375     BT_AG_CALL_STATE_IDLE = 0x00,  /**< Idle state */
376     BT_AG_CALL_STATE_ACTIVE,  /**< Active state */
377     BT_AG_CALL_STATE_HELD,  /**< Held state */
378     BT_AG_CALL_STATE_DIALING,  /**< Dialing state */
379     BT_AG_CALL_STATE_ALERTING,  /**< Alerting state */
380     BT_AG_CALL_STATE_INCOMING,  /**< Incoming state */
381     BT_AG_CALL_STATE_WAITING,  /**< Waiting for connected indication event after answering an incoming call*/
382 } bt_ag_call_state_e;
383
384 /**
385  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
386  * @brief  Enumerations for the call handling event
387  */
388 typedef enum {
389     BT_AG_CALL_HANDLING_EVENT_ANSWER = 0x00,  /**< Request to answer an incoming call */
390     BT_AG_CALL_HANDLING_EVENT_RELEASE,  /**< Request to release a call */
391     BT_AG_CALL_HANDLING_EVENT_REJECT,  /**< Request to reject an incoming call */
392 } bt_ag_call_handling_event_e;
393
394 /**
395  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
396  * @brief  Enumerations for the multi call handling event
397  */
398 typedef enum {
399     BT_AG_MULTI_CALL_HANDLING_EVENT_RELEASE_HELD_CALLS = 0x00,  /**< Request to release held calls */
400     BT_AG_MULTI_CALL_HANDLING_EVENT_RELEASE_ACTIVE_CALLS,  /**< Request to release active calls */
401     BT_AG_MULTI_CALL_HANDLING_EVENT_ACTIVATE_HELD_CALL,  /**< Request to put active calls into hold state and activate another (held or waiting) call */
402     BT_AG_MULTI_CALL_HANDLING_EVENT_MERGE_CALLS,  /**< Request to add a held call to the conversation */
403     BT_AG_MULTI_CALL_HANDLING_EVENT_EXPLICIT_CALL_TRANSFER,  /**< Request to let a user who has two calls to connect these two calls together and release its connections to both other parties */
404 } bt_ag_multi_call_handling_event_e;
405
406 /**
407  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
408  * @brief  The handle of calls state
409  */
410 typedef void* bt_call_list_h;
411
412 /**
413  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
414  * @brief  The attribute handle of GATT(Generic Attribute Profile)
415  */
416 typedef void* bt_gatt_attribute_h;
417
418 /**
419  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
420  * @brief Class structure of device and service.
421  *
422  * @see #bt_device_info_s
423  * @see #bt_adapter_device_discovery_info_s
424  * @see bt_device_bond_created_cb()
425  * @see bt_adapter_device_discovery_state_changed_cb()
426  */
427 typedef struct
428 {
429         bt_major_device_class_e major_device_class;     /**< Major device class. */
430         bt_minor_device_class_e minor_device_class;     /**< Minor device class. */
431         int major_service_class_mask;   /**< Major service class mask.
432         This value can be a combination of #bt_major_service_class_e like #BT_MAJOR_SERVICE_CLASS_RENDERING | #BT_MAJOR_SERVICE_CLASS_AUDIO */
433 } bt_class_s;
434
435 /**
436  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
437  * @brief Structure of device discovery information.
438  *
439  * @see #bt_class_s
440  * @see bt_adapter_device_discovery_state_changed_cb()
441  */
442 typedef struct
443 {
444         char *remote_address;   /**< The address of remote device */
445         char *remote_name;      /**< The name of remote device */
446         bt_class_s bt_class;    /**< The Bluetooth classes */
447         int rssi;       /**< The strength indicator of received signal  */
448         bool is_bonded; /**< The bonding state */
449         char **service_uuid;  /**< The UUID list of service */
450         int service_count;      /**< The number of services */
451 } bt_adapter_device_discovery_info_s;
452
453 /**
454  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
455  * @brief Device information structure used for identifying pear device.
456  *
457  * @see #bt_class_s
458  * @see bt_device_bond_created_cb()
459  */
460 typedef struct
461 {
462         char *remote_address;   /**< The address of remote device */
463         char *remote_name;      /**< The name of remote device */
464         bt_class_s bt_class;    /**< The Bluetooth classes */
465         char **service_uuid;  /**< The UUID list of service */
466         int service_count;      /**< The number of services */
467         bool is_bonded; /**< The bonding state */
468         bool is_connected;      /**< The connection state */
469         bool is_authorized;     /**< The authorization state */
470 } bt_device_info_s;
471
472 /**
473  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
474  * @brief Service Discovery Protocol (SDP) data structure.
475  *
476  * @details This protocol is used for discovering available services or pear device,
477  * and finding one to connect with.
478  *
479  * @see bt_device_service_searched_cb()
480  */
481 typedef struct
482 {
483         char *remote_address;   /**< The address of remote device */
484         char **service_uuid;  /**< The UUID list of service */
485         int service_count;    /**< The number of services. */
486 } bt_device_sdp_info_s;
487
488 /**
489  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
490  *
491  * @brief Rfcomm connection data used for exchanging data between Bluetooth devices.
492  *
493  * @see bt_socket_connection_state_changed_cb()
494  */
495 typedef struct
496 {
497         int socket_fd;  /**< The file descriptor of connected socket */
498         bt_socket_role_e local_role;    /**< The local device role in this connection */
499         char *remote_address;   /**< The remote device address */
500         char *service_uuid;     /**< The service UUId */
501 } bt_socket_connection_s;
502
503 /**
504  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
505  *
506  * @brief Structure of RFCOMM received data.
507  *
508  * @remarks User can use standard linux functions for reading/writing
509  * data from/to sockets.
510  *
511  * @see bt_socket_data_received_cb()
512  */
513 typedef struct
514 {
515         int socket_fd;  /**< The socket fd */
516         int data_size;  /**< The length of the received data */
517         char *data;     /**< The received data */
518 } bt_socket_received_data_s;
519
520 /**
521  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
522  * @brief  Called when the Bluetooth adapter state changes.
523  * @param[in]   result  The result of the adapter state changing
524  * @param[in]   adapter_state  The adapter state to be changed
525  * @param[in]   user_data  The user data passed from the callback registration function
526  * @pre Either bt_adapter_enable() or bt_adapter_disable() will invoke this callback if you register this callback using bt_adapter_set_state_changed_cb().
527  * @see bt_adapter_enable()
528  * @see bt_adapter_disable()
529  * @see bt_adapter_set_state_changed_cb()
530  * @see bt_adapter_unset_state_changed_cb()
531  */
532 typedef void (*bt_adapter_state_changed_cb)(int result, bt_adapter_state_e adapter_state, void *user_data);
533
534 /**
535  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
536  * @brief  Called when adapter name changes.
537  * @param[in]   device_name     The name of the Bluetooth device to be changed
538  * @param[in]   user_data       The user data passed from the callback registration function
539  * @pre This function will be invoked when the name of Bluetooth adapter changes
540  * if you register this callback using bt_adapter_set_name_changed_cb().
541  * @see bt_adapter_set_name()
542  * @see bt_adapter_set_name_changed_cb()
543  * @see bt_adapter_unset_name_changed_cb()
544  */
545 typedef void (*bt_adapter_name_changed_cb)(char *device_name, void *user_data);
546
547 /**
548  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
549  * @brief  Called when the visibility mode changes.
550  * @param[in] result The result of the visibility mode changing
551  * @param[in] visibility_mode The visibility mode to be changed
552  * @param[in] user_data The user data passed from the callback registration function
553  *
554  * @pre This function will be invoked when the visibility of Bluetooth adapter changes
555  * if you register this callback using bt_adapter_set_visibility_mode_changed_cb().
556  *
557  * @see bt_adapter_set_visibility()
558  * @see bt_adapter_set_visibility_mode_changed_cb()
559  * @see bt_adapter_unset_visibility_mode_changed_cb()
560  */
561 typedef void (*bt_adapter_visibility_mode_changed_cb)
562         (int result, bt_adapter_visibility_mode_e visibility_mode, void *user_data);
563
564 /**
565  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
566  * @brief  Called every second until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
567  * @remarks  This callback function is called only if visibility mode is #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE.
568  * @param[in]  duration  The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds)
569  * @param[in]  user_data  The user data passed from the callback registration function
570  * @pre  This function will be invoked if you register this callback using bt_adapter_set_visibility_duration_changed_cb().
571  * @see  bt_adapter_set_visibility_duration_changed_cb()
572  * @see  bt_adapter_unset_visibility_duration_changed_cb()
573  * @see  bt_adapter_set_visibility()
574  */
575 typedef void (*bt_adapter_visibility_duration_changed_cb)(int duration, void *user_data);
576
577 /**
578  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
579  * @brief  Called when the state of device discovery changes.
580  *
581  * @remarks If \a discovery_state is #BT_ADAPTER_DEVICE_DISCOVERY_FOUND,
582  * then you can get some information, such as remote device address, remote device name, rssi, and bonding state.
583  *
584  * @param[in] result The result of the device discovery
585  * @param[in] discovery_state The discovery state to be changed
586  * @param[in] device_info The information of the discovered device \n
587  *                                      If \a discovery_state is #BT_ADAPTER_DEVICE_DISCOVERY_STARTED or
588  * #BT_ADAPTER_DEVICE_DISCOVERY_FINISHED, then \a device_info is NULL.
589  * @param[in] user_data The user data passed from the callback registration function
590  *
591  * @pre Either bt_adapter_start_device_discovery() or bt_adapter_stop_device_discovery() will invoke this function
592  * if you register this callback using bt_adapter_set_device_discovery_state_changed_cb().
593  *
594  * @see bt_adapter_start_device_discovery()
595  * @see bt_adapter_stop_device_discovery()
596  * @see bt_adapter_set_device_discovery_state_changed_cb()
597  * @see bt_adapter_unset_device_discovery_state_changed_cb()
598  *
599  */
600 typedef void (*bt_adapter_device_discovery_state_changed_cb)
601         (int result, bt_adapter_device_discovery_state_e discovery_state, bt_adapter_device_discovery_info_s *discovery_info, void *user_data);
602
603 /**
604  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
605  * @brief  Called when you get bonded devices repeatedly.
606  *
607  * @param[in] device_info The bonded device information
608  * @param[in] user_data The user data passed from the foreach function
609  * @return @c true to continue with the next iteration of the loop,
610  * \n @c false to break out of the loop.
611  * @pre bt_adapter_foreach_bonded_device() will invoke this function.
612  *
613  * @see bt_adapter_foreach_bonded_device()
614  *
615  */
616 typedef bool (*bt_adapter_bonded_device_cb)(bt_device_info_s *device_info, void *user_data);
617
618 /**
619  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
620  * @brief Called when the process of creating bond finishes.
621  * @remarks If the remote user does not respond within 60 seconds, a time out will happen with #BT_ERROR_TIMED_OUT result code.\n
622  * If bt_device_cancel_bonding() is called and it returns #BT_ERROR_NONE, then this callback function will be called
623  * with #BT_ERROR_CANCELLED result. \n
624  * If creating a bond succeeds but service search fails, then this callback will be called with #BT_ERROR_SERVICE_SEARCH_FAILED.
625  * In this case, you should try service search again by bt_device_start_service_search() to get the supported service list.
626  *
627  * @param[in] result The result of the bonding device
628  * @param[in] device_info The device information which you creates bond with
629  * @param[in] user_data The user data passed from the callback registration function
630  *
631  * @pre Either bt_device_create_bond() will invoke this function
632  * if you register this callback using bt_device_set_bond_created_cb().
633  *
634  * @see bt_device_create_bond()
635  * @see bt_device_cancel_bonding()
636  * @see bt_device_set_bond_created_cb()
637  * @see bt_device_unset_bond_created_cb()
638  */
639 typedef void (*bt_device_bond_created_cb)(int result, bt_device_info_s *device_info, void *user_data);
640
641 /**
642  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
643  * @brief  Called when you get connected profiles repeatedly.
644  * @param[in] profile The connected Bluetooth profile
645  * @param[in] user_data The user data passed from the foreach function
646  * @return @c true to continue with the next iteration of the loop,
647  * \n @c false to break out of the loop.
648  * @pre bt_device_foreach_connected_profiles() will invoke this function.
649  * @see bt_device_foreach_connected_profiles()
650  */
651 typedef bool (*bt_device_connected_profile)(bt_profile_e profile, void *user_data);
652
653 /**
654  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
655  * @brief  Called when the bond destroys.
656  * @param[in] result The result that a bond is destroyed
657  * @param[in] remote_address The address of the remote Bluetooth device to destroy bond with
658  * @param[in] user_data The user data passed from the callback registration function
659  * @pre bt_device_destroy_bond() will invoke this function
660  * if you register this callback using bt_device_set_bond_destroyed_cb().
661  *
662  * @see bt_device_destroy_bond()
663  * @see bt_device_set_bond_destroyed_cb()
664  * @see bt_device_unset_bond_destroyed_cb()
665  */
666 typedef void (*bt_device_bond_destroyed_cb)(int result, char *remote_address, void *user_data);
667
668 /**
669  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
670  * @brief  Called when the authorization of device changes.
671  * @param[in] authorization The authorization of device
672  * @param[in] remote_address The address of the remote Bluetooth device which is (un)authorized
673  * @param[in] user_data The user data passed from the callback registration function
674  * @pre bt_device_set_authorization() will invoke this function if you register this callback using bt_device_set_authorization_changed_cb().
675  *
676  * @see bt_device_set_authorization()
677  * @see #bt_device_set_authorization_changed_cb()
678  * @see #bt_device_unset_authorization_changed_cb()
679  */
680 typedef void (*bt_device_authorization_changed_cb)
681         (bt_device_authorization_e authorization, char *remote_address, void *user_data);
682
683 /**
684  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
685  * @brief  Called when the process of service search finishes.
686  * @remark If bt_device_cancel_service_search() is called and it returns #BT_ERROR_NONE,
687  * then this callback function will be called with #BT_ERROR_CANCELLED result.
688  *
689  * @param[in] result The result of the service searching
690  * @param[in] sdp_info The structure of service lists found on a device
691  * @param[in] user_data The user data passed from the callback registration function
692  * @pre Either bt_device_start_service_search() will invoke this function
693  * if you register this callback using  bt_device_set_service_searched_cb().
694  *
695  * @see bt_device_start_service_search()
696  * @see bt_device_cancel_service_search()
697  * @see bt_device_set_service_searched_cb()
698  * @see bt_device_unset_service_searched_cb()
699  *
700  */
701 typedef void (*bt_device_service_searched_cb)(int result, bt_device_sdp_info_s *sdp_info, void *user_data);
702
703 /**
704  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
705  * @brief  Called when the connection state is changed.
706  * @param[in] connected The connection status: (@c true = connected, @c false = disconnected)
707  * @param[in] remote_address The address of the remote Bluetooth device
708  * @param[in] user_data The user data passed from the callback registration function
709  * @see bt_device_set_connection_state_changed_cb()
710  * @see bt_device_unset_connection_state_changed_cb()
711  */
712 typedef void (*bt_device_connection_state_changed_cb)(bool connected, const char *remote_address, void *user_data);
713
714 /**
715  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
716  * @brief Called when you receive data.
717  *
718  * @param[in] data The received data from the remote device
719  * @param[in] user_data The user data passed from the callback registration function
720  *
721  * @pre When the connected remote Bluetooth device invokes bt_socket_send_data(),
722  *              this function will be invoked if you register this function using bt_socket_set_data_received_cb().
723  *
724  * @see bt_socket_set_data_received_cb()
725  * @see bt_socket_unset_data_received_cb()
726  * @see bt_socket_send_data()
727  */
728 typedef void (*bt_socket_data_received_cb)(bt_socket_received_data_s *data, void *user_data);
729
730 /**
731  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
732  * @brief  Called when the socket connection state changes.
733  * @param[in] result The result of connection state changing
734  * @param[in] connection_state The connection state
735  * @param[in] connection The connection information which is established or disconnected
736  * @param[in] user_data The user data passed from the callback registration function
737  * @pre Either bt_socket_connect_rfcomm() will invoke this function.
738  * In addtion, bt_socket_connection_state_changed_cb() will be invoked when the socket connection state is changed.
739  * @see bt_socket_listen_and_accept_rfcomm()
740  * @see bt_socket_connect_rfcomm()
741  * @see bt_socket_set_connection_state_changed_cb()
742  * @see bt_socket_unset_connection_state_changed_cb()
743  */
744 typedef void (*bt_socket_connection_state_changed_cb)
745         (int result, bt_socket_connection_state_e connection_state, bt_socket_connection_s *connection, void *user_data);
746
747
748 /**
749  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
750  * @brief Initializes the Bluetooth API.
751  *
752  * @remarks This function must be called before Bluetooth API starts. \n
753  * You must free all resources of the Bluetooth service by calling bt_deinitialize() if Bluetooth service is no longer needed.
754  *
755  * @return 0 on success, otherwise a negative error value.
756  * @retval #BT_ERROR_NONE  Successful
757  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
758  *
759  * @see  bt_deinitialize()
760  */
761 int bt_initialize(void);
762
763
764 /**
765  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
766  * @brief Releases all resources of the Bluetooth API.
767  *
768  * @remarks This function must be called if Bluetooth API is no longer needed.
769  *
770  * @return 0 on success, otherwise a negative error value.
771  * @retval #BT_ERROR_NONE  Successful
772  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
773  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
774  *
775  * @pre Bluetooth API must be initialized with bt_initialize().
776  *
777  * @see bt_initialize()
778  */
779 int bt_deinitialize(void);
780
781
782 /**
783  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
784  * @brief Enables the local Bluetooth adapter, asynchronously.
785  *
786  * @details This function enables Bluetooth protocol stack and hardware.
787  *
788  * @return 0 on success, otherwise a negative error value.
789  * @retval #BT_ERROR_NONE  Successful
790  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
791  * @retval #BT_ERROR_ALREADY_DONE  Already enabled
792  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
793  *
794  * @pre Bluetooth service must be initialized with bt_initialize().
795  * @post This function invokes bt_adapter_state_changed_cb().
796  *
797  * @see bt_initialize()
798  * @see bt_adapter_get_state()
799  * @see bt_adapter_disable()
800  * @see bt_adapter_set_state_changed_cb()
801  * @see bt_adapter_unset_state_changed_cb()
802  * @see bt_adapter_state_changed_cb()
803  *
804  */
805 int bt_adapter_enable(void);
806
807 /**
808  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
809  * @brief Disables the local Bluetooth adapter, asynchronously.
810  *
811  * @details This function disables Bluetooth protocol stack and hardware.
812  *
813  * @remarks You should disable Bluetooth adapter to switch off Bluetooth chip, which is helpful for saving power.
814  *
815  * @return 0 on success, otherwise a negative error value.
816  * @retval #BT_ERROR_NONE  Successful
817  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
818  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
819  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
820  *
821  * @pre Bluetooth API must be enabled with bt_adapter_enable().
822  * @post This function invokes bt_adapter_state_changed_cb().
823  *
824  * @see bt_adapter_get_state()
825  * @see bt_adapter_enable()
826  * @see bt_adapter_state_changed_cb()
827  * @see bt_adapter_set_state_changed_cb()
828  * @see bt_adapter_unset_state_changed_cb ()
829  *
830  */
831 int bt_adapter_disable(void);
832
833 /**
834  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
835  * @brief Gets the current state of local Bluetooth adapter.
836  *
837  * @param[out] adapter_state The current adapter state
838  *
839  * @return 0 on success, otherwise a negative error value.
840  * @retval #BT_ERROR_NONE  Successful
841  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
842  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
843  *
844  * @pre Bluetooth service must be initialized with bt_initialize().
845  *
846  * @see bt_initialize()
847  * @see bt_adapter_enable()
848  * @see bt_adapter_disable()
849  */
850 int bt_adapter_get_state(bt_adapter_state_e *adapter_state);
851
852 /**
853  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
854  * @brief Gets the address of local Bluetooth adapter.
855  *
856  * @remarks The @a local_address must be released with free() by you.
857  *
858  * @param[out] local_address The device address of local Bluetooth adapter
859  *
860  * @return 0 on success, otherwise a negative error value.
861  * @retval #BT_ERROR_NONE Successful
862  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
863  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
864  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
865  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
866  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
867  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
868  * @see bt_adapter_enable()
869  * @see bt_adapter_get_name()
870  */
871 int bt_adapter_get_address(char **local_address);
872
873 /**
874  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
875  * @brief Gets the name of local Bluetooth adapter.
876  *
877  * @details Use this function to get the friendly name associated with Bluetooth
878  * device, retrieved by the remote Bluetooth devices.
879  *
880  * @remarks The @a local_name must be released with free() by you.
881  *
882  * @param[out] local_name  The local device name
883  *
884  * @return 0 on success, otherwise a negative error value.
885  * @retval #BT_ERROR_NONE  Successful
886  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
887  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
888  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
889  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
890  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
891  *
892  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
893  *
894  * @see bt_adapter_enable()
895  * @see bt_adapter_set_name()
896  */
897 int bt_adapter_get_name(char **local_name);
898
899 /**
900  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
901  * @brief Sets the name of local Bluetooth adapter.
902  *
903  * @param[in] local_name The name of the Bluetooth device. \n
904  *                              The maximum length is 248 characters.
905  *
906  * @return 0 on success, otherwise a negative error value.
907  * @retval #BT_ERROR_NONE  Successful
908  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
909  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
910  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
911  * @retval #BT_ERROR_OPERATION_FAILED Operation failed
912  *
913  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
914  * @post bt_adapter_name_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
915  *
916  * @see bt_adapter_enable()
917  * @see bt_adapter_get_name()
918  * @see bt_adapter_name_changed_cb()
919  * @see bt_adapter_set_name_changed_cb()
920  * @see bt_adapter_unset_name_changed_cb()
921  */
922 int bt_adapter_set_name(const char *local_name);
923
924 /**
925  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
926  * @brief  Gets the visibility mode of local Bluetooth adapter.
927  * @param[out] mode  The visibility mode of the Bluetooth device
928  * @param[out] duration  The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
929  * @a duration is valid only if @a mode is #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE. This value can be NULL.
930  * @return 0 on success, otherwise a negative error value.
931  * @retval #BT_ERROR_NONE  Successful
932  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
933  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
934  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
935  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
936  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
937  * @see bt_adapter_enable()
938  * @see bt_adapter_set_visibility()
939  */
940 int bt_adapter_get_visibility(bt_adapter_visibility_mode_e *mode, int *duration);
941
942 /**
943  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
944  * @brief Sets the visibility mode.
945  *
946  * @remarks #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE will change to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE
947  * after the given @a duration goes.
948  *
949  * @param[in] discoverable_mode The Bluetooth visibility mode to set
950  * @param[in] duration The duration until the visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE (in seconds).
951  * @a duration is used only for #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE mode.
952  *
953  * @return 0 on success, otherwise a negative error value.
954  * @retval #BT_ERROR_NONE  Successful
955  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
956  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
957  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
958  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
959  *
960  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
961  * @post bt_adapter_visibility_mode_changed_cb() will be invoked if this function returns #BT_ERROR_NONE.
962  *
963  * @see bt_adapter_enable()
964  * @see bt_adapter_get_visibility()
965  * @see bt_adapter_visibility_mode_changed_cb()
966  * @see bt_adapter_set_visibility_mode_changed_cb()
967  * @see bt_adapter_unset_visibility_mode_changed_cb()
968  */
969 int bt_adapter_set_visibility(bt_adapter_visibility_mode_e discoverable_mode, int duration);
970
971 /**
972  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
973  * @brief Starts the device discovery, asynchronously.
974  *
975  * @details If a device is discovered, bt_adapter_device_discovery_state_changed_cb() will be invoked
976  * with #BT_ADAPTER_DEVICE_DISCOVERY_FOUND, and then bt_adapter_device_discovery_state_changed_cb()
977  * will be called with #BT_ADAPTER_DEVICE_DISCOVERY_FINISHED in case of the completion or cancellation of the discovery.
978  *
979  * @remarks To connect to peer Bluetooth device, you need to know its Bluetooth address. \n
980  * The device discovery can be stopped by bt_adapter_stop_device_discovery().
981  *
982  * @return 0 on success, otherwise a negative error value.
983  * @retval #BT_ERROR_NONE  Successful
984  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
985  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
986  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation is now in progress
987  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
988  *
989  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
990  * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
991  *
992  * @see bt_adapter_enable()
993  * @see bt_adapter_is_discovering()
994  * @see bt_adapter_stop_device_discovery()
995  * @see bt_adapter_device_discovery_state_changed_cb()
996  * @see bt_adapter_set_device_discovery_state_changed_cb()
997  * @see bt_adapter_unset_device_discovery_state_changed_cb()
998  */
999 int bt_adapter_start_device_discovery(void);
1000
1001 /**
1002  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1003  * @brief Stops the device discovery, asynchronously.
1004  * @remarks The device discovery process will take 10 ~ 20 seconds to get all the devices in vicinity.
1005  *
1006  * @return 0 on success, otherwise a negative error value.
1007  * @retval #BT_ERROR_NONE  Successful
1008  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1009  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1010  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation is not in progress
1011  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1012  *
1013  * @pre The device discovery must be in progress with bt_adapter_start_device_discovery().
1014  * @post This function invokes bt_adapter_device_discovery_state_changed_cb().
1015  *
1016  * @see bt_adapter_is_discovering()
1017  * @see bt_adapter_start_device_discovery()
1018  * @see bt_adapter_set_device_discovery_state_changed_cb()
1019  * @see bt_adapter_unset_device_discovery_state_changed_cb()
1020  * @see bt_adapter_device_discovery_state_changed_cb()
1021  */
1022 int bt_adapter_stop_device_discovery(void);
1023
1024 /**
1025  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1026  * @brief Checks for the device discovery is in progress or not.
1027  *
1028  * @remarks If Bluetooth discovery is in progress, other operations are not allowed and
1029  * you have to either stop the discovery operation, or wait for it to be finished,
1030  * before performing other operations.
1031
1032  * @param[out] is_discovering The discovering status: (@c true = in progress , @c  false = not in progress )
1033  *
1034  * @return 0 on success, otherwise a negative error value.
1035  * @retval #BT_ERROR_NONE  Successful
1036  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1037  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1038  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1039  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1040  *
1041  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1042  *
1043  * @see bt_adapter_enable()
1044  * @see bt_adapter_start_device_discovery()
1045  * @see bt_adapter_stop_device_discovery()
1046  */
1047 int bt_adapter_is_discovering(bool *is_discovering);
1048
1049 /**
1050  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1051  * @brief Retrieves the device information of all bonded devices.
1052  *
1053  * @param [in] callback The callback function to invoke
1054  * @param [in] user_data The user data passed from the foreach function
1055  *
1056  * @return 0 on success, otherwise a negative error value.
1057  * @retval #BT_ERROR_NONE  Successful
1058  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1059  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1060  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
1061  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1062  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1063  *
1064  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1065  * @post This function invokes bt_adapter_bonded_device_cb().
1066  *
1067  * @see bt_adapter_bonded_device_cb()
1068  * @see bt_adapter_enable()
1069  */
1070 int bt_adapter_foreach_bonded_device(bt_adapter_bonded_device_cb callback, void *user_data);
1071
1072 /**
1073  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1074  * @brief Gets the device information of a bonded device.
1075  * @remarks The @a device_info must be released with bt_adapter_free_device_info() by you .
1076  *
1077  * @param [in] remote_address The address of remote device
1078  * @param [out] device_info The bonded device information
1079  *
1080  * @return 0 on success, otherwise a negative error value.
1081  * @retval #BT_ERROR_NONE  Successful
1082  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1083  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1084  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
1085  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1086  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1087  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1088  *
1089  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1090  * @post This function invokes bt_adapter_bonded_device_cb().
1091  *
1092  * @see bt_adapter_bonded_device_cb()
1093  * @see bt_adapter_enable()
1094  */
1095 int bt_adapter_get_bonded_device_info(const char *remote_address, bt_device_info_s **device_info);
1096
1097 /**
1098  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1099  * @brief Frees device info.
1100  *
1101  * @param [in] device_info The bonded device information
1102  *
1103  * @return 0 on success, otherwise a negative error value.
1104  * @retval #BT_ERROR_NONE  Successful
1105  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1106  *
1107  * @see bt_adapter_get_bonded_device_info()
1108  */
1109 int bt_adapter_free_device_info(bt_device_info_s *device_info);
1110
1111 /**
1112  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1113  * @brief Checks whether the UUID of service is used or not
1114  * @param[in] service_uuid The UUID of service
1115  * @param[out] used Indicates whether the service is used or not
1116  * @return true on success, otherwise false.
1117  * @return 0 on success, otherwise a negative error value.
1118  * @retval #BT_ERROR_NONE  Successful
1119  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1120  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1121  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1122  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1123  * @see bt_adapter_enable()
1124  */
1125 int bt_adapter_is_service_used(const char *service_uuid, bool *used);
1126
1127 /**
1128  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1129  * @brief  Registers a callback function to be invoked when the Bluetooth adapter state changes.
1130  *
1131  * @param[in] callback  The callback function to invoke
1132  * @param[in] user_data The user data to be passed to the callback function
1133  *
1134  * @return   0 on success, otherwise a negative error value.
1135  * @retval #BT_ERROR_NONE  Successful
1136  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1137  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1138  *
1139  * @pre The Bluetooth service must be initialized with bt_initialize().
1140  * @post bt_adapter_state_changed_cb() will be invoked.
1141  *
1142  * @see bt_initialize()
1143  * @see bt_adapter_state_changed_cb()
1144  * @see bt_adapter_set_state_changed_cb()
1145  * @see bt_adapter_unset_state_changed_cb()
1146  */
1147 int bt_adapter_set_state_changed_cb(bt_adapter_state_changed_cb callback, void *user_data);
1148
1149 /**
1150  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1151  * @brief       Unregisters the callback function.
1152  *
1153  * @return      0 on success, otherwise a negative error value.
1154  * @retval #BT_ERROR_NONE  Successful
1155  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1156  *
1157  * @pre The Bluetooth service must be initialized with bt_initialize().
1158  *
1159  * @see bt_initialize()
1160  * @see bt_adapter_set_state_changed_cb()
1161  */
1162 int bt_adapter_unset_state_changed_cb(void);
1163
1164 /**
1165  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1166  * @brief  Registers a callback function to be invoked when the name of Bluetooth adapter changes.
1167  *
1168  * @param[in] callback The callback function to invoke
1169  * @param[in] user_data The user data to be passed to the callback function
1170  *
1171  * @return   0 on success, otherwise a negative error value.
1172  * @retval #BT_ERROR_NONE  Successful
1173  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1174  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1175  *
1176  * @pre The Bluetooth service must be initialized with bt_initialize().
1177  * @post  bt_adapter_name_changed_cb() will be invoked.
1178  *
1179  * @see bt_initialize()
1180  * @see bt_adapter_name_changed_cb()
1181  * @see bt_adapter_unset_name_changed_cb()
1182  */
1183 int bt_adapter_set_name_changed_cb(bt_adapter_name_changed_cb callback, void *user_data);
1184
1185 /**
1186  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1187  * @brief       Unregisters the callback function.
1188  *
1189  * @return      0 on success, otherwise a negative error value.
1190  * @retval #BT_ERROR_NONE  Successful
1191  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1192  *
1193  * @pre The Bluetooth service must be initialized with bt_initialize().
1194  *
1195  * @see bt_initialize()
1196  * @see bt_adapter_set_name_changed_cb()
1197  */
1198 int bt_adapter_unset_name_changed_cb(void);
1199
1200 /**
1201  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1202  * @brief  Registers a callback function to be invoked when the visibility mode changes.
1203  *
1204  * @param[in] callback The callback function to register
1205  * @param[in] user_data The user data to be passed to the callback function
1206  *
1207  * @return   0 on success, otherwise a negative error value.
1208  * @retval #BT_ERROR_NONE  Successful
1209  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1210  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1211  *
1212  * @pre The Bluetooth service must be initialized with bt_initialize().
1213  * @post bt_adapter_visibility_mode_changed_cb() will be invoked.
1214  *
1215  * @see bt_initialize()
1216  * @see bt_adapter_visibility_mode_changed_cb()
1217  * @see bt_adapter_unset_visibility_mode_changed_cb()
1218  */
1219 int bt_adapter_set_visibility_mode_changed_cb(bt_adapter_visibility_mode_changed_cb callback, void *user_data);
1220
1221 /**
1222  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1223  * @brief  Unregisters the callback function.
1224  *
1225  * @return  0 on success, otherwise a negative error value.
1226  * @retval  #BT_ERROR_NONE  Successful
1227  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
1228  *
1229  * @pre  The Bluetooth service must be initialized with bt_initialize().
1230  *
1231  * @see  bt_initialize()
1232  * @see  bt_adapter_set_visibility_mode_changed_cb()
1233  */
1234 int bt_adapter_unset_visibility_mode_changed_cb(void);
1235
1236 /**
1237  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1238  * @brief  Registers a callback function to be invoked every second
1239  * until the visibility mode is changed from #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE
1240  * to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
1241  * @details  When you set visibility mode as #BT_ADAPTER_VISIBILITY_MODE_LIMITED_DISCOVERABLE,
1242  * @a callback will be called every second until visibility mode is changed to #BT_ADAPTER_VISIBILITY_MODE_NON_DISCOVERABLE.
1243  * @param[in]  callback  The callback function to register
1244  * @param[in]  user_data  The user data to be passed to the callback function
1245  * @return  0 on success, otherwise a negative error value.
1246  * @retval  #BT_ERROR_NONE  Successful
1247  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
1248  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1249  * @pre  The Bluetooth service must be initialized by bt_initialize().
1250  * @post  bt_adapter_visibility_duration_changed_cb() will be invoked.
1251  * @see  bt_initialize()
1252  * @see  bt_adapter_set_visibility()
1253  * @see  bt_adapter_visibility_duration_changed_cb()
1254  * @see  bt_adapter_unset_visibility_duration_changed_cb()
1255  */
1256 int bt_adapter_set_visibility_duration_changed_cb(bt_adapter_visibility_duration_changed_cb callback, void *user_data);
1257
1258 /**
1259  * @ingroup  CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1260  * @brief        Unregisters the callback function.
1261  * @return  0 on success, otherwise a negative error value.
1262  * @retval  #BT_ERROR_NONE  Successful
1263  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
1264  * @pre  The Bluetooth service must be initialized with bt_initialize().
1265  * @see  bt_initialize()
1266  * @see  bt_adapter_set_visibility_duration_changed_cb()
1267  */
1268 int bt_adapter_unset_visibility_duration_changed_cb(void);
1269
1270 /**
1271  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1272  * @brief  Registers a callback function to be invoked when the device discovery state changes.
1273  *
1274  * @param[in] callback The callback function to register
1275  * @param[in] user_data The user data to be passed to the callback function
1276  *
1277  * @return   0 on success, otherwise a negative error value.
1278  * @retval #BT_ERROR_NONE  Successful
1279  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1280  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1281  *
1282  * @pre The Bluetooth service must be initialized with bt_initialize().
1283  * @post bt_adapter_device_discovery_state_changed_cb() will be invoked.
1284  *
1285  * @see bt_initialize()
1286  * @see bt_adapter_device_discovery_state_changed_cb()
1287  * @see bt_adapter_set_device_discovery_state_changed_cb()
1288  * @see bt_adapter_unset_device_discovery_state_changed_cb()
1289  */
1290 int bt_adapter_set_device_discovery_state_changed_cb(bt_adapter_device_discovery_state_changed_cb callback, void *user_data);
1291
1292 /**
1293  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_MODULE
1294  * @brief       Unregisters the callback function.
1295  *
1296  * @return      0 on success, otherwise a negative error value.
1297  * @retval #BT_ERROR_NONE  Successful
1298  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1299  *
1300  * @pre The Bluetooth service must be initialized with bt_initialize().
1301  *
1302  * @see bt_initialize()
1303  * @see bt_adapter_set_device_discovery_state_changed_cb()
1304  */
1305 int bt_adapter_unset_device_discovery_state_changed_cb(void);
1306
1307
1308 /**
1309  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1310  * @brief Creates a bond with a remote Bluetooth device, asynchronously.
1311  *
1312  * @remarks A bond can be destroyed by bt_device_destroy_bond().\n
1313  * The bonding request can be cancelled by bt_device_cancel_bonding().
1314  *
1315  * @param[in] remote_address The address of the remote Bluetooth device with which the bond should be created
1316  *
1317  * @return 0 on success, otherwise a negative error value.
1318  * @retval #BT_ERROR_NONE  Successful
1319  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1320  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1321  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1322  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1323  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1324  *
1325  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable()
1326  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1327  * @post This function invokes bt_device_bond_created_cb().
1328  *
1329  * @see bt_adapter_enable()
1330  * @see bt_adapter_start_device_discovery()
1331  * @see bt_device_bond_created_cb()
1332  * @see bt_device_cancel_bonding()
1333  * @see bt_device_destroy_bond()
1334  * @see bt_device_set_bond_created_cb()
1335  * @see bt_device_unset_bond_created_cb()
1336  */
1337 int bt_device_create_bond(const char *remote_address);
1338
1339 /**
1340  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1341  * @brief Cancels the bonding process.
1342  *
1343  * @remakrs Use this function when the remote Bluetooth device is not responding to the
1344  * bond request or you wish to cancel the bonding request.
1345  *
1346  * @return 0 on success, otherwise a negative error value.
1347  * @retval #BT_ERROR_NONE  Successful
1348  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1349  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1350  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation not in progress
1351  * @pre The creating a bond must be in progress by bt_device_create_bond().
1352  *
1353  * @see bt_device_create_bond()
1354  * @see bt_device_bond_created_cb()
1355  * @see bt_device_set_bond_created_cb()
1356  * @see bt_device_unset_bond_created_cb()
1357  */
1358 int bt_device_cancel_bonding(void);
1359
1360 /**
1361  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1362  * @brief Destroys the bond, asynchronously.
1363  *
1364  * @param[in] remote_address The address of the remote Bluetooth device to remove bonding
1365  *
1366  * @return 0 on success, otherwise a negative error value.
1367  * @retval #BT_ERROR_NONE  Successful
1368  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1369  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1370  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1371  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
1372  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1373  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1374  *
1375  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1376  * @pre The bond with the remote device must be created with bt_device_create_bond().
1377  * @post This function invokes bt_device_bond_destroyed_cb().
1378  *
1379  * @see bt_adapter_enable()
1380  * @see bt_device_create_bond()
1381  * @see bt_device_bond_destroyed_cb()
1382  * @see bt_device_set_bond_destroyed_cb()
1383  * @see bt_device_unset_bond_destroyed_cb()
1384  */
1385 int bt_device_destroy_bond(const char *remote_address);
1386
1387 /**
1388  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1389  * @brief Sets an alias for the bonded device.
1390  *
1391  * @param[in] remote_address The address of the remote Bluetooth device
1392  * @param[in] alias The alias of the remote Bluetooth device
1393  *
1394  * @return 0 on success, otherwise a negative error value.
1395  * @retval #BT_ERROR_NONE  Successful
1396  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1397  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1398  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1399  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1400  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1401  *
1402  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1403  * @pre The bond with the remote device must be created with bt_device_create_bond().
1404  *
1405  * @see bt_adapter_enable()
1406  * @see bt_device_create_bond()
1407  */
1408 int bt_device_set_alias(const char *remote_address, const char *alias);
1409
1410 /**
1411  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1412  * @brief Sets the authorization of a bonded device, asynchronously.
1413  *
1414  * @remarks Once a device is authorized, you don't need to receive a confirmation.
1415  *
1416  * @param[in] remote_address The address of the remote Bluetooth device to authorize
1417  * @param[in] authorization The Bluetooth authorization state
1418  *
1419  * @return 0 on success, otherwise a negative error value.
1420  * @retval #BT_ERROR_NONE  Successful
1421  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1422  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1423  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1424  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1425  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1426  *
1427  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1428  * @pre The bond with the remote device must be created with bt_device_create_bond().
1429  * @post bt_device_authorization_changed_cb() will be invoked.
1430  *
1431  * @see bt_adapter_enable()
1432  * @see bt_device_create_bond()
1433  * @see bt_device_authorization_changed_cb()
1434  * @see bt_device_set_authorization_changed_cb()
1435  * @see bt_device_unset_authorization_changed_cb()
1436  */
1437 int bt_device_set_authorization(const char *remote_address, bt_device_authorization_e authorization_state);
1438
1439 /**
1440  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1441  * @brief Starts the search for services supported by the specified device, asynchronously.
1442  *
1443  * @remarks If creating a bond succeeds, which means bt_device_bond_created_cb() is called with result #BT_ERROR_NONE,
1444  * then you don't need to run this function.\n
1445  * The service search takes a couple of seconds to complete normally. \n
1446  * The service search can be canceled by bt_device_cancel_service_search().
1447  *
1448  * @param[in] remote_address The address of the remote Bluetooth device whose services need to be checked
1449  *
1450  * @return 0 on success, otherwise a negative error value.
1451  * @retval #BT_ERROR_NONE  Successful
1452  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1453  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1454  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1455  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1456  * @retval #BT_ERROR_SERVICE_SEARCH_FAILED  Service search failed
1457  *
1458  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1459  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1460  * @pre The bond with the remote device must be created with bt_device_create_bond().
1461  * @post This function invokes bt_device_service_searched_cb().
1462  *
1463  * @see bt_adapter_enable()
1464  * @see bt_adapter_start_device_discovery()
1465  * @see bt_device_create_bond()
1466  * @see bt_device_bond_created_cb()
1467  * @see bt_device_service_searched_cb()
1468  * @see bt_device_cancel_service_search()
1469  * @see bt_device_set_service_searched_cb()
1470  * @see bt_device_unset_service_searched_cb()
1471  */
1472 int bt_device_start_service_search(const char *remote_address);
1473
1474 /**
1475  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1476  * @brief Cancels service search process.
1477  *
1478  * @return 0 on success, otherwise a negative error value.
1479  * @retval #BT_ERROR_NONE  Successful
1480  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1481  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1482  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1483  * @retval #BT_ERROR_NOT_IN_PROGRESS  Operation not in progress
1484  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1485  *
1486  * @pre The service search must be in progress by bt_device_start_service_search().
1487  *
1488  * @see bt_device_start_service_search()
1489  * @see bt_device_service_searched_cb()
1490  * @see bt_device_set_service_searched_cb()
1491  * @see bt_device_unset_service_searched_cb()
1492  */
1493 int bt_device_cancel_service_search(void);
1494
1495 /**
1496  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1497  * @brief Gets the connected profiles.
1498  * @param[in] remote_address The address of the remote device
1499  * @param[in] callback The callback function to invoke
1500  * @param[in] user_data The user data to be passed to the callback function
1501  * @return 0 on success, otherwise a negative error value.
1502  * @retval #BT_ERROR_NONE  Successful
1503  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1504  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1505  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1506  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1507  * @post bt_device_connected_profile() will be invoked.
1508  * @see bt_adapter_enable()
1509  * @see bt_device_connected_profile()
1510  */
1511 int bt_device_foreach_connected_profiles(const char *remote_address, bt_device_connected_profile callback, void *user_data);
1512
1513 /**
1514  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1515  * @brief  Registers a callback function to be invoked when the bond creates.
1516  * @param[in] callback The callback function to register
1517  * @param[in] user_data The user data to be passed to the callback function
1518  * @return   0 on success, otherwise a negative error value.
1519  * @retval #BT_ERROR_NONE  Successful
1520  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1521  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1522  * @pre The Bluetooth service must be initialized with bt_initialize().
1523  * @post  bt_device_bond_created_cb() will be invoked.
1524  * @see bt_initialize()
1525  * @see bt_device_bond_created_cb()
1526  * @see bt_device_unset_bond_created_cb()
1527  */
1528 int bt_device_set_bond_created_cb(bt_device_bond_created_cb callback, void *user_data);
1529
1530 /**
1531  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1532  * @brief       Unregisters the callback function.
1533  * @return      0 on success, otherwise a negative error value.
1534  * @retval #BT_ERROR_NONE  Successful
1535  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1536  * @pre The Bluetooth service must be initialized with bt_initialize().
1537  * @see bt_initialize()
1538  * @see bt_device_set_bond_created_cb()
1539  */
1540 int bt_device_unset_bond_created_cb(void);
1541
1542 /**
1543  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1544  * @brief  Registers a callback function to be invoked when the bond destroys.
1545  * @param[in] callback The callback function to register
1546  * @param[in] user_data The user data to be passed to the callback function
1547  * @return   0 on success, otherwise a negative error value.
1548  * @retval #BT_ERROR_NONE  Successful
1549  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1550  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1551  * @pre The Bluetooth service must be initialized with bt_initialize().
1552  * @post  bt_device_bond_destroyed_cb() will be invoked.
1553  * @see bt_initialize()
1554  * @see bt_device_bond_destroyed_cb()
1555  * @see bt_device_unset_bond_destroyed_cb()
1556  */
1557 int bt_device_set_bond_destroyed_cb(bt_device_bond_destroyed_cb callback, void *user_data);
1558
1559 /**
1560  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1561  * @brief       Unregisters the callback function.
1562  * @return      0 on success, otherwise a negative error value.
1563  * @retval #BT_ERROR_NONE  Successful
1564  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1565  * @pre The Bluetooth service must be initialized with bt_initialize().
1566  * @see bt_initialize()
1567  * @see bt_device_set_bond_destroyed_cb()
1568  */
1569 int bt_device_unset_bond_destroyed_cb(void);
1570
1571 /**
1572  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1573  * @brief  Registers a callback function to be invoked when the authorization of device changes.
1574  * @param[in] callback The callback function to register
1575  * @param[in] user_data The user data to be passed to the callback function
1576  * @return   0 on success, otherwise a negative error value.
1577  * @retval #BT_ERROR_NONE  Successful
1578  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1579  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1580  * @pre The Bluetooth service must be initialized with bt_initialize().
1581  * @post  bt_device_authorization_changed_cb() will be invoked.
1582  * @see bt_initialize()
1583  * @see bt_device_authorization_changed_cb()
1584  * @see bt_device_set_authorization_changed_cb()
1585  * @see bt_device_unset_authorization_changed_cb()
1586  */
1587 int bt_device_set_authorization_changed_cb(bt_device_authorization_changed_cb callback, void *user_data);
1588
1589 /**
1590  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1591  * @brief       Unregisters the callback function.
1592  * @return      0 on success, otherwise a negative error value.
1593  * @retval #BT_ERROR_NONE  Successful
1594  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1595  * @pre The Bluetooth service must be initialized with bt_initialize().
1596  * @see bt_initialize()
1597  * @see bt_device_set_authorization_changed_cb()
1598  */
1599 int bt_device_unset_authorization_changed_cb(void);
1600
1601 /**
1602  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1603  * @brief  Registers a callback function to be invoked when the process of service search finishes.
1604  * @param[in] callback The callback function to register
1605  * @param[in] user_data The user data to be passed to the callback function
1606  * @return   0 on success, otherwise a negative error value.
1607  * @retval #BT_ERROR_NONE  Successful
1608  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1609  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1610  * @pre The Bluetooth service must be initialized with bt_initialize().
1611  * @post  bt_device_service_searched_cb() will be invoked.
1612  * @see bt_initialize()
1613  * @see bt_device_service_searched_cb()
1614  * @see bt_device_unset_service_searched_cb()
1615  */
1616 int bt_device_set_service_searched_cb(bt_device_service_searched_cb callback, void *user_data);
1617
1618 /**
1619  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1620  * @brief       Unregisters the callback function.
1621  * @return      0 on success, otherwise a negative error value.
1622  * @retval #BT_ERROR_NONE  Successful
1623  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1624  * @pre The Bluetooth service must be initialized with bt_initialize().
1625  * @see bt_initialize()
1626  * @see bt_device_set_service_searched_cb()
1627  */
1628 int bt_device_unset_service_searched_cb(void);
1629
1630 /**
1631  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1632  * @brief  Registers a callback function to be invoked when the connection state is changed.
1633  * @param[in] callback The callback function to register
1634  * @param[in] user_data The user data to be passed to the callback function
1635  * @return 0 on success, otherwise a negative error value.
1636  * @retval #BT_ERROR_NONE  Successful
1637  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1638  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1639  * @pre The Bluetooth service must be initialized with bt_initialize().
1640  * @post bt_device_connection_state_changed_cb() will be invoked.
1641  * @see bt_initialize()
1642  * @see bt_device_connection_state_changed_cb()
1643  * @see bt_device_unset_connection_state_changed_cb()
1644  */
1645 int bt_device_set_connection_state_changed_cb(bt_device_connection_state_changed_cb callback, void *user_data);
1646
1647 /**
1648  * @ingroup CAPI_NETWORK_BLUETOOTH_DEVICE_MODULE
1649  * @brief       Unregisters the callback function to be invoked when the connection state is changed.
1650  * @return 0 on success, otherwise a negative error value.
1651  * @retval #BT_ERROR_NONE  Successful
1652  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1653  * @pre The Bluetooth service must be initialized with bt_initialize().
1654  * @see bt_initialize()
1655  * @see bt_device_set_connection_state_changed_cb()
1656  */
1657 int bt_device_unset_connection_state_changed_cb(void);
1658
1659 /**
1660  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1661  * @brief Registers a rfcomm socket with a specific UUID.
1662  *
1663  * @remarks A socket can be destroyed by bt_socket_destroy_rfcomm().
1664  *
1665  * @param[in] service_uuid The UUID of service to provide
1666  * @param[out] socket_fd The file descriptor of socket to listen
1667  * @return 0 on success, otherwise a negative error value.
1668  *
1669  * @retval #BT_ERROR_NONE  Successful
1670  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1671  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1672  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1673  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1674  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1675  *
1676  * @see bt_adapter_enable()
1677  * @see bt_socket_listen_and_accept_rfcomm()
1678  * @see bt_socket_destroy_rfcomm()
1679  */
1680 int bt_socket_create_rfcomm(const char *service_uuid, int *socket_fd);
1681
1682 /**
1683  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1684  * @brief Removes the rfcomm socket with the given socket.
1685  * @remarks If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
1686  * then bt_socket_connection_state_changed_cb() will be called when this function is finished successfully.
1687  *
1688  * @param[in] socket_fd The file descriptor of socket to destroy
1689  * @return 0 on success, otherwise a negative error value.
1690  * @retval #BT_ERROR_NONE  Successful
1691  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1692  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1693  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1694  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1695  *
1696  * @pre The socket must be created with bt_socket_create_rfcomm().
1697  * @post If callback function bt_socket_connection_state_changed_cb() is set and the remote Bluetooth device is connected,
1698  * then bt_socket_connection_state_changed_cb() will be called.
1699  * @see bt_socket_create_rfcomm()
1700  * @see bt_socket_connection_state_changed_cb()
1701  * @see bt_socket_set_connection_state_changed_cb()
1702  * @see bt_socket_unset_connection_state_changed_cb()
1703  */
1704 int bt_socket_destroy_rfcomm(int socket_fd);
1705
1706 /**
1707  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1708  * @brief Starts listening on passed rfcomm socket and accepts connection requests.
1709  * @details Pop-up is shown automatically when a RFCOMM connection is requested.
1710  * bt_socket_connection_state_changed_cb() will be called with
1711  * #BT_SOCKET_CONNECTED if you click "yes" and connection is finished successfully.
1712  * @param[in] socket_fd The file descriptor of socket on which start to listen
1713  * @param[in] max_pending_connections The maximum number of pending connections
1714  * @return 0 on success, otherwise a negative error value.
1715  * @retval #BT_ERROR_NONE  Successful
1716  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1717  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1718  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1719  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1720  * @pre The socket must be created with bt_socket_create_rfcomm().
1721  * @post If callback function bt_socket_connection_state_changed_cb() is set,
1722  * then bt_socket_connection_state_changed_cb() will be called when the remote Bluetooth device is connected.
1723  * @see bt_socket_create_rfcomm()
1724  * @see bt_socket_connection_state_changed_cb()
1725  * @see bt_socket_set_connection_state_changed_cb()
1726  * @see bt_socket_unset_connection_state_changed_cb()
1727  */
1728 int bt_socket_listen_and_accept_rfcomm(int socket_fd, int max_pending_connections);
1729
1730 /**
1731  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1732  * @brief  Called when a RFCOMM connection is requested.
1733  * @details You must call bt_socket_accept() if you want to accept. Otherwise, you must call bt_socket_reject().
1734  * @param[in] socket_fd  The file descriptor of socket on which a connection is requested
1735  * @param[in] remote_address  The address of remote device
1736  * @param[in] user_data The user data passed from the callback registration function
1737  * @pre If you register this callback function by bt_socket_set_connection_requested_cb() and listen a socket by bt_socket_listen(),
1738  * bt_socket_connection_requested_cb() will be invoked.
1739  * @see bt_socket_listen()
1740  * @see bt_socket_accept()
1741  * @see bt_socket_reject()
1742  */
1743 typedef void (*bt_socket_connection_requested_cb) (int socket_fd, const char *remote_address, void *user_data);
1744
1745 /**
1746  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1747  * @brief Starts listening on passed rfcomm socket.
1748  * @details bt_socket_connection_requested_cb() will be called when a RFCOMM connection is requested.
1749  *
1750  * @param[in] socket_fd  The file descriptor socket on which start to listen
1751  * @param[in] user_data  The user data to be passed to the callback function
1752  *
1753  * @return 0 on success, otherwise a negative error value.
1754  * @retval #BT_ERROR_NONE  Successful
1755  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1756  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1757  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1758  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1759  *
1760  * @pre The socket must be created with bt_socket_create_rfcomm().
1761  * @post This function invokes bt_socket_connection_state_changed_cb().
1762  *
1763  * @see bt_socket_create_rfcomm()
1764  * @see bt_socket_set_connection_requested_cb()
1765  * @see bt_socket_unset_connection_requested_cb()
1766  * @see bt_socket_connection_requested_cb()
1767  */
1768 int bt_socket_listen(int socket_fd, int max_pending_connections);
1769
1770 /**
1771  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1772  * @brief  Accepts a connection request.
1773  * @param[in] requested_socket_fd  The file descriptor of socket on which a connection is requested
1774  * @param[out] connected_socket_fd  The file descriptor of connected socket
1775  * @return 0 on success, otherwise a negative error value.
1776  * @retval #BT_ERROR_NONE  Successful
1777  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1778  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1779  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1780  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1781  * @pre The connection is requested by bt_socket_connection_requested_cb().
1782  * @see bt_socket_create_rfcomm()
1783  * @see bt_socket_connection_requested_cb()
1784  * @see bt_socket_listen()
1785  * @see bt_socket_reject()
1786 */
1787 int bt_socket_accept(int requested_socket_fd, int *connected_socket_fd);
1788
1789 /**
1790  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1791  * @brief  Rejects a connection request.
1792  * @param[in] socket_fd  The file descriptor of socket on which a connection is requested
1793  * @return 0 on success, otherwise a negative error value.
1794  * @retval #BT_ERROR_NONE  Successful
1795  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1796  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1797  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1798  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1799  * @pre The connection is requested by bt_socket_connection_requested_cb().
1800  * @see bt_socket_create_rfcomm()
1801  * @see bt_socket_connection_requested_cb()
1802  * @see bt_socket_listen()
1803  * @see bt_socket_accept()
1804  */
1805 int bt_socket_reject(int socket_fd);
1806
1807 /**
1808  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1809  * @brief Connects to a specific RFCOMM based service on a remote Bluetooth device UUID, asynchronously.
1810  *
1811  * @remarks A connection can be disconnected by bt_socket_disconnect_rfcomm().
1812  *
1813  * @param[in] remote_address The address of the remote Bluetooth device
1814  * @param[in] service_uuid The UUID of service provided by the remote Bluetooth device
1815  *
1816  * @return 0 on success, otherwise a negative error value.
1817  * @retval #BT_ERROR_NONE  Successful
1818  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1819  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1820  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1821  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device not bonded
1822  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1823  *
1824  * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED with bt_adapter_enable().
1825  * @pre The remote device must be discoverable with bt_adapter_start_device_discovery().
1826  * @pre The bond with the remote device must be created with bt_device_create_bond().
1827  * @post This function invokes bt_socket_connection_state_changed_cb().
1828  *
1829  * @see bt_adapter_enable()
1830  * @see bt_device_create_bond()
1831  * @see bt_adapter_start_device_discovery()
1832  * @see bt_device_start_service_search()
1833  * @see bt_socket_disconnect_rfcomm()
1834  * @see bt_socket_connection_state_changed_cb()
1835  * @see bt_socket_set_connection_state_changed_cb()
1836  * @see bt_socket_unset_connection_state_changed_cb()
1837  */
1838 int bt_socket_connect_rfcomm(const char *remote_address, const char *service_uuid);
1839
1840 /**
1841  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1842  * @brief Disconnects the RFCOMM connection with the given file descriptor of conneted socket.
1843  * @remarks Because this function is synchronous, bt_socket_connection_state_changed_cb() won't be called.
1844  * @param[in] socket_fd  The file descriptor of socket to close
1845  * @return 0 on success, otherwise a negative error value.
1846  * @retval #BT_ERROR_NONE  Successful
1847  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1848  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1849  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1850  * @pre The connection must be established.
1851  */
1852 int bt_socket_disconnect_rfcomm(int socket_fd);
1853
1854 /**
1855  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1856  * @brief Sends data to the connected device.
1857  *
1858  * @param[in] socket_fd The file descriptor of connected socket
1859  * @param[in] data The data to be sent
1860  * @param[in] length The length of data to be sent
1861  *
1862  * @return 0 on success, otherwise a negative error value.
1863  * @retval #BT_ERROR_NONE  Successful
1864  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1865  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
1866  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1867  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
1868  *
1869  * @pre The connection must be established.
1870  */
1871 int bt_socket_send_data(int socket_fd, const char *data, int length);
1872
1873 /**
1874  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1875  * @brief  Register a callback function that will be invoked when you receive data.
1876  * @param[in] callback The callback function to register
1877  * @param[in] user_data The user data to be passed to the callback function
1878  * @return   0 on success, otherwise a negative error value.
1879  * @retval #BT_ERROR_NONE  Successful
1880  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1881  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1882  * @pre The Bluetooth service must be initialized with bt_initialize().
1883  * @post  bt_socket_data_received_cb() will be invoked.
1884  * @see bt_initialize()
1885  * @see bt_socket_data_received_cb()
1886  * @see bt_socket_set_data_received_cb()
1887  * @see bt_socket_unset_data_received_cb()
1888  */
1889 int bt_socket_set_data_received_cb(bt_socket_data_received_cb callback, void *user_data);
1890
1891 /**
1892  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1893  * @brief       Unregisters the callback function.
1894  * @return      0 on success, otherwise a negative error value.
1895  * @retval #BT_ERROR_NONE  Successful
1896  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1897  * @pre The Bluetooth service must be initialized with bt_initialize().
1898  * @see bt_initialize()
1899  * @see bt_socket_data_received_cb()
1900  * @see bt_socket_set_data_received_cb()
1901  */
1902 int bt_socket_unset_data_received_cb(void);
1903
1904 /**
1905  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1906  * @brief  Register a callback function that will be invoked when a RFCOMM connection is requested.
1907  * @param[in] callback The callback function to register
1908  * @param[in] user_data The user data to be passed to the callback function
1909  * @return   0 on success, otherwise a negative error value.
1910  * @retval #BT_ERROR_NONE  Successful
1911  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1912  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1913  * @pre The Bluetooth service must be initialized with bt_initialize().
1914  * @post If you listen a socket by bt_socket_listen(), bt_socket_connection_requested_cb() will be invoked.
1915  * @see bt_initialize()
1916  * @see bt_socket_unset_connection_requested_cb()
1917  */
1918 int bt_socket_set_connection_requested_cb(bt_socket_connection_requested_cb callback, void *user_data);
1919
1920 /**
1921  * @ingroup  CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1922  * @brief  Unregisters the callback function.
1923  * @return  0 on success, otherwise a negative error value.
1924  * @retval  #BT_ERROR_NONE  Successful
1925  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
1926  * @pre  The Bluetooth service must be initialized with bt_initialize().
1927  * @see  bt_initialize()
1928  * @see  bt_socket_set_connection_requested_cb()
1929  * @see  bt_socket_connection_requested_cb()
1930  */
1931 int bt_socket_unset_connection_requested_cb(void);
1932
1933 /**
1934  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1935  * @brief  Register a callback function that will be invoked when the connection state changes.
1936  * @param[in] callback The callback function to register
1937  * @param[in] user_data The user data to be passed to the callback function
1938  * @return   0 on success, otherwise a negative error value.
1939  * @retval #BT_ERROR_NONE  Successful
1940  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1941  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
1942  * @pre The Bluetooth service must be initialized with bt_initialize().
1943  * @post bt_socket_connection_state_changed_cb() will be invoked.
1944  * @see bt_initialize()
1945  * @see bt_socket_connection_state_changed_cb()
1946  * @see bt_socket_unset_connection_state_changed_cb()
1947  */
1948 int bt_socket_set_connection_state_changed_cb(bt_socket_connection_state_changed_cb callback, void *user_data);
1949
1950 /**
1951  * @ingroup CAPI_NETWORK_BLUETOOTH_SOCKET_MODULE
1952  * @brief       Unregisters the callback function.
1953  * @return      0 on success, otherwise a negative error value.
1954  * @retval #BT_ERROR_NONE  Successful
1955  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
1956  * @pre The Bluetooth service must be initialized with bt_initialize().
1957  * @see bt_initialize()
1958  * @see bt_socket_connection_state_changed_cb()
1959  * @see bt_socket_set_connection_state_changed_cb()
1960  */
1961 int bt_socket_unset_connection_state_changed_cb(void);
1962
1963 /**
1964  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
1965  * @brief  Called when the push is requested.
1966  * @details You must call bt_opp_server_accept() if you want to accept.
1967  * Otherwise, you must call bt_opp_server_reject().
1968  * @param[in] file  The path of file to be pushed
1969  * @param[in] size The file size (bytes)
1970  * @param[in] user_data The user data passed from the callback registration function
1971  * @see bt_opp_server_initialize()
1972  */
1973 typedef void (*bt_opp_server_push_requested_cb)(const char *file, int size, void *user_data);
1974
1975 /**
1976  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
1977  * @brief  Called when an OPP connection is requested.
1978  * @details You must call bt_opp_server_accept_connection() if you want to accept.
1979  * Otherwise, you must call bt_opp_server_reject_connection().
1980  * @param[in] remote_address  The address of remote device
1981  * @param[in] user_data The user data passed from the callback registration function
1982  * @see bt_opp_server_initialize()
1983  * @see bt_opp_server_accept_connection()
1984  * @see bt_opp_server_reject_connection()
1985  */
1986 typedef void (*bt_opp_server_connection_requested_cb)(const char *remote_address, void *user_data);
1987
1988 /**
1989  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
1990  * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_push_requested_cb().
1991  * @details The popup appears when an OPP connection is requested from a remote device.
1992  * If you accept the request, then connection will be established and bt_opp_server_push_requested_cb() will be called.
1993  * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
1994  * @remarks This function must be called to start Bluetooth OPP server. You must free all resources of the Bluetooth service
1995  * by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
1996  * @param[in] destination  The destination path
1997  * @param[in] push_requested_cb  The callback called when a push is requested
1998  * @param[in] user_data The user data to be passed to the callback function
1999  * @return 0 on success, otherwise a negative error value.
2000  * @retval #BT_ERROR_NONE  Successful
2001  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2002  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2003  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2004  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2005  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2006  * @see  bt_opp_server_push_requested_cb()
2007  * @see  bt_opp_server_deinitialize()
2008  * @see  bt_opp_server_accept()
2009  * @see  bt_opp_server_reject()
2010  */
2011 int bt_opp_server_initialize(const char *destination, bt_opp_server_push_requested_cb push_requested_cb, void *user_data);
2012
2013 /**
2014  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2015  * @brief Initializes the Bluetooth OPP server requested by bt_opp_server_connection_requested_cb().
2016  * @details No popup appears when an OPP connection is requested from a remote device.
2017  * Instead, @a connection_requested_cb() will be called.
2018  * At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
2019  * @remarks This function must be called to start Bluetooth OPP server. \n
2020  * You must free all resources of the Bluetooth service by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
2021  * @param[in] destination  The destination path
2022  * @param[in] connection_requested_cb  The callback called when an OPP connection is requested
2023  * @param[in] user_data The user data to be passed to the callback function
2024  * @return 0 on success, otherwise a negative error value.
2025  * @retval #BT_ERROR_NONE  Successful
2026  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2027  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2028  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2029  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2030  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2031  * @see  bt_opp_server_connection_requested_cb()
2032  * @see  bt_opp_server_deinitialize()
2033  * @see  bt_opp_server_accept_connection()
2034  * @see  bt_opp_server_reject_connection()
2035  */
2036 int bt_opp_server_initialize_by_connection_request(const char *destination, bt_opp_server_connection_requested_cb connection_requested_cb, void *user_data);
2037
2038 /**
2039  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2040  * @brief Denitializes the Bluetooth OPP server.
2041  * @return 0 on success, otherwise a negative error value.
2042  * @retval #BT_ERROR_NONE  Successful
2043  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2044  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2045  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2046  * @see  bt_opp_server_initialize()
2047  * @see  bt_opp_server_deinitialize()
2048  * @see  bt_opp_server_initialize()
2049  */
2050 int bt_opp_server_deinitialize(void);
2051
2052 /**
2053  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2054  * @brief  Called when a file is being transfered.
2055  * @param[in] file  The path of file to be pushed
2056  * @param[in] size The file size (bytes)
2057  * @param[in] percent The progress in percentage (1 ~ 100)
2058  * @param[in] user_data The user data passed from the callback registration function
2059  * @see bt_opp_server_accept()
2060  * @see bt_opp_server_accept_connection()
2061  */
2062 typedef void (*bt_opp_server_transfer_progress_cb) (const char *file, long long size, int percent, void *user_data);
2063
2064 /**
2065  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2066  * @brief  Called when a transfer is finished.
2067  * @param[in] error_code  The result of push
2068  * @param[in] file  The path of file to be pushed
2069  * @param[in] size The file size (bytes)
2070  * @param[in] user_data The user data passed from the callback registration function
2071  * @see bt_opp_server_accept()
2072  * @see bt_opp_server_accept_connection()
2073  */
2074 typedef void (*bt_opp_server_transfer_finished_cb) (int result, const char *file, long long size, void *user_data);
2075
2076 /**
2077  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2078  * @brief Accepts the push request from the remote device.
2079  * @remarks If you initialize OPP server by bt_opp_server_initialize_by_connection_request(), then name is ignored.
2080  * You can cancel the pushes by bt_opp_server_cancel_transfer() with transfer_id.
2081  * @param[in] progress_cb  The callback called when a file is being transfered
2082  * @param[in] finished_cb  The callback called when a transfer is finished
2083  * @param[in] name  The name to store. This can be NULL if you initialize OPP server by bt_opp_server_initialize_by_connection_request().
2084  * @param[in] user_data The user data to be passed to the callback function
2085  * @param[out]  transfer_id  The ID of transfer
2086  * @return 0 on success, otherwise a negative error value.
2087  * @retval #BT_ERROR_NONE  Successful
2088  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2089  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2090  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2091  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2092  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
2093  * @see  bt_opp_server_reject()
2094  */
2095 int bt_opp_server_accept(bt_opp_server_transfer_progress_cb progress_cb, bt_opp_server_transfer_finished_cb finished_cb, const char *name,
2096  void *user_data, int *transfer_id);
2097
2098 /**
2099  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2100  * @brief Rejects the push request from the remote device.
2101  * @return 0 on success, otherwise a negative error value.
2102  * @retval #BT_ERROR_NONE  Successful
2103  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2104  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2105  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2106  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2107  * @see  bt_opp_server_accept()
2108  */
2109 int bt_opp_server_reject(void);
2110
2111 /**
2112  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2113  * @brief Cancels the transfer.
2114  * @param[in] transfer_id  The ID of transfer
2115  * @return 0 on success, otherwise a negative error value.
2116  * @retval #BT_ERROR_NONE  Successful
2117  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2118  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2119  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2120  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2121  * @see  bt_opp_server_accept_connection()
2122  * @see  bt_opp_server_accept()
2123  */
2124 int bt_opp_server_cancel_transfer(int transfer_id);
2125
2126 /**
2127  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_SERVER_MODULE
2128  * @brief Sets the destination path of file to be pushed.
2129  * @param[in] destination  The destination path of file to be pushed
2130  * @return 0 on success, otherwise a negative error value.
2131  * @retval #BT_ERROR_NONE  Successful
2132  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2133  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2134  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2135  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2136  * @see  bt_opp_server_initialize()
2137  */
2138 int bt_opp_server_set_destination(const char *destination);
2139
2140 /**
2141  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2142  * @brief Initializes the Bluetooth OPP client.
2143  * @remarks This function must be called before Bluetooth OPP client starts. \n
2144  * You must free all resources of the Bluetooth service by calling bt_opp_client_deinitialize()
2145  * if Bluetooth OPP service is no longer needed.
2146  * @return 0 on success, otherwise a negative error value.
2147  * @retval #BT_ERROR_NONE  Successful
2148  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2149  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2150  * @retval #BT_ERROR_RESOURCE_BUSY  Device or resource busy
2151  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2152  * @see  bt_opp_client_deinitialize()
2153  */
2154 int bt_opp_client_initialize(void);
2155
2156 /**
2157  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2158  * @brief Denitializes the Bluetooth OPP client.
2159  * @return 0 on success, otherwise a negative error value.
2160  * @retval #BT_ERROR_NONE  Successful
2161  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2162  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2163  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2164  * @see  bt_opp_client_initialize()
2165  */
2166 int bt_opp_client_deinitialize(void);
2167
2168 /**
2169  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2170  * @brief Adds file to be pushed.
2171  * @param[in] file  The path of file to be pushed
2172  * @return 0 on success, otherwise a negative error value.
2173  * @retval #BT_ERROR_NONE  Successful
2174  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2175  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2176  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2177  * @see  bt_opp_client_clear_files()
2178  * @see  bt_opp_client_push_files()
2179  */
2180 int bt_opp_client_add_file(const char *file);
2181
2182 /**
2183  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2184  * @brief Adds file to be pushed.
2185  * @return 0 on success, otherwise a negative error value.
2186  * @retval #BT_ERROR_NONE  Successful
2187  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2188  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2189  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2190  * @see  bt_opp_client_add_file()
2191  * @see  bt_opp_client_push_files()
2192  */
2193 int bt_opp_client_clear_files(void);
2194
2195 /**
2196  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2197  * @brief  Called when OPP server responds to the push request.
2198  * @param[in] result  The result of OPP server response
2199  * @param[in] remote_address  The remote address
2200  * @param[in] user_data  The user data passed from the callback registration function
2201  * @pre bt_opp_client_push_files() will invoke this function.
2202  * @see bt_opp_client_push_files()
2203  */
2204 typedef void (*bt_opp_client_push_responded_cb)(int result, const char *remote_address, void *user_data);
2205
2206 /**
2207  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2208  * @brief  Called when each file is being transfered.
2209  * @param[in] file  The path of file to be pushed
2210  * @param[in] size The file size (bytes)
2211  * @param[in] percent The progress in percentage (1 ~ 100). 100 means that a file is transfered completely.
2212  * @param[in] user_data The user data passed from the callback registration function
2213  * @pre bt_opp_client_push_files() will invoke this function.
2214  * @see bt_opp_client_push_files()
2215  */
2216 typedef void (*bt_opp_client_push_progress_cb)(const char *file, long long size, int percent, void *user_data);
2217
2218 /**
2219  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2220  * @brief  Called when the push request is finished.
2221  * @param[in] result  The result of the push request
2222  * @param[in] remote_address  The remote address
2223  * @param[in] user_data The user data passed from the callback registration function
2224  * @see bt_opp_client_push_files()
2225  */
2226 typedef void (*bt_opp_client_push_finished_cb)(int result, const char *remote_address, void *user_data);
2227
2228 /**
2229  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2230  * @brief Pushes the file to the remote device, asynchronously.
2231  * @details At first, bt_opp_client_push_responded_cb() will be called when OPP server responds to the push request.
2232  * After connection is established, bt_opp_client_push_progress_cb() will be called repeatedly until a file is tranfered completely.
2233  * If you send several files, then bt_opp_client_push_progress_cb() with another file will be called repeatedly until the file is tranfered completely.
2234  * bt_opp_client_push_finished_cb() will be called when the push request is finished.
2235  * @param[in] remote_address The remote address
2236  * @param[in] responded_cb  The callback called when OPP server responds to the push request
2237  * @param[in] progress_cb  The callback called when each file is being transfered
2238  * @param[in] finished_cb  The callback called when the push request is finished
2239  * @param[in] user_data The user data to be passed to the callback function
2240  * @return 0 on success, otherwise a negative error value.
2241  * @retval #BT_ERROR_NONE  Successful
2242  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2243  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2244  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2245  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2246  * @retval #BT_ERROR_NOW_IN_PROGRESS  Operation now in progress
2247  * @see bt_opp_client_initialize()
2248  * @see bt_opp_client_cancel_push
2249  */
2250 int bt_opp_client_push_files(const char *remote_address, bt_opp_client_push_responded_cb responded_cb,
2251  bt_opp_client_push_progress_cb progress_cb, bt_opp_client_push_finished_cb finished_cb, void *user_data);
2252
2253 /**
2254  * @ingroup CAPI_NETWORK_BLUETOOTH_OPP_CLIENT_MODULE
2255  * @brief Cancels the push request in progress, asynchronously.
2256  * @return 0 on success, otherwise a negative error value.
2257  * @retval #BT_ERROR_NONE  Successful
2258  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2259  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2260  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2261  * @pre bt_opp_client_push_files() must be called.
2262  * @post bt_opp_client_push_finished_cb() will be invoked with result #BT_ERROR_CANCELLED,
2263  * which is a parameter of bt_opp_client_push_files().
2264  * @see bt_opp_client_initialize()
2265  * @see bt_opp_client_push_files()
2266  */
2267 int bt_opp_client_cancel_push(void);
2268
2269 /**
2270  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2271  * @brief  Called when the connection state is changed.
2272  * @param[in] connected  Indicates whether a client is connected or disconnected
2273  * @param[in] remote_address  The remote address
2274  * @param[in] interface_name  The interface name. For example, bnep0, bnep1.
2275  * @param[in] user_data The user data passed from the callback registration function
2276  * @see bt_nap_set_connection_state_changed_cb()
2277  * @see bt_nap_unset_connection_state_changed_cb()
2278  */
2279 typedef void (*bt_nap_connection_state_changed_cb) (bool connected, const char *remote_address, const char *interface_name, void *user_data);
2280
2281 /**
2282  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2283  * @brief Activates the NAP(Network Access Point).
2284  * @return 0 on success, otherwise a negative error value.
2285  * @retval #BT_ERROR_NONE  Successful
2286  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2287  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2288  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2289  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
2290  * @pre The Bluetooth must be enabled with bt_adapter_enable().
2291  * @see bt_adapter_enable()
2292  * @see bt_nap_deactivate()
2293  */
2294 int bt_nap_activate(void);
2295
2296 /**
2297  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2298  * @brief Deactivates the NAP(Network Access Point).
2299  * @return 0 on success, otherwise a negative error value.
2300  * @retval #BT_ERROR_NONE  Successful
2301  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2302  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2303  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2304  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
2305  * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
2306  * @see bt_nap_activate()
2307  */
2308 int bt_nap_deactivate(void);
2309
2310 /**
2311  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2312  * @brief Disconnects the all PANUs(Personal Area Networking User) which are connected to you.
2313  * @return 0 on success, otherwise a negative error value.
2314  * @retval #BT_ERROR_NONE  Successful
2315  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2316  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2317  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2318  * @pre The Bluetooth NAP service must be activated with bt_nap_activate().
2319  * @see bt_nap_activate()
2320  */
2321 int bt_nap_disconnect_all(void);
2322
2323 /**
2324  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2325  * @brief  Registers a callback function that will be invoked when the connection state changes.
2326  * @param[in] callback The callback function to register
2327  * @param[in] user_data The user data to be passed to the callback function
2328  * @return   0 on success, otherwise a negative error value.
2329  * @retval #BT_ERROR_NONE  Successful
2330  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2331  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2332  * @pre The Bluetooth service must be initialized with bt_initialize().
2333  * @post bt_nap_connection_state_changed_cb() will be invoked.
2334  * @see bt_initialize()
2335  * @see bt_nap_connection_state_changed_cb()
2336  * @see bt_nap_unset_connection_state_changed_cb()
2337  */
2338 int bt_nap_set_connection_state_changed_cb(bt_nap_connection_state_changed_cb callback, void *user_data);
2339
2340 /**
2341  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_NAP_MODULE
2342  * @brief  Unregisters a callback function that will be invoked when the connection state changes.
2343  * @return   0 on success, otherwise a negative error value.
2344  * @retval #BT_ERROR_NONE  Successful
2345  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2346  * @pre The Bluetooth service must be initialized with bt_initialize().
2347  * @post bt_nap_connection_state_changed_cb() will be invoked.
2348  * @see bt_initialize()
2349  * @see bt_nap_connection_state_changed_cb()
2350  * @see bt_nap_set_connection_state_changed_cb()
2351  */
2352 int bt_nap_unset_connection_state_changed_cb(void);
2353
2354 /**
2355  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
2356  * @brief  Called when the connection state is changed.
2357  * @details  This callback is called when the connection state is changed.
2358  * When you call bt_panu_connect() or bt_panu_disconnect(), this callback is also called with error result even though these functions fail.
2359  * @param[in] result  The result of changing the connection state
2360  * @param[in] connected  The state to be changed. @a true means connected state, Otherwise, @a false.
2361  * @param[in] remote_address  The remote address
2362  * @param[in] type  The type of PAN service
2363  * @param[in] user_data The user data passed from the callback registration function
2364  * @see bt_nap_set_connection_state_changed_cb()
2365  * @see bt_nap_unset_connection_state_changed_cb()
2366  */
2367 typedef void (*bt_panu_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_panu_service_type_e type, void *user_data);
2368
2369 /**
2370  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
2371  * @brief  Registers a callback function that will be invoked when the connection state changes.
2372  * @param[in] callback The callback function to register
2373  * @param[in] user_data The user data to be passed to the callback function
2374  * @return   0 on success, otherwise a negative error value.
2375  * @retval #BT_ERROR_NONE  Successful
2376  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2377  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2378  * @pre The Bluetooth service must be initialized with bt_initialize().
2379  * @post bt_nap_connection_state_changed_cb() will be invoked.
2380  * @see bt_initialize()
2381  * @see bt_panu_connection_state_changed_cb()
2382  * @see bt_panu_unset_connection_state_changed_cb()
2383  */
2384 int bt_panu_set_connection_state_changed_cb(bt_panu_connection_state_changed_cb callback, void *user_data);
2385
2386 /**
2387  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
2388  * @brief  Unregisters a callback function that will be invoked when the connection state changes.
2389  * @return   0 on success, otherwise a negative error value.
2390  * @retval #BT_ERROR_NONE  Successful
2391  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2392  * @pre The Bluetooth service must be initialized with bt_initialize().
2393  * @post bt_nap_connection_state_changed_cb() will be invoked.
2394  * @see bt_initialize()
2395  * @see bt_panu_connection_state_changed_cb()
2396  * @see bt_panu_set_connection_state_changed_cb()
2397  */
2398 int bt_panu_unset_connection_state_changed_cb(void);
2399
2400 /**
2401  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
2402  * @brief Connects the remote device with the PAN(Personal Area Networking) service, asynchronously.
2403  * @param[in] remote_address  The remote address
2404  * @param[in] type  The type of PAN service
2405  * @return 0 on success, otherwise a negative error value.
2406  * @retval #BT_ERROR_NONE  Successful
2407  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2408  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2409  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2410  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2411  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
2412  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2413  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
2414  * @post bt_panu_connection_state_changed_cb() will be invoked.
2415  * @see bt_panu_disconnect()
2416  * @see bt_panu_connection_state_changed_cb()
2417  */
2418 int bt_panu_connect(const char *remote_address, bt_panu_service_type_e type);
2419
2420 /**
2421  * @ingroup CAPI_NETWORK_BLUETOOTH_PAN_PANU_MODULE
2422  * @brief Disconnects the remote device with the PAN(Personal Area Networking) service, asynchronously.
2423  * @param[in] remote_address  The remote address
2424  * @return 0 on success, otherwise a negative error value.
2425  * @retval #BT_ERROR_NONE  Successful
2426  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2427  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2428  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2429  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2430  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
2431  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2432  * @pre The remote device must be connected by bt_panu_connect().
2433  * @post bt_panu_connection_state_changed_cb() will be invoked.
2434  * @see bt_panu_connect()
2435  * @see bt_panu_connection_state_changed_cb()
2436  */
2437 int bt_panu_disconnect(const char *remote_address);
2438
2439 /**
2440  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2441  * @brief  Called when the connection state is changed.
2442  * @details  This callback is called when the connection state is changed.
2443  * When you call bt_hid_host_connect() or bt_hid_host_disconnect(), this callback is also called with error result even though these functions fail.
2444  * @param[in] result  The result of changing the connection state
2445  * @param[in] connected  The state to be changed. @a true means connected state, Otherwise, @a false.
2446  * @param[in] remote_address  The remote address
2447  * @param[in] user_data The user data passed from the callback registration function
2448  * @see bt_hid_host_connect()
2449  * @see bt_hid_host_disconnect()
2450  */
2451 typedef void (*bt_hid_host_connection_state_changed_cb) (int result, bool connected, const char *remote_address, void *user_data);
2452
2453 /**
2454  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2455  * @brief Initializes the Bluetooth HID(Human Interface Device) Host.
2456  * @remarks This function must be called before Bluetooth HID Host starts. \n
2457  * You must free all resources of the Bluetooth service by calling bt_hid_host_deinitialize()
2458  * if Bluetooth HID Host service is no longer needed.
2459  * @param[in] connection_cb  The callback called when the connection state is changed
2460  * @param[in] user_data The user data to be passed to the callback function
2461  * @return 0 on success, otherwise a negative error value.
2462  * @retval #BT_ERROR_NONE  Successful
2463  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2464  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2465  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2466  * @pre The Bluetooth service must be initialized with bt_initialize().
2467  * @see bt_initialize()
2468  * @see  bt_hid_host_deinitialize()
2469  */
2470 int bt_hid_host_initialize(bt_hid_host_connection_state_changed_cb connection_cb, void *user_data);
2471
2472 /**
2473  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2474  * @brief Deinitializes the Bluetooth HID(Human Interface Device) Host.
2475  * @return 0 on success, otherwise a negative error value.
2476  * @retval #BT_ERROR_NONE  Successful
2477  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2478  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2479  * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
2480  * @see  bt_hid_host_initialize()
2481  */
2482 int bt_hid_host_deinitialize(void);
2483
2484 /**
2485  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2486  * @brief Connects the remote device with the HID(Human Interface Device) service, asynchronously.
2487  * @param[in] remote_address  The remote address
2488  * @return 0 on success, otherwise a negative error value.
2489  * @retval #BT_ERROR_NONE  Successful
2490  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2491  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2492  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2493  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2494  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2495  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
2496  * @pre The Bluetooth HID service must be initialized with bt_hid_host_initialize().
2497  * @post bt_hid_host_connection_state_changed_cb() will be invoked.
2498  * @see bt_hid_host_disconnect()
2499  * @see bt_hid_host_connection_state_changed_cb()
2500  */
2501 int bt_hid_host_connect(const char *remote_address);
2502
2503 /**
2504  * @ingroup CAPI_NETWORK_BLUETOOTH_HID_MODULE
2505  * @brief Disconnects the remote device with the HID(Human Interface Device) service, asynchronously.
2506  * @param[in] remote_address  The remote address
2507  * @return 0 on success, otherwise a negative error value.
2508  * @retval #BT_ERROR_NONE  Successful
2509  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2510  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2511  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2512  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2513  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2514  * @pre The remote device must be connected by bt_hid_host_connect().
2515  * @post bt_hid_host_connection_state_changed_cb() will be invoked.
2516  * @see bt_hid_host_connect()
2517  * @see bt_hid_host_connection_state_changed_cb()
2518  */
2519 int bt_hid_host_disconnect(const char *remote_address);
2520
2521 /**
2522  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2523  * @brief Initializes the Bluetooth profiles related with audio.
2524  * @remarks This function must be called before Bluetooth profiles related with audio starts. \n
2525  * You must free all resources of the this service by calling bt_audio_deinitialize()
2526  * if Bluetooth profiles related with audio service is no longer needed.
2527  * @return 0 on success, otherwise a negative error value.
2528  * @retval #BT_ERROR_NONE  Successful
2529  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2530  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2531  * @pre The Bluetooth service must be initialized with bt_initialize().
2532  * @see bt_initialize()
2533  * @see bt_audio_deinitialize()
2534  */
2535 int bt_audio_initialize(void);
2536
2537 /**
2538  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2539  * @brief Deinitializes the Bluetooth profiles related with audio.
2540  * @return 0 on success, otherwise a negative error value.
2541  * @retval #BT_ERROR_NONE  Successful
2542  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2543  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2544  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2545  * @see bt_audio_initialize()
2546  */
2547 int bt_audio_deinitialize(void);
2548
2549 /**
2550  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2551  * @brief Connects the remote device with the given audio profile, asynchronously.
2552  * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and connection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
2553  * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is connected and #BT_AUDIO_PROFILE_TYPE_A2DP is connected.
2554  * @param[in] remote_address  The remote address
2555  * @param[in] type  The type of audio profile
2556  * @return 0 on success, otherwise a negative error value.
2557  * @retval #BT_ERROR_NONE  Successful
2558  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2559  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2560  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2561  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2562  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2563  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2564  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
2565  * @post bt_audio_connection_state_changed_cb() will be invoked.
2566  * @see bt_audio_disconnect()
2567  * @see bt_audio_connection_state_changed_cb()
2568  */
2569 int bt_audio_connect(const char *remote_address, bt_audio_profile_type_e type);
2570
2571 /**
2572  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2573  * @brief Disconnects the remote device with the given audio profile, asynchronously.
2574  * @details If you input type as #BT_AUDIO_PROFILE_TYPE_ALL and disconnection request succeeds, then bt_audio_connection_state_changed_cb() will be called twice
2575  * when #BT_AUDIO_PROFILE_TYPE_HSP_HFP is disconnected and #BT_AUDIO_PROFILE_TYPE_A2DP is disconnected.
2576  * @param[in] remote_address  The remote address
2577  * @param[in] type  The type of audio profile
2578  * @return 0 on success, otherwise a negative error value.
2579  * @retval #BT_ERROR_NONE  Successful
2580  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2581  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2582  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2583  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2584  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2585  * @pre The remote device must be connected by bt_audio_connect().
2586  * @post bt_audio_connection_state_changed_cb() will be invoked.
2587  * @see bt_audio_connect()
2588  * @see bt_audio_connection_state_changed_cb()
2589  */
2590 int bt_audio_disconnect(const char *remote_address, bt_audio_profile_type_e type);
2591
2592 /**
2593  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2594  * @brief  Called when the connection state is changed.
2595  * @details  This callback is called when the connection state is changed.
2596  * When you call bt_audio_connect() or bt_audio_disconnect(), this callback is also called with error result even though these functions fail.
2597  * @param[in] result  The result of changing the connection state
2598  * @param[in] connected  The state to be changed. @a true means connected state, Otherwise, @a false.
2599  * @param[in] remote_address  The remote address
2600  * @param[in] type  The type of audio profile except #BT_AUDIO_PROFILE_TYPE_ALL
2601  * @param[in] user_data The user data passed from the callback registration function
2602  * @see bt_audio_set_connection_state_changed_cb()
2603  * @see bt_audio_unset_connection_state_changed_cb()
2604  */
2605 typedef void (*bt_audio_connection_state_changed_cb) (int result, bool connected, const char *remote_address, bt_audio_profile_type_e type, void *user_data);
2606
2607 /**
2608  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2609  * @brief  Registers a callback function that will be invoked when the connection state is changed.
2610  * @param[in] callback The callback function to register
2611  * @param[in] user_data The user data to be passed to the callback function
2612  * @return   0 on success, otherwise a negative error value.
2613  * @retval #BT_ERROR_NONE  Successful
2614  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2615  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2616  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2617  * @see bt_audio_initialize()
2618  * @see bt_audio_connection_state_changed_cb()
2619  * @see bt_panu_unset_connection_state_changed_cb()
2620  */
2621 int bt_audio_set_connection_state_changed_cb(bt_audio_connection_state_changed_cb callback, void *user_data);
2622
2623 /**
2624  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_MODULE
2625  * @brief  Unregisters a callback function that will be invoked when the connection state is changed.
2626  * @return   0 on success, otherwise a negative error value.
2627  * @retval #BT_ERROR_NONE  Successful
2628  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2629  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2630  * @see bt_audio_initialize()
2631  * @see bt_audio_connection_state_changed_cb()
2632  * @see bt_audio_set_connection_state_changed_cb()
2633  */
2634 int bt_audio_unset_connection_state_changed_cb(void);
2635
2636 /**
2637  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2638  * @brief Opens a SCO(Synchronous Connection Oriented link) to connected remote device, asynchronously.
2639  * @return 0 on success, otherwise a negative error value.
2640  * @retval #BT_ERROR_NONE  Successful
2641  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2642  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2643  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2644  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2645  * @retval #BT_ERROR_ALREADY_DONE  Operation is already done
2646  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2647  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2648  * @post bt_ag_sco_state_changed_cb() will be invoked.
2649  * @see bt_ag_close_sco()
2650  * @see bt_ag_sco_state_changed_cb()
2651  * @see bt_audio_connect()
2652  */
2653 int bt_ag_open_sco(void);
2654
2655 /**
2656  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2657  * @brief Closes an opened SCO(Synchronous Connection Oriented link), asynchronously.
2658  * @return 0 on success, otherwise a negative error value.
2659  * @retval #BT_ERROR_NONE  Successful
2660  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2661  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2662  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2663  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2664  * @pre The SCO must be opened with bt_ag_open_sco().
2665  * @post bt_ag_sco_state_changed_cb() will be invoked.
2666  * @see bt_ag_open_sco()
2667  * @see bt_ag_sco_state_changed_cb()
2668  */
2669 int bt_ag_close_sco(void);
2670
2671 /**
2672  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2673  * @brief Checks whether an opened SCO(Synchronous Connection Oriented link) exists or not.
2674  * @param[out] opened The SCO status: (@c true = opened, @c  false = not opened)
2675  * @return 0 on success, otherwise a negative error value.
2676  * @retval #BT_ERROR_NONE  Successful
2677  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2678  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2679  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2680  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2681  * @see bt_adapter_enable()
2682  * @see bt_ag_open_sco()
2683  * @see bt_ag_close_sco()
2684  */
2685 int bt_ag_is_sco_opened(bool *opened);
2686
2687 /**
2688  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2689  * @brief  Called when the SCO(Synchronous Connection Oriented link) state is changed.
2690  * @details  This callback is called when the SCO state is changed.
2691  * When you call bt_ag_open_sco() or bt_ag_close_sco(), this callback is also called with error result even though these functions failed.
2692  * @param[in] result  The result of changing the connection state
2693  * @param[in] opened  The state to be changed: (@c true = opened, @c  false = not opened)
2694  * @param[in] user_data The user data passed from the callback registration function
2695  * @see bt_ag_set_sco_state_changed_cb()
2696  * @see bt_ag_unset_sco_state_changed_cb()
2697  * @see bt_ag_open_sco()
2698  * @see bt_ag_close_sco()
2699  */
2700 typedef void (*bt_ag_sco_state_changed_cb) (int result, bool opened, void *user_data);
2701
2702 /**
2703  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2704  * @brief  Registers a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed.
2705  * @param[in] callback The callback function to register
2706  * @param[in] user_data The user data to be passed to the callback function
2707  * @return   0 on success, otherwise a negative error value.
2708  * @retval #BT_ERROR_NONE  Successful
2709  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2710  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2711  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2712  * @see bt_audio_initialize()
2713  * @see bt_ag_sco_state_changed_cb()
2714  * @see bt_ag_unset_sco_state_changed_cb()
2715  */
2716 int bt_ag_set_sco_state_changed_cb(bt_ag_sco_state_changed_cb callback, void *user_data);
2717
2718 /**
2719  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2720  * @brief  Unregisters a callback function that will be invoked when the SCO(Synchronous Connection Oriented link) state is changed.
2721  * @return   0 on success, otherwise a negative error value.
2722  * @retval #BT_ERROR_NONE  Successful
2723  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2724  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2725  * @see bt_audio_initialize()
2726  * @see bt_ag_sco_state_changed_cb()
2727  * @see bt_ag_set_sco_state_changed_cb()
2728  */
2729 int bt_ag_unset_sco_state_changed_cb(void);
2730
2731 /**
2732  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2733  * @brief Notifies the call event to the remote bluetooth device.
2734  * @remarks Before notifying #BT_AG_CALL_EVENT_ANSWERED or #BT_AG_CALL_EVENT_DIALING, you should open SCO(Synchronous Connection Oriented link)
2735  * if Bluetooth Hands-Free need SCO connection.
2736  * @param[in] event  The call event
2737  * @param[in] call_id  The call ID
2738  * @param[in] phone_number  The phone number. You must set this value in case of #BT_AG_CALL_EVENT_DIALING and #BT_AG_CALL_EVENT_INCOMING.
2739  * In other cases, this value can be NULL.
2740  * @return 0 on success, otherwise a negative error value.
2741  * @retval #BT_ERROR_NONE  Successful
2742  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2743  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2744  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2745  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2746  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2747  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2748  * @see bt_audio_connect()
2749  */
2750 int bt_ag_notify_call_event(bt_ag_call_event_e event, unsigned int call_id, const char *phone_number);
2751
2752 /**
2753  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2754  * @brief Notifies the call list to the remote bluetooth device.
2755  * @param[in] list  The call list
2756  * @return 0 on success, otherwise a negative error value.
2757  * @retval #BT_ERROR_NONE  Successful
2758  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2759  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2760  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2761  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2762  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2763  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2764  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2765  * @see bt_audio_connect()
2766  */
2767 int bt_ag_notify_call_list(bt_call_list_h list);
2768
2769 /**
2770  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2771  * @brief Notifies the state of voice recognition.
2772  * @param[in] state  The state of voice recognition: (@c true = enabled, @c  false = disabled)
2773  * @return 0 on success, otherwise a negative error value.
2774  * @retval #BT_ERROR_NONE  Successful
2775  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2776  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2777  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2778  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
2779  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2780  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2781  * @pre The Bluetooth audio device must be connected with bt_audio_connect().
2782  * @see bt_audio_connect()
2783  */
2784 int bt_ag_notify_voice_recognition_state(bool state);
2785
2786 /**
2787  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2788  * @brief  Called when a call handling event happened from Hands-Free.
2789  * @param[in] event  The call handling event happened from Hands-Free
2790  * @param[in] call_id  The call ID
2791  * @param[in] user_data The user data passed from the callback registration function
2792  * @see bt_ag_set_call_handling_event_cb()
2793  * @see bt_ag_unset_call_handling_event_cb()
2794  */
2795 typedef void (*bt_ag_call_handling_event_cb) (bt_ag_call_handling_event_e event, unsigned int call_id, void *user_data);
2796
2797 /**
2798  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2799  * @brief  Registers a callback function that will be invoked when a call handling event happened from Hands-Free.
2800  * @param[in] callback The callback function to register
2801  * @param[in] user_data The user data to be passed to the callback function
2802  * @return   0 on success, otherwise a negative error value.
2803  * @retval #BT_ERROR_NONE  Successful
2804  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2805  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2806  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2807  * @see bt_audio_initialize()
2808  * @see bt_ag_call_handling_event_cb()
2809  * @see bt_ag_unset_call_handling_event_cb()
2810  */
2811 int bt_ag_set_call_handling_event_cb(bt_ag_call_handling_event_cb callback, void *user_data);
2812
2813 /**
2814  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2815  * @brief  Unregisters a callback function that will be invoked when a call handling event happened from Hands-Free.
2816  * @return   0 on success, otherwise a negative error value.
2817  * @retval #BT_ERROR_NONE  Successful
2818  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2819  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2820  * @see bt_audio_initialize()
2821  * @see bt_ag_call_handling_event_cb()
2822  * @see bt_ag_set_call_handling_event_cb()
2823  */
2824 int bt_ag_unset_call_handling_event_cb(void);
2825
2826 /**
2827  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2828  * @brief  Called when a multi call handling event happened from Hands-Free.
2829  * @param[in] event  The call handling event happened from Hands-Free
2830  * @param[in] user_data The user data passed from the callback registration function
2831  * @see bt_ag_set_multi_call_handling_event_cb()
2832  * @see bt_ag_unset_multi_call_handling_event_cb()
2833  */
2834 typedef void (*bt_ag_multi_call_handling_event_cb) (bt_ag_multi_call_handling_event_e event, void *user_data);
2835
2836 /**
2837  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2838  * @brief  Registers a callback function that will be invoked when a multi call handling event happened from Hands-Free.
2839  * @param[in] callback The callback function to register
2840  * @param[in] user_data The user data to be passed to the callback function
2841  * @return   0 on success, otherwise a negative error value.
2842  * @retval #BT_ERROR_NONE  Successful
2843  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2844  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2845  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2846  * @see bt_audio_initialize()
2847  * @see bt_ag_multi_call_handling_event_cb()
2848  * @see bt_ag_unset_multi_call_handling_event_cb()
2849  */
2850 int bt_ag_set_multi_call_handling_event_cb(bt_ag_multi_call_handling_event_cb callback, void *user_data);
2851
2852 /**
2853  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2854  * @brief  Unregisters a callback function that will be invoked when a multi call handling event happened from Hands-Free.
2855  * @return   0 on success, otherwise a negative error value.
2856  * @retval #BT_ERROR_NONE  Successful
2857  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2858  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2859  * @see bt_audio_initialize()
2860  * @see bt_ag_multi_call_handling_event_cb()
2861  * @see bt_ag_set_multi_call_handling_event_cb()
2862  */
2863 int bt_ag_unset_multi_call_handling_event_cb(void);
2864
2865 /**
2866  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2867  * @brief  Called when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
2868  * @param[in] dtmf  The DTMF transmitted from Hands-Free
2869  * @param[in] user_data The user data passed from the callback registration function
2870  * @see bt_ag_set_dtmf_transmitted_cb()
2871  * @see bt_ag_unset_dtmf_transmitted_cb()
2872  */
2873 typedef void (*bt_ag_dtmf_transmitted_cb) (const char *dtmf, void *user_data);
2874
2875 /**
2876  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2877  * @brief  Registers a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
2878  * @param[in] callback The callback function to register
2879  * @param[in] user_data The user data to be passed to the callback function
2880  * @return   0 on success, otherwise a negative error value.
2881  * @retval #BT_ERROR_NONE  Successful
2882  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2883  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2884  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2885  * @see bt_audio_initialize()
2886  * @see bt_ag_dtmf_transmitted_cb()
2887  * @see bt_ag_unset_dtmf_transmitted_cb()
2888  */
2889 int bt_ag_set_dtmf_transmitted_cb(bt_ag_dtmf_transmitted_cb callback, void *user_data);
2890
2891 /**
2892  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2893  * @brief  Unregisters a callback function that will be invoked when a DTMF(Dual Tone Multi Frequency) is transmitted from Hands-Free.
2894  * @return   0 on success, otherwise a negative error value.
2895  * @retval #BT_ERROR_NONE  Successful
2896  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2897  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2898  * @see bt_audio_initialize()
2899  * @see bt_ag_dtmf_transmitted_cb()
2900  * @see bt_ag_set_dtmf_transmitted_cb()
2901  */
2902 int bt_ag_unset_dtmf_transmitted_cb(void);
2903
2904 /**
2905  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2906  * @brief  Notifies the speaker gain to the remote device.
2907  * @details This function sends a signal to the remote device. This signal has the gain value.
2908  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
2909  * When the speaker gain of remote device is changed to the requested gain, bt_audio_speaker_gain_changed_cb() will be called.
2910  * @param[in] gain The gain of speaker (0 ~ 15)
2911  * @return   0 on success, otherwise a negative error value.
2912  * @retval #BT_ERROR_NONE  Successful
2913  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2914  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2915  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2916  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
2917  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2918  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
2919  * @see bt_ag_get_speaker_gain()
2920  * @see bt_ag_set_speaker_gain_changed_cb()
2921  * @see bt_ag_unset_speaker_gain_changed_cb()
2922  */
2923 int bt_ag_notify_speaker_gain(int gain);
2924
2925 /**
2926  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2927  * @brief  Gets the current speaker gain of the remote device.
2928  * @details This function gets the value of speaker gain of the remote device.
2929  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
2930  * @param[out] gain The gain of speaker (0 ~ 15)
2931  * @return   0 on success, otherwise a negative error value.
2932  * @retval #BT_ERROR_NONE  Successful
2933  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2934  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2935  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2936  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2937  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
2938  * @see bt_ag_notify_speaker_gain()
2939  * @see bt_ag_set_speaker_gain_changed_cb()
2940  * @see bt_ag_unset_speaker_gain_changed_cb()
2941  */
2942 int bt_ag_get_speaker_gain(int *gain);
2943
2944 /**
2945  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2946  * @brief Checks whether the remoted device enables NREC(Noise Reduction and Echo Canceling) or not.
2947  * @param[out] enabled The NREC status: (@c true = enabled, @c  false = not enabled)
2948  * @return   0 on success, otherwise a negative error value.
2949  * @retval #BT_ERROR_NONE  Successful
2950  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2951  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2952  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
2953  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
2954  * @pre The remote device is connected by bt_audio_connect() with #BT_AUDIO_PROFILE_TYPE_HSP_HFP service.
2955  * @see bt_audio_connect()
2956  */
2957 int bt_ag_is_nrec_enabled(bool *enabled);
2958
2959 /**
2960  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2961  * @brief  Called when the speaker gain of the remote device is changed.
2962  * @param[in] gain The gain of speaker (0 ~ 15)
2963  * @param[in] user_data The user data passed from the callback registration function
2964  * @see bt_ag_set_speaker_gain_changed_cb()
2965  * @see bt_ag_unset_speaker_gain_changed_cb()
2966  */
2967 typedef void (*bt_ag_speaker_gain_changed_cb) (int gain, void *user_data);
2968
2969 /**
2970  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2971  * @brief  Registers a callback function that will be invoked when the speaker gain of the remote device is changed.
2972  * @details This function let you know the change of the speaker gain of the remote device.
2973  * @a gain is represented on a scale from 0 to 15. This value is absolute value relating to a particular volume level.
2974  * @param[in] callback The callback function to register
2975  * @param[in] user_data The user data to be passed to the callback function
2976  * @return   0 on success, otherwise a negative error value.
2977  * @retval #BT_ERROR_NONE  Successful
2978  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2979  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2980  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2981  * @see bt_audio_initialize()
2982  * @see bt_ag_unset_speaker_gain_changed_cb()
2983  */
2984 int bt_ag_set_speaker_gain_changed_cb(bt_ag_speaker_gain_changed_cb callback, void *user_data);
2985
2986 /**
2987  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
2988  * @brief  Unregisters a callback function that will be invoked when the speaker gain of the remote device is changed.
2989  * @return   0 on success, otherwise a negative error value.
2990  * @retval #BT_ERROR_NONE  Successful
2991  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
2992  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
2993  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
2994  * @see bt_audio_initialize()
2995  * @see bt_ag_set_speaker_gain_changed_cb()
2996  */
2997 int bt_ag_unset_speaker_gain_changed_cb(void);
2998
2999 /**
3000  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3001  * @brief  Called when the microphone gain of the remote device is changed.
3002  * @param[in] gain The gain of microphone (0 ~ 15)
3003  * @param[in] user_data The user data passed from the callback registration function
3004  * @see bt_ag_set_microphone_gain_changed_cb()
3005  * @see bt_ag_unset_microphone_gain_changed_cb()
3006  */
3007 typedef void (*bt_ag_microphone_gain_changed_cb) (int gain, void *user_data);
3008
3009 /**
3010  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3011  * @brief  Registers a callback function that will be invoked when the microphone gain of the remote device is changed.
3012  * @param[in] callback The callback function to register
3013  * @param[in] user_data The user data to be passed to the callback function
3014  * @return   0 on success, otherwise a negative error value.
3015  * @retval #BT_ERROR_NONE  Successful
3016  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3017  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3018  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3019  * @see bt_audio_initialize()
3020  * @see bt_ag_unset_microphone_gain_changed_cb()
3021  */
3022 int bt_ag_set_microphone_gain_changed_cb(bt_ag_microphone_gain_changed_cb callback, void *user_data);
3023
3024 /**
3025  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_MODULE
3026  * @brief  Unregisters a callback function that will be invoked when the microphone gain of the remote device is changed.
3027  * @return   0 on success, otherwise a negative error value.
3028  * @retval #BT_ERROR_NONE  Successful
3029  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3030  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3031  * @pre The Bluetooth audio service must be initialized with bt_audio_initialize().
3032  * @see bt_audio_initialize()
3033  * @see bt_ag_set_microphone_gain_changed_cb()
3034  */
3035 int bt_ag_unset_microphone_gain_changed_cb(void);
3036
3037 /**
3038  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3039  * @brief Creates a handle of call list.
3040  * @param[out] list  The handle of call list
3041  * @return 0 on success, otherwise a negative error value.
3042  * @retval #BT_ERROR_NONE  Successful
3043  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3044  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3045  * @see bt_call_list_destroy()
3046  */
3047 int bt_call_list_create(bt_call_list_h *list);
3048
3049 /**
3050  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3051  * @brief Destroys the handle of call list.
3052  * @param[in] list  The handle of call list
3053  * @return 0 on success, otherwise a negative error value.
3054  * @retval #BT_ERROR_NONE  Successful
3055  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3056  * @see bt_call_list_create()
3057  */
3058 int bt_call_list_destroy(bt_call_list_h list);
3059
3060 /**
3061  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3062  * @brief Resets the handle of call list.
3063  * @param[in] list  The handle of call list
3064  * @return 0 on success, otherwise a negative error value.
3065  * @retval #BT_ERROR_NONE  Successful
3066  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3067  * @see bt_call_list_create()
3068  */
3069 int bt_call_list_reset(bt_call_list_h list);
3070
3071 /**
3072  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_AG_CALL_MODULE
3073  * @brief Adds a call to the handle of call list.
3074  * @param[in] list  The handle of call list
3075  * @return 0 on success, otherwise a negative error value.
3076  * @retval #BT_ERROR_NONE  Successful
3077  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3078  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3079  * @see bt_call_list_create()
3080  */
3081 int bt_call_list_add(bt_call_list_h list, unsigned int call_id, bt_ag_call_state_e state);
3082
3083 /**
3084  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3085  * @brief  Called when the connection state is changed.
3086  * @param[in] connected  The state to be changed. @a true means connected state, Otherwise, @a false.
3087  * @param[in] remote_address  The remote address
3088  * @param[in] user_data The user data passed from the callback registration function
3089  * @see bt_avrcp_target_initialize()
3090  * @see bt_avrcp_target_deinitialize()
3091  */
3092 typedef void (*bt_avrcp_target_connection_state_changed_cb) (bool connected, const char *remote_address, void *user_data);
3093
3094 /**
3095  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3096  * @brief Initializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
3097  * @remarks This function must be called before Bluetooth AVRCP service. \n
3098  * You must free all resources of the this service by calling bt_avrcp_target_deinitialize()
3099  * if Bluetooth AVRCP service is no longer needed.
3100  * @param[in] callback The callback function called when the connection state is changed
3101  * @param[in] user_data The user data to be passed to the callback function
3102  * @return 0 on success, otherwise a negative error value.
3103  * @retval #BT_ERROR_NONE  Successful
3104  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3105  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3106  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3107  * @pre The Bluetooth service must be initialized with bt_initialize().
3108  * @see bt_initialize()
3109  * @see bt_avrcp_target_deinitialize()
3110  */
3111 int bt_avrcp_target_initialize(bt_avrcp_target_connection_state_changed_cb callback, void *user_data);
3112
3113 /**
3114  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3115  * @brief Deinitializes the Bluetooth AVRCP(Audio/Video Remote Control Profile) service.
3116  * @return 0 on success, otherwise a negative error value.
3117  * @retval #BT_ERROR_NONE  Successful
3118  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3119  * @pre The Bluetooth audio service must be initialized with bt_avrcp_target_initialize().
3120  * @see bt_avrcp_target_initialize()
3121  */
3122 int bt_avrcp_target_deinitialize(void);
3123
3124 /**
3125  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3126  * @brief  Notifies the equalize state to the remote device.
3127  * @param[in] state The state of equalizer
3128  * @return   0 on success, otherwise a negative error value.
3129  * @retval #BT_ERROR_NONE  Successful
3130  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3131  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3132  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3133  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3134  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3135  * @pre The remote device must be connected.
3136  * @see bt_avrcp_target_connection_state_changed_cb()
3137  * @see bt_avrcp_target_initialize()
3138  */
3139 int bt_avrcp_target_notify_equalizer_state(bt_avrcp_equalizer_state_e state);
3140
3141 /**
3142  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3143  * @brief  Notifies the repeat mode to the remote device.
3144  * @param[in] mode The repeat mode
3145  * @return   0 on success, otherwise a negative error value.
3146  * @retval #BT_ERROR_NONE  Successful
3147  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3148  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3149  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3150  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3151  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3152  * @pre The remote device must be connected.
3153  * @see bt_avrcp_target_connection_state_changed_cb()
3154  * @see bt_avrcp_target_initialize()
3155  */
3156 int bt_avrcp_target_notify_repeat_mode(bt_avrcp_repeat_mode_e mode);
3157
3158 /**
3159  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3160  * @brief  Notifies the shuffle mode to the remote device.
3161  * @param[in] mode The repeat mode
3162  * @return   0 on success, otherwise a negative error value.
3163  * @retval #BT_ERROR_NONE  Successful
3164  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3165  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3166  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3167  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3168  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3169  * @pre The remote device must be connected.
3170  * @see bt_avrcp_target_connection_state_changed_cb()
3171  * @see bt_avrcp_target_initialize()
3172  */
3173 int bt_avrcp_target_notify_shuffle_mode(bt_avrcp_shuffle_mode_e mode);
3174
3175 /**
3176  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3177  * @brief  Notifies the scan mode to the remote device.
3178  * @param[in] mode The scan mode
3179  * @return   0 on success, otherwise a negative error value.
3180  * @retval #BT_ERROR_NONE  Successful
3181  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3182  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3183  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3184  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3185  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3186  * @pre The remote device must be connected.
3187  * @see bt_avrcp_target_connection_state_changed_cb()
3188  * @see bt_avrcp_target_initialize()
3189  */
3190 int bt_avrcp_target_notify_scan_mode(bt_avrcp_scan_mode_e mode);
3191
3192 /**
3193  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3194  * @brief  Notifies the player state to the remote device.
3195  * @param[in] state The player state
3196  * @return   0 on success, otherwise a negative error value.
3197  * @retval #BT_ERROR_NONE  Successful
3198  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3199  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3200  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3201  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3202  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3203  * @pre The remote device must be connected.
3204  * @see bt_avrcp_target_connection_state_changed_cb()
3205  * @see bt_avrcp_target_initialize()
3206  */
3207 int bt_avrcp_target_notify_player_state(bt_avrcp_player_state_e state);
3208
3209 /**
3210  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3211  * @brief  Notifies the current position of song to the remote device.
3212  * @param[in] position The current position in milliseconds
3213  * @return  0 on success, otherwise a negative error value.
3214  * @retval #BT_ERROR_NONE  Successful
3215  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3216  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3217  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3218  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3219  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3220  * @pre The remote device must be connected.
3221  * @see bt_avrcp_target_connection_state_changed_cb()
3222  * @see bt_avrcp_target_initialize()
3223  */
3224 int bt_avrcp_target_notify_position(unsigned int position);
3225
3226 /**
3227  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3228  * @brief  Notifies the track to the remote device.
3229  * @param[in] title The title of track
3230  * @param[in] artist The artist of track
3231  * @param[in] album The album of track
3232  * @param[in] genre The genre of track
3233  * @param[in] track_num The track number
3234  * @param[in] total_tracks The number of all tracks
3235  * @param[in] duration The duration of track in milliseconds
3236  * @return   0 on success, otherwise a negative error value.
3237  * @retval #BT_ERROR_NONE  Successful
3238  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3239  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3240  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3241  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3242  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3243  * @pre The remote device must be connected.
3244  * @see bt_avrcp_target_connection_state_changed_cb()
3245  * @see bt_avrcp_target_initialize()
3246  */
3247 int bt_avrcp_target_notify_track(const char *title, const char *artist, const char *album, const char *genre, unsigned int track_num, unsigned int total_tracks, unsigned int duration);
3248
3249 /**
3250  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3251  * @brief  Called when the equalizer state is changed by the remote control device.
3252  * @param[in] equalizer The equalizer state
3253  * @param[in] user_data The user data passed from the callback registration function
3254  * @see bt_avrcp_set_equalizer_state_changed_cb()
3255  * @see bt_avrcp_unset_equalizer_state_changed_cb()
3256  */
3257 typedef void (*bt_avrcp_equalizer_state_changed_cb) (bt_avrcp_equalizer_state_e equalizer, void *user_data);
3258
3259 /**
3260  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3261  * @brief  Registers a callback function that will be invoked when the equalizer state is changed by the remote control device.
3262  * @param[in] callback The callback function to register
3263  * @param[in] user_data The user data to be passed to the callback function
3264  * @return   0 on success, otherwise a negative error value.
3265  * @retval #BT_ERROR_NONE  Successful
3266  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3267  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3268  * @pre The Bluetooth service must be initialized by bt_initialize().
3269  * @see bt_initialize()
3270  * @see bt_avrcp_unset_equalizer_state_changed_cb()
3271  */
3272 int bt_avrcp_set_equalizer_state_changed_cb(bt_avrcp_equalizer_state_changed_cb callback, void *user_data);
3273
3274 /**
3275  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3276  * @brief  Unregisters a callback function that will be invoked when the equalizer state is changed by the remote control device.
3277  * @return   0 on success, otherwise a negative error value.
3278  * @retval #BT_ERROR_NONE  Successful
3279  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3280  * @pre The Bluetooth service must be initialized by bt_initialize().
3281  * @see bt_initialize()
3282  * @see bt_avrcp_set_equalizer_state_changed_cb()
3283  */
3284 int bt_avrcp_unset_equalizer_state_changed_cb(void);
3285
3286 /**
3287  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3288  * @brief  Called when the repeat mode is changed by the remote control device.
3289  * @param[in] repeat The repeat mode
3290  * @param[in] user_data The user data passed from the callback registration function
3291  * @see bt_avrcp_set_repeat_mode_changed_cb()
3292  * @see bt_avrcp_unset_repeat_mode_changed_cb()
3293  */
3294 typedef void (*bt_avrcp_repeat_mode_changed_cb) (bt_avrcp_repeat_mode_e repeat, void *user_data);
3295
3296 /**
3297  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3298  * @brief  Registers a callback function that will be invoked when the repeat mode is changed by the remote control device.
3299  * @param[in] callback The callback function to register
3300  * @param[in] user_data The user data to be passed to the callback function
3301  * @return   0 on success, otherwise a negative error value.
3302  * @retval #BT_ERROR_NONE  Successful
3303  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3304  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3305  * @pre The Bluetooth service must be initialized by bt_initialize().
3306  * @see bt_initialize()
3307  * @see bt_avrcp_unset_repeat_mode_changed_cb()
3308  */
3309 int bt_avrcp_set_repeat_mode_changed_cb(bt_avrcp_repeat_mode_changed_cb callback, void *user_data);
3310
3311 /**
3312  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3313  * @brief  Unregisters a callback function that will be invoked when the repeat mode is changed by the remote control device.
3314  * @return   0 on success, otherwise a negative error value.
3315  * @retval #BT_ERROR_NONE  Successful
3316  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3317  * @pre The Bluetooth service must be initialized by bt_initialize().
3318  * @see bt_initialize()
3319  * @see bt_avrcp_set_repeat_mode_changed_cb()
3320  */
3321 int bt_avrcp_unset_repeat_mode_changed_cb(void);
3322
3323 /**
3324  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3325  * @brief  Called when the shuffle mode is changed by the remote control device.
3326  * @param[in] shuffle The shuffle mode
3327  * @param[in] user_data The user data passed from the callback registration function
3328  * @see bt_avrcp_set_shuffle_mode_changed_cb()
3329  * @see bt_avrcp_unset_shuffle_mode_changed_cb()
3330  */
3331 typedef void (*bt_avrcp_shuffle_mode_changed_cb) (bt_avrcp_shuffle_mode_e shuffle, void *user_data);
3332
3333 /**
3334  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3335  * @brief  Registers a callback function that will be invoked when the shuffle mode is changed by the remote control device.
3336  * @param[in] callback The callback function to register
3337  * @param[in] user_data The user data to be passed to the callback function
3338  * @return   0 on success, otherwise a negative error value.
3339  * @retval #BT_ERROR_NONE  Successful
3340  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3341  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3342  * @pre The Bluetooth service must be initialized by bt_initialize().
3343  * @see bt_initialize()
3344  * @see bt_avrcp_unset_shuffle_mode_changed_cb()
3345  */
3346 int bt_avrcp_set_shuffle_mode_changed_cb(bt_avrcp_shuffle_mode_changed_cb callback, void *user_data);
3347
3348 /**
3349  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3350  * @brief  Unregisters a callback function that will be invoked when the shuffle mode is changed by the remote control device.
3351  * @return   0 on success, otherwise a negative error value.
3352  * @retval #BT_ERROR_NONE  Successful
3353  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3354  * @pre The Bluetooth service must be initialized by bt_initialize().
3355  * @see bt_initialize()
3356  * @see bt_avrcp_set_shuffle_mode_changed_cb()
3357  */
3358 int bt_avrcp_unset_shuffle_mode_changed_cb(void);
3359
3360 /**
3361  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3362  * @brief  Called when the scan mode is changed by the remote control device.
3363  * @param[in] shuffle The shuffle mode
3364  * @param[in] user_data The user data passed from the callback registration function
3365  * @see bt_avrcp_set_scan_mode_changed_cb()
3366  * @see bt_avrcp_unset_scan_mode_changed_cb()
3367  */
3368 typedef void (*bt_avrcp_scan_mode_changed_cb) (bt_avrcp_scan_mode_e scan, void *user_data);
3369
3370 /**
3371  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3372  * @brief  Registers a callback function that will be invoked when the scan mode is changed by the remote control device.
3373  * @param[in] callback The callback function to register
3374  * @param[in] user_data The user data to be passed to the callback function
3375  * @return   0 on success, otherwise a negative error value.
3376  * @retval #BT_ERROR_NONE  Successful
3377  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3378  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3379  * @pre The Bluetooth service must be initialized by bt_initialize().
3380  * @see bt_initialize()
3381  * @see bt_avrcp_unset_scan_mode_changed_cb()
3382  */
3383 int bt_avrcp_set_scan_mode_changed_cb(bt_avrcp_scan_mode_changed_cb callback, void *user_data);
3384
3385 /**
3386  * @ingroup CAPI_NETWORK_BLUETOOTH_AVRCP_MODULE
3387  * @brief  Unregisters a callback function that will be invoked when the scan mode is changed by the remote control device.
3388  * @return   0 on success, otherwise a negative error value.
3389  * @retval #BT_ERROR_NONE  Successful
3390  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3391  * @pre The Bluetooth service must be initialized by bt_initialize().
3392  * @see bt_initialize()
3393  * @see bt_avrcp_set_scan_mode_changed_cb()
3394  */
3395 int bt_avrcp_unset_scan_mode_changed_cb(void);
3396
3397 /**
3398  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3399  * @brief Registers an application that acts as the @a Sink role of HDP(Health Device Profile).
3400  * @param[in] data_type  The data type of MDEP. This value is defined in ISO/IEEE 11073-20601 spec.
3401  * For example, pulse oximeter is 0x1004 and blood pressure monitor is 0x1007.
3402  * @param[out] app_id  The ID of application
3403  * @return 0 on success, otherwise a negative error value.
3404  * @retval #BT_ERROR_NONE  Successful
3405  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3406  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3407  * @pre The Bluetooth must be enabled with bt_adapter_enable().
3408  * @see bt_adapter_enable()
3409  * @see bt_hdp_deactivate_sink()
3410  */
3411 int bt_hdp_register_sink_app(unsigned short data_type, char **app_id);
3412
3413 /**
3414  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3415  * @brief Unregisters the given application that acts as the @a Sink role of HDP(Health Device Profile).
3416  * @param[in] app_id  The ID of application
3417  * @return 0 on success, otherwise a negative error value.
3418  * @retval #BT_ERROR_NONE  Successful
3419  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3420  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3421  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3422  * @see bt_hdp_register_sink_app()
3423  */
3424 int bt_hdp_unregister_sink_app(const char *app_id);
3425
3426 /**
3427  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3428  * @brief Connects the remote device which acts as @a Source role, asynchronously.
3429  * @param[in] remote_address  The remote address
3430  * @param[in] app_id  The ID of application
3431  * @return 0 on success, otherwise a negative error value.
3432  * @retval #BT_ERROR_NONE  Successful
3433  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3434  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3435  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3436  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_BONDED  Remote device is not bonded
3437  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3438  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3439  * @pre The Sink role of HDP must be activated with bt_hdp_activate_sink().
3440  * @pre The local device must be bonded with the remote device by bt_device_create_bond().
3441  * @post bt_hdp_connected_cb() will be invoked.
3442  * @see bt_hdp_disconnect()
3443  * @see bt_hdp_set_connection_state_changed_cb()
3444  * @see bt_hdp_unset_connection_state_changed_cb()
3445  */
3446 int bt_hdp_connect_to_source(const char *remote_address, const char *app_id);
3447
3448 /**
3449  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3450  * @brief Disconnects the remote device, asynchronously.
3451  * @param[in] remote_address  The remote address
3452  * @param[in] channel  The connected data channel
3453  * @return 0 on success, otherwise a negative error value.
3454  * @retval #BT_ERROR_NONE  Successful
3455  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3456  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3457  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3458  * @retval #BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED  Remote device is not connected
3459  * @retval #BT_ERROR_OUT_OF_MEMORY  Out of memory
3460  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3461  * @pre The remote device must be connected.
3462  * @post bt_hdp_disconnected_cb() will be invoked.
3463  * @see bt_hdp_set_connection_state_changed_cb()
3464  * @see bt_hdp_unset_connection_state_changed_cb()
3465  */
3466 int bt_hdp_disconnect(const char *remote_address, unsigned int channel);
3467
3468 /**
3469  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3470  * @brief Sends the data to the remote device.
3471  * @param[in] channel  The connected data channel
3472  * @param[in] data  The data to send
3473  * @param[in] size  The size of data to send (byte)
3474  * @return 0 on success, otherwise a negative error value.
3475  * @retval #BT_ERROR_NONE  Successful
3476  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3477  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3478  * @retval #BT_ERROR_NOT_ENABLED  Not enabled
3479  * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
3480  * @pre The remote device must be connected.
3481  * @see bt_hdp_data_received_cb()
3482  * @see bt_hdp_set_data_received_cb()
3483  * @see bt_hdp_unset_data_received_cb()
3484  */
3485 int bt_hdp_send_data(unsigned int channel, const char *data, unsigned int size);
3486
3487 /**
3488  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3489  * @brief  Called when the connection is established.
3490  * @param[in] result  The result of connecting to the remote device
3491  * @param[in] remote_address  The address of connected remote device
3492  * @param[in] app_id  The ID of application
3493  * @param[in] type  The type of HDP(Health Device Profile) channel
3494  * @param[in] channel  The connected data channel
3495  * @param[in] user_data The user data passed from the callback registration function
3496  * @see  bt_hdp_disconnected_cb
3497  * @see bt_hdp_set_connection_state_changed_cb()
3498  * @see bt_hdp_unset_connection_state_changed_cb()
3499  */
3500 typedef void (*bt_hdp_connected_cb) (int result, const char *remote_address, const char *app_id,
3501     bt_hdp_channel_type_e type, unsigned int channel, void *user_data);
3502
3503 /**
3504  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3505  * @brief  Called when the connection is disconnected.
3506  * @param[in] result  The result of disconnecting from the remote device
3507  * @param[in] remote_address  The address of disconnected remote device
3508  * @param[in] channel  The connected data channel
3509  * @param[in] user_data The user data passed from the callback registration function
3510  * @see  bt_hdp_connected_cb
3511  * @see bt_hdp_set_connection_state_changed_cb()
3512  * @see bt_hdp_unset_connection_state_changed_cb()
3513  */
3514 typedef void (*bt_hdp_disconnected_cb) (int result, const char *remote_address, unsigned int channel, void *user_data);
3515
3516 /**
3517  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3518  * @brief  Registers a callback function that will be invoked when the connection state is changed.
3519  * @param[in] connected_cb The callback function called when a connection is established
3520  * @param[in] disconnected_cb The callback function called when a connection is disconnected
3521  * @param[in] user_data The user data to be passed to the callback function
3522  * @return   0 on success, otherwise a negative error value.
3523  * @retval #BT_ERROR_NONE  Successful
3524  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3525  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3526  * @pre The Bluetooth service must be initialized with bt_initialize().
3527  * @see bt_hdp_unset_connection_state_changed_cb()
3528  */
3529 int bt_hdp_set_connection_state_changed_cb(bt_hdp_connected_cb connected_cb, bt_hdp_disconnected_cb disconnected_cb, void *user_data);
3530
3531 /**
3532  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3533  * @brief  Unregisters a callback function that will be invoked when the connection state is changed.
3534  * @return   0 on success, otherwise a negative error value.
3535  * @retval #BT_ERROR_NONE  Successful
3536  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3537  * @pre The Bluetooth service must be initialized with bt_initialize().
3538  * @see bt_hdp_set_connection_state_changed_cb()
3539  */
3540 int bt_hdp_unset_connection_state_changed_cb(void);
3541
3542 /**
3543  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3544  * @brief  Called when the you receive the data.
3545  * @param[in] channel  The connected data channel
3546  * @param[in] data  The received data
3547  * @param[in] size  The size of received data (byte)
3548  * @param[in] user_data The user data passed from the callback registration function
3549  * @see bt_hdp_set_data_received_cb()
3550  * @see bt_hdp_unset_data_received_cb()
3551  */
3552 typedef void (*bt_hdp_data_received_cb) (unsigned int channel, const char *data, unsigned int size, void *user_data);
3553
3554 /**
3555  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3556  * @brief  Registers a callback function that will be invoked when you receive the data.
3557  * @param[in] callback The callback function to register
3558  * @param[in] user_data The user data to be passed to the callback function
3559  * @return   0 on success, otherwise a negative error value.
3560  * @retval #BT_ERROR_NONE  Successful
3561  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3562  * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3563  * @pre The Bluetooth service must be initialized with bt_initialize().
3564  * @see bt_hdp_unset_data_received_cb()
3565  */
3566 int bt_hdp_set_data_received_cb(bt_hdp_data_received_cb callback, void *user_data);
3567
3568 /**
3569  * @ingroup CAPI_NETWORK_BLUETOOTH_HDP_MODULE
3570  * @brief  Unregisters a callback function that will be invoked when you receive the data.
3571  * @return   0 on success, otherwise a negative error value.
3572  * @retval #BT_ERROR_NONE  Successful
3573  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3574  * @pre The Bluetooth service must be initialized with bt_initialize().
3575  * @see bt_hdp_set_data_received_cb()
3576  */
3577 int bt_hdp_unset_data_received_cb(void);
3578
3579 /**
3580  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3581  * @brief  Called when you get the primary services repeatedly.
3582  * @param[in]  service  The attribute handle of service
3583  * @param[in]  user_data  The user data passed from the foreach function
3584  * @return  @c true to continue with the next iteration of the loop,
3585  * \n @c false to break out of the loop.
3586  * @pre  bt_gatt_foreach_primary_services() will invoke this function.
3587  * @see  bt_gatt_foreach_primary_services()
3588  */
3589 typedef bool (*bt_gatt_primary_service_cb) (bt_gatt_attribute_h service, void *user_data);
3590
3591 /**
3592  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3593  * @brief  Gets the primary services of GATT(Generic Attribute Profile).
3594  * @param[in]  remote_address  The address of the remote device
3595  * @param[in]  callback  The callback function to invoke
3596  * @param[in]  user_data  The user data to be passed to the callback function
3597  * @return  0 on success, otherwise a negative error value.
3598  * @retval  #BT_ERROR_NONE  Successful
3599  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3600  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3601  * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
3602  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3603  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3604  * @post  @a callback will be called if there are primary services.
3605  * @see  bt_adapter_enable()
3606  * @see  bt_gatt_primary_service_cb()
3607  */
3608 int bt_gatt_foreach_primary_services(const char *remote_address, bt_gatt_primary_service_cb callback, void *user_data);
3609
3610 /**
3611  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3612  * @brief  Called after the characteristics are discovered by bt_gatt_discover_characteristics().
3613  * @remakrs  If bt_gatt_discover_characteristics() failed, then this callback function is called only once with 0 totla and NULL characteristic_handle.
3614  * @param[in]  result  The result of discovering
3615  * @param[in]  index  The index of characteristics in a service, starts from 0
3616  * @param[in]  total  The total number of characteristics in a service
3617  * @param[in]  characteristic  The attribute handle of characteristic
3618  * @param[in]  user_data  The user data passed from the request function
3619  * @return  @c true to continue with the next iteration of the loop,
3620  * \n @c false to break out of the loop.
3621  * @pre  bt_gatt_discover_characteristics() will invoke this callback.
3622  * @see  bt_gatt_discover_characteristics()
3623  */
3624 typedef bool (*bt_gatt_characteristics_discovered_cb) (int result, int index, int total, bt_gatt_attribute_h characteristic, void *user_data);
3625
3626 /**
3627  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3628  * @brief  Discovers the characteristics in service, asynchronously.
3629  * @param[in]  service  The attribute handle of service
3630  * @param[in]  callback  The result callback
3631  * @param[in]  user_data  The user data to be passed to the callback function
3632  * @return  0 on success, otherwise a negative error value.
3633  * @retval  #BT_ERROR_NONE  Successful
3634  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3635  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3636  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3637  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3638  * @post  @a callback will be called.
3639  * @see  bt_adapter_enable()
3640  * @see  bt_gatt_characteristics_discovered_cb()
3641  */
3642 int bt_gatt_discover_characteristics(bt_gatt_attribute_h service, bt_gatt_characteristics_discovered_cb callback, void *user_data);
3643
3644 /**
3645  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3646  * @brief  Gets the UUID of service.
3647  * @remarks  @a uuid must be released with free() by you.
3648  * @param[in]  service  The attribute handle of service
3649  * @param[out]  uuid  The UUID of service
3650  * @return  0 on success, otherwise a negative error value.
3651  * @retval  #BT_ERROR_NONE  Successful
3652  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3653  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3654  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3655  * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3656  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3657  * @see  bt_adapter_enable()
3658  */
3659 int bt_gatt_get_service_uuid(bt_gatt_attribute_h service, char **uuid);
3660
3661 /**
3662  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3663  * @brief  Called when you get the included services repeatedly.
3664  * @param[in]  service  The attribute handle of service
3665  * @param[in]  user_data  The user data passed from the foreach function
3666  * @return  @c true to continue with the next iteration of the loop,
3667  * \n @c false to break out of the loop.
3668  * @pre  bt_gatt_foreach_included_services() will invoke this function.
3669  * @see  bt_gatt_foreach_included_services()
3670  */
3671 typedef bool (*bt_gatt_included_service_cb) (bt_gatt_attribute_h service, void *user_data);
3672
3673 /**
3674  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3675  * @brief  Gets the included services in service.
3676  * @param[in]  service  The attribute handle of service
3677  * @param[in]  callback  The callback function to invoke
3678  * @param[in]  user_data  The user data to be passed to the callback function
3679  * @return  0 on success, otherwise a negative error value.
3680  * @retval  #BT_ERROR_NONE  Successful
3681  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3682  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3683  * @retval  #BT_ERROR_NOT_ENABLED  Not enabled
3684  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3685  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3686  * @post  @a callback will be called if there are included services.
3687  * @see  bt_adapter_enable()
3688  * @see  bt_gatt_included_service_cb()
3689  */
3690 int bt_gatt_foreach_included_services(bt_gatt_attribute_h service, bt_gatt_included_service_cb callback, void *user_data);
3691
3692 /*
3693  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3694  * @brief  Called when a characteristic in service is changed.
3695  * @param[in]  characteristic  The attribute handle of characteristic
3696  * @param[in]  value  The value of characteristic (byte array)
3697  * @param[in]  value_length  The length of value
3698  * @param[in]  user_data  The user data passed from the callback registration function
3699  * @see bt_gatt_set_characteristic_changed_cb()
3700  * @see bt_gatt_unset_characteristic_changed_cb()
3701  */
3702 typedef void (*bt_gatt_characteristic_changed_cb) (bt_gatt_attribute_h characteristic, unsigned char *value, int value_length, void *user_data);
3703
3704 /**
3705  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3706  * @brief  Registers a callback function that will be invoked when a characteristic in service is changed.
3707  * @param[in]  service  The attribute handle of service
3708  * @param[in]  callback  The callback function to register
3709  * @param[in]  user_data  The user data to be passed to the callback function
3710  * @return  0 on success, otherwise a negative error value.
3711  * @retval  #BT_ERROR_NONE  Successful
3712  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3713  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3714  * @pre  The Bluetooth service must be initialized with bt_initialize().
3715  * @see  bt_gatt_unset_characteristic_changed_cb()
3716  */
3717 int bt_gatt_set_characteristic_changed_cb(bt_gatt_attribute_h service, bt_gatt_characteristic_changed_cb callback, void *user_data);
3718
3719 /**
3720  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3721  * @brief  Unregisters a callback function that will be invoked when a characteristic in service is changed.
3722  * @param[in]  service  The attribute handle of service
3723  * @return  0 on success, otherwise a negative error value.
3724  * @retval #BT_ERROR_NONE  Successful
3725  * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
3726  * @pre The Bluetooth service must be initialized with bt_initialize().
3727  * @see bt_gatt_set_characteristic_changed_cb()
3728  */
3729 int bt_gatt_unset_characteristic_changed_cb(bt_gatt_attribute_h service);
3730
3731 /**
3732  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3733  * @brief  Gets the characteristic declaration.
3734  * @remarks  @a uuid and @a value must be released with free() by you.
3735  * @param[in]  characteristic  The attribute handle of characteristic
3736  * @param[out]  uuid  The UUID of service
3737  * @param[out]  value  The value of characteristic (byte array)
3738  * @param[out]  value_length  The length of value
3739  * @return  0 on success, otherwise a negative error value.
3740  * @retval  #BT_ERROR_NONE  Successful
3741  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3742  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3743  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3744  * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3745  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3746  * @see  bt_adapter_enable()
3747  * @see  bt_gatt_set_characteristic_value()
3748  */
3749 int bt_gatt_get_characteristic_declaration(bt_gatt_attribute_h characteristic, char **uuid, unsigned char **value, int *value_length);
3750
3751 /**
3752  * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3753  * @brief  Sets the value of characteristic.
3754  * @param[in]  characteristic  The attribute handle of characteristic
3755  * @param[in]  value  The value of characteristic (byte array)
3756  * @param[in]  value_length  The length of value
3757  * @return  0 on success, otherwise a negative error value.
3758  * @retval  #BT_ERROR_NONE  Successful
3759  * @retval  #BT_ERROR_NOT_INITIALIZED  Not initialized
3760  * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3761  * @retval  #BT_ERROR_OPERATION_FAILED  Operation failed
3762  * @pre  The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
3763  * @see  bt_adapter_enable()
3764  * @see  bt_gatt_get_characteristic_declaration()
3765  */
3766 int bt_gatt_set_characteristic_value(bt_gatt_attribute_h characteristic, const unsigned char *value, int value_length);
3767
3768 /**
3769 * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3770 * @brief  Clones the attribute handle.
3771 * @remarks  @a clone must be released with bt_gatt_destroy_attribute_handle().
3772 * @param[out]  clone  The cloned attribute handle
3773 * @param[in]  origin  The origin attribute handle
3774 * @return  0 on success, otherwise negative error value.
3775 * @retval  #BT_ERROR_NONE  Successful
3776 * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3777 * @retval  #BT_ERROR_OUT_OF_MEMORY  Out of memory
3778 * @see  bt_gatt_destroy_attribute_handle()
3779 */
3780 int bt_gatt_clone_attribute_handle(bt_gatt_attribute_h* clone, bt_gatt_attribute_h origin);
3781
3782 /**
3783 * @ingroup  CAPI_NETWORK_BLUETOOTH_GATT_MODULE
3784 * @brief  Destroys the attribute handle.
3785 * @param[in]  handle  The attribute handle
3786 * @return  0 on success, otherwise negative error value.
3787 * @retval  #BT_ERROR_NONE  Successful
3788 * @retval  #BT_ERROR_INVALID_PARAMETER  Invalid parameter
3789 * @see  bt_gatt_clone_attribute_handle()
3790 */
3791 int bt_gatt_destroy_attribute_handle(bt_gatt_attribute_h handle);
3792
3793 /**
3794  * @}
3795  */
3796
3797
3798 #ifdef __cplusplus
3799 }
3800 #endif /* __cplusplus */
3801
3802 #endif // __TIZEN_NETWORK_BLUETOOTH_H__