4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: Hocheol Seo <hocheol.seo@samsung.com>
7 * Girishashok Joshi <girish.joshi@samsung.com>
8 * Chanyeol Park <chanyeol.park@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
24 #ifndef _BLUETOOTH_API_H_
25 #define _BLUETOOTH_API_H_
33 #endif /* __cplusplus */
36 * @defgroup BLUETOOTHFW BluetoothFW
38 * A base library for bluetooth framework
40 * @addtogroup BLUETOOTHFW
44 #define BLUETOOTH_ADDRESS_LENGTH 6 /**< This specifies bluetooth device address length */
45 #define BLUETOOTH_VERSION_LENGTH_MAX 30 /**< This specifies bluetooth device version length */
46 #define BLUETOOTH_INTERFACE_NAME_LENGTH 16
47 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX 248 /**< This specifies maximum device name length */
48 #define BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX 31 /**< This specifies maximum AD data length */
49 #define BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX 31 /**< This specifies maximum LE Scan response data length */
50 #define BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX 240 /**< This specifies maximum manufacturer data length */
52 #define BLUETOOTH_MAX_SERVICES_FOR_DEVICE 40 /**< This specifies maximum number of services
53 a device can support */
55 #define BLUETOOTH_UUID_STRING_MAX 50
56 #define BLUETOOTH_PATH_STRING 50
58 #define BLUETOOTH_OOB_DATA_LENGTH 16
60 * This is Bluetooth Connected event role
62 #define RFCOMM_ROLE_SERVER 1
63 #define RFCOMM_ROLE_CLIENT 2
66 * This is RFCOMM default Channel Value
68 #define RFCOMM_DEFAULT_PROFILE_CHANNEL 0
71 * This is maximum length for search value string for PBAP Phonebook Search
73 #define BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH 100
77 * This is Bluetooth error code
79 #define BLUETOOTH_ERROR_BASE ((int)0) /**< Error code base */
81 #define BLUETOOTH_ERROR_NONE ((int)0) /**< No error #0 */
82 #define BLUETOOTH_ERROR_CANCEL ((int)BLUETOOTH_ERROR_BASE - 0x01)
84 #define BLUETOOTH_ERROR_INVALID_CALLBACK ((int)BLUETOOTH_ERROR_BASE - 0x02)
85 /**< Callback error */
86 #define BLUETOOTH_ERROR_INVALID_PARAM ((int)BLUETOOTH_ERROR_BASE - 0x03)
87 /**< invalid paramerror */
88 #define BLUETOOTH_ERROR_INVALID_DATA ((int)BLUETOOTH_ERROR_BASE - 0x04)
89 /**< invalid data error */
90 #define BLUETOOTH_ERROR_MEMORY_ALLOCATION ((int)BLUETOOTH_ERROR_BASE - 0x05)
91 /**< Memory allocation error */
92 #define BLUETOOTH_ERROR_OUT_OF_MEMORY ((int)BLUETOOTH_ERROR_BASE - 0x06)
93 /**< out of memory error */
94 #define BLUETOOTH_ERROR_TIMEOUT ((int)BLUETOOTH_ERROR_BASE - 0x07)
96 #define BLUETOOTH_ERROR_NO_RESOURCES ((int)BLUETOOTH_ERROR_BASE - 0x08)
97 /**< No resource error */
98 #define BLUETOOTH_ERROR_INTERNAL ((int)BLUETOOTH_ERROR_BASE - 0x09)
99 /**< internal error */
100 #define BLUETOOTH_ERROR_NOT_SUPPORT ((int)BLUETOOTH_ERROR_BASE - 0x0a)
101 /**< Not supported error */
102 #define BLUETOOTH_ERROR_DEVICE_NOT_ENABLED ((int)BLUETOOTH_ERROR_BASE - 0x0b)
103 /**< Operation is failed because
104 of not enabled BT Adapter */
105 #define BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED ((int)BLUETOOTH_ERROR_BASE - 0x0c)
106 /**< Enabling is failed because of
107 already enabled BT Adapter */
108 #define BLUETOOTH_ERROR_DEVICE_BUSY ((int)BLUETOOTH_ERROR_BASE - 0x0d)
109 /**< Operation is failed because of
110 other on going operation */
111 #define BLUETOOTH_ERROR_ACCESS_DENIED ((int)BLUETOOTH_ERROR_BASE - 0x0e)
112 /**< access denied error */
113 #define BLUETOOTH_ERROR_MAX_CLIENT ((int)BLUETOOTH_ERROR_BASE - 0x0f)
114 /**< max client error */
115 #define BLUETOOTH_ERROR_NOT_FOUND ((int)BLUETOOTH_ERROR_BASE - 0x10)
116 /**< not found error */
117 #define BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR ((int)BLUETOOTH_ERROR_BASE - 0x11)
118 /**< service search fail */
119 #define BLUETOOTH_ERROR_PARING_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x12)
120 /**< pairing failed error */
121 #define BLUETOOTH_ERROR_NOT_PAIRED ((int)BLUETOOTH_ERROR_BASE - 0x13)
122 /**< Not paired error */
123 #define BLUETOOTH_ERROR_SERVICE_NOT_FOUND ((int)BLUETOOTH_ERROR_BASE - 0x14)
124 /**< no service error */
125 #define BLUETOOTH_ERROR_NOT_CONNECTED ((int)BLUETOOTH_ERROR_BASE - 0x15)
126 /**< no connection error */
127 #define BLUETOOTH_ERROR_ALREADY_CONNECT ((int)BLUETOOTH_ERROR_BASE - 0x16)
128 /**< alread connected error */
129 #define BLUETOOTH_ERROR_CONNECTION_BUSY ((int)BLUETOOTH_ERROR_BASE - 0x17)
130 /**< connection busy error */
131 #define BLUETOOTH_ERROR_CONNECTION_ERROR ((int)BLUETOOTH_ERROR_BASE - 0x18)
132 /**< connection error */
133 #define BLUETOOTH_ERROR_MAX_CONNECTION ((int)BLUETOOTH_ERROR_BASE - 0x19)
134 /**< max connection error*/
135 #define BLUETOOTH_ERROR_NOT_IN_OPERATION ((int)BLUETOOTH_ERROR_BASE - 0x1a)
136 /**< Not in operation */
137 #define BLUETOOTH_ERROR_CANCEL_BY_USER ((int)BLUETOOTH_ERROR_BASE - 0x1b)
138 /**< Cancelled by user */
139 #define BLUETOOTH_ERROR_REGISTRATION_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x1c)
140 /**< Service record registration failed */
141 #define BLUETOOTH_ERROR_IN_PROGRESS ((int)BLUETOOTH_ERROR_BASE - 0x1d)
142 /**< Operation in progress */
143 #define BLUETOOTH_ERROR_AUTHENTICATION_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x1e)
144 /**< authentication failed error when paring*/
145 #define BLUETOOTH_ERROR_HOST_DOWN ((int)BLUETOOTH_ERROR_BASE - 0x1f)
146 /**< Remote host is down */
147 #define BLUETOOTH_ERROR_END_OF_DEVICE_LIST ((int)BLUETOOTH_ERROR_BASE - 0x20)
148 /**< End of device list */
150 #define BLUETOOTH_ERROR_AGENT_ALREADY_EXIST ((int)BLUETOOTH_ERROR_BASE - 0x21)
151 /**< Obex agent already exists */
152 #define BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST ((int)BLUETOOTH_ERROR_BASE - 0x22)
153 /**< Obex agent does not exist */
155 #define BLUETOOTH_ERROR_ALREADY_INITIALIZED ((int)BLUETOOTH_ERROR_BASE - 0x23)
156 /**< Already initialized */
158 #define BLUETOOTH_ERROR_PERMISSION_DEINED ((int)BLUETOOTH_ERROR_BASE - 0x24)
159 /**< Permission deined */
161 #define BLUETOOTH_ERROR_ALREADY_DEACTIVATED ((int)BLUETOOTH_ERROR_BASE - 0x25)
162 /**< Nap already done */
164 #define BLUETOOTH_ERROR_NOT_INITIALIZED ((int)BLUETOOTH_ERROR_BASE - 0x26)
165 /**< Not initialized */
168 * Device disconnect reason
171 BLUETOOTH_DEVICE_DISCONNECT_UNKNOWN,
172 BLUETOOTH_DEVICE_DISCONNECT_TIMEOUT,
173 BLUETOOTH_DEVICE_DISCONNECT_LOCAL_HOST,
174 BLUETOOTH_DEVICE_DISCONNECT_REMOTE,
175 } bluetooth_device_disconnect_reason_t;
178 * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
181 unsigned char addr[BLUETOOTH_ADDRESS_LENGTH];
182 } bluetooth_device_address_t;
185 * This is Bluetooth device address type
189 BLUETOOTH_DEVICE_PUBLIC_ADDRESS = 0x00,
190 BLUETOOTH_DEVICE_RANDOM_ADDRESS
191 } bluetooth_device_address_type_t;
194 * This is Bluetooth version
197 char version[BLUETOOTH_VERSION_LENGTH_MAX + 1];
198 } bluetooth_version_t;
201 * This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes
204 char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1];
205 } bluetooth_device_name_t;
208 * This is Bluetooth manufacturer specific data, maximum size of data is 240 bytes
211 int data_len; /**< manafacturer specific data length */
212 char data[BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX];
213 } bluetooth_manufacturer_data_t;
219 BLUETOOTH_ADAPTER_DISABLED, /**< Bluetooth adapter is disabled */
220 BLUETOOTH_ADAPTER_ENABLED, /**< Bluetooth adapter is enabled */
221 BLUETOOTH_ADAPTER_CHANGING_ENABLE, /**< Bluetooth adapter is currently enabling */
222 BLUETOOTH_ADAPTER_CHANGING_DISABLE, /**< Bluetooth adapter is currently disabling */
223 } bluetooth_adapter_state_t;
229 BLUETOOTH_ADAPTER_LE_DISABLED, /**< Bluetooth adapter le is disabled */
230 BLUETOOTH_ADAPTER_LE_ENABLED, /**< Bluetooth adapter le is enabled */
231 BLUETOOTH_ADAPTER_LE_CHANGING_ENABLE, /**< Bluetooth adapter le is currently enabling */
232 BLUETOOTH_ADAPTER_LE_CHANGING_DISABLE, /**< Bluetooth adapter le is currently disabling */
233 } bluetooth_adapter_le_state_t;
239 BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, /**< Non discoverable mode */
240 /*Changed the order to make it compatable with old method */
241 BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,/**< Discoverable mode */
242 BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE,
243 /**< Discoverable mode with time limit
244 After specific timeout, it is changed
245 to non discoverable mode */
246 } bluetooth_discoverable_mode_t;
249 * Network connect mode
252 BLUETOOTH_NETWORK_PANU_ROLE,
254 BLUETOOTH_NETWORK_NAP_ROLE,/**< Network Access Point */
255 BLUETOOTH_NETWORK_GN_ROLE, /**< Group ad-hoc Network */
256 BLUETOOTH_NETWORK_CUSTOM_UUID, /**< Custom role */
257 } bluetooth_network_role_t;
263 BLUETOOTH_RFCOMM_SERVICE = 0x01,
264 BLUETOOTH_A2DP_SERVICE = 0x02,
265 BLUETOOTH_HSP_SERVICE = 0x04,
266 BLUETOOTH_HID_SERVICE = 0x08,
267 BLUETOOTH_NAP_SERVICE = 0x10,
268 BLUETOOTH_HFG_SERVICE = 0x20,
269 BLUETOOTH_GATT_SERVICE = 0x40,
270 BLUETOOTH_NAP_SERVER_SERVICE = 0x80,
271 } bluetooth_service_type_t;
277 BLUETOOTH_DEV_CONN_DEFAULT = 0xFF, /* represents that connection
278 * type can both BR/EDR and LE */
279 BLUETOOTH_DEV_CONN_BREDR = 0x00,
280 BLUETOOTH_DEV_CONN_LE = 0x01,
281 } bluetooth_conn_type_t;
287 BLUETOOTH_CODEC_ID_CVSD = 0x01,
288 BLUETOOTH_CODEC_ID_MSBC = 0x02,
289 } bluetooth_codec_type_t;
295 BLUETOOTH_HF_AUDIO_DISCONNECTED = 0x00,
296 BLUETOOTH_HF_AUDIO_CONNECTED = 0x01,
297 } bluetooth_hf_audio_connected_type_t;
303 guint8 data[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];
304 } bluetooth_advertising_data_t;
310 guint8 data[BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX];
311 } bluetooth_scan_resp_data_t;
314 * Advertising filter policy
317 BLUETOOTH_ALLOW_SCAN_CONN_ALL = 0x00,
318 BLUETOOTH_ALLOW_CONN_ALL_SCAN_WHITE_LIST = 0x01,
319 BLUETOOTH_ALLOW_SCAN_ALL_CONN_WHITE_LIST = 0x02,
320 BLUETOOTH_ALLOW_SCAN_CONN_WHITE_LIST = 0x03,
321 } bluetooth_advertising_filter_policy_t;
327 BLUETOOTH_ADV_CONNECTABLE = 0x00, /* ADV_IND */
328 BLUETOOTH_ADV_CONNECTABLE_DIRECT_HIGH = 0x01, /* ADV_DIRECT_IND, high duty cycle */
329 BLUETOOTH_ADV_SCANNABLE = 0x02, /* ADV_SCAN_IND */
330 BLUETOOTH_ADV_NON_CONNECTABLE = 0x03, /* ADV_NONCOND_IND */
331 BLUETOOTH_ADV_CONNECTABLE_DIRECT_LOW = 0x04, /* ADV_DIRECT_IND, low duty cycle */
332 } bluetooth_advertising_type_t;
336 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
337 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
338 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
339 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
340 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
341 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
342 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
343 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0x80
344 }bt_gatt_characteristic_property_t;
347 * Advertising parameters
352 guint8 filter_policy;
354 } bluetooth_advertising_params_t;
360 int type; /**< passive 0, active 1 */
361 float interval; /**< LE scan interval */
362 float window; /**< LE scan window */
363 } bluetooth_le_scan_params_t;
369 guint16 interval_min;
370 guint16 interval_max;
373 } bluetooth_le_conn_update_t;
376 * Samsung XSAT Vendor dependent command
381 } bluetooth_vendor_dep_at_cmd_t;
384 #define BLUETOOTH_EVENT_BASE ((int)(0x0000)) /**< No event */
385 #define BLUETOOTH_EVENT_GAP_BASE ((int)(BLUETOOTH_EVENT_BASE + 0x0010))
386 /**< Base ID for GAP Event */
387 #define BLUETOOTH_EVENT_SDP_BASE ((int)(BLUETOOTH_EVENT_GAP_BASE + 0x0020))
388 /**< Base ID for SDP events */
389 #define BLUETOOTH_EVENT_RFCOMM_BASE ((int)(BLUETOOTH_EVENT_SDP_BASE + 0x0020))
390 /**< Base ID for RFCOMM events */
391 #define BLUETOOTH_EVENT_NETWORK_BASE ((int)(BLUETOOTH_EVENT_RFCOMM_BASE + 0x0020))
392 /**< Base ID for NETWORK events */
393 #define BLUETOOTH_EVENT_HDP_BASE ((int)(BLUETOOTH_EVENT_NETWORK_BASE + 0x0020))
394 /**< Base ID for HDP events */
395 #define BLUETOOTH_EVENT_OPC_BASE ((int)(BLUETOOTH_EVENT_HDP_BASE + 0x0020))
396 /**< Base ID for OPC events */
397 #define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
398 /**< Base ID for Obex Server events */
399 #define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
400 /**< Base ID for GATT events */
402 #define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
403 /**< Base ID for Audio events */
404 #define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0020))
405 /**< Base ID for HID events */
406 #define BLUETOOTH_EVENT_ADVERTISING_BASE ((int)(BLUETOOTH_EVENT_HID_BASE + 0x0020))
407 /**< Base ID for Advertising events */
408 #define BLUETOOTH_EVENT_PBAP_CLIENT_BASE ((int)(BLUETOOTH_EVENT_ADVERTISING_BASE + 0x0020))
409 /**< Base ID for PBAP Client events */
410 #define BLUETOOTH_EVENT_AVRCP_CONTROL_BASE ((int)(BLUETOOTH_EVENT_PBAP_CLIENT_BASE + 0x0020))
411 /**< Base ID for AVRCP events */
414 * Bluetooth event type
417 BLUETOOTH_EVENT_NONE = BLUETOOTH_EVENT_BASE,/**< No event */
419 BLUETOOTH_EVENT_ENABLED, /**< Bluetooth event adpater enabled */
420 BLUETOOTH_EVENT_DISABLED, /**< Bluetooth event adpater disabled */
421 BLUETOOTH_EVENT_LE_ENABLED, /**< Bluetooth event adpater enabled */
422 BLUETOOTH_EVENT_LE_DISABLED, /**< Bluetooth event adpater disabled */
423 BLUETOOTH_EVENT_LOCAL_NAME_CHANGED, /**< Bluetooth event local name changed*/
424 BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED,
425 /**< Bluetooth event Discoverable timeout requested*/
426 BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED, /**< Bluetooth event mode changed */
427 BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED, /**< Bluetooth event discovery option */
428 BLUETOOTH_EVENT_DISCOVERY_STARTED, /**< Bluetooth event discovery started */
429 BLUETOOTH_EVENT_DISCOVERY_FINISHED, /**< Bluetooth event discovery finished */
430 BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, /**< Bluetooth event remote deice found */
431 BLUETOOTH_EVENT_LE_DISCOVERY_STARTED, /**< Bluetooth event LE discovery started */
432 BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, /**< Bluetooth event LE discovery finished */
433 BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND, /**< Bluetooth event remote deice found (LE dev) */
434 BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
435 BLUETOOTH_EVENT_BONDING_FINISHED, /**< Bluetooth event bonding completed */
436 BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED, /**< Bluetooth event bonding removed */
437 BLUETOOTH_EVENT_BONDED_DEVICE_FOUND, /**< Bluetooth event paired device found */
438 BLUETOOTH_EVENT_REMOTE_DEVICE_READ, /**< Bluetooth event read remote device */
439 BLUETOOTH_EVENT_DEVICE_AUTHORIZED, /**< Bluetooth event authorize device */
440 BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED, /**< Bluetooth event unauthorize device */
441 BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_CHANGED, /**< Bluetooth event mode changed */
442 BLUETOOTH_EVENT_CONNECTABLE_CHANGED, /**< Bluetooth event connectable changed */
444 BLUETOOTH_EVENT_RSSI_ENABLED, /**< Bluetooth event RSSI monitoring enabled */
445 BLUETOOTH_EVENT_RSSI_ALERT, /**< Bluetooth event RSSI Alert */
446 BLUETOOTH_EVENT_RAW_RSSI, /**< Bluetooth event Raw RSSI */
448 BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
449 /**< Bluetooth event serice search base id */
450 BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED, /**< Bluetooth event service search cancelled */
451 BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED = BLUETOOTH_EVENT_RFCOMM_BASE,
452 /**< RFCOMM data receive event */
453 BLUETOOTH_EVENT_RFCOMM_CONNECTED, /**< Rfcomm server incomming connection */
454 BLUETOOTH_EVENT_RFCOMM_DISCONNECTED, /**< Rfcomm server/client disconnect */
456 BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
458 BLUETOOTH_EVENT_DEVICE_CONNECTED, /**< Bluetooth event device connected */
459 BLUETOOTH_EVENT_DEVICE_DISCONNECTED, /**< Bluetooth event device disconnected */
461 BLUETOOTH_EVENT_RFCOMM_SERVER_REMOVED,
463 BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED = BLUETOOTH_EVENT_NETWORK_BASE,
464 /**< Bluetooth Network event */
465 BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED, /**< Network server deactivated */
466 BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED, /**< Network connected event in server */
467 BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
468 /**< Network disconnected evnet in server */
470 BLUETOOTH_EVENT_NETWORK_CONNECTED, /**< Network connected event in client*/
471 BLUETOOTH_EVENT_NETWORK_DISCONNECTED, /**< Network disconnected evnet in client*/
473 BLUETOOTH_EVENT_HDP_CONNECTED
474 = BLUETOOTH_EVENT_HDP_BASE, /**<HDP Connect>*/
475 BLUETOOTH_EVENT_HDP_DISCONNECTED, /**<HDP Disconnect>*/
476 BLUETOOTH_EVENT_HDP_DATA_RECEIVED, /**<HDP Data Indication>*/
478 BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE,
479 /* OPC Connected event */
480 BLUETOOTH_EVENT_OPC_DISCONNECTED, /* OPC Disonnected event */
481 BLUETOOTH_EVENT_OPC_TRANSFER_STARTED, /* OPC Transfer started event */
482 BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS, /* OPC Transfer progress event */
483 BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE, /* OPC Transfer Complete event */
485 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
486 /* Obex server authorize event*/
487 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED, /* Obex Server transfer started event*/
488 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
489 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
490 BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
491 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED, /* Obex Transfer connected event */
492 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED, /* Obex Transfer disconnected event */
494 BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
495 /**<Discovered GATT service characteristics event*/
496 BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
497 /**<Remote GATT charateristic value changed event*/
498 BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID,
499 BLUETOOTH_EVENT_GATT_READ_CHAR, /**<Gatt Read Characteristic Value */
500 BLUETOOTH_EVENT_GATT_WRITE_CHAR, /**<Gatt Write Characteristic Value */
501 BLUETOOTH_EVENT_GATT_READ_DESC, /**<Gatt Read Characteristic Descriptor Value */
502 BLUETOOTH_EVENT_GATT_WRITE_DESC, /**<Gatt Write Characteristic Descriptor Value */
503 BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED, /**<Gatt Char Descriptors Discovered Event*/
504 BLUETOOTH_EVENT_GATT_CONNECTED,/**<Gatt connected event */
505 BLUETOOTH_EVENT_GATT_DISCONNECTED, /**<Gatt Disconnected event */
506 BLUETOOTH_EVENT_GATT_SERVER_CHARACTERISTIC_VALUE_CHANGED, /**<Gatt Char write callback event */
508 BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
509 BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
510 BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
511 BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
512 BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
513 BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED, /**<AV & AG service disconnected event*/
514 BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
515 BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
516 BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
517 BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
518 BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle status event*/
519 BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
520 BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
521 BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
522 BLUETOOTH_EVENT_HF_CONNECTED,
523 BLUETOOTH_EVENT_HF_DISCONNECTED,
524 BLUETOOTH_EVENT_HF_AUDIO_CONNECTED,
525 BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED,
526 BLUETOOTH_EVENT_HF_RING_INDICATOR,
527 BLUETOOTH_EVENT_HF_CALL_WAITING,
528 BLUETOOTH_EVENT_HF_CALL_TERMINATED,
529 BLUETOOTH_EVENT_HF_CALL_STARTED,
530 BLUETOOTH_EVENT_HF_CALL_ENDED,
531 BLUETOOTH_EVENT_HF_CALL_UNHOLD,
532 BLUETOOTH_EVENT_HF_CALL_SWAPPED,
533 BLUETOOTH_EVENT_HF_CALL_ON_HOLD,
534 BLUETOOTH_EVENT_HF_CALL_STATUS,
535 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED,
536 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED,
537 BLUETOOTH_EVENT_HF_VOLUME_SPEAKER,
538 BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD,
540 BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
541 BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
543 BLUETOOTH_EVENT_ADVERTISING_STARTED = BLUETOOTH_EVENT_ADVERTISING_BASE, /**< Advertising started event */
544 BLUETOOTH_EVENT_ADVERTISING_STOPPED, /**< Advertising stopped event */
545 BLUETOOTH_EVENT_ADVERTISING_MANUFACTURER_DATA_CHANGED, /**< Advertising manufacturer data changed event */
546 BLUETOOTH_EVENT_SCAN_RESPONSE_MANUFACTURER_DATA_CHANGED, /**< Scan response manufacturer data changed event */
547 BLUETOOTH_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed event */
548 BLUETOOTH_EVENT_DEVICE_ERROR, /**< Hardware error */
549 BLUETOOTH_EVENT_TX_TIMEOUT_ERROR, /** TX Timeout Error*/
550 BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
552 BLUETOOTH_PBAP_CONNECTED = BLUETOOTH_EVENT_PBAP_CLIENT_BASE, /**< PBAP connected/disconnectd event*/
553 BLUETOOTH_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size event*/
554 BLUETOOTH_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull event*/
555 BLUETOOTH_PBAP_VCARD_LIST, /**< PBAP vCard List event*/
556 BLUETOOTH_PBAP_VCARD_PULL, /**< PBAP vCard Pull event*/
557 BLUETOOTH_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search event*/
559 BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED = BLUETOOTH_EVENT_AVRCP_CONTROL_BASE, /**<AVRCP service connected event*/
560 BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED, /**<AVRCP service disconnected event*/
561 BLUETOOTH_EVENT_AVRCP_CONTROL_SHUFFLE_STATUS, /**<AVRCP control suffle status event*/
562 BLUETOOTH_EVENT_AVRCP_CONTROL_EQUALIZER_STATUS, /**<AVRCP control equalizer status event*/
563 BLUETOOTH_EVENT_AVRCP_CONTROL_REPEAT_STATUS, /**<AVRCP control repeat status event*/
564 BLUETOOTH_EVENT_AVRCP_CONTROL_SCAN_STATUS, /**<AVRCP control scan status event*/
565 BLUETOOTH_EVENT_AVRCP_SONG_POSITION_STATUS, /**<AVRCP control play Postion status event*/
566 BLUETOOTH_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**<AVRCP control play status event*/
567 BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED, /**<AVRCP control song metadata event*/
568 } bluetooth_event_type_t;
571 * This bt_service_uuid_list_t enum indicates service uuid list .
572 * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
576 BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101), /**<SPP*/
577 BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102), /**<LAP*/
578 BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103), /**<DUN*/
579 BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104), /**<OBEX IR MC SYNC*/
580 BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105), /**<OPP*/
581 BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106), /**<FTP*/
582 BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107), /**<IRMC SYNC COMMAND*/
583 BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108), /**<HS*/
584 BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109), /**<CTP*/
585 BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A), /**<AUDIO SOURCE*/
586 BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B), /**<AUDIO SINK*/
587 BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C), /**<AV REMOTE CONTROL
589 BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
590 BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E), /**<AV REMOTE CONTROL UUID*/
591 BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
592 BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110), /**<ICP*/
593 BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111), /**<FAX*/
594 BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112), /**<HS AG */
595 BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115), /**<PAN*/
596 BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116), /**<PAN*/
597 BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117), /**<PAN*/
598 BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
599 BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118), /**<OBEX BPPS*/ /* Will be removed */
600 BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
601 BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A), /**<OBEX_IMAGING*/
602 BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B), /**<OBEX_IMAGING
604 BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C), /**<IMAGING AUTOMATIC ARCHIVE*/
605 BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D), /**<IMAGING REFERENCED OBJECTS*/
606 BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E), /**<HF*/
607 BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F), /**<HFG*/
608 BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
609 /**<DIRECT PRINTING*/
610 BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121), /**<REFLECTED UI*/
611 BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122), /**<BASIC PRINTING*/
612 BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123), /**<PRINTING STATUS*/
613 BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
614 BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124), /**<HID*/
615 BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125), /**<HCRP*/
616 BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126), /**<HCR PRINT*/
617 BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127), /**<HCR SCAN*/
618 BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D), /**<SIM ACCESS PROFILE*/
619 BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E), /**<PBAP - PCE*/
620 BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/
621 BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/ /* Will be removed */
622 BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130), /**<OBEX PBA*/
623 BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131), /**<HEADSET HS*/
624 BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
625 BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
626 BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
627 BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200), /**<PNP*/
628 BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201), /**<GENERIC NETWORKING*/
629 BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
630 BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203), /**<GENERIC AUDIO*/
631 BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204), /**<GENERIC TELEPHONY*/
632 BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303), /**<VEDIO SOURCE*/
633 BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304), /**<VEDIO SINK*/
634 BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305), /**<VEDIO DISTRIBUTION*/
635 BLUETOOTH_HDP_UUID = ((unsigned short)0x1400), /**<HDP*/
636 BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401), /**<HDP SOURCE*/
637 BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402), /**<HDP SINK*/
638 BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000) /**<OBEX_SYNC*/ /* Will be removed */
639 } bluetooth_service_uuid_list_t;
642 * Service class part of class of device returned from device discovery
645 BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
646 BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000, /**< */
647 BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000, /**< */
648 BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000, /**< */
649 BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000, /**< */
650 BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000, /**< */
651 BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000, /**< */
652 BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000, /**< */
653 BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000, /**< */
654 } bluetooth_device_service_class_t;
658 * Major device mask (For device discovery)
661 BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
662 BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
663 BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
664 BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
665 BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
666 BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
667 BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
668 BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
669 BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
670 BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
671 } bluetooth_device_major_mask_t;
675 * Major device class (part of Class of Device)
678 BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
679 BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01, /**< Computer major device class*/
680 BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02, /**< Phone major device class*/
681 BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03, /**< LAN major device class*/
682 BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04, /**< AUDIO major device class*/
683 BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class*/
684 BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06, /**< Imaging major device class*/
685 BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07, /**< Wearable device class*/
686 BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08, /**< Toy device class*/
687 BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09, /**< Health device class*/
688 BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F /**< Unknown major device class*/
689 } bluetooth_device_major_class_t;
692 BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00, /**< unclassified minor class */
694 /* About Computer Major class */
695 BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04, /**< desktop workstation
697 BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08, /**< server minor class */
698 BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C, /**< laptop minor class */
699 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10, /**< PDA minor class */
700 BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14, /**< PALM minor class */
701 BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18, /**< Wearable PC minor class */
703 /* About Phone Major class */
704 BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04, /**< Cellular minor class */
705 BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08, /**< cordless minor class */
706 BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C, /**< smart phone minor class */
707 BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
708 /**< voice gateway minor class */
709 BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14, /**< ISDN minor class */
711 /* About LAN/Network Access Point Major class */
712 BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04, /**< Fully available minor class */
713 BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor class */
714 BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor class */
715 BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor class */
716 BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor class */
717 BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor class */
718 BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor class */
719 BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor class */
721 /* About Audio/Video Major class */
722 BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04, /**< Headset minor class */
723 BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08, /**< Handsfree minor class*/
725 BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10, /**< Microphone minor class */
726 BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14, /**< Loud Speaker minor class */
727 BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18, /**< Headphones minor class */
728 BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C, /**< Portable Audio minor class */
729 BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20, /**< Car Audio minor class */
730 BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24, /**< Set top box minor class */
731 BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi minor class */
732 BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C, /**< VCR minor class */
733 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30, /**< Video Camera minor class */
734 BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34, /**< CAM Corder minor class */
735 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38, /**<Video Monitor minor class */
736 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
737 /**< Video Display and Loud
738 Speaker minor class */
739 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
742 BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48, /**< Gaming or toy minor class */
744 /* About Peripheral Major class */
745 BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40, /**< Key board minor class */
746 BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80, /**< Pointing Device minor class */
747 BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
748 /**< Combo Keyboard or pointing
751 BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04, /**< JoyStick minor class */
752 BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08, /**< Game Pad minor class */
753 BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C, /**< Remote Control minor class */
754 BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10, /**< Sensing Device minor class */
755 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14, /**< Digitizer minor class */
756 BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18, /**< Card Reader minor class */
757 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C, /**< Digital pen minor class */
758 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20, /**< Handheld scanner for bar-codes, RFID minor class */
759 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor class */
761 /* About Imaging Major class */
762 BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10, /**< Display minor class */
763 BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20, /**< Camera minor class */
764 BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40, /**< Scanner minor class */
765 BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80, /**< Printer minor class */
767 /* About Wearable Major class */
768 BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04, /**< Wrist watch minor class */
769 BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08, /**< Pager minor class */
770 BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C, /**< Jacket minor class */
771 BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10, /**< Helmet minor class */
772 BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14, /**< Glasses minor class */
774 /* About Toy Major class */
775 BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04, /**< Robot minor class */
776 BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08, /**< Vehicle minor class */
777 BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C, /**< Doll or Action minor class */
778 BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10, /**< Controller minor class */
779 BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14, /**< Game minor class */
781 /* About Health Major class */
782 BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood Pressure minor class */
783 BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08, /**< Thermometer minor class */
784 BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C, /**< Weighing Scale minor class */
785 BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10, /**< Glucose minor class */
786 BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14, /**< Pulse Oximeter minor class */
787 BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
788 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C, /**< Medical minor class */
789 BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20, /**< Step Counter minor class */
790 BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor class */
791 BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor class */
792 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
793 BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor class */
794 BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor class */
795 } bluetooth_device_minor_class_t;
798 * structure to hold the device information
801 bluetooth_device_major_class_t major_class; /**< major device class */
802 bluetooth_device_minor_class_t minor_class; /**< minor device class */
803 bluetooth_device_service_class_t service_class;
804 /**< service device class */
805 } bluetooth_device_class_t;
808 * Discovery Role types
811 DISCOVERY_ROLE_BREDR = 0x1,
813 DISCOVERY_ROLE_LE_BREDR
814 } bt_discovery_role_type_t;
817 * structure to hold the device information
820 bluetooth_device_address_t device_address; /**< device address */
821 bluetooth_device_name_t device_name; /**< device name */
822 bluetooth_device_class_t device_class; /**< device class */
823 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
824 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
826 int rssi; /**< received strength signal*/
827 gboolean paired; /**< paired flag */
828 gboolean connected; /**< connected flag */
829 gboolean trust; /**< connected flag */
830 bluetooth_manufacturer_data_t manufacturer_data; /**< manafacturer specific class */
831 } bluetooth_device_info_t;
834 * structure to hold the LE device information
837 int data_len; /**< manafacturer specific data length */
838 bluetooth_advertising_data_t data; /**< manafacturer specific data */
839 } bluetooth_le_advertising_data_t;
842 bluetooth_device_address_t device_address; /**< device address */
843 int addr_type; /**< address type*/
844 int rssi; /**< received strength signal*/
845 bluetooth_le_advertising_data_t adv_ind_data;
846 bluetooth_le_advertising_data_t scan_resp_data;
847 } bluetooth_le_device_info_t;
850 * structure to hold the paired device information
853 bluetooth_device_address_t device_address; /**< paired device address */
854 bluetooth_device_name_t device_name; /**< device name */
855 bluetooth_device_class_t device_class; /**< device class */
856 } bluetooth_paired_device_info_t;
859 * structure to hold the paired device information
862 bluetooth_device_address_t device_address;
863 /**< device address */
864 char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
865 /**< network interface name */
866 } bluetooth_network_device_info_t;
869 * Stucture to hold discovery option
872 unsigned short max_response; /**< the number of maximum response */
873 unsigned short discovery_duration;
874 /**< duration of discovery (seconds) */
875 unsigned int classOfDeviceMask; /**< mask for values of class of device. to be used with
876 classOfDevice variable */
877 } bluetooth_discovery_option_t;
880 * Stucture to hold event information
883 int event; /**< event type */
884 int result; /**< Success or error value */
886 /**<parameter data pointer */
888 } bluetooth_event_param_t;
891 bluetooth_device_address_t device_addr;
892 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
893 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
894 unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
899 bluetooth_device_address_t device_addr;
900 unsigned char addr_type;
902 } bt_connection_info_t;
905 * Stucture to rfcomm receive data
910 /**< the socket fd */
911 int buffer_size;/**< the length of the receive buffer */
913 /**< the receive data buffer */
914 } bluetooth_rfcomm_received_data_t;
917 * Stucture to rfcomm connection
921 int socket_fd; /**< the socket fd */
922 int server_id; /* Server id */
923 int device_role; /** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
924 bluetooth_device_address_t device_addr;
925 /**< device address */
926 char uuid[BLUETOOTH_UUID_STRING_MAX];
927 } bluetooth_rfcomm_connection_t;
930 * Stucture to rfcomm disconnection
934 /**< the socket fd */
935 int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
936 bluetooth_device_address_t device_addr;
937 /**< device address */
938 char uuid[BLUETOOTH_UUID_STRING_MAX];
939 } bluetooth_rfcomm_disconnection_t;
943 /**< the socket fd */
944 bluetooth_device_address_t device_addr;
945 /**< device address */
946 } bluetooth_rfcomm_connection_request_t;
961 HDP_ROLE_SOURCE = 0x0,
967 * Stucture to HDP connected
970 const char *app_handle; /**< the application handle */
971 unsigned int channel_id; /**< the channel id */
972 bt_hdp_qos_type_t type; /**< the QOS type */
973 bluetooth_device_address_t device_address; /**< the remote address */
974 } bt_hdp_connected_t;
977 * Stucture to HDP disconnected
980 unsigned int channel_id; /**< the channel id */
981 bluetooth_device_address_t device_address; /**< the remote address */
982 } bt_hdp_disconnected_t;
985 * Stucture to HDP data indication
988 unsigned int channel_id; /**< the channel id */
989 const char *buffer; /**< the RX data buffer */
990 unsigned int size; /**< the RX data size */
994 * Stucture to OPP client transfer information
1000 }bt_opc_transfer_info_t;
1002 /* Obex Server transfer type */
1003 #define TRANSFER_PUT "PUT"
1004 #define TRANSFER_GET "GET"
1006 * Stucture to OPP/FTP Server authorize information
1011 } bt_obex_server_authorize_into_t;
1019 } bt_obex_server_type_t;
1022 * Stucture to OPP/FTP server transfer information
1030 unsigned long file_size;
1032 bt_obex_server_type_t server_type;
1033 } bt_obex_server_transfer_info_t;
1036 * Stucture to OOB data
1040 unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
1041 unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
1042 unsigned int hash_len;
1043 unsigned int randomizer_len;
1047 * Structure to GATT attribute handle data
1053 } bt_gatt_handle_info_t;
1056 * Structure to GATT Remote service data
1063 bt_gatt_handle_info_t include_handles;
1064 bt_gatt_handle_info_t char_handle;
1065 } bt_gatt_service_property_t;
1068 * Structure to GATT Remote characteristic data
1072 char *service_handle;
1073 bt_gatt_handle_info_t handle_info;
1074 } bt_gatt_discovered_char_t;
1077 * Structure to format of GATT Characteristic Value
1081 unsigned char format;
1082 unsigned char exponent;
1083 unsigned short unit;
1084 unsigned char name_space;
1085 unsigned short description;
1086 } bt_gatt_char_format_t;
1089 * Structure to GATT Characteristic property
1097 bt_gatt_char_format_t format;
1099 unsigned int val_len;
1100 unsigned int permission;
1101 char *representation;
1102 bt_gatt_handle_info_t char_desc_handle;
1103 } bt_gatt_char_property_t;
1106 * Structure to GATT Characteristic descriptor property
1113 unsigned int val_len;
1114 } bt_gatt_char_descriptor_property_t;
1117 * Structure to GATT Characteristic value
1124 } bt_gatt_char_value_t;
1128 * Structure to RSSI Signal Strength Alert
1139 * Structure to RSSI Signal Strength
1149 * Structure for RSSI Enabled or Disabled
1155 gboolean rssi_enabled;
1156 } bt_rssi_enabled_t;
1159 * Structure for RSSI Threshold
1164 int in_range_threshold;
1166 } bt_rssi_threshold_t;
1169 * Structure for PBAP Folder Parameters
1172 unsigned char addressbook;
1173 unsigned char folder_type;
1177 * Structure for PBAP Pull application Parameters
1180 unsigned char format;
1181 unsigned char order;
1182 unsigned short offset;
1183 unsigned short maxlist;
1184 long long unsigned fields;
1185 } bt_pbap_pull_parameters_t;
1188 * Structure for PBAP List application Parameters
1191 unsigned char order;
1192 unsigned short offset;
1193 unsigned short maxlist;
1194 } bt_pbap_list_parameters_t;
1197 * Structure for PBAP Pull vCard application Parameters
1200 unsigned char format;
1201 long long unsigned fields;
1203 } bt_pbap_pull_vcard_parameters_t;
1206 * Structure for PBAP Search application Parameters
1209 unsigned char order;
1210 unsigned short offset;
1211 unsigned short maxlist;
1212 unsigned char search_attribute;
1213 char search_value[BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH];
1214 } bt_pbap_search_parameters_t;
1217 * Structure for PBAP Connection Status
1220 bluetooth_device_address_t btaddr;
1222 } bt_pbap_connected_t;
1225 * Structure for PBAP Phonebook Size
1228 bluetooth_device_address_t btaddr;
1230 } bt_pbap_phonebook_size_t;
1233 * Structure for PBAP Phonebook Pull
1236 bluetooth_device_address_t btaddr;
1239 } bt_pbap_phonebook_pull_t;
1242 * Structure for PBAP vCard List
1245 bluetooth_device_address_t btaddr;
1249 } bt_pbap_vcard_list_t;
1252 * Structure for PBAP vCard Pull
1255 bluetooth_device_address_t btaddr;
1258 } bt_pbap_vcard_pull_t;
1261 * Structure for PBAP Phonebook search List
1264 bluetooth_device_address_t btaddr;
1268 } bt_pbap_phonebook_search_list_t;
1271 * Stucture to HF Call status information
1275 char *number; /*Phone Number */
1276 int direction; /*Direction :Incoming(1), Outgoing(0)*/
1277 int status; /* Call Status :Active(0), Held(1), Waiting(5), Dailing(2)*/
1278 int mpart; /*Multiparty/conf call: Yes(1), No(0) */
1279 int idx; /*Call index/ID */
1280 } bt_hf_call_status_info_t;
1285 } bt_hf_call_list_s;
1288 * Callback pointer type
1290 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
1293 * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1294 * @brief Set the callback function pointer for bluetooth event
1297 * This API will register the callback function, when any response and event are received from
1298 * bluetooth framework. @n
1299 * this registered callback function will be get called with appropriate event and data structures.
1300 * This function is a synchronous call. An application developer can call
1301 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1302 * type. This registered function will receive events of bluetooth_event_type_t type along with
1306 * @param[in] callback_ptr A pointer to the callback function
1307 * @param[in] user_data A pointer to user data
1308 * @return BLUETOOTH_ERROR_NONE - Success
1312 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1314 GMainLoop *main_loop = (GMainLoop*) user_data;
1318 // Code for each event
1320 g_main_loop_quit(main_loop);
1327 GMainLoop *main_loop = NULL;
1330 main_loop = g_main_loop_new(NULL, FALSE);
1331 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1332 if (ret >= BLUETOOTH_ERROR_NONE)
1334 // bluetooth_register_callback returned Success
1338 // bluetooth_register_callback returned failiure
1340 g_main_loop_run(main_loop);
1344 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1347 * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1348 * @brief Set the callback function pointer for bluetooth le event
1351 * This API will register the callback function, when any response and event are received from
1352 * bluetooth framework. @n
1353 * this registered callback function will be get called with appropriate event and data structures.
1354 * This function is a synchronous call. An application developer can call
1355 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1356 * type. This registered function will receive events of bluetooth_event_type_t type along with
1360 * @param[in] callback_ptr A pointer to the callback function
1361 * @param[in] user_data A pointer to user data
1362 * @return BLUETOOTH_ERROR_NONE - Success
1366 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1369 * @fn int bluetooth_le_unregister_callback(void)
1370 * @brief Set the callback function pointer for bluetooth le event
1373 * This API will register the callback function, when any response and event are received from
1374 * bluetooth framework. @n
1375 * this registered callback function will be get called with appropriate event and data structures.
1376 * This function is a synchronous call. An application developer can call
1377 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1378 * type. This registered function will receive events of bluetooth_event_type_t type along with
1383 * @return BLUETOOTH_ERROR_NONE - Success
1387 int bluetooth_le_unregister_callback(void);
1390 * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
1391 * @brief Set the callback function pointer for bluetooth event
1394 * This API will register the callback function, when any response and event are received from
1395 * bluetooth framework. @n
1396 * this registered callback function will be get called with appropriate event and data structures.
1397 * This function is a synchronous call. An application developer can call
1398 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1399 * type. This registered function will receive events of bluetooth_event_type_t type along with
1404 * @return BLUETOOTH_ERROR_NONE - Success
1408 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1410 GMainLoop *main_loop = (GMainLoop*) user_data;
1414 // Code for each event
1416 g_main_loop_quit(main_loop);
1423 GMainLoop *main_loop = NULL;
1426 main_loop = g_main_loop_new(NULL, FALSE);
1427 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1428 if (ret >= BLUETOOTH_ERROR_NONE)
1430 // bluetooth_register_callback returned Success
1434 // bluetooth_register_callback returned failiure
1436 ret = bluetooth_deregister_callback(void);
1437 g_main_loop_run(main_loop);
1441 int bluetooth_unregister_callback(void);
1444 * @fn int bluetooth_enable_adapter(void)
1445 * @brief Enable the Bluetooth H/W
1448 * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
1449 * send request to bluetooth chip for activation.
1450 * This function is typically called at startup or when Bluetooth services are required. This
1451 * function must be called before calling any other API of Bluetooth operations.
1453 * Before performing any operations like Device discover, service search etc.., the adapter must be
1456 * This function is a asynchronous call.
1457 * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
1458 * through registered callback function with appropriate result code
1459 * BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
1460 * BLUETOOTH_ERROR_NONE - Success \n
1462 * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
1463 * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
1465 * @return BLUETOOTH_ERROR_NONE - Success\n
1466 * BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
1467 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1468 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1470 * @see bluetooth_check_adapter, bluetooth_disable_adapter
1472 void bt_event_callback(int event, bluetooth_event_param_t *param)
1476 case BLUETOOTH_EVENT_ENABLED:
1477 if (param->result == BLUETOOTH_ERROR_NONE)
1479 // Successfully Enabled
1492 ret = bluetooth_enable_adapter();
1496 int bluetooth_enable_adapter(void);
1499 * @fn int bluetooth_disable_adapter(void)
1500 * @brief Disable the Bluetooth H/W
1503 * This function disables Bluetooth protocol stack and hardware. This function is called when
1504 * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
1506 * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
1507 * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
1508 * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
1510 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1513 * This function is a asynchronous call.
1514 * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
1515 * through registered callback function.
1518 * @return BLUETOOTH_ERROR_NONE - Success\n
1519 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1520 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1521 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1523 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1525 void bt_event_callback(int event, bluetooth_event_param_t *param)
1529 case BLUETOOTH_EVENT_DISABLED:
1530 if (param->result == BLUETOOTH_ERROR_NONE)
1532 // Successfully disabled
1545 ret = bluetooth_disable_adapter();
1548 int bluetooth_disable_adapter(void);
1549 int bluetooth_recover_adapter(void);
1550 int bluetooth_check_adapter_le(void);
1551 int bluetooth_enable_adapter_le(void);
1553 int bluetooth_disable_adapter_le(void);
1556 * @fn int bluetooth_reset_adapter(void)
1557 * @brief Reset the Bluetooth H/W and values
1560 * This function resets Bluetooth protocol stack and hardware. This function is called when
1561 * an user want to initialize Bluetooth environment.
1563 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1566 * This function is a synchronous call.
1568 * @return BLUETOOTH_ERROR_NONE - Success\n
1569 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1571 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1576 ret = bluetooth_reset_adapter();
1579 int bluetooth_reset_adapter(void);
1582 * @fn int bluetooth_is_supported(void)
1583 * @brief Check if the bluetooth is supported or not by the current target
1585 * This API checks whether the bluetooth is supported or not.
1586 * This API only run by root permission.
1588 * This function is a synchronous call.
1590 * @return 0 - if bluetooth is not supported\n
1591 * 1 - if bluetooth is supported\n
1592 * BLUETOOTH_ERROR_INTERNAL - Error in API internal
1597 ret = bluetooth_is_supported();
1600 int bluetooth_is_supported(void);
1604 * @fn int bluetooth_check_adapter(void)
1605 * @brief Check the current status of the Bluetooth adapter
1608 * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1609 * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1610 * bluetooth adapter.
1611 * This API get the adapter internal data structure and check current adapter status.
1613 * This function is a synchronous call.
1616 * @return BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1617 * BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1619 * @see bluetooth_enable_adapter, bluetooth_disable_adapter
1623 ret = bluetooth_check_adapter();
1626 int bluetooth_check_adapter(void);
1629 * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1630 * @brief Get the local adapter bluetooth address
1633 * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1634 * the adapter should be enabled.
1635 * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1636 * contain Bluetooth address.
1637 * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1638 * friendly name for each device.
1639 * There is no event callback for this API.
1641 * This function is a synchronous call.
1644 * @return BLUETOOTH_ERROR_NONE - Succeess \n
1645 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
1646 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
1647 * @param[out] local_address a device address of local bluetooth adapter
1652 bluetooth_device_address_t local_address={0,};
1655 ret = bluetooth_get_local_address(&local_address);
1658 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1661 * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
1662 * @brief Get the hci version
1665 * This function is used to get the bluetooth hci version
1666 * Before calling this API make sure that the adapter is enabled.
1668 * This function is a synchronous call.
1671 * @return BLUETOOTH_ERROR_NONE - Success \n
1672 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1673 * @param[out] timeout remain visibility timeout value
1676 bluetooth_version_t *version;
1678 ret = bluetooth_get_local_version (&version);
1681 int bluetooth_get_local_version(bluetooth_version_t *version);
1684 * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1685 * @brief Get the local device name
1688 * This function is used, get the local device name. Since its difficult to remember the Adapter
1689 * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1690 * friendly name is retrived by the remote device and displaying.
1691 * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1693 * This function is a synchronous call.
1696 * @return BLUETOOTH_ERROR_NONE - Success \n
1697 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1698 * @param[out] local_name a local device name
1702 bluetooth_device_name_t local_name={0,}
1704 ret = bluetooth_get_local_name (&local_name);
1707 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1710 * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1711 * @brief Set the local device name
1714 * This function is used to set the local device name. This is a human friendly name whose
1715 * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1717 * This function is a synchronous call.
1719 * @param[in] local_name bluetooth device name to set local device
1721 * @return BLUETOOTH_ERROR_NONE - Success \n
1722 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1723 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1724 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1725 * BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1726 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1731 bluetooth_device_name_t local_name={0,}
1733 ret = bluetooth_set_local_name (&local_name);
1736 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1740 * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1741 * @brief Check if the uuid is used or not
1743 * This function is used to check if the uuid is used or not.
1745 * This function is a synchronous call.
1747 * @param[in] service_uuid service uuid (UUID 128 bit as string)
1748 * @param[out] used if the uuid is used or not
1750 * @return BLUETOOTH_ERROR_NONE - Success \n
1751 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1752 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1753 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1758 gboolean used = FALSE;
1759 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1760 ret = bluetooth_is_service_used(uuid, &used);
1763 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1766 * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1767 * @brief Check if the device is connected to the specific service
1769 * This function is used to check if if the device is connected to the specific service.
1771 * This function is a synchronous call.
1773 * @param[in] local_address a device address of remote bluetooth device
1774 * @param[in] type the service type
1775 * @param[out] is_connected if the device is connected or not
1777 * @return BLUETOOTH_ERROR_NONE - Success \n
1778 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1779 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1780 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1785 gboolean is_connected = FALSE;
1786 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
1787 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
1790 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
1791 bluetooth_service_type_t type,
1792 gboolean *is_connected);
1795 * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
1796 * @brief Get the visibility mode
1799 * This function is used to get the discoverable mode (Visibility option). Depending upon the
1800 * visibity mode, the property of the device is determined whether it can be discoverable, non
1801 * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
1803 * This function is a synchronous call.
1806 * @return BLUETOOTH_ERROR_NONE - Success \n
1807 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1808 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1809 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1810 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1811 * @param[out] discoverable_mode current bluetooth discoverable mode
1813 * @see bluetooth_set_discoverable_mode
1815 bluetooth_discoverable_mode_t discoverable_mode_ptr;
1817 ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
1820 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
1823 * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1825 * @brief Set the visibility mode
1828 * This function is used to set the discoverable mode (Visibility option).
1830 * Many times user may want to keep his device discoverable so that when peer device is performing
1831 * device search, he/she can find user's device. Application programmer can keep the mode as
1832 * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
1833 * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
1834 * modes cause bluetooth adapter to consume more battery. Hence developer should generally
1835 * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
1837 * This function is a synchronous call.
1839 * @return BLUETOOTH_ERROR_NONE - Success \n
1840 * BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
1842 * @param[in] discoverable_mode the bluetooth discoverable mode to set
1843 * @param[in] timeout discoverable time in only limited discoverable mode (second), default: 0
1845 * @see bluetooth_get_discoverable_mode
1849 bluetooth_discoverable_mode_t mode;
1851 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
1852 ret = bluetooth_set_discoverable_mode (mode, 180);
1856 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1861 * @fn int bluetooth_get_timeout_value(int *timeout)
1862 * @brief Get the visibility timeout value
1865 * This function is used to get the visibility timeout
1866 * Before calling this API make sure that the adapter is enabled.
1868 * This function is a synchronous call.
1871 * @return BLUETOOTH_ERROR_NONE - Success \n
1872 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1873 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1874 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1875 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1876 * @param[out] timeout remain visibility timeout value
1878 * @see bluetooth_set_discoverable_mode
1882 ret = bluetooth_get_timeout_value (&timeout);
1885 int bluetooth_get_timeout_value(int *timeout);
1889 * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
1890 * unsigned int classOfDeviceMask)
1891 * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
1893 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
1894 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
1895 * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
1896 * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
1897 * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
1898 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
1899 * You will receive device address, device name, device class, rssi (received signal strength indicator).
1900 * please see bluetooth_device_info_t for more details.
1903 * This API provides searching options like max responses, discovery duration in seconds and class
1904 * of device mask to filter device search. some times there may be too many bluetooth devices in
1905 * vicinity of your device.in such scenario, application can request to reduce number of responces
1906 * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
1907 * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
1908 * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
1909 * application defined time. please note that discovery_duration should be mentioned in seconds.
1910 * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
1913 * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
1914 * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
1915 * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
1917 * This function is a asynchronous call.
1918 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
1919 * through registered callback function.
1921 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
1922 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
1924 * The completion or cancellation of the discovery is indicated by an
1925 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
1927 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
1930 * @return BLUETOOTH_ERROR_NONE - Success \n
1931 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
1932 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
1933 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
1934 agent is not running \n
1936 * @param[in] max_response define the maximum response of the number of founded devices
1938 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
1939 * @param[in] classOfDeviceMask define classes of the device mask which user wants
1940 (refer to class of device)
1942 * @see bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
1945 void bt_event_callback(int event, bluetooth_event_param_t *param)
1949 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
1951 bluetooth_device_info_t *device_info = NULL;
1952 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
1954 device_info = (bluetooth_device_info_t *)param->param_data;
1955 memcpy(&searched_device, &device_info->device_address,
1956 sizeof(bluetooth_device_address_t));
1957 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
1958 device_info->device_address.addr[0],
1959 device_info->device_address.addr[1],
1960 device_info->device_address.addr[2],
1961 device_info->device_address.addr[3],
1962 device_info->device_address.addr[4],
1963 device_info->device_address.addr[5]);
1966 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
1968 bluetooth_device_info_t *device_info = NULL;
1969 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
1971 device_info = (bluetooth_device_info_t *)param->param_data;
1972 memcpy(&searched_device, &device_info->device_address,
1973 sizeof(bluetooth_device_address_t));
1974 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
1975 device_info->device_name.name,
1976 device_info->device_address.addr[0],
1977 device_info->device_address.addr[1],
1978 device_info->device_address.addr[2],
1979 device_info->device_address.addr[3],
1980 device_info->device_address.addr[4],
1981 device_info->device_address.addr[5]);
1985 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
1986 printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
1991 unsigned short max_response;
1992 unsigned short discovery_duration;
1993 unsigned classOfDeviceMask;
1997 discovery_duration =0;
1998 classOfDeviceMask =0;
2000 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
2005 int bluetooth_start_discovery(unsigned short max_response,
2006 unsigned short discovery_duration,
2007 unsigned int classOfDeviceMask);
2010 * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
2011 * unsigned short max_response,
2012 * unsigned short discovery_duration,
2013 * unsigned int classOfDeviceMask)
2014 * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
2016 * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
2017 * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
2018 * Please see bluetooth_start_discovery() for other parameters description.
2020 * This function is a asynchronous call.
2021 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2022 * through registered callback function.
2024 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2025 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2027 * The completion or cancellation of the discovery is indicated by an
2028 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2030 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2033 * @return BLUETOOTH_ERROR_NONE - Success \n
2034 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2035 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2036 * BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
2037 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2038 agent is not running \n
2040 * @param[in] role define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
2041 (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
2042 DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
2043 * @param[in] max_response define the maximum response of the number of founded devices
2045 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
2046 * @param[in] classOfDeviceMask define classes of the device mask which user wants
2047 (refer to class of device)
2049 * @see bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2052 unsigned short type;
2053 unsigned short max_response;
2054 unsigned short discovery_duration;
2055 unsigned classOfDeviceMask;
2060 discovery_duration =0;
2061 classOfDeviceMask =0;
2063 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
2068 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
2069 unsigned short max_response,
2070 unsigned short discovery_duration,
2071 unsigned int classOfDeviceMask);
2074 * @fn int bluetooth_cancel_discovery (void)
2075 * @brief Cancel the on-going device discovery operation
2078 * This function stops the on-going device discovery operation. This API has to be called after the
2079 * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
2080 * the bluetooth_start_discovery API
2082 * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
2083 * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
2084 * cancel the discover request once the user received the device to which he wish to connect.
2086 * This function is a asynchronous call.
2087 * If the call is success to cancel discovey then the application will receive
2088 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
2089 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2090 * BLUETOOTH_ERROR_NONE
2093 * @return BLUETOOTH_ERROR_NONE - Success \n
2094 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2095 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2096 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2097 other application \n
2098 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2100 * @see bluetooth_start_discovery
2102 void bt_event_callback(int event, bluetooth_event_param_t *param)
2106 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2107 TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2116 ret = bluetooth_cancel_discovery();
2119 int bluetooth_cancel_discovery(void);
2122 * @fn int bluetooth_start_le_discovery(void)
2123 * @brief Start the generic device discovery which finds the LE devices.
2125 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2126 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
2127 * It try to find LE devices. Bluetooth device address and name are
2128 * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
2129 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2130 * You will receive device address, device name, device class, rssi (received signal strength indicator).
2131 * please see bluetooth_device_info_t for more details.
2133 * This function is a asynchronous call.
2134 * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
2135 * through registered callback function.
2137 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
2140 * The completion or cancellation of the discovery is indicated by an
2141 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
2143 * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
2146 * @return BLUETOOTH_ERROR_NONE - Success \n
2147 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2148 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2149 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2150 agent is not running \n
2153 * @see bluetooth_stop_le_discovery, bluetooth_device_info_t
2156 void bt_event_callback(int event, bluetooth_event_param_t *param)
2160 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
2162 bluetooth_device_info_t *device_info = NULL;
2163 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2165 device_info = (bluetooth_device_info_t *)param->param_data;
2166 memcpy(&searched_device, &device_info->device_address,
2167 sizeof(bluetooth_device_address_t));
2168 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2169 device_info->device_address.addr[0],
2170 device_info->device_address.addr[1],
2171 device_info->device_address.addr[2],
2172 device_info->device_address.addr[3],
2173 device_info->device_address.addr[4],
2174 device_info->device_address.addr[5]);
2178 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2179 printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2185 ret = bluetooth_start_discovery();
2190 int bluetooth_start_le_discovery(void);
2193 * @fn int bluetooth_stop_le_discovery (void)
2194 * @brief Cancel the on-going device LE discovery operation
2197 * This function stops the on-going device discovery operation. This API has to be called after the
2198 * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
2199 * the bluetooth_start_le_discovery API
2202 * This function is a asynchronous call.
2203 * If the call is success to cancel discovey then the application will receive
2204 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
2205 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2206 * BLUETOOTH_ERROR_NONE
2209 * @return BLUETOOTH_ERROR_NONE - Success \n
2210 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2211 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2212 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2213 other application \n
2214 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2216 * @see bluetooth_start_discovery
2218 void bt_event_callback(int event, bluetooth_event_param_t *param)
2222 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2223 TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2232 ret = bluetooth_stop_le_discovery();
2235 int bluetooth_stop_le_discovery(void);
2238 * @fn int bluetooth_is_discovering(void)
2239 * @brief Check for the device discovery is in-progress or not.
2241 * This API is used to check the current status of the Discovery operation.If discovery is in\
2242 * progress normally other operations are not allowed.
2243 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2244 * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
2245 * event before performing other operations. This API is used to get for the current discovery
2246 * operation status and using bluetooth_cancel_discovery()
2247 * we can cancell the ongoing discovery process.
2248 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2251 * This function checks whether the device discovery is started or not.
2253 * This function is a synchronous call.
2256 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2257 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2258 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2261 * @see bluetooth_start_discovery, bluetooth_cancel_discovery
2265 ret = bluetooth_is_discovering ();
2268 int bluetooth_is_discovering(void);
2271 * @fn int bluetooth_is_le_discovering(void)
2272 * @brief Check for the device LE discovery is in-progress or not.
2274 * This API is used to check the current status of the LE Discovery operation.If discovery is in\
2275 * progress normally other operations are not allowed.
2276 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2277 * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
2278 * event before performing other operations. This API is used to get for the current discovery
2279 * operation status and using bluetooth_stop_le_discovery()
2280 * we can cancell the ongoing LE discovery process.
2281 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2284 * This function checks whether the device LE discovery is started or not.
2286 * This function is a synchronous call.
2289 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2290 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2291 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2294 * @see bluetooth_start_le_discovery, bluetooth_stop_le_discovery
2298 ret = bluetooth_is_le_discovering ();
2301 int bluetooth_is_le_discovering(void);
2304 * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2305 int link_type, bt_rssi_threshold_t rssi_threshold)
2306 * @brief Enable RSSI monitoring
2308 * This function enables RSSI monitoring and sets threshold for a connection
2310 * @return BLUETOOTH_ERROR_NONE - Success \n
2313 * @see bluetooth_get_rssi_strength
2315 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2316 int link_type, bt_rssi_threshold_t *rssi_threshold);
2319 * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
2320 * @brief Gets Raw RSSI signal Strength
2322 * This function gives the Raw RSSI signal strength for a connection.
2324 * @return BLUETOOTH_ERROR_NONE - Success \n
2327 * @see bluetooth_enable_rssi
2329 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
2331 int bluetooth_set_connectable(gboolean is_connectable);
2333 int bluetooth_is_connectable(gboolean *is_connectable);
2336 * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
2337 * @brief Initiate a bonding process
2340 * This function initiates a bonding procedure with a peer device. The bonding procedure
2341 * enables authentication and optionally encryption on the Bluetooth link.
2343 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2344 * inititate the bonding request to the devices already in the paired list.
2346 * Usually we call this API after the device discovery.
2347 * This function is a asynchronous call.
2349 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2350 * mentioed result code
2351 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2352 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2353 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2354 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2355 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2357 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2358 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2361 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2364 * @return BLUETOOTH_ERROR_NONE - Success \n
2365 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2366 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2367 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2368 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2370 * @param[in] device_address This indicates an address of the device with which the pairing
2371 * should be initiated
2373 * @see bluetooth_cancel_bonding
2375 void bt_event_callback(int event, bluetooth_event_param_t *param)
2379 case BLUETOOTH_EVENT_BONDING_FINISHED:
2381 TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
2382 if (param->result >= BLUETOOTH_ERROR_NONE)
2384 bluetooth_device_info_t *device_info = NULL;
2385 device_info = (bluetooth_device_info_t *)param->param_data;
2386 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
2387 mjr[%#x] min[%#x] srv[%#x]",
2388 device_info->device_name.name,
2389 device_info->device_address.addr[0],
2390 device_info->device_address.addr[1],
2391 device_info->device_address.addr[2],
2392 device_info->device_address.addr[3],
2393 device_info->device_address.addr[4],
2394 device_info->device_address.addr[5],
2395 device_info->device_class.major_class,
2396 device_info->device_class.minor_class,
2397 device_info->device_class.service_class);
2411 bluetooth_device_address_t device_address={{0}};
2413 ret = bluetooth_bond_device(&device_address);
2417 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
2420 * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2421 * bluetooth_conn_type_t conn_type)
2422 * @brief Initiate a bonding process
2425 * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
2426 * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
2428 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2429 * inititate the bonding request to the devices already in the paired list.
2431 * Usually we call this API after the device discovery.
2432 * This function is a asynchronous call.
2434 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2435 * mentioed result code
2436 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2437 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2438 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2439 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2440 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2442 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2443 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2446 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2449 * @return BLUETOOTH_ERROR_NONE - Success \n
2450 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2451 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2452 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2453 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2455 * @param[in] device_address This indicates an address of the device with which pairing
2456 * should be initiated
2457 * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
2460 * @see bluetooth_cancel_bonding
2462 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2463 bluetooth_conn_type_t conn_type);
2466 * @fn int bluetooth_cancel_bonding(void)
2467 * @brief Cancel the on-going bonding process
2469 * This API is called to cancel the on-going bonding procedure. It should be called before the
2470 * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
2471 * This API is useful when the remote device is not responding to the bond request or we wish to
2472 * cancel the bonding request. In this case we need not wait for the timeout to happen.
2474 * This function is a synchronous call.
2476 * @return BLUETOOTH_ERROR_NONE - Success \n
2477 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
2478 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2481 * @see bluetooth_bond_device
2487 ret = bluetooth_cancel_bonding();
2490 int bluetooth_cancel_bonding(void);
2493 * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
2494 * @brief Remove bonding
2497 * To communicate with remote device over bluetooth link, user should bond with peer device.
2498 * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
2499 * API is used to remove peer device from the list. Please note that after removing the device
2500 * from bonded device list, you cannot communication with peer device until bonding happens again.
2502 * User can call this function by passing bluetooth device address of any bonded device. Please note
2503 * that after successful return of this function, any bluetooth application running on your device
2504 * will not be able to communicate with unbonded device until bond operation happens again using
2505 * bluetooth_bond_device()
2508 * This function is a asynchronous call. The request to remove the specified device from the bonded
2509 * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
2510 * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
2511 * in case if there is a problem in locating given bluetooth device address in bonded devices list
2515 * @return BLUETOOTH_ERROR_NONE - Success \n
2516 * BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
2517 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2518 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2519 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2520 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2521 * agent is not running \n
2522 * BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
2525 * @param[in] device_address This indicates an address of the device to remove bonding
2529 * @see bluetooth_bond_device, bluetooth_cancel_bonding
2532 void bt_event_callback(int event, bluetooth_event_param_t *param)
2535 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
2536 bluetooth_device_address_t *dev_addr = NULL;
2538 if (param->result == BLUETOOTH_ERROR_NONE) {
2539 dev_addr = (bluetooth_device_address_t *)param->param_data;
2541 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2542 dev_addr->addr[0], dev_addr->addr[1]
2543 dev_addr->addr[2], dev_addr->addr[3]
2544 dev_addr->addr[4], dev_addr->addr[5]
2555 bluetooth_device_address_t *device_address;
2557 // copy valid device address in device_address
2559 ret = bluetooth_unbond_device(device_address);
2562 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
2565 * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
2566 * @brief Get bonded(paired) device list
2569 * This API gets all bonded device list.
2570 * The devices in the bonded device list further can be used to perform the authorization by calling
2571 * bluetooth_authorize_device API.
2573 * This function is a synchronous call.
2574 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2575 * there is no valid information in the dev_list.
2576 * The len field in the dev_list represents the number of bonded devices. The data structure for
2577 * bonded device information is bluetooth_device_info_t.
2580 * @return BLUETOOTH_ERROR_NONE - Success \n
2581 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2583 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2585 void bt_get_bonded_devices(void)
2589 GPtrArray *devinfo = NULL;
2590 bluetooth_device_info_t *ptr;
2592 // allocate the g_pointer_array
2593 devinfo = g_ptr_array_new();
2595 ret = bluetooth_get_bonded_device_list(&devinfo);
2596 if (ret != BLUETOOTH_ERROR_NONE)
2598 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
2602 printf("g pointer arrary count : [%d]", devinfo->len);
2603 for (i=0; i<devinfo->len; i++)
2605 ptr = g_ptr_array_index(devinfo, i);
2608 printf("Name [%s]\n", ptr->device_name.name);
2609 printf("Major Class [%d]\n", ptr->device_class.major_class);
2610 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
2611 printf("Service Class [%d]\n", ptr->device_class.service_class);
2612 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2613 ptr->device_address.addr[0],
2614 ptr->device_address.addr[1], ptr->device_address.addr[2],
2615 ptr->device_address.addr[3],
2616 ptr->device_address.addr[4], ptr->device_address.addr[5]);
2623 // free g_pointer_array
2624 g_ptr_array_free(devinfo, TRUE);
2629 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
2632 * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2633 * bluetooth_device_info_t *dev_info)
2634 * @brief Get a bonded(paired) device
2637 * This API gets a bonded device.
2639 * This function is a synchronous call.
2640 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2641 * there is no valid information in the dev_info.
2642 * The data structure for bonded device information is bluetooth_device_info_t.
2645 * @return BLUETOOTH_ERROR_NONE - Success \n
2646 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2648 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2650 void bt_get_bonded_device(void)
2654 bluetooth_device_info_t devinfo = {0};
2655 bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
2657 ret = bluetooth_get_bonded_device(&device_address, &devinfo);
2658 if (ret != BLUETOOTH_ERROR_NONE)
2660 printf("bluetooth_get_bonded_device failed with [%d]",ret);
2664 printf("Name [%s]\n", devinfo.device_name.name);
2665 printf("Major Class [%d]\n", devinfo.device_class.major_class);
2666 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
2667 printf("Service Class [%d]\n", devinfo.device_class.service_class);
2668 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
2669 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
2670 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
2671 devinfo.device_address.addr[5]);
2680 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2681 bluetooth_device_info_t *dev_info);
2684 * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
2685 * @brief set alias for bonded device
2688 * This function set alias for bonded device.
2690 * This function is a synchronous call.
2693 * @return BLUETOOTH_ERROR_NONE - Success \n
2694 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2695 * @param[in] device_address This indicates an address of the remote device
2696 * @param[in] alias This indicates an alias to set
2701 ret = bluetooth_set_alias(&remote_address);
2704 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
2708 * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
2709 * @brief Get remote deivice
2712 * This function gets specific remote device.
2714 * This function is a asynchronous call.
2715 * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
2718 * @return BLUETOOTH_ERROR_NONE - Success \n
2719 * BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
2720 * @param[in] device_address This indicates an address of the remote device
2725 ret = bluetooth_get_remote_device(&remote_address);
2728 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
2731 * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
2732 * gboolean authorized)
2733 * @brief Authorize/Unauthorize a bonded device
2736 * This function authorizes/unauthorize a bonded device. It decides the device to connect
2737 * with/without user confirmation.
2739 * If we select a paired device and make it authorized by calling this API with the authorized
2740 * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
2741 * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
2742 * then it will ask for the user conformation before the connection.
2744 * This API supposed to be called on the paired devices. Which means we have to use this API only
2745 * after successful pairing.
2747 * This function is a asynchronous call.
2748 * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
2750 * @return BLUETOOTH_ERROR_NONE - Success \n
2751 * @exception BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
2752 * @param[in] device_address This indicates an address of the device to authorize \n
2753 * @param[in] authorized TRUE : authorize FALSE: unauthorize
2755 * @see bluetooth_get_bonded_device_list
2757 void bt_event_callback(int event, bluetooth_event_param_t *param)
2761 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
2763 if (param->result == BLUETOOTH_ERROR_NONE)
2767 //device authorization failed failure
2775 bluetooth_device_address_t device_address={{0}};
2776 gboolean authorized;
2780 ret = bluetooth_authorize_device(&device_address,authorized);
2783 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
2784 gboolean authorized);
2787 * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
2788 * @brief Get all services supported by remote device
2791 * This API call initiates the search for the services supported by the specified device. Normally
2792 * the service search will take a couple of seconds to get it completed. Before calling this API
2793 * make sure that the Adapter is enabled. We have to give the device address of the remote device to
2794 * perform the service search. We can get the device address by doing a device discovery operation.
2797 * This function is a asynchronous call.
2798 * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
2800 * There is a timeout associated with the service search. The default time out is 40 seconds. If the
2801 * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
2802 * event is generated with appropriate result code.
2804 * @return BLUETOOTH_ERROR_NONE - Success \n
2805 * BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
2806 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2807 * @param[in] device_address This indicates an address of the device
2808 * whose services need to be found
2810 * @see bluetooth_cancel_service_search
2812 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
2815 * @fn int bluetooth_cancel_service_search(void)
2816 * @brief Cancel the ongoing service search operation
2819 * This function cancel the ongoing service search operation. This API is usually calling after the
2820 * bluetooth_search_service API.
2821 * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
2822 * if the user wish to cancel the Ongoing service search operation.
2824 * This API should be called just after the bluetooth_search_service API and before the
2825 * BLUETOOTH_EVENT_SERVICE_SEARCHED event
2827 * This function is a synchronous call.
2829 * @return BLUETOOTH_ERROR_NONE - Success \n
2830 * BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
2831 * BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
2832 * BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
2835 * @see bluetooth_search_service
2840 ret = bluetooth_cancel_service_search();
2843 int bluetooth_cancel_service_search(void);
2846 * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
2847 * @brief Register rfcomm socket with a specific uuid
2850 * This API register rfcomm socket with the given UUID. The return value of this API is the socket
2851 * descriptor of the server.
2852 * This is the first API which is called to create the server. Once we created the server socket,
2853 * we will listen on that return socket.
2854 * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
2857 * @return socket FD on Success \n
2858 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2859 * BLUETOOTH_ERROR_INTERNAL - Internal error\n
2860 * BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
2861 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2862 * @param[in] UUID (128 bits)
2865 * @see bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
2869 const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
2870 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2874 int bluetooth_rfcomm_create_socket(const char *uuid);
2877 * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
2878 * @brief De-register the rfcomm socket
2881 * This API deregister rfcomm socket with the given socket fd and UUID. If the remote device is
2882 * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
2883 * descriptor else no event will come. We will call this API only after the
2884 * bluetooth_rfcomm_listen_and_accept.
2885 * This is a synchronous call.
2887 * @return BLUETOOTH_ERROR_NONE - Success \n
2888 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
2889 * BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
2890 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2891 * @param[in] int socket_fd
2894 * @see bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
2897 void bt_event_callback(int event, bluetooth_event_param_t *param)
2901 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
2903 bluetooth_rfcomm_connection_t *discon_ind =
2904 (bluetooth_rfcomm_connection_t *)param->param_data;
2906 printf("\nDisconnected from FD %d", discon_ind->socket_fd);
2914 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2915 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
2917 ret = bluetooth_rfcomm_remove_socket(fd);
2920 int bluetooth_rfcomm_remove_socket(int socket_fd);
2923 * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
2924 * @brief Disconnect rfcomm connection
2927 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
2928 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
2931 * @return BLUETOOTH_ERROR_NONE - Success \n
2932 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2933 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
2934 * @param[in] int socket_fd the sending socket fd
2940 ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
2942 printf("Disconnection failed");
2944 printf("Disconnection Success");
2948 int bluetooth_rfcomm_server_disconnect(int socket_fd);
2951 * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
2952 * @brief Rfcomm socket listen
2955 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
2956 * after the bluetooth_rfcomm_create_socket API.
2957 * This API listen for the incomming connection and once it receives a connection, it will give
2958 * BLUETOOTH_EVENT_RFCOMM_CONNECTED
2959 * event to the application. This is an Asynchronous API call.
2962 * @return BLUETOOTH_ERROR_NONE - Success \n
2963 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2964 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
2966 * @param[in] int socket_fd
2967 * @param[in] max pending connection.
2970 * @see bluetooth_rfcomm_create_socket
2973 void bt_event_callback(int event, bluetooth_event_param_t* param)
2977 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
2979 bluetooth_rfcomm_connection_t *conn_ind =
2980 (bluetooth_rfcomm_connection_t *)param->param_data;
2982 printf("\nConnected from FD %d", conn_ind->socket_fd);
2990 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
2991 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
2995 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
2998 * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
2999 * @brief Rfcomm socket listen
3002 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3003 * after the bluetooth_rfcomm_create_socket API.
3004 * This API listen for the incomming connection and once it receives a connection, it will give
3005 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
3006 * event to the application. This is an Asynchronous API call.
3009 * @return BLUETOOTH_ERROR_NONE - Success \n
3010 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3011 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3013 * @param[in] int socket_fd
3014 * @param[in] max pending connection.
3017 * @see bluetooth_rfcomm_create_socket
3020 void bt_event_callback(int event, bluetooth_event_param_t* param)
3024 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
3026 char *name = (char *)param->param_data;
3028 printf("\nConnected from %s", name);
3030 bluetooth_rfcomm_accept_connection();
3038 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3039 ret = bluetooth_rfcomm_listen(fd, 1);
3043 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
3046 * @fn int bluetooth_rfcomm_accept_connection()
3047 * @brief Accepts the authorization request indicated by the event
3048 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3050 * This function is a synchronous call.
3052 * @return BLUETOOTH_ERROR_NONE - Success \n
3053 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3055 * @param[in] the socket fd of the server
3056 * @param[out] the socket fd of the client
3060 * @see bluetooth_rfcomm_reject_connection
3062 int bluetooth_rfcomm_accept_connection(int server_fd);
3065 * @fn int bluetooth_rfcomm_reject_connection()
3066 * @brief Rejects the authorization request indicated by the event
3067 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3069 * This function is a synchronous call.
3071 * @return BLUETOOTH_ERROR_NONE - Success \n
3072 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3074 * @param[in] the socket fd of the server
3078 * @see bluetooth_rfcomm_accept_connection
3080 int bluetooth_rfcomm_reject_connection(int server_fd);
3083 * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
3084 * @brief Informs whether rfcomm server uuid is available or not.
3086 * This function is a synchronous call.
3088 * @return TRUE - RFCOMM uuid is available \n
3089 * FALSE - RFCOMM uuid is not available \n
3091 * @param[in] uuid UUID string
3097 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
3100 * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3101 * const char *remote_uuid)
3102 * @brief Connect to the remote device rfcomm *
3104 * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
3105 * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
3106 * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
3107 * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
3108 * initiating a connection.
3110 * @return BLUETOOTH_ERROR_NONE - Success \n
3111 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3112 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3113 * BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
3114 * BLUETOOTH_ERROR_INTERNAL - Internal Error\n
3115 * @param[in] bluetooth_device_address_t remote bt_address
3116 * @param[in] char remote uuid
3118 * @see bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
3122 void bt_event_callback(int event, bluetooth_event_param_t *param)
3126 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
3128 if (param->result >= BLUETOOTH_ERROR_NONE)
3130 bt_sdp_info_t *bt_sdp_info=param->param_data;
3132 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3133 bt_sdp_info->device_addr.addr[0],
3134 bt_sdp_info->device_addr.addr[1],
3135 bt_sdp_info->device_addr.addr[2],
3136 bt_sdp_info->device_addr.addr[3],
3137 bt_sdp_info->device_addr.addr[4],
3138 bt_sdp_info->device_addr.addr[5]);
3140 printf("Supported service list:\n");
3141 for(i=0; i<bt_sdp_info->service_index; i++)
3143 bt_sdp_info->service_list_array[i]);
3146 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
3147 //rfcomm_test_uuid);
3151 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3153 bluetooth_rfcomm_connection_t *conn_ind =
3154 (bluetooth_rfcomm_connection_t *)param->param_data;
3156 printf("\nConnected from FD %d, Role = %s", conn_ind->socket_fd,
3157 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
3158 "SERVER" : "CLIENT");
3163 bluetooth_device_address_t remote_address = {{0},};
3164 remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
3165 remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19; remote_address.addr[5]= 0x36;
3166 ret = bluetooth_search_service(&remote_address);
3168 printf("Seach failed, Reason = %d", ret);
3170 printf("Search Success, Ret = %d", ret);
3172 ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
3174 printf("Connection failed, Reason = %d", ret);
3176 printf("Connection Success, Ret = %d", ret);
3180 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3181 const char *remote_uuid);
3184 * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
3185 * @brief Disconnect rfcomm connection
3188 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
3189 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3192 * @return BLUETOOTH_ERROR_NONE - Success \n
3193 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3194 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3195 * @param[in] char remote bt_address
3198 * @see bluetooth_rfcomm_connect
3202 ret = bluetooth_rfcomm_disconnect(g_ret_fd);
3204 printf("Disconnection failed");
3206 printf("Disconnection Success");
3211 int bluetooth_rfcomm_disconnect(int socket_fd);
3214 * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
3215 * @brief Write to rfcomm connection
3218 * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
3219 * API is used to send the data for server and the client.
3221 * @return BLUETOOTH_ERROR_NONE - Success \n
3222 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3223 * BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
3225 * @param[in] const char *buff Data buffer to send
3226 * @param[in] int length Length of the data
3229 * @see bluetooth_rfcomm_connect
3232 char *buff = "Test data 123456789"
3233 ret = bluetooth_rfcomm_write(g_ret_fd, buff, 15);
3235 printf("Send failed");
3237 printf("Send success");
3241 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
3244 * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
3245 * @brief Informs whether rfcomm client is connected.
3247 * This function is a synchronous call.
3249 * @return TRUE - RFCOMM client is connected \n
3250 * FALSE - RFCOMM client is not connected \n
3256 gboolean bluetooth_rfcomm_is_client_connected(void);
3257 int bluetooth_rfcomm_client_is_connected(bluetooth_device_address_t *device_address, gboolean *connected);
3258 int bluetooth_rfcomm_server_is_connected(bluetooth_device_address_t *device_address, gboolean *connected);
3261 * @fn int bluetooth_network_activate_server(void)
3262 * @brief Activate the NAP (Network Access Point) service
3264 * This function is a asynchronous call.
3265 * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
3267 * @return BLUETOOTH_ERROR_NONE - Success \n
3268 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3269 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3270 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3273 * @see bluetooth_network_deactivate_server
3276 int bluetooth_network_activate_server(void);
3279 * @fn int bluetooth_network_deactivate_server(void)
3280 * @brief Deactivate the NAP (Network Access Point) service
3282 * This function is a asynchronous call.
3283 * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
3285 * @return BLUETOOTH_ERROR_NONE - Success \n
3286 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3287 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3288 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3291 * @see bluetooth_network_activate_server
3294 int bluetooth_network_deactivate_server(void);
3297 * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3298 * bluetooth_network_role_t role,
3300 * @brief Connect the network server in the peer
3302 * This function is a asynchronous call.
3303 * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3305 * @return BLUETOOTH_ERROR_NONE - Success \n
3306 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3307 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3308 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3311 * @param[in] device_address This indicates an address of the device with which the pairing
3312 * should be initiated
3313 * @param[in] role The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
3314 * need to use the third parameter.
3315 * @param[in] custom_uuid If use the CUSTOM value in second parameter, use this parameter to
3316 * connect. UUID string
3318 * @see bluetooth_network_disconnect
3320 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3321 bluetooth_network_role_t role, char *custom_uuid);
3324 * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
3325 * bluetooth_network_role_t role,
3326 * char *custom_uuid)
3327 * @brief Connect the network server in the peer
3329 * This function is a asynchronous call.
3330 * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3332 * @return BLUETOOTH_ERROR_NONE - Success \n
3333 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3334 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3335 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3338 * @param[in] device_address This indicates an address of the device with which the pairing
3339 * should be initiated
3341 * @see bluetooth_network_connect
3343 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
3346 * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
3347 * @brief Disconnect the device from the network
3349 * This function is an asynchronous call.
3350 * The network server disconnect request is responded by
3351 * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
3353 * @return BLUETOOTH_ERROR_NONE - Success \n
3354 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3355 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3356 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3359 * @param[in] device_address This indicates an address of the connected client device
3361 * @see bluetooth_network_activate_server
3363 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
3368 * @fn int bluetooth_hdp_activate(unsigned short data_type,
3369 * bt_hdp_role_type_t role,
3370 * bt_hdp_qos_type_t channel_type,
3371 * char **app_handle)
3372 * @brief Activate the HDP service for a particular data type
3374 * This function is a synchronous call.
3376 * @return BLUETOOTH_ERROR_NONE - Success \n
3377 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3378 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3379 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3382 * @param[in] data_type The data type against corresponding service
3383 * @param[in] role The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
3384 * @param[in] channel_type The QOS type for the channel.
3385 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
3386 * For role = HDP_ROLE_SINK, the channel_type
3387 * should be HDP_QOS_ANY.
3388 * @param[out] app_handle The application handler against corresponding service
3390 * @see bluetooth_hdp_deactivate
3392 int bluetooth_hdp_activate(unsigned short data_type,
3393 bt_hdp_role_type_t role,
3394 bt_hdp_qos_type_t channel_type,
3397 * @fn int bluetooth_hdp_deactivate(const char *app_handle)
3398 * @brief Deactivate the HDP service for a particular service using the handler
3400 * This function is a synchronous call.
3402 * @return BLUETOOTH_ERROR_NONE - Success \n
3403 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3404 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3405 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3408 * @param[in] app_handle The application handler against corresponding service
3410 * @see bluetooth_hdp_deactivate
3412 int bluetooth_hdp_deactivate(const char *app_handle);
3415 * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
3416 * const char *buffer, unsigned int size)
3417 * @brief Send data to the remote HDP device
3419 * This function is a synchronous call.
3421 * @return BLUETOOTH_ERROR_NONE - Success \n
3422 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3423 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3424 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3425 * BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid \n
3428 * @param[in] channel_id The channel id for the connection.
3429 * @param[in] buffer The pdu buffer.
3430 * @param[in] size Size of the buffer.
3432 * @see bluetooth_hdp_connect
3434 int bluetooth_hdp_send_data(unsigned int channel_id,
3435 const char *buffer, unsigned int size);
3437 * @fn int bluetooth_hdp_connect(const char *app_handle,
3438 * bt_hdp_qos_type_t channel_type,
3439 * const bluetooth_device_address_t *device_address)
3440 * @brief Connect to the remote device(Mainly used by source)
3442 * This function is a asynchronous call.
3443 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
3445 * @return BLUETOOTH_ERROR_NONE - Success \n
3446 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3447 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3448 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3449 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3452 * @param[in] app_handle The application handler against corresponding service
3453 * @param[in] channel_type The QOS type for the channel.
3454 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
3455 * @param[in] device_address The remote device Bd address.
3458 * @see bluetooth_hdp_disconnect
3460 int bluetooth_hdp_connect(const char *app_handle,
3461 bt_hdp_qos_type_t channel_type,
3462 const bluetooth_device_address_t *device_address);
3464 * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
3465 * const bluetooth_device_address_t *device_address)
3466 * @brief Disconnect from the remote device(Mainly used by source)
3468 * This function is a asynchronous call.
3469 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
3471 * @return BLUETOOTH_ERROR_NONE - Success \n
3472 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3473 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3474 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3475 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3478 * @param[in] channel_id The channel id for the connection.
3479 * @param[in] device_address The remote device Bd address.
3482 * @see bluetooth_hdp_connect
3484 int bluetooth_hdp_disconnect(unsigned int channel_id,
3485 const bluetooth_device_address_t *device_address);
3489 * @fn int bluetooth_opc_init(void)
3490 * @brief Initialize OPP client.
3492 * This function is a synchronous call.
3493 * No event corresponding to this api
3495 * @return BLUETOOTH_ERROR_NONE - Success \n
3496 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3497 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3498 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3499 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3504 * @see bluetooth_opc_deinit
3506 int bluetooth_opc_init(void);
3509 * @fn int bluetooth_opc_deinit(void)
3510 * @brief Deinitialize OPP client.
3512 * This function is a synchronous call.
3513 * No event corresponding to this api
3515 * @return BLUETOOTH_ERROR_NONE - Success \n
3516 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3517 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3522 * @see bluetooth_opc_init
3525 int bluetooth_opc_deinit(void);
3528 * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
3529 char **file_name_array)
3530 * @brief Send multiple files to a remote device.
3532 * This function is a asynchronous call.
3533 * This api is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
3535 * @return BLUETOOTH_ERROR_NONE - Success \n
3536 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3537 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3538 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3539 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3540 * BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
3543 * @param[in] device_address The remote device Bd address.
3544 * @param[in] file_name_array Array of filepaths to be sent.
3547 * @see bluetooth_opc_cancel_push
3550 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
3551 char **file_name_array);
3554 * @fn int bluetooth_opc_cancel_push(void)
3555 * @brief Cancels the ongoing file push.
3557 * This function is a asynchronous call.
3558 * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
3559 * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
3561 * @return BLUETOOTH_ERROR_NONE - Success \n
3562 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3563 * BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
3568 * @see bluetooth_opc_push_files
3571 int bluetooth_opc_cancel_push(void);
3574 * @fn gboolean bluetooth_opc_session_is_exist(void)
3575 * @brief Informs whether opc session exists or not.
3577 * This function is a synchronous call.
3579 * @return TRUE - OPC session exists \n
3580 * FALSE - OPC session does not exist \n
3588 gboolean bluetooth_opc_session_is_exist(void);
3591 * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
3592 * @brief Informs whether opc session exists or not.
3594 * This function is a synchronous call.
3596 * @return BLUETOOTH_ERROR_NONE - Success \n
3597 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3598 * BLUETOOTH_ERROR_INTERNAL \n
3601 * @param[out] is_sending The sending status: (@c TRUE = in sending , @c false = not in sending)
3606 int bluetooth_opc_is_sending(gboolean *is_sending);
3609 * @fn int bluetooth_obex_server_init(const char *dst_path)
3610 * @brief Initialize OPP and FTP server.
3612 * This function is a synchronous call.
3613 * No event corresponding to this api
3615 * @return BLUETOOTH_ERROR_NONE - Success \n
3616 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3617 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3618 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
3619 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3622 * @param[in] dst_path OPS destination file path.
3624 * @see bluetooth_obex_server_deinit
3626 int bluetooth_obex_server_init(const char *dst_path);
3630 * @fn int bluetooth_obex_server_deinit(void)
3631 * @brief Deinitialize OPP and FTP server.
3633 * This function is a synchronous call.
3634 * No event corresponding to this api
3636 * @return BLUETOOTH_ERROR_NONE - Success \n
3637 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3638 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3643 * @see bluetooth_obex_server_init
3645 int bluetooth_obex_server_deinit(void);
3649 * @fn gboolean bluetooth_obex_server_is_activated(void)
3650 * @brief Informs whether obex server is activated or not.
3652 * This function is a synchronous call.
3654 * @return TRUE - OBEX server is activated \n
3655 * FALSE - OBEX server is not activated \n
3662 gboolean bluetooth_obex_server_is_activated(void);
3666 * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
3667 * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
3669 * This function is a synchronous call.
3670 * No event corresponding to this api
3672 * @return BLUETOOTH_ERROR_NONE - Success \n
3673 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3674 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3675 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
3676 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3680 * @param[in] dst_path OPS destination file path.
3682 * @see bluetooth_obex_server_deinit_without_agent
3684 int bluetooth_obex_server_init_without_agent(const char *dst_path);
3688 * @fn int bluetooth_obex_server_deinit_without_agent(void)
3689 * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
3691 * This function is a synchronous call.
3692 * No event corresponding to this api
3694 * @return BLUETOOTH_ERROR_NONE - Success \n
3695 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3696 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3701 * @see bluetooth_obex_server_init_without_agent
3703 int bluetooth_obex_server_deinit_without_agent(void);
3707 * @fn int bluetooth_obex_server_accept_connection(void)
3708 * @brief Accepts the authorization request indicated by the event
3709 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
3711 * This function is a synchronous call.
3713 * @return BLUETOOTH_ERROR_NONE - Success \n
3714 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3715 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3719 * @see bluetooth_obex_server_reject_authorize
3721 int bluetooth_obex_server_accept_connection(void);
3725 * @fn int bluetooth_obex_server_reject_connection(void)
3726 * @brief Rejects the authorization request indicated by the event
3727 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
3729 * This function is a synchronous call.
3731 * @return BLUETOOTH_ERROR_NONE - Success \n
3732 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3733 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3737 * @see bluetooth_obex_server_reject_authorize
3739 int bluetooth_obex_server_reject_connection(void);
3743 * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
3744 * @brief Accepts the authorization request indicated by the event
3745 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
3747 * This function is a asynchronous call.
3748 * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
3750 * @return BLUETOOTH_ERROR_NONE - Success \n
3751 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3752 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3753 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3756 * @param[in] filename Authorized filename.
3759 * @see bluetooth_obex_server_reject_authorize
3762 int bluetooth_obex_server_accept_authorize(const char *filename);
3765 * @fn int bluetooth_obex_server_reject_authorize(void)
3766 * @brief Reject the authorization request indicated by the event
3767 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
3769 * This function is a asynchronous call.
3770 * No event for this api..
3772 * @return BLUETOOTH_ERROR_NONE - Success \n
3773 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3774 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3779 * @see bluetooth_obex_server_accept_authorize
3782 int bluetooth_obex_server_reject_authorize(void);
3785 * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
3786 * @brief Set the OPS destination file path..
3788 * This function is a asynchronous call.
3789 * No event for this api..
3791 * @return BLUETOOTH_ERROR_NONE - Success \n
3792 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3793 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3794 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
3797 * @param[in] dst_path OPS destination file path.
3803 int bluetooth_obex_server_set_destination_path(const char *dst_path);
3806 * @fn int bluetooth_obex_server_set_root(const char *root)
3807 * @brief Set the FTS root folder..
3809 * This function is a asynchronous call.
3810 * No event for this api..
3812 * @return BLUETOOTH_ERROR_NONE - Success \n
3813 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3814 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3815 * BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
3816 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3817 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3820 * @param[in] root FTS root folder.
3826 int bluetooth_obex_server_set_root(const char *root);
3829 * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
3830 * @brief Cancel the transfer on server
3832 * This function is an asynchronous call.
3833 * If the function call that cancels transfer is successful, the application would receive
3834 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
3835 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
3836 * the error code will be BLUETOOTH_ERROR_NONE
3838 * @return BLUETOOTH_ERROR_NONE - Success \n
3839 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3840 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3841 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
3842 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
3845 * @param[in] transfer_id transfer ID
3850 int bluetooth_obex_server_cancel_transfer(int transfer_id);
3854 * @fn int bluetooth_obex_server_cancel_all_transfers(void)
3855 * @brief Cancel the transfer on server
3857 * This function is an asynchronous call.
3858 * If the function call that cancels transfer is successful, the application would receive
3859 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
3860 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
3861 * the error code will be BLUETOOTH_ERROR_NONE
3863 * @return BLUETOOTH_ERROR_NONE - Success \n
3864 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3865 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3866 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
3867 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
3874 int bluetooth_obex_server_cancel_all_transfers(void);
3878 * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
3879 * @brief Informs whether obex server is receiving or not.
3881 * This function is a synchronous call.
3883 * @return BLUETOOTH_ERROR_NONE - Success \n
3884 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3885 * BLUETOOTH_ERROR_INTERNAL \n
3888 * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c false = not in receiving)
3893 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
3897 * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
3898 * @brief Read the local Hash and Randmizer.
3900 * This function is a synchronous call.
3902 * @return BLUETOOTH_ERROR_NONE - Success \n
3903 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3907 * @param[out] local_oob_data - Pointer to the local OOB data
3913 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
3917 * @fn int bluetooth_oob_add_remote_data(
3918 * const bluetooth_device_address_t *remote_device_address,
3919 * bt_oob_data_t *oob_data)
3920 * @brief Add/updated the remote device Hash and Randmizer.
3922 * This function is a synchronous call.
3923 * No event for this api..
3925 * @return BLUETOOTH_ERROR_NONE - Success \n
3926 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3929 * @param[in] remote_device_address - Remote device address
3930 * remote_oob_data - Ponter to Hash and Randomizer oob data structure
3936 int bluetooth_oob_add_remote_data(
3937 const bluetooth_device_address_t *remote_device_address,
3938 bt_oob_data_t *remote_oob_data);
3942 * @fn int bluetooth_oob_remove_remote_data(
3943 * const bluetooth_device_address_t *remote_device_address)
3944 * @brief Delete the Hash and Randomizer w.r.t the remote device address.
3946 * This function is a synchronous call.
3947 * No event for this api..
3949 * @return BLUETOOTH_ERROR_NONE - Success \n
3950 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3953 * @param[in] remote_device_address - Remote device address
3959 int bluetooth_oob_remove_remote_data(
3960 const bluetooth_device_address_t *remote_device_address);
3963 * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
3964 * bt_gatt_handle_info_t *prim_svc);
3966 * @brief Gets the GATT based primary services handle supported by remote device
3968 * This function is a synchronous call.
3969 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
3971 * @return BLUETOOTH_ERROR_NONE - Success \n
3972 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3973 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3974 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
3977 * @param[in] address - Remote device address
3978 * @param[out] prim_svc - Structure containing remote service count and handle list.
3981 * @see bluetooth_gatt_free_primary_services()
3983 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
3984 bt_gatt_handle_info_t *prim_svc);
3987 * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
3989 * @brief Discovers the characteristics of GATT based service of remote device
3991 * This function is an asynchronous call.
3992 * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
3994 * @return BLUETOOTH_ERROR_NONE - Success \n
3995 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3996 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
3997 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4000 * @param[in] service_handle - Handle for remote service.
4005 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
4008 * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
4009 * bt_gatt_service_property_t *service);
4011 * @brief Gets the properties of GATT based service of remote device
4013 * This function is a synchronous call.
4014 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4016 * @return BLUETOOTH_ERROR_NONE - Success \n
4017 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4018 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4019 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4022 * @param[in] service_handle - Handle for remote service.
4023 * @param[out] service - Structure containing remote service property.
4026 * @see bluetooth_gatt_free_service_property()
4028 int bluetooth_gatt_get_service_property(const char *service_handle,
4029 bt_gatt_service_property_t *service);
4032 * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
4034 * @brief Register to GATT based service to receive value change notification/indication.
4036 * This function is a synchronous call.
4037 * No event for this api.
4039 * @return BLUETOOTH_ERROR_NONE - Success \n
4040 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4041 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4042 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4045 * @param[in] service_handle - Handle for remote service.
4050 int bluetooth_gatt_watch_characteristics(const char *service_handle);
4053 * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
4055 * @brief Unregister GATT based service to receive value change notification/indication.
4057 * This function is a synchronous call.
4058 * No event for this api.
4060 * @return BLUETOOTH_ERROR_NONE - Success \n
4061 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4062 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4063 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4066 * @param[in] service_handle - Handle for remote service.
4071 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
4074 * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4075 * bt_gatt_char_property_t *characteristic);
4077 * @brief Provides characteristic value along with properties.
4079 * This function is a synchronous call.
4080 * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
4082 * @return BLUETOOTH_ERROR_NONE - Success \n
4083 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4084 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4085 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4088 * @param[in] char_handle - Handle for Characteristic property.
4089 * @param[out] characteristic - Structure containing remote characteristic property.
4092 * @see bluetooth_gatt_free_char_property()
4094 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4095 bt_gatt_char_property_t *characteristic);
4098 * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
4099 * bt_gatt_char_property_t *characteristic);
4101 * @brief Provides characteristic descriptor value along with its UUID.
4103 * This function is a synchronous call.
4104 * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
4106 * @return BLUETOOTH_ERROR_NONE - Success \n
4107 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4108 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4109 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4112 * @param[in] desc_handle - Handle for Characteristic descriptor.
4113 * @param[out] descriptor - Structure containing remote characteristic descriptor property.
4116 * @see bluetooth_gatt_free_desc_property()
4118 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
4119 bt_gatt_char_descriptor_property_t *descriptor);
4123 * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4124 * const guint8 *value, int length)
4126 * @brief Set characteristic value.
4128 * This function is a synchronous call.
4130 * @return BLUETOOTH_ERROR_NONE - Success \n
4131 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4132 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4133 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4136 * @param[in] char_handle - Handle for Characteristic property.
4137 * @param[in] value - New value to set for characteristic property.
4138 * @param[in] length - Length of the value to be set.
4143 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4144 const guint8 *value, int length);
4147 * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4148 * const guint8 *value, int length)
4150 * @brief Set characteristic value request.
4152 * This function is an asynchronous call.
4154 * @return BLUETOOTH_ERROR_NONE - Success \n
4155 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4156 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4157 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4160 * @param[in] char_handle - Handle for Characteristic property.
4161 * @param[in] value - New value to set for characteristic property.
4162 * @param[in] length - Length of the value to be set.
4167 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4168 const guint8 *value, int length);
4171 * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
4173 * @brief Read characteristic value.
4175 * This function is a asynchronous call.
4177 * @return BLUETOOTH_ERROR_NONE - Success \n
4178 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4179 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4180 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4183 * @param[in] char_handle - Handle for Characteristic property.
4188 int bluetooth_gatt_read_characteristic_value(const char *char_handle);
4191 * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4192 * const char *service_uuid,
4193 * bt_gatt_service_property_t *service)
4195 * @brief Gets the service property from a device based on a particular uuid
4197 * This function is a synchronous call.
4199 * @return BLUETOOTH_ERROR_NONE - Success \n
4200 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4201 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4202 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4205 * @param[in] address - BD address of the remote device
4206 * @param[in] service_uuid - uuid of the service.
4207 * @param[out] service - Structure containing the service property.
4212 int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4213 const char *service_uuid,
4214 bt_gatt_service_property_t *service);
4217 * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4218 * const char *char_uuid)
4220 * @brief Gets the characteristic property from a service based on a particular char uuid
4222 * This function is an asynchronous call.
4223 * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
4225 * @return BLUETOOTH_ERROR_NONE - Success \n
4226 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4227 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4228 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4231 * @param[in] service_handle - Service handle.
4232 * @param[in] uuid - Characteristic uuid.
4237 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4238 const char *char_uuid);
4241 * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4243 * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
4245 * This function is a synchronous call.
4246 * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
4248 * @return BLUETOOTH_ERROR_NONE - Success \n
4249 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4252 * @param[in] prim_svc - GATT handle info structure
4255 * @see bluetooth_gatt_get_primary_services()
4257 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4260 * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4262 * @brief Releases the memory allocated by bluetooth_gatt_get_service_property()
4264 * This function is a synchronous call.
4265 * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
4267 * @return BLUETOOTH_ERROR_NONE - Success \n
4268 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4271 * @param[in] svc_pty - GATT service property structure.
4274 * @see bluetooth_gatt_get_service_property()
4276 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4279 * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4281 * @brief Provides characteristic value along with properties.
4283 * This function is a synchronous call.
4284 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4286 * @return BLUETOOTH_ERROR_NONE - Success \n
4287 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4290 * @param[in] char_pty - GATT characteristics property structure.
4293 * @see bluetooth_gatt_get_characteristics_property()
4295 int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4298 * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4300 * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
4302 * This function is a synchronous call.
4303 * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
4305 * @return BLUETOOTH_ERROR_NONE - Success \n
4306 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4309 * @param[in] desc_pty - GATT characteristics descriptor property structure.
4312 * @see bluetooth_gatt_get_char_descriptor_property()
4314 int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4317 int bluetooth_connect_le(const bluetooth_device_address_t *device_address, gboolean auto_connect);
4319 int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address);
4322 * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4324 * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
4326 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4328 * @return BLUETOOTH_ERROR_NONE - Success \n
4329 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4332 * @param[in] characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
4336 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4339 * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
4341 * @brief Read characteristic descriptor value.
4343 * This function is a asynchronous call.
4345 * @return BLUETOOTH_ERROR_NONE - Success \n
4346 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4347 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4348 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4351 * @param[in] desc_handle - Handle for Characteristic descriptor
4356 int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
4359 * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4360 * const guint8 *value, int length);
4362 * @brief Set characteristic descriptor value.
4364 * This function is a asynchronous call.
4366 * @return BLUETOOTH_ERROR_NONE - Success \n
4367 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4368 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4369 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4372 * @param[in] desc_handle - Handle for Characteristic descriptor
4373 * @param[in] value - New value to set for characteristic descriptor
4374 * @param[in] length - Length of the value to be set.
4379 int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4380 const guint8 *value, int length);
4382 /* @fn int bluetooth_gatt_init(void)
4384 * @brief Initializes the gatt service.
4386 * This function is a synchronous call.
4387 * @return BLUETOOTH_ERROR_NONE - Success \n
4388 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4389 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4390 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4393 * @remark Adapter should be enabled
4394 * @see bluetooth_gatt_deinit()
4396 int bluetooth_gatt_init(void);
4398 /* @fn int bluetooth_gatt_init(void)
4400 * @brief DeInitializes the gatt service.
4402 * This function is a synchronous call.
4403 * @return BLUETOOTH_ERROR_NONE - Success \n
4404 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4405 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4406 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4409 * @remark Adapter should be enabled
4410 * @see bluetooth_gatt_init()
4412 int bluetooth_gatt_deinit(void);
4414 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
4415 unsigned char **svc_path)
4417 * @brief Exports a new gatt service to the service interface.
4419 * This function is a synchronous call.
4421 * @return BLUETOOTH_ERROR_NONE - Success \n
4422 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4423 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4424 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4427 * @param[in] svc_uuid Gatt service uuid.
4428 * @param[out] svc_path service object path of the exported service.
4429 * @remark Adapter should be enabled
4430 * @see bluetooth_gatt_init()
4432 int bluetooth_gatt_add_service(const char *svc_uuid,
4435 /* @fn int bluetooth_gatt_add_new_characteristic(
4436 const char *svc_path, const char *char_uuid,
4437 bt_gatt_characteristic_property_t *properties,
4438 int flags_length, char **char_path);;
4440 * @brief Exports a new gatt characteristic to the characteristic interface.
4442 * This function is a synchronous call.
4443 * @return BLUETOOTH_ERROR_NONE - Success \n
4444 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4445 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4446 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4448 * @param[in] svc_path service object path of the exported service.
4449 * @param[in] char_uuid Gatt service uuid.
4450 * @param[in] properties GATT characteristic properties.
4451 * @param[out] char_path characteristic object path of the exported characteristic.
4453 * @remark Adapter should be enabled
4454 * @see bluetooth_gatt_add_service()
4456 int bluetooth_gatt_add_new_characteristic(
4457 const char *svc_path, const char *char_uuid,
4458 bt_gatt_characteristic_property_t properties,
4461 /* @fn bluetooth_gatt_set_characteristic_value(
4462 const char *characteristic, const char *char_value,
4465 * @brief adds gatt charactertisic value to the given charactertistic path.
4467 * This function is a synchronous call.
4468 * @return BLUETOOTH_ERROR_NONE - Success \n
4469 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4470 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4471 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4473 * @param[in] char_value Value of the GATT characteristic to be added.
4474 * @param[in] value_length length of the chantacteristic value..
4475 * @param[out] characteristic characteristic object path..
4477 * @remark Adapter should be enabled
4478 * @see bluetooth_gatt_add_service()
4480 int bluetooth_gatt_set_characteristic_value(
4481 const char *characteristic, const char *char_value,
4484 /* @fn int bluetooth_gatt_add_descriptor(const char *desc_uuid,
4485 const char *desc_value, int value_length,
4486 const char *permissions, const char *char_path,
4489 * @brief Exports a new gatt descriptor to the descriptor interface.
4491 * This function is a synchronous call.
4493 * @return BLUETOOTH_ERROR_NONE - Success \n
4494 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4495 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4496 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4499 * @param[in] desc_uuid Gatt descriptor uuid.
4500 * @param[in] desc_value GATT descriptor value.
4501 * @param[in] value_length Length of GATT descriptor value.
4502 * @param[in] permissions descriptor permissions.
4503 * @param[in] char_path characteristics object path of the exported character.
4505 * @remark Adapter should be enabled
4506 * @see bluetooth_gatt_add_service()
4507 * @see bluetooth_gatt_add_characteristics()
4509 int bluetooth_gatt_add_descriptor(const char *char_path,
4510 const char *desc_uuid,
4513 /* @fn int bluetooth_gatt_set_descriptor_value(
4514 const char *desc_path, const char *desc_value,
4517 * @brief Adds value to the given descriptor handle.
4519 * This function is a synchronous call.
4521 * @return BLUETOOTH_ERROR_NONE - Success \n
4522 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4523 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4524 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4527 * @param[in] desc_value GATT descriptor value.
4528 * @param[in] value_length Length of GATT descriptor value.
4529 * @param[in] desc_path descriptor path to which the value needs to be added.
4531 * @remark Adapter should be enabled
4532 * @see bluetooth_gatt_add_service()
4533 * @see bluetooth_gatt_add_characteristics()
4535 int bluetooth_gatt_set_descriptor_value(
4536 const char *desc_path, const char *desc_value,
4539 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
4541 * @brief Reads the Service registered on manager interface.
4543 * This function is a synchronous call.
4545 * @return BLUETOOTH_ERROR_NONE - Success \n
4546 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4547 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4548 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4551 * @param[in] svc_uuid Gatt Service uuid.
4553 * @remark Adapter should be enabled and service should be registered.
4554 * @see bluetooth_gatt_register_service()
4556 int bluetooth_gatt_get_service(const char *svc_uuid);
4558 /* @fn int bluetooth_gatt_register_service(const char *svc_path)
4560 * @brief Registers the given service path with the bluez gatt server.
4562 * This function is a synchronous call.
4564 * @return BLUETOOTH_ERROR_NONE - Success \n
4565 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4566 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4567 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4570 * @param[in] svc_path service object path of the exported service.
4572 * @remark Adapter should be enabled
4573 * @see bluetooth_gatt_add_service()
4574 * @see bluetooth_gatt_add_characteristics()
4575 * @see bluetooth_gatt_add_descriptor()
4577 int bluetooth_gatt_register_service(const char *svc_path);
4579 /* @fn int bluetooth_gatt_unregister_service(const char *svc_path)
4581 * @brief Removes(unregister) service from the bluez gatt server db.
4583 * This function is a synchronous call.
4585 * @return BLUETOOTH_ERROR_NONE - Success \n
4586 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4587 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4588 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4591 * @param[in] svc_path service object path of the exported service.
4593 * @remark Adapter should be enabled
4594 * @see bluetooth_gatt_add_service()
4595 * @see bluetooth_gatt_add_characteristics()
4596 * @see bluetooth_gatt_add_descriptor()
4597 * @see bluetooth_gatt_register_service()
4599 int bluetooth_gatt_unregister_service(const char *svc_path);
4601 /* @fn int bluetooth_gatt_delete_services(void)
4603 * @brief deletes (unregisters) all services from the gatt server database..
4605 * This function is a synchronous call.
4607 * @return BLUETOOTH_ERROR_NONE - Success \n
4608 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4609 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4610 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4614 * @remark Adapter should be enabled
4615 * @see bluetooth_gatt_add_service()
4616 * @see bluetooth_gatt_add_characteristics()
4617 * @see bluetooth_gatt_add_descriptor()
4618 * @see bluetooth_gatt_register_service()
4619 * @see bluetooth_gatt_unregister_service()
4621 int bluetooth_gatt_delete_services(void);
4623 /* @fn int bluetooth_gatt_update_characteristic(void)
4625 * @brief updates the given characteristic with a new value
4627 * This function is a synchronous call.
4629 * @return BLUETOOTH_ERROR_NONE - Success \n
4630 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4631 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4632 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4636 * @remark Adapter should be enabled
4637 * @see bluetooth_gatt_add_service()
4638 * @see bluetooth_gatt_add_characteristics()
4639 * @see bluetooth_gatt_add_descriptor()
4640 * @see bluetooth_gatt_register_service()
4641 * @see bluetooth_gatt_unregister_service()
4643 int bluetooth_gatt_update_characteristic(const char *char_path,
4644 const char* char_value, int value_length);
4647 * @fn int bluetooth_set_advertising(gboolean enable);
4649 * @brief Set advertising status.
4651 * This function is used to enable or disable LE advertising.
4652 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
4654 * This function is a synchronous call.
4656 * @return BLUETOOTH_ERROR_NONE - Success \n
4657 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4658 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4661 * @param[in] enable - The status of advertising
4664 * @see bluetooth_set_advertising_data
4666 int bluetooth_set_advertising(gboolean enable);
4669 * @fn int bluetooth_set_custom_advertising(gboolean enable, float interval_min, float interval_max,
4670 * guint8 filter_policy);
4672 * @brief Set advertising status along with interval value.
4674 * This function is used to enable or disable LE advertising.
4675 * Interval_min and Interval_max is used to set the best advertising interval.
4676 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
4678 * This function is a synchronous call.
4680 * @return BLUETOOTH_ERROR_NONE - Success \n
4681 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4682 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4685 * @param[in] enable - The status of advertising
4686 * @param[in] interval_min - Minimum interval of advertising (msec)
4687 * @param[in] interval_max - Maximum interval of advertising (msec)
4688 * @param[in] filter_policy - Advertising filter policy
4691 * @see bluetooth_set_advertising_data
4693 int bluetooth_set_custom_advertising(gboolean enable,
4694 bluetooth_advertising_params_t *params);
4697 * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
4698 * @brief Get the advertising data
4700 * This function is used to get advertising data.
4701 * Before calling this API, the adapter should be enabled.
4703 * This function is a synchronous call.
4705 * @return BLUETOOTH_ERROR_NONE - Success \n
4706 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4707 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
4708 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4710 * @param[out] value - Advertising data structure.
4711 * @param[out] length - The length of Advertising data.
4715 bluetooth_advertising_data_t *value = { {0} };
4718 ret = bluetooth_get_advertising_data(&value, &length);
4721 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
4724 * @fn int bluetooth_set_advertising_data(const bluetooth_advertising_data_t *value, int length);
4726 * @brief Set advertising data with value
4728 * This function is used to set advertising data and Maximum size of advertising data
4729 * is 28 byte (Except Flag)
4731 * This function is a synchronous call.
4733 * @return BLUETOOTH_ERROR_NONE - Success \n
4734 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4735 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4738 * @param[in] value - Advertising data structure.
4742 int bluetooth_set_advertising_data(const bluetooth_advertising_data_t *value, int length);
4745 * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
4746 * @brief Get the LE scan response data
4748 * This function is used to get scan response data.
4749 * Before calling this API, the adapter should be enabled.
4751 * This function is a synchronous call.
4753 * @return BLUETOOTH_ERROR_NONE - Success \n
4754 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4755 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
4756 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4758 * @param[out] value - Scan response data structure.
4759 * @param[out] length - The length of Scan response data.
4763 bluetooth_scan_resp_data_t *value = { {0} };
4766 ret = bluetooth_get_scan_response_data(&value, &length);
4769 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
4772 * @fn int bluetooth_set_scan_response_data(const bluetooth_scan_resp_data_t *value, int length);
4774 * @brief Set scan response data with value
4776 * This function is used to set scan response data and Maximum size of scan response data is 31 byte
4778 * This function is a synchronous call.
4780 * @return BLUETOOTH_ERROR_NONE - Success \n
4781 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4782 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4785 * @param[in] value - LE Scan response data structure.
4789 int bluetooth_set_scan_response_data(const bluetooth_scan_resp_data_t *value, int length);
4792 * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
4794 * @brief Set scan interval and window
4796 * This function is used to set LE scan interval and window size
4798 * This function is a synchronous call.
4800 * @return BLUETOOTH_ERROR_NONE - Success \n
4801 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4802 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4805 * @param[in] interval - Interval of LE scan (msec)
4806 * @param[in] window - Window size of LE scan (msec)
4810 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
4813 * @fn int bluetooth_is_advertising(void)
4814 * @brief Check for the advertising is in-progress or not.
4816 * This API is used to check the current status of the advertising procedure.
4817 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
4820 * This function checks whether the advertising is started or not.
4822 * This function is a synchronous call.
4824 * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c false = not in progress)
4826 * @return BLUETOOTH_ERROR_NONE - Success \n
4827 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4830 * @see bluetooth_set_advertising, bluetooth_set_custom_advertising
4834 gboolean is_advertising = 0;
4836 ret = bluetooth_is_advertising(&is_advertising);
4839 int bluetooth_is_advertising(gboolean *is_advertising);
4842 * @fn int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
4843 * @brief Add LE device to white list
4845 * This API is used to add LE device to white list
4846 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
4850 * This function is a synchronous call.
4852 * @param[in] address The address of remote device
4854 * @return BLUETOOTH_ERROR_NONE - Success \n
4855 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4858 * @see bluetooth_set_custom_advertising
4860 int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
4863 * @fn int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
4864 * @brief Remove LE device from white list
4866 * This API is used to remove LE device from white list
4867 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
4871 * This function is a synchronous call.
4873 * @param[in] address The address of remote device
4875 * @return BLUETOOTH_ERROR_NONE - Success \n
4876 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4879 * @see bluetooth_set_custom_advertising
4881 int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
4884 * @fn int bluetooth_clear_white_list(void)
4885 * @brief Clear white list
4887 * This API is used to clear white list
4888 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
4892 * This function is a synchronous call.
4894 * @param[in] address The address of remote device
4896 * @return BLUETOOTH_ERROR_NONE - Success \n
4897 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4900 * @see bluetooth_set_custom_advertising
4902 int bluetooth_clear_white_list(void);
4905 * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
4906 * const bluetooth_le_conn_update_t *parameters)
4907 * @brief update connection paramter of LE connection.
4909 * This function is a synchronous call.
4911 * @return BLUETOOTH_ERROR_NONE - Success \n
4912 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4915 * @param[in] address - remote device address value.
4916 * @param[in] parameters - new connection parameters.
4919 * @see bluetooth_bond_device
4921 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
4922 const bluetooth_le_conn_update_t *parameters);
4926 * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
4928 * @brief Enable/Disable LE Privacy feature.
4930 * This function is used to enable or disable LE Privacy feature.
4931 * Once Privacy feature is enabled, Adapter can use Random Address for more security.
4933 * This function is a synchronous call.
4935 * @return BLUETOOTH_ERROR_NONE - Success \n
4936 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4937 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4940 * @param[in] enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
4944 int bluetooth_enable_le_privacy(gboolean enable_privacy);
4946 int bluetooth_pbap_init(void);
4947 int bluetooth_pbap_deinit(void);
4948 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
4949 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
4950 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
4951 bt_pbap_folder_t *folder);
4952 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
4953 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
4954 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
4955 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
4956 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
4957 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
4958 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
4959 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
4962 * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
4964 * @brief Set manufacturer data with value
4966 * This function is used to set manufacturer data.
4968 * This function is a synchronous call.
4970 * @return BLUETOOTH_ERROR_NONE - Success \n
4971 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4972 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4975 * @param[in] value - Manufacturer data structure.
4979 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
4986 #endif /* __cplusplus */
4987 #endif /* _BLUETOOTH_API_H_*/