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 + 0x0030))
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 */
507 BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED, /** <GATT Characteristic/Descriptor Read Request event */
509 BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
510 BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
511 BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
512 BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
513 BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
514 BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED, /**<AV & AG service disconnected event*/
515 BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
516 BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
517 BLUETOOTH_EVENT_AV_SOURCE_CONNECTED, /**<AV Source device connected event */
518 BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED, /**<AV Source device disconnected event */
519 BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
520 BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
521 BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle status event*/
522 BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
523 BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
524 BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
525 BLUETOOTH_EVENT_HF_CONNECTED,
526 BLUETOOTH_EVENT_HF_DISCONNECTED,
527 BLUETOOTH_EVENT_HF_AUDIO_CONNECTED,
528 BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED,
529 BLUETOOTH_EVENT_HF_RING_INDICATOR,
530 BLUETOOTH_EVENT_HF_CALL_WAITING,
531 BLUETOOTH_EVENT_HF_CALL_TERMINATED,
532 BLUETOOTH_EVENT_HF_CALL_STARTED,
533 BLUETOOTH_EVENT_HF_CALL_ENDED,
534 BLUETOOTH_EVENT_HF_CALL_UNHOLD,
535 BLUETOOTH_EVENT_HF_CALL_SWAPPED,
536 BLUETOOTH_EVENT_HF_CALL_ON_HOLD,
537 BLUETOOTH_EVENT_HF_CALL_STATUS,
538 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED,
539 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED,
540 BLUETOOTH_EVENT_HF_VOLUME_SPEAKER,
541 BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD,
543 BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
544 BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
546 BLUETOOTH_EVENT_ADVERTISING_STARTED = BLUETOOTH_EVENT_ADVERTISING_BASE, /**< Advertising started event */
547 BLUETOOTH_EVENT_ADVERTISING_STOPPED, /**< Advertising stopped event */
548 BLUETOOTH_EVENT_ADVERTISING_MANUFACTURER_DATA_CHANGED, /**< Advertising manufacturer data changed event */
549 BLUETOOTH_EVENT_SCAN_RESPONSE_MANUFACTURER_DATA_CHANGED, /**< Scan response manufacturer data changed event */
550 BLUETOOTH_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed event */
551 BLUETOOTH_EVENT_DEVICE_ERROR, /**< Hardware error */
552 BLUETOOTH_EVENT_TX_TIMEOUT_ERROR, /** TX Timeout Error*/
553 BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
555 BLUETOOTH_PBAP_CONNECTED = BLUETOOTH_EVENT_PBAP_CLIENT_BASE, /**< PBAP connected event*/
556 BLUETOOTH_PBAP_DISCONNECTED, /**< PBAP disconnectd event*/
557 BLUETOOTH_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size event*/
558 BLUETOOTH_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull event*/
559 BLUETOOTH_PBAP_VCARD_LIST, /**< PBAP vCard List event*/
560 BLUETOOTH_PBAP_VCARD_PULL, /**< PBAP vCard Pull event*/
561 BLUETOOTH_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search event*/
563 BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED = BLUETOOTH_EVENT_AVRCP_CONTROL_BASE, /**<AVRCP service connected event*/
564 BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED, /**<AVRCP service disconnected event*/
565 BLUETOOTH_EVENT_AVRCP_CONTROL_SHUFFLE_STATUS, /**<AVRCP control suffle status event*/
566 BLUETOOTH_EVENT_AVRCP_CONTROL_EQUALIZER_STATUS, /**<AVRCP control equalizer status event*/
567 BLUETOOTH_EVENT_AVRCP_CONTROL_REPEAT_STATUS, /**<AVRCP control repeat status event*/
568 BLUETOOTH_EVENT_AVRCP_CONTROL_SCAN_STATUS, /**<AVRCP control scan status event*/
569 BLUETOOTH_EVENT_AVRCP_SONG_POSITION_STATUS, /**<AVRCP control play Postion status event*/
570 BLUETOOTH_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**<AVRCP control play status event*/
571 BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED, /**<AVRCP control song metadata event*/
572 } bluetooth_event_type_t;
575 * This bt_service_uuid_list_t enum indicates service uuid list .
576 * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
580 BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101), /**<SPP*/
581 BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102), /**<LAP*/
582 BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103), /**<DUN*/
583 BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104), /**<OBEX IR MC SYNC*/
584 BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105), /**<OPP*/
585 BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106), /**<FTP*/
586 BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107), /**<IRMC SYNC COMMAND*/
587 BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108), /**<HS*/
588 BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109), /**<CTP*/
589 BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A), /**<AUDIO SOURCE*/
590 BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B), /**<AUDIO SINK*/
591 BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C), /**<AV REMOTE CONTROL
593 BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
594 BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E), /**<AV REMOTE CONTROL UUID*/
595 BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
596 BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110), /**<ICP*/
597 BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111), /**<FAX*/
598 BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112), /**<HS AG */
599 BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115), /**<PAN*/
600 BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116), /**<PAN*/
601 BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117), /**<PAN*/
602 BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
603 BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118), /**<OBEX BPPS*/ /* Will be removed */
604 BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
605 BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A), /**<OBEX_IMAGING*/
606 BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B), /**<OBEX_IMAGING
608 BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C), /**<IMAGING AUTOMATIC ARCHIVE*/
609 BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D), /**<IMAGING REFERENCED OBJECTS*/
610 BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E), /**<HF*/
611 BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F), /**<HFG*/
612 BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
613 /**<DIRECT PRINTING*/
614 BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121), /**<REFLECTED UI*/
615 BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122), /**<BASIC PRINTING*/
616 BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123), /**<PRINTING STATUS*/
617 BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
618 BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124), /**<HID*/
619 BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125), /**<HCRP*/
620 BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126), /**<HCR PRINT*/
621 BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127), /**<HCR SCAN*/
622 BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D), /**<SIM ACCESS PROFILE*/
623 BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E), /**<PBAP - PCE*/
624 BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/
625 BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/ /* Will be removed */
626 BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130), /**<OBEX PBA*/
627 BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131), /**<HEADSET HS*/
628 BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
629 BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
630 BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
631 BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200), /**<PNP*/
632 BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201), /**<GENERIC NETWORKING*/
633 BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
634 BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203), /**<GENERIC AUDIO*/
635 BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204), /**<GENERIC TELEPHONY*/
636 BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303), /**<VEDIO SOURCE*/
637 BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304), /**<VEDIO SINK*/
638 BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305), /**<VEDIO DISTRIBUTION*/
639 BLUETOOTH_HDP_UUID = ((unsigned short)0x1400), /**<HDP*/
640 BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401), /**<HDP SOURCE*/
641 BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402), /**<HDP SINK*/
642 BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000) /**<OBEX_SYNC*/ /* Will be removed */
643 } bluetooth_service_uuid_list_t;
646 * Service class part of class of device returned from device discovery
649 BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
650 BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000, /**< */
651 BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000, /**< */
652 BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000, /**< */
653 BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000, /**< */
654 BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000, /**< */
655 BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000, /**< */
656 BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000, /**< */
657 BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000, /**< */
658 } bluetooth_device_service_class_t;
662 * Major device mask (For device discovery)
665 BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
666 BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
667 BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
668 BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
669 BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
670 BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
671 BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
672 BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
673 BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
674 BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
675 } bluetooth_device_major_mask_t;
679 * Major device class (part of Class of Device)
682 BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
683 BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01, /**< Computer major device class*/
684 BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02, /**< Phone major device class*/
685 BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03, /**< LAN major device class*/
686 BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04, /**< AUDIO major device class*/
687 BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class*/
688 BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06, /**< Imaging major device class*/
689 BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07, /**< Wearable device class*/
690 BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08, /**< Toy device class*/
691 BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09, /**< Health device class*/
692 BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F /**< Unknown major device class*/
693 } bluetooth_device_major_class_t;
696 BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00, /**< unclassified minor class */
698 /* About Computer Major class */
699 BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04, /**< desktop workstation
701 BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08, /**< server minor class */
702 BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C, /**< laptop minor class */
703 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10, /**< PDA minor class */
704 BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14, /**< PALM minor class */
705 BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18, /**< Wearable PC minor class */
707 /* About Phone Major class */
708 BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04, /**< Cellular minor class */
709 BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08, /**< cordless minor class */
710 BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C, /**< smart phone minor class */
711 BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
712 /**< voice gateway minor class */
713 BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14, /**< ISDN minor class */
715 /* About LAN/Network Access Point Major class */
716 BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04, /**< Fully available minor class */
717 BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor class */
718 BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor class */
719 BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor class */
720 BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor class */
721 BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor class */
722 BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor class */
723 BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor class */
725 /* About Audio/Video Major class */
726 BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04, /**< Headset minor class */
727 BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08, /**< Handsfree minor class*/
729 BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10, /**< Microphone minor class */
730 BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14, /**< Loud Speaker minor class */
731 BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18, /**< Headphones minor class */
732 BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C, /**< Portable Audio minor class */
733 BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20, /**< Car Audio minor class */
734 BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24, /**< Set top box minor class */
735 BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi minor class */
736 BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C, /**< VCR minor class */
737 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30, /**< Video Camera minor class */
738 BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34, /**< CAM Corder minor class */
739 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38, /**<Video Monitor minor class */
740 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
741 /**< Video Display and Loud
742 Speaker minor class */
743 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
746 BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48, /**< Gaming or toy minor class */
748 /* About Peripheral Major class */
749 BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40, /**< Key board minor class */
750 BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80, /**< Pointing Device minor class */
751 BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
752 /**< Combo Keyboard or pointing
755 BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04, /**< JoyStick minor class */
756 BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08, /**< Game Pad minor class */
757 BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C, /**< Remote Control minor class */
758 BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10, /**< Sensing Device minor class */
759 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14, /**< Digitizer minor class */
760 BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18, /**< Card Reader minor class */
761 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C, /**< Digital pen minor class */
762 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20, /**< Handheld scanner for bar-codes, RFID minor class */
763 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor class */
765 /* About Imaging Major class */
766 BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10, /**< Display minor class */
767 BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20, /**< Camera minor class */
768 BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40, /**< Scanner minor class */
769 BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80, /**< Printer minor class */
771 /* About Wearable Major class */
772 BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04, /**< Wrist watch minor class */
773 BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08, /**< Pager minor class */
774 BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C, /**< Jacket minor class */
775 BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10, /**< Helmet minor class */
776 BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14, /**< Glasses minor class */
778 /* About Toy Major class */
779 BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04, /**< Robot minor class */
780 BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08, /**< Vehicle minor class */
781 BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C, /**< Doll or Action minor class */
782 BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10, /**< Controller minor class */
783 BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14, /**< Game minor class */
785 /* About Health Major class */
786 BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood Pressure minor class */
787 BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08, /**< Thermometer minor class */
788 BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C, /**< Weighing Scale minor class */
789 BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10, /**< Glucose minor class */
790 BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14, /**< Pulse Oximeter minor class */
791 BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
792 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C, /**< Medical minor class */
793 BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20, /**< Step Counter minor class */
794 BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor class */
795 BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor class */
796 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
797 BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor class */
798 BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor class */
799 } bluetooth_device_minor_class_t;
802 * structure to hold the device information
805 bluetooth_device_major_class_t major_class; /**< major device class */
806 bluetooth_device_minor_class_t minor_class; /**< minor device class */
807 bluetooth_device_service_class_t service_class;
808 /**< service device class */
809 } bluetooth_device_class_t;
812 * Discovery Role types
815 DISCOVERY_ROLE_BREDR = 0x1,
817 DISCOVERY_ROLE_LE_BREDR
818 } bt_discovery_role_type_t;
821 * Connected state types
824 BLUETOOTH_CONNECTED_LINK_NONE = 0x00,
825 BLUETOOTH_CONNECTED_LINK_BREDR = 0x01,
826 BLUETOOTH_CONNECTED_LINK_LE = 0x02,
827 BLUETOOTH_CONNECTED_LINK_BREDR_LE = 0x03,
828 } bluetooth_connected_link_t;
834 BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS = 0x01, /**< device address */
835 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_UUID = 0x04, /**< service uuid */
836 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID = 0x08, /**< service solicitation uuid */
837 BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_NAME = 0x10, /**< device name */
838 BLUETOOTH_LE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA = 0x20, /**< manufacturer data */
839 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_DATA = 0x40, /**< service data */
840 } bluetooth_le_scan_filter_feature_t;
843 * structure to hold the device information
846 bluetooth_device_address_t device_address; /**< device address */
847 bluetooth_device_name_t device_name; /**< device name */
848 bluetooth_device_class_t device_class; /**< device class */
849 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
850 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
852 int rssi; /**< received strength signal*/
853 gboolean paired; /**< paired flag */
854 bluetooth_connected_link_t connected; /**< connected link type */
855 gboolean trust; /**< trust flag */
856 bluetooth_manufacturer_data_t manufacturer_data; /**< manafacturer specific class */
857 } bluetooth_device_info_t;
860 * structure to hold the LE device information
863 int data_len; /**< manafacturer specific data length */
864 bluetooth_advertising_data_t data; /**< manafacturer specific data */
865 } bluetooth_le_advertising_data_t;
868 bluetooth_device_address_t device_address; /**< device address */
869 int addr_type; /**< address type*/
870 int rssi; /**< received strength signal*/
871 bluetooth_le_advertising_data_t adv_ind_data;
872 bluetooth_le_advertising_data_t scan_resp_data;
873 } bluetooth_le_device_info_t;
877 bluetooth_le_scan_filter_feature_t added_features; /**< added features */
878 bluetooth_device_address_t device_address; /**< device address */
879 char device_name[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX]; /**< device name */
880 bluetooth_le_advertising_data_t service_uuid; /**< service uuid */
881 bluetooth_le_advertising_data_t service_uuid_mask; /**< service uuid mask */
882 bluetooth_le_advertising_data_t service_solicitation_uuid; /**< service solicitation uuid */
883 bluetooth_le_advertising_data_t service_solicitation_uuid_mask; /**< service solicitation uuid mask */
884 bluetooth_le_advertising_data_t service_data; /**< service data */
885 bluetooth_le_advertising_data_t service_data_mask; /**< service data mask */
886 int manufacturer_id; /**< manufacturer ID */
887 bluetooth_le_advertising_data_t manufacturer_data; /**< manufacturer data */
888 bluetooth_le_advertising_data_t manufacturer_data_mask; /**< manufacturer data mask */
889 } bluetooth_le_scan_filter_t;
892 * structure to hold the paired device information
895 bluetooth_device_address_t device_address; /**< paired device address */
896 bluetooth_device_name_t device_name; /**< device name */
897 bluetooth_device_class_t device_class; /**< device class */
898 } bluetooth_paired_device_info_t;
901 * structure to hold the paired device information
904 bluetooth_device_address_t device_address;
905 /**< device address */
906 char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
907 /**< network interface name */
908 } bluetooth_network_device_info_t;
911 * Stucture to hold discovery option
914 unsigned short max_response; /**< the number of maximum response */
915 unsigned short discovery_duration;
916 /**< duration of discovery (seconds) */
917 unsigned int classOfDeviceMask; /**< mask for values of class of device. to be used with
918 classOfDevice variable */
919 } bluetooth_discovery_option_t;
922 * Stucture to hold event information
925 int event; /**< event type */
926 int result; /**< Success or error value */
928 /**<parameter data pointer */
930 } bluetooth_event_param_t;
933 bluetooth_device_address_t device_addr;
934 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
935 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
936 unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
941 bluetooth_device_address_t device_addr;
942 unsigned char addr_type;
944 } bt_connection_info_t;
947 * Stucture to rfcomm receive data
952 /**< the socket fd */
953 int buffer_size;/**< the length of the receive buffer */
955 /**< the receive data buffer */
956 } bluetooth_rfcomm_received_data_t;
959 * Stucture to rfcomm connection
963 int socket_fd; /**< the socket fd */
964 int server_id; /* Server id */
965 int device_role; /** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
966 bluetooth_device_address_t device_addr;
967 /**< device address */
968 char uuid[BLUETOOTH_UUID_STRING_MAX];
969 } bluetooth_rfcomm_connection_t;
972 * Stucture to rfcomm disconnection
976 /**< the socket fd */
977 int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
978 bluetooth_device_address_t device_addr;
979 /**< device address */
980 char uuid[BLUETOOTH_UUID_STRING_MAX];
981 } bluetooth_rfcomm_disconnection_t;
985 /**< the socket fd */
986 bluetooth_device_address_t device_addr;
987 /**< device address */
988 } bluetooth_rfcomm_connection_request_t;
1003 HDP_ROLE_SOURCE = 0x0,
1005 }bt_hdp_role_type_t;
1009 * Stucture to HDP connected
1012 const char *app_handle; /**< the application handle */
1013 unsigned int channel_id; /**< the channel id */
1014 bt_hdp_qos_type_t type; /**< the QOS type */
1015 bluetooth_device_address_t device_address; /**< the remote address */
1016 } bt_hdp_connected_t;
1019 * Stucture to HDP disconnected
1022 unsigned int channel_id; /**< the channel id */
1023 bluetooth_device_address_t device_address; /**< the remote address */
1024 } bt_hdp_disconnected_t;
1027 * Stucture to HDP data indication
1030 unsigned int channel_id; /**< the channel id */
1031 const char *buffer; /**< the RX data buffer */
1032 unsigned int size; /**< the RX data size */
1033 } bt_hdp_data_ind_t;
1036 * Stucture to OPP client transfer information
1042 }bt_opc_transfer_info_t;
1044 /* Obex Server transfer type */
1045 #define TRANSFER_PUT "PUT"
1046 #define TRANSFER_GET "GET"
1048 * Stucture to OPP/FTP Server authorize information
1053 } bt_obex_server_authorize_into_t;
1061 } bt_obex_server_type_t;
1064 * Stucture to OPP/FTP server transfer information
1072 unsigned long file_size;
1074 bt_obex_server_type_t server_type;
1075 } bt_obex_server_transfer_info_t;
1078 * Stucture to OOB data
1082 unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
1083 unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
1084 unsigned int hash_len;
1085 unsigned int randomizer_len;
1089 * Structure to GATT attribute handle data
1095 } bt_gatt_handle_info_t;
1098 * Structure to GATT Remote service data
1105 bt_gatt_handle_info_t include_handles;
1106 bt_gatt_handle_info_t char_handle;
1107 } bt_gatt_service_property_t;
1110 * Structure to GATT Remote characteristic data
1114 char *service_handle;
1115 bt_gatt_handle_info_t handle_info;
1116 } bt_gatt_discovered_char_t;
1119 * Structure to format of GATT Characteristic Value
1123 unsigned char format;
1124 unsigned char exponent;
1125 unsigned short unit;
1126 unsigned char name_space;
1127 unsigned short description;
1128 } bt_gatt_char_format_t;
1131 * Structure to GATT Characteristic property
1139 bt_gatt_char_format_t format;
1141 unsigned int val_len;
1142 unsigned int permission;
1143 char *representation;
1144 bt_gatt_handle_info_t char_desc_handle;
1145 } bt_gatt_char_property_t;
1148 * Structure to GATT Characteristic descriptor property
1155 unsigned int val_len;
1156 } bt_gatt_char_descriptor_property_t;
1159 * Structure to GATT Characteristic value
1166 } bt_gatt_char_value_t;
1169 * Structure to GATT Read Request
1173 char *service_handle;
1177 } bt_gatt_read_req_t;
1180 * Structure to RSSI Signal Strength Alert
1191 * Structure to RSSI Signal Strength
1201 * Structure for RSSI Enabled or Disabled
1207 gboolean rssi_enabled;
1208 } bt_rssi_enabled_t;
1211 * Structure for RSSI Threshold
1216 int in_range_threshold;
1218 } bt_rssi_threshold_t;
1221 * Structure for PBAP Folder Parameters
1224 unsigned char addressbook;
1225 unsigned char folder_type;
1229 * Structure for PBAP Pull application Parameters
1232 unsigned char format;
1233 unsigned char order;
1234 unsigned short offset;
1235 unsigned short maxlist;
1236 long long unsigned fields;
1237 } bt_pbap_pull_parameters_t;
1240 * Structure for PBAP List application Parameters
1243 unsigned char order;
1244 unsigned short offset;
1245 unsigned short maxlist;
1246 } bt_pbap_list_parameters_t;
1249 * Structure for PBAP Pull vCard application Parameters
1252 unsigned char format;
1253 long long unsigned fields;
1255 } bt_pbap_pull_vcard_parameters_t;
1258 * Structure for PBAP Search application Parameters
1261 unsigned char order;
1262 unsigned short offset;
1263 unsigned short maxlist;
1264 unsigned char search_attribute;
1265 char search_value[BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH];
1266 } bt_pbap_search_parameters_t;
1269 * Structure for PBAP Connection Status
1272 bluetooth_device_address_t btaddr;
1274 } bt_pbap_connected_t;
1277 * Structure for PBAP Phonebook Size
1280 bluetooth_device_address_t btaddr;
1282 } bt_pbap_phonebook_size_t;
1285 * Structure for PBAP Phonebook Pull
1288 bluetooth_device_address_t btaddr;
1291 } bt_pbap_phonebook_pull_t;
1294 * Structure for PBAP vCard List
1297 bluetooth_device_address_t btaddr;
1301 } bt_pbap_vcard_list_t;
1304 * Structure for PBAP vCard Pull
1307 bluetooth_device_address_t btaddr;
1310 } bt_pbap_vcard_pull_t;
1313 * Structure for PBAP Phonebook search List
1316 bluetooth_device_address_t btaddr;
1320 } bt_pbap_phonebook_search_list_t;
1323 * Stucture to HF Call status information
1327 char *number; /*Phone Number */
1328 int direction; /*Direction :Incoming(1), Outgoing(0)*/
1329 int status; /* Call Status :Active(0), Held(1), Waiting(5), Dailing(2)*/
1330 int mpart; /*Multiparty/conf call: Yes(1), No(0) */
1331 int idx; /*Call index/ID */
1332 } bt_hf_call_status_info_t;
1337 } bt_hf_call_list_s;
1340 * Callback pointer type
1342 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
1345 * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1346 * @brief Set the callback function pointer for bluetooth event
1349 * This API will register the callback function, when any response and event are received from
1350 * bluetooth framework. @n
1351 * this registered callback function will be get called with appropriate event and data structures.
1352 * This function is a synchronous call. An application developer can call
1353 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1354 * type. This registered function will receive events of bluetooth_event_type_t type along with
1358 * @param[in] callback_ptr A pointer to the callback function
1359 * @param[in] user_data A pointer to user data
1360 * @return BLUETOOTH_ERROR_NONE - Success
1364 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1366 GMainLoop *main_loop = (GMainLoop*) user_data;
1370 // Code for each event
1372 g_main_loop_quit(main_loop);
1379 GMainLoop *main_loop = NULL;
1382 main_loop = g_main_loop_new(NULL, FALSE);
1383 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1384 if (ret >= BLUETOOTH_ERROR_NONE)
1386 // bluetooth_register_callback returned Success
1390 // bluetooth_register_callback returned failiure
1392 g_main_loop_run(main_loop);
1396 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1399 * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1400 * @brief Set the callback function pointer for bluetooth le event
1403 * This API will register the callback function, when any response and event are received from
1404 * bluetooth framework. @n
1405 * this registered callback function will be get called with appropriate event and data structures.
1406 * This function is a synchronous call. An application developer can call
1407 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1408 * type. This registered function will receive events of bluetooth_event_type_t type along with
1412 * @param[in] callback_ptr A pointer to the callback function
1413 * @param[in] user_data A pointer to user data
1414 * @return BLUETOOTH_ERROR_NONE - Success
1418 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1421 * @fn int bluetooth_le_unregister_callback(void)
1422 * @brief Set the callback function pointer for bluetooth le event
1425 * This API will register the callback function, when any response and event are received from
1426 * bluetooth framework. @n
1427 * this registered callback function will be get called with appropriate event and data structures.
1428 * This function is a synchronous call. An application developer can call
1429 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1430 * type. This registered function will receive events of bluetooth_event_type_t type along with
1435 * @return BLUETOOTH_ERROR_NONE - Success
1439 int bluetooth_le_unregister_callback(void);
1442 * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
1443 * @brief Set the callback function pointer for bluetooth event
1446 * This API will register the callback function, when any response and event are received from
1447 * bluetooth framework. @n
1448 * this registered callback function will be get called with appropriate event and data structures.
1449 * This function is a synchronous call. An application developer can call
1450 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1451 * type. This registered function will receive events of bluetooth_event_type_t type along with
1456 * @return BLUETOOTH_ERROR_NONE - Success
1460 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1462 GMainLoop *main_loop = (GMainLoop*) user_data;
1466 // Code for each event
1468 g_main_loop_quit(main_loop);
1475 GMainLoop *main_loop = NULL;
1478 main_loop = g_main_loop_new(NULL, FALSE);
1479 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1480 if (ret >= BLUETOOTH_ERROR_NONE)
1482 // bluetooth_register_callback returned Success
1486 // bluetooth_register_callback returned failiure
1488 ret = bluetooth_deregister_callback(void);
1489 g_main_loop_run(main_loop);
1493 int bluetooth_unregister_callback(void);
1496 * @fn int bluetooth_enable_adapter(void)
1497 * @brief Enable the Bluetooth H/W
1500 * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
1501 * send request to bluetooth chip for activation.
1502 * This function is typically called at startup or when Bluetooth services are required. This
1503 * function must be called before calling any other API of Bluetooth operations.
1505 * Before performing any operations like Device discover, service search etc.., the adapter must be
1508 * This function is a asynchronous call.
1509 * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
1510 * through registered callback function with appropriate result code
1511 * BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
1512 * BLUETOOTH_ERROR_NONE - Success \n
1514 * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
1515 * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
1517 * @return BLUETOOTH_ERROR_NONE - Success\n
1518 * BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
1519 * BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
1520 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1521 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1523 * @see bluetooth_check_adapter, bluetooth_disable_adapter
1525 void bt_event_callback(int event, bluetooth_event_param_t *param)
1529 case BLUETOOTH_EVENT_ENABLED:
1530 if (param->result == BLUETOOTH_ERROR_NONE)
1532 // Successfully Enabled
1545 ret = bluetooth_enable_adapter();
1549 int bluetooth_enable_adapter(void);
1552 * @fn int bluetooth_disable_adapter(void)
1553 * @brief Disable the Bluetooth H/W
1556 * This function disables Bluetooth protocol stack and hardware. This function is called when
1557 * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
1559 * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
1560 * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
1561 * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
1563 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1566 * This function is a asynchronous call.
1567 * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
1568 * through registered callback function.
1571 * @return BLUETOOTH_ERROR_NONE - Success\n
1572 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1573 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1574 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1576 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1578 void bt_event_callback(int event, bluetooth_event_param_t *param)
1582 case BLUETOOTH_EVENT_DISABLED:
1583 if (param->result == BLUETOOTH_ERROR_NONE)
1585 // Successfully disabled
1598 ret = bluetooth_disable_adapter();
1601 int bluetooth_disable_adapter(void);
1602 int bluetooth_recover_adapter(void);
1603 int bluetooth_check_adapter_le(void);
1604 int bluetooth_enable_adapter_le(void);
1606 int bluetooth_disable_adapter_le(void);
1609 * @fn int bluetooth_reset_adapter(void)
1610 * @brief Reset the Bluetooth H/W and values
1613 * This function resets Bluetooth protocol stack and hardware. This function is called when
1614 * an user want to initialize Bluetooth environment.
1616 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1619 * This function is a synchronous call.
1621 * @return BLUETOOTH_ERROR_NONE - Success\n
1622 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1624 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1629 ret = bluetooth_reset_adapter();
1632 int bluetooth_reset_adapter(void);
1635 * @fn int bluetooth_is_supported(void)
1636 * @brief Check if the bluetooth is supported or not by the current target
1638 * This API checks whether the bluetooth is supported or not.
1639 * This API only run by root permission.
1641 * This function is a synchronous call.
1643 * @return 0 - if bluetooth is not supported\n
1644 * 1 - if bluetooth is supported\n
1645 * BLUETOOTH_ERROR_INTERNAL - Error in API internal
1650 ret = bluetooth_is_supported();
1653 int bluetooth_is_supported(void);
1657 * @fn int bluetooth_check_adapter(void)
1658 * @brief Check the current status of the Bluetooth adapter
1661 * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1662 * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1663 * bluetooth adapter.
1664 * This API get the adapter internal data structure and check current adapter status.
1666 * This function is a synchronous call.
1669 * @return BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1670 * BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1672 * @see bluetooth_enable_adapter, bluetooth_disable_adapter
1676 ret = bluetooth_check_adapter();
1679 int bluetooth_check_adapter(void);
1682 * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1683 * @brief Get the local adapter bluetooth address
1686 * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1687 * the adapter should be enabled.
1688 * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1689 * contain Bluetooth address.
1690 * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1691 * friendly name for each device.
1692 * There is no event callback for this API.
1694 * This function is a synchronous call.
1697 * @return BLUETOOTH_ERROR_NONE - Succeess \n
1698 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
1699 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
1700 * @param[out] local_address a device address of local bluetooth adapter
1705 bluetooth_device_address_t local_address={0,};
1708 ret = bluetooth_get_local_address(&local_address);
1711 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1714 * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
1715 * @brief Get the hci version
1718 * This function is used to get the bluetooth hci version
1719 * Before calling this API make sure that the adapter is enabled.
1721 * This function is a synchronous call.
1724 * @return BLUETOOTH_ERROR_NONE - Success \n
1725 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1726 * @param[out] timeout remain visibility timeout value
1729 bluetooth_version_t *version;
1731 ret = bluetooth_get_local_version (&version);
1734 int bluetooth_get_local_version(bluetooth_version_t *version);
1737 * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1738 * @brief Get the local device name
1741 * This function is used, get the local device name. Since its difficult to remember the Adapter
1742 * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1743 * friendly name is retrived by the remote device and displaying.
1744 * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1746 * This function is a synchronous call.
1749 * @return BLUETOOTH_ERROR_NONE - Success \n
1750 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1751 * @param[out] local_name a local device name
1755 bluetooth_device_name_t local_name={0,}
1757 ret = bluetooth_get_local_name (&local_name);
1760 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1763 * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1764 * @brief Set the local device name
1767 * This function is used to set the local device name. This is a human friendly name whose
1768 * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1770 * This function is a synchronous call.
1772 * @param[in] local_name bluetooth device name to set local device
1774 * @return BLUETOOTH_ERROR_NONE - Success \n
1775 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1776 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1777 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1778 * BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1779 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1784 bluetooth_device_name_t local_name={0,}
1786 ret = bluetooth_set_local_name (&local_name);
1789 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1793 * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1794 * @brief Check if the uuid is used or not
1796 * This function is used to check if the uuid is used or not.
1798 * This function is a synchronous call.
1800 * @param[in] service_uuid service uuid (UUID 128 bit as string)
1801 * @param[out] used if the uuid is used or not
1803 * @return BLUETOOTH_ERROR_NONE - Success \n
1804 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1805 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1806 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1811 gboolean used = FALSE;
1812 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1813 ret = bluetooth_is_service_used(uuid, &used);
1816 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1819 * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1820 * @brief Check if the device is connected to the specific service
1822 * This function is used to check if if the device is connected to the specific service.
1824 * This function is a synchronous call.
1826 * @param[in] local_address a device address of remote bluetooth device
1827 * @param[in] type the service type
1828 * @param[out] is_connected if the device is connected or not
1830 * @return BLUETOOTH_ERROR_NONE - Success \n
1831 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1832 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1833 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1838 gboolean is_connected = FALSE;
1839 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
1840 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
1843 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
1844 bluetooth_service_type_t type,
1845 gboolean *is_connected);
1848 * @fn int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address, bluetooth_connected_link_t *connected_link)
1849 * @brief Gets device's connected link type
1851 * This function is used to get device's connected link type
1853 * This function is a synchronous call.
1855 * @param[in] device_address a device address of remote bluetooth device
1856 * @param[out] connected_link a device's connected link type
1858 * @return BLUETOOTH_ERROR_NONE - Success \n
1859 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1860 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1861 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1866 bluetooth_connected_link_t *connected_link = BLUETOOTH_CONNECTED_LINK_NONE;
1867 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
1868 ret = bluetooth_get_connected_link(&device_address, &connected_link);
1871 int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address,
1872 bluetooth_connected_link_t *connected_link);
1875 * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
1876 * @brief Get the visibility mode
1879 * This function is used to get the discoverable mode (Visibility option). Depending upon the
1880 * visibity mode, the property of the device is determined whether it can be discoverable, non
1881 * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
1883 * This function is a synchronous call.
1886 * @return BLUETOOTH_ERROR_NONE - Success \n
1887 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1888 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1889 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1890 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1891 * @param[out] discoverable_mode current bluetooth discoverable mode
1893 * @see bluetooth_set_discoverable_mode
1895 bluetooth_discoverable_mode_t discoverable_mode_ptr;
1897 ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
1900 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
1903 * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1905 * @brief Set the visibility mode
1908 * This function is used to set the discoverable mode (Visibility option).
1910 * Many times user may want to keep his device discoverable so that when peer device is performing
1911 * device search, he/she can find user's device. Application programmer can keep the mode as
1912 * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
1913 * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
1914 * modes cause bluetooth adapter to consume more battery. Hence developer should generally
1915 * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
1917 * This function is a synchronous call.
1919 * @return BLUETOOTH_ERROR_NONE - Success \n
1920 * BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
1922 * @param[in] discoverable_mode the bluetooth discoverable mode to set
1923 * @param[in] timeout discoverable time in only limited discoverable mode (second), default: 0
1925 * @see bluetooth_get_discoverable_mode
1929 bluetooth_discoverable_mode_t mode;
1931 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
1932 ret = bluetooth_set_discoverable_mode (mode, 180);
1936 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
1941 * @fn int bluetooth_get_timeout_value(int *timeout)
1942 * @brief Get the visibility timeout value
1945 * This function is used to get the visibility timeout
1946 * Before calling this API make sure that the adapter is enabled.
1948 * This function is a synchronous call.
1951 * @return BLUETOOTH_ERROR_NONE - Success \n
1952 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1953 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
1954 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1955 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1956 * @param[out] timeout remain visibility timeout value
1958 * @see bluetooth_set_discoverable_mode
1962 ret = bluetooth_get_timeout_value (&timeout);
1965 int bluetooth_get_timeout_value(int *timeout);
1969 * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
1970 * unsigned int classOfDeviceMask)
1971 * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
1973 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
1974 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
1975 * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
1976 * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
1977 * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
1978 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
1979 * You will receive device address, device name, device class, rssi (received signal strength indicator).
1980 * please see bluetooth_device_info_t for more details.
1983 * This API provides searching options like max responses, discovery duration in seconds and class
1984 * of device mask to filter device search. some times there may be too many bluetooth devices in
1985 * vicinity of your device.in such scenario, application can request to reduce number of responces
1986 * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
1987 * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
1988 * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
1989 * application defined time. please note that discovery_duration should be mentioned in seconds.
1990 * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
1993 * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
1994 * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
1995 * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
1997 * This function is a asynchronous call.
1998 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
1999 * through registered callback function.
2001 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2002 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2004 * The completion or cancellation of the discovery is indicated by an
2005 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2007 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2010 * @return BLUETOOTH_ERROR_NONE - Success \n
2011 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2012 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2013 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2014 agent is not running \n
2016 * @param[in] max_response define the maximum response of the number of founded devices
2018 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
2019 * @param[in] classOfDeviceMask define classes of the device mask which user wants
2020 (refer to class of device)
2022 * @see bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2025 void bt_event_callback(int event, bluetooth_event_param_t *param)
2029 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
2031 bluetooth_device_info_t *device_info = NULL;
2032 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2034 device_info = (bluetooth_device_info_t *)param->param_data;
2035 memcpy(&searched_device, &device_info->device_address,
2036 sizeof(bluetooth_device_address_t));
2037 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2038 device_info->device_address.addr[0],
2039 device_info->device_address.addr[1],
2040 device_info->device_address.addr[2],
2041 device_info->device_address.addr[3],
2042 device_info->device_address.addr[4],
2043 device_info->device_address.addr[5]);
2046 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
2048 bluetooth_device_info_t *device_info = NULL;
2049 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
2051 device_info = (bluetooth_device_info_t *)param->param_data;
2052 memcpy(&searched_device, &device_info->device_address,
2053 sizeof(bluetooth_device_address_t));
2054 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2055 device_info->device_name.name,
2056 device_info->device_address.addr[0],
2057 device_info->device_address.addr[1],
2058 device_info->device_address.addr[2],
2059 device_info->device_address.addr[3],
2060 device_info->device_address.addr[4],
2061 device_info->device_address.addr[5]);
2065 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2066 printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2071 unsigned short max_response;
2072 unsigned short discovery_duration;
2073 unsigned classOfDeviceMask;
2077 discovery_duration =0;
2078 classOfDeviceMask =0;
2080 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
2085 int bluetooth_start_discovery(unsigned short max_response,
2086 unsigned short discovery_duration,
2087 unsigned int classOfDeviceMask);
2090 * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
2091 * unsigned short max_response,
2092 * unsigned short discovery_duration,
2093 * unsigned int classOfDeviceMask)
2094 * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
2096 * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
2097 * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
2098 * Please see bluetooth_start_discovery() for other parameters description.
2100 * This function is a asynchronous call.
2101 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2102 * through registered callback function.
2104 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2105 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2107 * The completion or cancellation of the discovery is indicated by an
2108 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2110 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2113 * @return BLUETOOTH_ERROR_NONE - Success \n
2114 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2115 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2116 * BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
2117 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2118 agent is not running \n
2120 * @param[in] role define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
2121 (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
2122 DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
2123 * @param[in] max_response define the maximum response of the number of founded devices
2125 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
2126 * @param[in] classOfDeviceMask define classes of the device mask which user wants
2127 (refer to class of device)
2129 * @see bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2132 unsigned short type;
2133 unsigned short max_response;
2134 unsigned short discovery_duration;
2135 unsigned classOfDeviceMask;
2140 discovery_duration =0;
2141 classOfDeviceMask =0;
2143 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
2148 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
2149 unsigned short max_response,
2150 unsigned short discovery_duration,
2151 unsigned int classOfDeviceMask);
2154 * @fn int bluetooth_cancel_discovery (void)
2155 * @brief Cancel the on-going device discovery operation
2158 * This function stops the on-going device discovery operation. This API has to be called after the
2159 * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
2160 * the bluetooth_start_discovery API
2162 * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
2163 * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
2164 * cancel the discover request once the user received the device to which he wish to connect.
2166 * This function is a asynchronous call.
2167 * If the call is success to cancel discovey then the application will receive
2168 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
2169 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2170 * BLUETOOTH_ERROR_NONE
2173 * @return BLUETOOTH_ERROR_NONE - Success \n
2174 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2175 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2176 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2177 other application \n
2178 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2180 * @see bluetooth_start_discovery
2182 void bt_event_callback(int event, bluetooth_event_param_t *param)
2186 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2187 TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2196 ret = bluetooth_cancel_discovery();
2199 int bluetooth_cancel_discovery(void);
2202 * @fn int bluetooth_start_le_discovery(void)
2203 * @brief Start the generic device discovery which finds the LE devices.
2205 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2206 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
2207 * It try to find LE devices. Bluetooth device address and name are
2208 * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
2209 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2210 * You will receive device address, device name, device class, rssi (received signal strength indicator).
2211 * please see bluetooth_device_info_t for more details.
2213 * This function is a asynchronous call.
2214 * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
2215 * through registered callback function.
2217 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
2220 * The completion or cancellation of the discovery is indicated by an
2221 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
2223 * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
2226 * @return BLUETOOTH_ERROR_NONE - Success \n
2227 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2228 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2229 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2230 agent is not running \n
2233 * @see bluetooth_stop_le_discovery, bluetooth_device_info_t
2236 void bt_event_callback(int event, bluetooth_event_param_t *param)
2240 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
2242 bluetooth_device_info_t *device_info = NULL;
2243 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2245 device_info = (bluetooth_device_info_t *)param->param_data;
2246 memcpy(&searched_device, &device_info->device_address,
2247 sizeof(bluetooth_device_address_t));
2248 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2249 device_info->device_address.addr[0],
2250 device_info->device_address.addr[1],
2251 device_info->device_address.addr[2],
2252 device_info->device_address.addr[3],
2253 device_info->device_address.addr[4],
2254 device_info->device_address.addr[5]);
2258 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2259 printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2265 ret = bluetooth_start_discovery();
2270 int bluetooth_start_le_discovery(void);
2273 * @fn int bluetooth_stop_le_discovery (void)
2274 * @brief Cancel the on-going device LE discovery operation
2277 * This function stops the on-going device discovery operation. This API has to be called after the
2278 * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
2279 * the bluetooth_start_le_discovery API
2282 * This function is a asynchronous call.
2283 * If the call is success to cancel discovey then the application will receive
2284 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
2285 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2286 * BLUETOOTH_ERROR_NONE
2289 * @return BLUETOOTH_ERROR_NONE - Success \n
2290 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2291 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2292 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2293 other application \n
2294 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2296 * @see bluetooth_start_discovery
2298 void bt_event_callback(int event, bluetooth_event_param_t *param)
2302 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2303 TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2312 ret = bluetooth_stop_le_discovery();
2315 int bluetooth_stop_le_discovery(void);
2318 * @fn int bluetooth_is_discovering(void)
2319 * @brief Check for the device discovery is in-progress or not.
2321 * This API is used to check the current status of the Discovery operation.If discovery is in\
2322 * progress normally other operations are not allowed.
2323 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2324 * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
2325 * event before performing other operations. This API is used to get for the current discovery
2326 * operation status and using bluetooth_cancel_discovery()
2327 * we can cancell the ongoing discovery process.
2328 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2331 * This function checks whether the device discovery is started or not.
2333 * This function is a synchronous call.
2336 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2337 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2338 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2341 * @see bluetooth_start_discovery, bluetooth_cancel_discovery
2345 ret = bluetooth_is_discovering ();
2348 int bluetooth_is_discovering(void);
2351 * @fn int bluetooth_is_le_discovering(void)
2352 * @brief Check for the device LE discovery is in-progress or not.
2354 * This API is used to check the current status of the LE Discovery operation.If discovery is in\
2355 * progress normally other operations are not allowed.
2356 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2357 * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
2358 * event before performing other operations. This API is used to get for the current discovery
2359 * operation status and using bluetooth_stop_le_discovery()
2360 * we can cancell the ongoing LE discovery process.
2361 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2364 * This function checks whether the device LE discovery is started or not.
2366 * This function is a synchronous call.
2369 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2370 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2371 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2374 * @see bluetooth_start_le_discovery, bluetooth_stop_le_discovery
2378 ret = bluetooth_is_le_discovering ();
2381 int bluetooth_is_le_discovering(void);
2384 * @fn int bluetooth_is_le_scanning(void)
2385 * @brief Check for the device LE scan is in-progress or not.
2387 * This API is used to check the current status of the LE Scan operation.If discovery is in\
2388 * progress normally other operations are not allowed.
2390 * This function checks whether the device LE Scan is started or not.
2392 * This function is a synchronous call.
2394 * @return TRUE - LE Scan in progress \n
2395 * FALSE - LE Scan is not in progress \n
2400 gboolean is_le_scanning = 0;
2401 is_le_scanning = bluetooth_is_le_scanning ();
2404 gboolean bluetooth_is_le_scanning(void);
2407 * @fn int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id)
2408 * @brief Register scan filter.
2410 * This function registers the scan filter.
2412 * This function is a synchronous call.
2414 * @return BLUETOOTH_ERROR_NONE - Success \n
2416 * @param[in] filter scan filter to register
2417 * @param[out] slot_id the slot ID of scan filter
2421 int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id);
2424 * @fn int bluetooth_unregister_scan_filter(int slot_id)
2425 * @brief Register scan filter.
2427 * This function unregisters the scan filter.
2429 * This function is a synchronous call.
2431 * @return BLUETOOTH_ERROR_NONE - Success \n
2433 * @param[in] slot_id the slot ID of scan filter
2437 int bluetooth_unregister_scan_filter(int slot_id);
2440 * @fn int bluetooth_unregister_all_scan_filters(void)
2441 * @brief Register scan filter.
2443 * This function usregisters all scan filters.
2445 * This function is a synchronous call.
2447 * @return BLUETOOTH_ERROR_NONE - Success \n
2451 int bluetooth_unregister_all_scan_filters(void);
2454 * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2455 int link_type, bt_rssi_threshold_t rssi_threshold)
2456 * @brief Enable RSSI monitoring
2458 * This function enables RSSI monitoring and sets threshold for a connection
2460 * @return BLUETOOTH_ERROR_NONE - Success \n
2463 * @see bluetooth_get_rssi_strength
2465 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2466 int link_type, bt_rssi_threshold_t *rssi_threshold);
2469 * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
2470 * @brief Gets Raw RSSI signal Strength
2472 * This function gives the Raw RSSI signal strength for a connection.
2474 * @return BLUETOOTH_ERROR_NONE - Success \n
2477 * @see bluetooth_enable_rssi
2479 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
2481 int bluetooth_set_connectable(gboolean is_connectable);
2483 int bluetooth_is_connectable(gboolean *is_connectable);
2486 * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
2487 * @brief Initiate a bonding process
2490 * This function initiates a bonding procedure with a peer device. The bonding procedure
2491 * enables authentication and optionally encryption on the Bluetooth link.
2493 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2494 * inititate the bonding request to the devices already in the paired list.
2496 * Usually we call this API after the device discovery.
2497 * This function is a asynchronous call.
2499 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2500 * mentioed result code
2501 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2502 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2503 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2504 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2505 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2507 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2508 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2511 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2514 * @return BLUETOOTH_ERROR_NONE - Success \n
2515 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2516 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2517 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2518 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2520 * @param[in] device_address This indicates an address of the device with which the pairing
2521 * should be initiated
2523 * @see bluetooth_cancel_bonding
2525 void bt_event_callback(int event, bluetooth_event_param_t *param)
2529 case BLUETOOTH_EVENT_BONDING_FINISHED:
2531 TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
2532 if (param->result >= BLUETOOTH_ERROR_NONE)
2534 bluetooth_device_info_t *device_info = NULL;
2535 device_info = (bluetooth_device_info_t *)param->param_data;
2536 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
2537 mjr[%#x] min[%#x] srv[%#x]",
2538 device_info->device_name.name,
2539 device_info->device_address.addr[0],
2540 device_info->device_address.addr[1],
2541 device_info->device_address.addr[2],
2542 device_info->device_address.addr[3],
2543 device_info->device_address.addr[4],
2544 device_info->device_address.addr[5],
2545 device_info->device_class.major_class,
2546 device_info->device_class.minor_class,
2547 device_info->device_class.service_class);
2561 bluetooth_device_address_t device_address={{0}};
2563 ret = bluetooth_bond_device(&device_address);
2567 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
2570 * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2571 * bluetooth_conn_type_t conn_type)
2572 * @brief Initiate a bonding process
2575 * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
2576 * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
2578 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2579 * inititate the bonding request to the devices already in the paired list.
2581 * Usually we call this API after the device discovery.
2582 * This function is a asynchronous call.
2584 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2585 * mentioed result code
2586 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2587 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2588 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2589 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2590 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2592 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2593 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2596 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2599 * @return BLUETOOTH_ERROR_NONE - Success \n
2600 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2601 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2602 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2603 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2605 * @param[in] device_address This indicates an address of the device with which pairing
2606 * should be initiated
2607 * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
2610 * @see bluetooth_cancel_bonding
2612 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2613 bluetooth_conn_type_t conn_type);
2616 * @fn int bluetooth_cancel_bonding(void)
2617 * @brief Cancel the on-going bonding process
2619 * This API is called to cancel the on-going bonding procedure. It should be called before the
2620 * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
2621 * This API is useful when the remote device is not responding to the bond request or we wish to
2622 * cancel the bonding request. In this case we need not wait for the timeout to happen.
2624 * This function is a synchronous call.
2626 * @return BLUETOOTH_ERROR_NONE - Success \n
2627 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
2628 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2631 * @see bluetooth_bond_device
2637 ret = bluetooth_cancel_bonding();
2640 int bluetooth_cancel_bonding(void);
2643 * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
2644 * @brief Remove bonding
2647 * To communicate with remote device over bluetooth link, user should bond with peer device.
2648 * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
2649 * API is used to remove peer device from the list. Please note that after removing the device
2650 * from bonded device list, you cannot communication with peer device until bonding happens again.
2652 * User can call this function by passing bluetooth device address of any bonded device. Please note
2653 * that after successful return of this function, any bluetooth application running on your device
2654 * will not be able to communicate with unbonded device until bond operation happens again using
2655 * bluetooth_bond_device()
2658 * This function is a asynchronous call. The request to remove the specified device from the bonded
2659 * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
2660 * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
2661 * in case if there is a problem in locating given bluetooth device address in bonded devices list
2665 * @return BLUETOOTH_ERROR_NONE - Success \n
2666 * BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
2667 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2668 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2669 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2670 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2671 * agent is not running \n
2672 * BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
2675 * @param[in] device_address This indicates an address of the device to remove bonding
2679 * @see bluetooth_bond_device, bluetooth_cancel_bonding
2682 void bt_event_callback(int event, bluetooth_event_param_t *param)
2685 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
2686 bluetooth_device_address_t *dev_addr = NULL;
2688 if (param->result == BLUETOOTH_ERROR_NONE) {
2689 dev_addr = (bluetooth_device_address_t *)param->param_data;
2691 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2692 dev_addr->addr[0], dev_addr->addr[1]
2693 dev_addr->addr[2], dev_addr->addr[3]
2694 dev_addr->addr[4], dev_addr->addr[5]
2705 bluetooth_device_address_t *device_address;
2707 // copy valid device address in device_address
2709 ret = bluetooth_unbond_device(device_address);
2712 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
2715 * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
2716 * @brief Get bonded(paired) device list
2719 * This API gets all bonded device list.
2720 * The devices in the bonded device list further can be used to perform the authorization by calling
2721 * bluetooth_authorize_device API.
2723 * This function is a synchronous call.
2724 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2725 * there is no valid information in the dev_list.
2726 * The len field in the dev_list represents the number of bonded devices. The data structure for
2727 * bonded device information is bluetooth_device_info_t.
2730 * @return BLUETOOTH_ERROR_NONE - Success \n
2731 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2733 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2735 void bt_get_bonded_devices(void)
2739 GPtrArray *devinfo = NULL;
2740 bluetooth_device_info_t *ptr;
2742 // allocate the g_pointer_array
2743 devinfo = g_ptr_array_new();
2745 ret = bluetooth_get_bonded_device_list(&devinfo);
2746 if (ret != BLUETOOTH_ERROR_NONE)
2748 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
2752 printf("g pointer arrary count : [%d]", devinfo->len);
2753 for (i=0; i<devinfo->len; i++)
2755 ptr = g_ptr_array_index(devinfo, i);
2758 printf("Name [%s]\n", ptr->device_name.name);
2759 printf("Major Class [%d]\n", ptr->device_class.major_class);
2760 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
2761 printf("Service Class [%d]\n", ptr->device_class.service_class);
2762 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2763 ptr->device_address.addr[0],
2764 ptr->device_address.addr[1], ptr->device_address.addr[2],
2765 ptr->device_address.addr[3],
2766 ptr->device_address.addr[4], ptr->device_address.addr[5]);
2773 // free g_pointer_array
2774 g_ptr_array_free(devinfo, TRUE);
2779 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
2782 * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2783 * bluetooth_device_info_t *dev_info)
2784 * @brief Get a bonded(paired) device
2787 * This API gets a bonded device.
2789 * This function is a synchronous call.
2790 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2791 * there is no valid information in the dev_info.
2792 * The data structure for bonded device information is bluetooth_device_info_t.
2795 * @return BLUETOOTH_ERROR_NONE - Success \n
2796 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2798 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2800 void bt_get_bonded_device(void)
2804 bluetooth_device_info_t devinfo = {0};
2805 bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
2807 ret = bluetooth_get_bonded_device(&device_address, &devinfo);
2808 if (ret != BLUETOOTH_ERROR_NONE)
2810 printf("bluetooth_get_bonded_device failed with [%d]",ret);
2814 printf("Name [%s]\n", devinfo.device_name.name);
2815 printf("Major Class [%d]\n", devinfo.device_class.major_class);
2816 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
2817 printf("Service Class [%d]\n", devinfo.device_class.service_class);
2818 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
2819 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
2820 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
2821 devinfo.device_address.addr[5]);
2830 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2831 bluetooth_device_info_t *dev_info);
2834 * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
2835 * @brief set alias for bonded device
2838 * This function set alias for bonded device.
2840 * This function is a synchronous call.
2843 * @return BLUETOOTH_ERROR_NONE - Success \n
2844 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2845 * @param[in] device_address This indicates an address of the remote device
2846 * @param[in] alias This indicates an alias to set
2851 ret = bluetooth_set_alias(&remote_address);
2854 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
2858 * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
2859 * @brief Get remote deivice
2862 * This function gets specific remote device.
2864 * This function is a asynchronous call.
2865 * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
2868 * @return BLUETOOTH_ERROR_NONE - Success \n
2869 * BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
2870 * @param[in] device_address This indicates an address of the remote device
2875 ret = bluetooth_get_remote_device(&remote_address);
2878 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
2881 * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
2882 * gboolean authorized)
2883 * @brief Authorize/Unauthorize a bonded device
2886 * This function authorizes/unauthorize a bonded device. It decides the device to connect
2887 * with/without user confirmation.
2889 * If we select a paired device and make it authorized by calling this API with the authorized
2890 * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
2891 * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
2892 * then it will ask for the user conformation before the connection.
2894 * This API supposed to be called on the paired devices. Which means we have to use this API only
2895 * after successful pairing.
2897 * This function is a asynchronous call.
2898 * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
2900 * @return BLUETOOTH_ERROR_NONE - Success \n
2901 * @exception BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
2902 * @param[in] device_address This indicates an address of the device to authorize \n
2903 * @param[in] authorized TRUE : authorize FALSE: unauthorize
2905 * @see bluetooth_get_bonded_device_list
2907 void bt_event_callback(int event, bluetooth_event_param_t *param)
2911 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
2913 if (param->result == BLUETOOTH_ERROR_NONE)
2917 //device authorization failed failure
2925 bluetooth_device_address_t device_address={{0}};
2926 gboolean authorized;
2930 ret = bluetooth_authorize_device(&device_address,authorized);
2933 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
2934 gboolean authorized);
2937 * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
2938 * @brief Get all services supported by remote device
2941 * This API call initiates the search for the services supported by the specified device. Normally
2942 * the service search will take a couple of seconds to get it completed. Before calling this API
2943 * make sure that the Adapter is enabled. We have to give the device address of the remote device to
2944 * perform the service search. We can get the device address by doing a device discovery operation.
2947 * This function is a asynchronous call.
2948 * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
2950 * There is a timeout associated with the service search. The default time out is 40 seconds. If the
2951 * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
2952 * event is generated with appropriate result code.
2954 * @return BLUETOOTH_ERROR_NONE - Success \n
2955 * BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
2956 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2957 * @param[in] device_address This indicates an address of the device
2958 * whose services need to be found
2960 * @see bluetooth_cancel_service_search
2962 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
2965 * @fn int bluetooth_cancel_service_search(void)
2966 * @brief Cancel the ongoing service search operation
2969 * This function cancel the ongoing service search operation. This API is usually calling after the
2970 * bluetooth_search_service API.
2971 * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
2972 * if the user wish to cancel the Ongoing service search operation.
2974 * This API should be called just after the bluetooth_search_service API and before the
2975 * BLUETOOTH_EVENT_SERVICE_SEARCHED event
2977 * This function is a synchronous call.
2979 * @return BLUETOOTH_ERROR_NONE - Success \n
2980 * BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
2981 * BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
2982 * BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
2985 * @see bluetooth_search_service
2990 ret = bluetooth_cancel_service_search();
2993 int bluetooth_cancel_service_search(void);
2996 * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
2997 * @brief Register rfcomm socket with a specific uuid
3000 * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3001 * descriptor of the server.
3002 * This is the first API which is called to create the server. Once we created the server socket,
3003 * we will listen on that return socket.
3004 * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
3007 * @return socket FD on Success \n
3008 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3009 * BLUETOOTH_ERROR_INTERNAL - Internal error\n
3010 * BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3011 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3012 * @param[in] UUID (128 bits)
3015 * @see bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
3019 const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3020 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3024 int bluetooth_rfcomm_create_socket(const char *uuid);
3027 * @fn int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path)
3028 * @brief Register rfcomm socket with a specific uuid
3031 * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3032 * descriptor of the server.
3033 * This is the first API which is called to create the server. Once we created the server socket,
3034 * we will listen on that return socket.
3035 * So a bluetooth_rfcomm_listen_and_accept_ex should follow this API call. This is a synchronous call.
3038 * @return socket FD on Success \n
3039 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3040 * BLUETOOTH_ERROR_INTERNAL - Internal error\n
3041 * BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3042 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3043 * @param[in] UUID (128 bits)
3044 * @param[in] bus_name (const char)
3045 * @param[in] path (const char)
3048 * @see bluetooth_rfcomm_listen_and_accept_ex, bluetooth_rfcomm_remove_socket
3052 const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3053 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, bus_name, path);
3057 int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path);
3060 * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
3061 * @brief De-register the rfcomm socket
3064 * This API deregister rfcomm socket with the given socket fd and UUID. If the remote device is
3065 * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3066 * descriptor else no event will come. We will call this API only after the
3067 * bluetooth_rfcomm_listen_and_accept.
3068 * This is a synchronous call.
3070 * @return BLUETOOTH_ERROR_NONE - Success \n
3071 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3072 * BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3073 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3074 * @param[in] int socket_fd
3077 * @see bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
3080 void bt_event_callback(int event, bluetooth_event_param_t *param)
3084 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3086 bluetooth_rfcomm_connection_t *discon_ind =
3087 (bluetooth_rfcomm_connection_t *)param->param_data;
3089 printf("\nDisconnected from FD %d", discon_ind->socket_fd);
3097 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3098 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3100 ret = bluetooth_rfcomm_remove_socket(fd);
3103 int bluetooth_rfcomm_remove_socket(int socket_fd);
3106 * @fn int bluetooth_rfcomm_remove_socket(const char *uuid)
3107 * @brief De-register the rfcomm socket
3110 * This API deregister rfcomm socket with the given socket UUID. If the remote device is
3111 * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3112 * descriptor else no event will come. We will call this API only after the
3113 * bluetooth_rfcomm_listen_and_accept_ex.
3114 * This is a synchronous call.
3116 * @return BLUETOOTH_ERROR_NONE - Success \n
3117 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3118 * BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3119 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3120 * @param[in] UUID (128 bits)
3123 * @see bluetooth_rfcomm_create_socket_ex, bluetooth_rfcomm_listen_and_accept_ex
3126 void bt_event_callback(int event, bluetooth_event_param_t *param)
3130 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3132 bluetooth_rfcomm_connection_t *discon_ind =
3133 (bluetooth_rfcomm_connection_t *)param->param_data;
3135 printf("\nDisconnected from FD %d", discon_ind->socket_fd);
3143 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, path, bus_name);
3144 ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3146 ret = bluetooth_rfcomm_remove_socket_ex(rfcomm_test_uuid);
3149 int bluetooth_rfcomm_remove_socket_ex(const char *uuid);
3152 * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
3153 * @brief Disconnect rfcomm connection
3156 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
3157 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3160 * @return BLUETOOTH_ERROR_NONE - Success \n
3161 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3162 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3163 * @param[in] int socket_fd the sending socket fd
3169 ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
3171 printf("Disconnection failed");
3173 printf("Disconnection Success");
3177 int bluetooth_rfcomm_server_disconnect(int socket_fd);
3180 * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
3181 * @brief Rfcomm socket listen
3184 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3185 * after the bluetooth_rfcomm_create_socket API.
3186 * This API listen for the incomming connection and once it receives a connection, it will give
3187 * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3188 * event to the application. This is an Asynchronous API call.
3191 * @return BLUETOOTH_ERROR_NONE - Success \n
3192 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3193 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3195 * @param[in] int socket_fd
3196 * @param[in] max pending connection.
3199 * @see bluetooth_rfcomm_create_socket
3202 void bt_event_callback(int event, bluetooth_event_param_t* param)
3206 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3208 bluetooth_rfcomm_connection_t *conn_ind =
3209 (bluetooth_rfcomm_connection_t *)param->param_data;
3211 printf("\nConnected from FD %d", conn_ind->socket_fd);
3219 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3220 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3224 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
3227 * @fn int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path)
3228 * @brief Rfcomm socket listen
3231 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3232 * after the bluetooth_rfcomm_create_socket API.
3233 * This API listen for the incomming connection and once it receives a connection, it will give
3234 * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3235 * event to the application. This is an Asynchronous API call.
3238 * @return BLUETOOTH_ERROR_NONE - Success \n
3239 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3240 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3242 * @param[in] int socket_fd
3243 * @param[in] max pending connection.
3248 * @see bluetooth_rfcomm_create_socket_ex
3251 void bt_event_callback(int event, bluetooth_event_param_t* param)
3255 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3257 bluetooth_rfcomm_connection_t *conn_ind =
3258 (bluetooth_rfcomm_connection_t *)param->param_data;
3260 printf("\nConnected from FD %d", conn_ind->socket_fd);
3268 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid);
3269 ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3274 int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path);
3277 * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
3278 * @brief Rfcomm socket listen
3281 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3282 * after the bluetooth_rfcomm_create_socket API.
3283 * This API listen for the incomming connection and once it receives a connection, it will give
3284 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
3285 * event to the application. This is an Asynchronous API call.
3288 * @return BLUETOOTH_ERROR_NONE - Success \n
3289 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3290 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3292 * @param[in] int socket_fd
3293 * @param[in] max pending connection.
3296 * @see bluetooth_rfcomm_create_socket
3299 void bt_event_callback(int event, bluetooth_event_param_t* param)
3303 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
3305 char *name = (char *)param->param_data;
3307 printf("\nConnected from %s", name);
3309 bluetooth_rfcomm_accept_connection();
3317 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3318 ret = bluetooth_rfcomm_listen(fd, 1);
3322 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
3325 * @fn int bluetooth_rfcomm_accept_connection()
3326 * @brief Accepts the authorization request indicated by the event
3327 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3329 * This function is a synchronous call.
3331 * @return BLUETOOTH_ERROR_NONE - Success \n
3332 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3334 * @param[in] the socket fd of the server
3335 * @param[out] the socket fd of the client
3339 * @see bluetooth_rfcomm_reject_connection
3341 int bluetooth_rfcomm_accept_connection(int server_fd);
3344 * @fn int bluetooth_rfcomm_reject_connection()
3345 * @brief Rejects the authorization request indicated by the event
3346 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3348 * This function is a synchronous call.
3350 * @return BLUETOOTH_ERROR_NONE - Success \n
3351 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3353 * @param[in] the socket fd of the server
3357 * @see bluetooth_rfcomm_accept_connection
3359 int bluetooth_rfcomm_reject_connection(int server_fd);
3362 * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
3363 * @brief Informs whether rfcomm server uuid is available or not.
3365 * This function is a synchronous call.
3367 * @return TRUE - RFCOMM uuid is available \n
3368 * FALSE - RFCOMM uuid is not available \n
3370 * @param[in] uuid UUID string
3376 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
3379 * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3380 * const char *remote_uuid)
3381 * @brief Connect to the remote device rfcomm *
3383 * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
3384 * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
3385 * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
3386 * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
3387 * initiating a connection.
3389 * @return BLUETOOTH_ERROR_NONE - Success \n
3390 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3391 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3392 * BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
3393 * BLUETOOTH_ERROR_INTERNAL - Internal Error\n
3394 * @param[in] bluetooth_device_address_t remote bt_address
3395 * @param[in] char remote uuid
3397 * @see bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
3401 void bt_event_callback(int event, bluetooth_event_param_t *param)
3405 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
3407 if (param->result >= BLUETOOTH_ERROR_NONE)
3409 bt_sdp_info_t *bt_sdp_info=param->param_data;
3411 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3412 bt_sdp_info->device_addr.addr[0],
3413 bt_sdp_info->device_addr.addr[1],
3414 bt_sdp_info->device_addr.addr[2],
3415 bt_sdp_info->device_addr.addr[3],
3416 bt_sdp_info->device_addr.addr[4],
3417 bt_sdp_info->device_addr.addr[5]);
3419 printf("Supported service list:\n");
3420 for(i=0; i<bt_sdp_info->service_index; i++)
3422 bt_sdp_info->service_list_array[i]);
3425 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
3426 //rfcomm_test_uuid);
3430 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3432 bluetooth_rfcomm_connection_t *conn_ind =
3433 (bluetooth_rfcomm_connection_t *)param->param_data;
3435 printf("\nConnected from FD %d, Role = %s", conn_ind->socket_fd,
3436 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
3437 "SERVER" : "CLIENT");
3442 bluetooth_device_address_t remote_address = {{0},};
3443 remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
3444 remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19; remote_address.addr[5]= 0x36;
3445 ret = bluetooth_search_service(&remote_address);
3447 printf("Seach failed, Reason = %d", ret);
3449 printf("Search Success, Ret = %d", ret);
3451 ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
3453 printf("Connection failed, Reason = %d", ret);
3455 printf("Connection Success, Ret = %d", ret);
3459 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3460 const char *remote_uuid);
3463 * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
3464 * @brief Disconnect rfcomm connection
3467 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
3468 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3471 * @return BLUETOOTH_ERROR_NONE - Success \n
3472 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3473 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3474 * @param[in] char remote bt_address
3477 * @see bluetooth_rfcomm_connect
3481 ret = bluetooth_rfcomm_disconnect(g_ret_fd);
3483 printf("Disconnection failed");
3485 printf("Disconnection Success");
3490 int bluetooth_rfcomm_disconnect(int socket_fd);
3493 * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
3494 * @brief Write to rfcomm connection
3497 * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
3498 * API is used to send the data for server and the client.
3500 * @return BLUETOOTH_ERROR_NONE - Success \n
3501 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3502 * BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
3504 * @param[in] const char *buff Data buffer to send
3505 * @param[in] int length Length of the data
3508 * @see bluetooth_rfcomm_connect
3511 char *buff = "Test data 123456789"
3512 ret = bluetooth_rfcomm_write(g_ret_fd, buff, 15);
3514 printf("Send failed");
3516 printf("Send success");
3520 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
3523 * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
3524 * @brief Informs whether rfcomm client is connected.
3526 * This function is a synchronous call.
3528 * @return TRUE - RFCOMM client is connected \n
3529 * FALSE - RFCOMM client is not connected \n
3535 gboolean bluetooth_rfcomm_is_client_connected(void);
3536 int bluetooth_rfcomm_client_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3537 int bluetooth_rfcomm_server_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3540 * @fn int bluetooth_network_activate_server(void)
3541 * @brief Activate the NAP (Network Access Point) service
3543 * This function is a asynchronous call.
3544 * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
3546 * @return BLUETOOTH_ERROR_NONE - Success \n
3547 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3548 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3549 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3552 * @see bluetooth_network_deactivate_server
3555 int bluetooth_network_activate_server(void);
3558 * @fn int bluetooth_network_deactivate_server(void)
3559 * @brief Deactivate the NAP (Network Access Point) service
3561 * This function is a asynchronous call.
3562 * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
3564 * @return BLUETOOTH_ERROR_NONE - Success \n
3565 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3566 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3567 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3570 * @see bluetooth_network_activate_server
3573 int bluetooth_network_deactivate_server(void);
3576 * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3577 * bluetooth_network_role_t role,
3579 * @brief Connect the network server in the peer
3581 * This function is a asynchronous call.
3582 * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3584 * @return BLUETOOTH_ERROR_NONE - Success \n
3585 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3586 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3587 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3590 * @param[in] device_address This indicates an address of the device with which the pairing
3591 * should be initiated
3592 * @param[in] role The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
3593 * need to use the third parameter.
3594 * @param[in] custom_uuid If use the CUSTOM value in second parameter, use this parameter to
3595 * connect. UUID string
3597 * @see bluetooth_network_disconnect
3599 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3600 bluetooth_network_role_t role, char *custom_uuid);
3603 * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
3604 * bluetooth_network_role_t role,
3605 * char *custom_uuid)
3606 * @brief Connect the network server in the peer
3608 * This function is a asynchronous call.
3609 * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3611 * @return BLUETOOTH_ERROR_NONE - Success \n
3612 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3613 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3614 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3617 * @param[in] device_address This indicates an address of the device with which the pairing
3618 * should be initiated
3620 * @see bluetooth_network_connect
3622 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
3625 * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
3626 * @brief Disconnect the device from the network
3628 * This function is an asynchronous call.
3629 * The network server disconnect request is responded by
3630 * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
3632 * @return BLUETOOTH_ERROR_NONE - Success \n
3633 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3634 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3635 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3638 * @param[in] device_address This indicates an address of the connected client device
3640 * @see bluetooth_network_activate_server
3642 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
3647 * @fn int bluetooth_hdp_activate(unsigned short data_type,
3648 * bt_hdp_role_type_t role,
3649 * bt_hdp_qos_type_t channel_type,
3650 * char **app_handle)
3651 * @brief Activate the HDP service for a particular data type
3653 * This function is a synchronous call.
3655 * @return BLUETOOTH_ERROR_NONE - Success \n
3656 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3657 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3658 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3661 * @param[in] data_type The data type against corresponding service
3662 * @param[in] role The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
3663 * @param[in] channel_type The QOS type for the channel.
3664 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
3665 * For role = HDP_ROLE_SINK, the channel_type
3666 * should be HDP_QOS_ANY.
3667 * @param[out] app_handle The application handler against corresponding service
3669 * @see bluetooth_hdp_deactivate
3671 int bluetooth_hdp_activate(unsigned short data_type,
3672 bt_hdp_role_type_t role,
3673 bt_hdp_qos_type_t channel_type,
3676 * @fn int bluetooth_hdp_deactivate(const char *app_handle)
3677 * @brief Deactivate the HDP service for a particular service using the handler
3679 * This function is a synchronous call.
3681 * @return BLUETOOTH_ERROR_NONE - Success \n
3682 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3683 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3684 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3687 * @param[in] app_handle The application handler against corresponding service
3689 * @see bluetooth_hdp_deactivate
3691 int bluetooth_hdp_deactivate(const char *app_handle);
3694 * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
3695 * const char *buffer, unsigned int size)
3696 * @brief Send data to the remote HDP device
3698 * This function is a synchronous call.
3700 * @return BLUETOOTH_ERROR_NONE - Success \n
3701 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3702 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3703 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3704 * BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid \n
3707 * @param[in] channel_id The channel id for the connection.
3708 * @param[in] buffer The pdu buffer.
3709 * @param[in] size Size of the buffer.
3711 * @see bluetooth_hdp_connect
3713 int bluetooth_hdp_send_data(unsigned int channel_id,
3714 const char *buffer, unsigned int size);
3716 * @fn int bluetooth_hdp_connect(const char *app_handle,
3717 * bt_hdp_qos_type_t channel_type,
3718 * const bluetooth_device_address_t *device_address)
3719 * @brief Connect to the remote device(Mainly used by source)
3721 * This function is a asynchronous call.
3722 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
3724 * @return BLUETOOTH_ERROR_NONE - Success \n
3725 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3726 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3727 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3728 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3731 * @param[in] app_handle The application handler against corresponding service
3732 * @param[in] channel_type The QOS type for the channel.
3733 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
3734 * @param[in] device_address The remote device Bd address.
3737 * @see bluetooth_hdp_disconnect
3739 int bluetooth_hdp_connect(const char *app_handle,
3740 bt_hdp_qos_type_t channel_type,
3741 const bluetooth_device_address_t *device_address);
3743 * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
3744 * const bluetooth_device_address_t *device_address)
3745 * @brief Disconnect from the remote device(Mainly used by source)
3747 * This function is a asynchronous call.
3748 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
3750 * @return BLUETOOTH_ERROR_NONE - Success \n
3751 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3752 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3753 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3754 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3757 * @param[in] channel_id The channel id for the connection.
3758 * @param[in] device_address The remote device Bd address.
3761 * @see bluetooth_hdp_connect
3763 int bluetooth_hdp_disconnect(unsigned int channel_id,
3764 const bluetooth_device_address_t *device_address);
3768 * @fn int bluetooth_opc_init(void)
3769 * @brief Initialize OPP client.
3771 * This function is a synchronous call.
3772 * No event corresponding to this api
3774 * @return BLUETOOTH_ERROR_NONE - Success \n
3775 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3776 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3777 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3778 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3783 * @see bluetooth_opc_deinit
3785 int bluetooth_opc_init(void);
3788 * @fn int bluetooth_opc_deinit(void)
3789 * @brief Deinitialize OPP client.
3791 * This function is a synchronous call.
3792 * No event corresponding to this api
3794 * @return BLUETOOTH_ERROR_NONE - Success \n
3795 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3796 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3801 * @see bluetooth_opc_init
3804 int bluetooth_opc_deinit(void);
3807 * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
3808 char **file_name_array)
3809 * @brief Send multiple files to a remote device.
3811 * This function is a asynchronous call.
3812 * This api is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
3814 * @return BLUETOOTH_ERROR_NONE - Success \n
3815 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3816 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3817 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3818 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3819 * BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
3820 * BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
3823 * @param[in] device_address The remote device Bd address.
3824 * @param[in] file_name_array Array of filepaths to be sent.
3827 * @see bluetooth_opc_cancel_push
3830 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
3831 char **file_name_array);
3834 * @fn int bluetooth_opc_cancel_push(void)
3835 * @brief Cancels the ongoing file push.
3837 * This function is a asynchronous call.
3838 * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
3839 * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
3841 * @return BLUETOOTH_ERROR_NONE - Success \n
3842 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3843 * BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
3848 * @see bluetooth_opc_push_files
3851 int bluetooth_opc_cancel_push(void);
3854 * @fn gboolean bluetooth_opc_session_is_exist(void)
3855 * @brief Informs whether opc session exists or not.
3857 * This function is a synchronous call.
3859 * @return TRUE - OPC session exists \n
3860 * FALSE - OPC session does not exist \n
3868 gboolean bluetooth_opc_session_is_exist(void);
3871 * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
3872 * @brief Informs whether opc session exists or not.
3874 * This function is a synchronous call.
3876 * @return BLUETOOTH_ERROR_NONE - Success \n
3877 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3878 * BLUETOOTH_ERROR_INTERNAL \n
3881 * @param[out] is_sending The sending status: (@c TRUE = in sending , @c false = not in sending)
3886 int bluetooth_opc_is_sending(gboolean *is_sending);
3889 * @fn int bluetooth_obex_server_init(const char *dst_path)
3890 * @brief Initialize OPP and FTP server.
3892 * This function is a synchronous call.
3893 * No event corresponding to this api
3895 * @return BLUETOOTH_ERROR_NONE - Success \n
3896 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3897 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3898 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
3899 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3902 * @param[in] dst_path OPS destination file path.
3904 * @see bluetooth_obex_server_deinit
3906 int bluetooth_obex_server_init(const char *dst_path);
3910 * @fn int bluetooth_obex_server_deinit(void)
3911 * @brief Deinitialize OPP and FTP server.
3913 * This function is a synchronous call.
3914 * No event corresponding to this api
3916 * @return BLUETOOTH_ERROR_NONE - Success \n
3917 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3918 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3923 * @see bluetooth_obex_server_init
3925 int bluetooth_obex_server_deinit(void);
3929 * @fn gboolean bluetooth_obex_server_is_activated(void)
3930 * @brief Informs whether obex server is activated or not.
3932 * This function is a synchronous call.
3934 * @return TRUE - OBEX server is activated \n
3935 * FALSE - OBEX server is not activated \n
3942 gboolean bluetooth_obex_server_is_activated(void);
3946 * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
3947 * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
3949 * This function is a synchronous call.
3950 * No event corresponding to this api
3952 * @return BLUETOOTH_ERROR_NONE - Success \n
3953 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3954 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3955 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
3956 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3960 * @param[in] dst_path OPS destination file path.
3962 * @see bluetooth_obex_server_deinit_without_agent
3964 int bluetooth_obex_server_init_without_agent(const char *dst_path);
3968 * @fn int bluetooth_obex_server_deinit_without_agent(void)
3969 * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
3971 * This function is a synchronous call.
3972 * No event corresponding to this api
3974 * @return BLUETOOTH_ERROR_NONE - Success \n
3975 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3976 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
3981 * @see bluetooth_obex_server_init_without_agent
3983 int bluetooth_obex_server_deinit_without_agent(void);
3987 * @fn int bluetooth_obex_server_accept_connection(void)
3988 * @brief Accepts the authorization request indicated by the event
3989 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
3991 * This function is a synchronous call.
3993 * @return BLUETOOTH_ERROR_NONE - Success \n
3994 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3995 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3999 * @see bluetooth_obex_server_reject_authorize
4001 int bluetooth_obex_server_accept_connection(void);
4005 * @fn int bluetooth_obex_server_reject_connection(void)
4006 * @brief Rejects the authorization request indicated by the event
4007 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4009 * This function is a synchronous call.
4011 * @return BLUETOOTH_ERROR_NONE - Success \n
4012 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4013 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
4017 * @see bluetooth_obex_server_reject_authorize
4019 int bluetooth_obex_server_reject_connection(void);
4023 * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
4024 * @brief Accepts the authorization request indicated by the event
4025 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4027 * This function is a asynchronous call.
4028 * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
4030 * @return BLUETOOTH_ERROR_NONE - Success \n
4031 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4032 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4033 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4036 * @param[in] filename Authorized filename.
4039 * @see bluetooth_obex_server_reject_authorize
4042 int bluetooth_obex_server_accept_authorize(const char *filename);
4045 * @fn int bluetooth_obex_server_reject_authorize(void)
4046 * @brief Reject the authorization request indicated by the event
4047 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4049 * This function is a asynchronous call.
4050 * No event for this api..
4052 * @return BLUETOOTH_ERROR_NONE - Success \n
4053 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4054 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4059 * @see bluetooth_obex_server_accept_authorize
4062 int bluetooth_obex_server_reject_authorize(void);
4065 * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
4066 * @brief Set the OPS destination file path..
4068 * This function is a asynchronous call.
4069 * No event for this api..
4071 * @return BLUETOOTH_ERROR_NONE - Success \n
4072 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4073 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4074 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
4077 * @param[in] dst_path OPS destination file path.
4083 int bluetooth_obex_server_set_destination_path(const char *dst_path);
4086 * @fn int bluetooth_obex_server_set_root(const char *root)
4087 * @brief Set the FTS root folder..
4089 * This function is a asynchronous call.
4090 * No event for this api..
4092 * @return BLUETOOTH_ERROR_NONE - Success \n
4093 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4094 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4095 * BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
4096 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4097 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4100 * @param[in] root FTS root folder.
4106 int bluetooth_obex_server_set_root(const char *root);
4109 * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
4110 * @brief Cancel the transfer on server
4112 * This function is an asynchronous call.
4113 * If the function call that cancels transfer is successful, the application would receive
4114 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4115 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4116 * the error code will be BLUETOOTH_ERROR_NONE
4118 * @return BLUETOOTH_ERROR_NONE - Success \n
4119 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4120 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4121 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4122 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4125 * @param[in] transfer_id transfer ID
4130 int bluetooth_obex_server_cancel_transfer(int transfer_id);
4134 * @fn int bluetooth_obex_server_cancel_all_transfers(void)
4135 * @brief Cancel the transfer on server
4137 * This function is an asynchronous call.
4138 * If the function call that cancels transfer is successful, the application would receive
4139 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4140 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4141 * the error code will be BLUETOOTH_ERROR_NONE
4143 * @return BLUETOOTH_ERROR_NONE - Success \n
4144 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4145 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4146 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4147 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4154 int bluetooth_obex_server_cancel_all_transfers(void);
4158 * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
4159 * @brief Informs whether obex server is receiving or not.
4161 * This function is a synchronous call.
4163 * @return BLUETOOTH_ERROR_NONE - Success \n
4164 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4165 * BLUETOOTH_ERROR_INTERNAL \n
4168 * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c false = not in receiving)
4173 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
4177 * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
4178 * @brief Read the local Hash and Randmizer.
4180 * This function is a synchronous call.
4182 * @return BLUETOOTH_ERROR_NONE - Success \n
4183 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4187 * @param[out] local_oob_data - Pointer to the local OOB data
4193 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
4197 * @fn int bluetooth_oob_add_remote_data(
4198 * const bluetooth_device_address_t *remote_device_address,
4199 * bt_oob_data_t *oob_data)
4200 * @brief Add/updated the remote device Hash and Randmizer.
4202 * This function is a synchronous call.
4203 * No event for this api..
4205 * @return BLUETOOTH_ERROR_NONE - Success \n
4206 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4209 * @param[in] remote_device_address - Remote device address
4210 * remote_oob_data - Ponter to Hash and Randomizer oob data structure
4216 int bluetooth_oob_add_remote_data(
4217 const bluetooth_device_address_t *remote_device_address,
4218 bt_oob_data_t *remote_oob_data);
4222 * @fn int bluetooth_oob_remove_remote_data(
4223 * const bluetooth_device_address_t *remote_device_address)
4224 * @brief Delete the Hash and Randomizer w.r.t the remote device address.
4226 * This function is a synchronous call.
4227 * No event for this api..
4229 * @return BLUETOOTH_ERROR_NONE - Success \n
4230 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4233 * @param[in] remote_device_address - Remote device address
4239 int bluetooth_oob_remove_remote_data(
4240 const bluetooth_device_address_t *remote_device_address);
4243 * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4244 * bt_gatt_handle_info_t *prim_svc);
4246 * @brief Gets the GATT based primary services handle supported by remote device
4248 * This function is a synchronous call.
4249 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4251 * @return BLUETOOTH_ERROR_NONE - Success \n
4252 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4253 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4254 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4257 * @param[in] address - Remote device address
4258 * @param[out] prim_svc - Structure containing remote service count and handle list.
4261 * @see bluetooth_gatt_free_primary_services()
4263 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4264 bt_gatt_handle_info_t *prim_svc);
4267 * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
4269 * @brief Discovers the characteristics of GATT based service of remote device
4271 * This function is an asynchronous call.
4272 * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
4274 * @return BLUETOOTH_ERROR_NONE - Success \n
4275 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4276 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4277 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4280 * @param[in] service_handle - Handle for remote service.
4285 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
4288 * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
4289 * bt_gatt_service_property_t *service);
4291 * @brief Gets the properties of GATT based service of remote device
4293 * This function is a synchronous call.
4294 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4296 * @return BLUETOOTH_ERROR_NONE - Success \n
4297 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4298 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4299 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4302 * @param[in] service_handle - Handle for remote service.
4303 * @param[out] service - Structure containing remote service property.
4306 * @see bluetooth_gatt_free_service_property()
4308 int bluetooth_gatt_get_service_property(const char *service_handle,
4309 bt_gatt_service_property_t *service);
4312 * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
4314 * @brief Register to GATT based service to receive value change notification/indication.
4316 * This function is a synchronous call.
4317 * No event for this api.
4319 * @return BLUETOOTH_ERROR_NONE - Success \n
4320 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4321 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4322 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4325 * @param[in] service_handle - Handle for remote service.
4330 int bluetooth_gatt_watch_characteristics(const char *service_handle);
4333 * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
4335 * @brief Unregister GATT based service to receive value change notification/indication.
4337 * This function is a synchronous call.
4338 * No event for this api.
4340 * @return BLUETOOTH_ERROR_NONE - Success \n
4341 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4342 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4343 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4346 * @param[in] service_handle - Handle for remote service.
4351 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
4354 * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4355 * bt_gatt_char_property_t *characteristic);
4357 * @brief Provides characteristic value along with properties.
4359 * This function is a synchronous call.
4360 * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
4362 * @return BLUETOOTH_ERROR_NONE - Success \n
4363 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4364 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4365 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4368 * @param[in] char_handle - Handle for Characteristic property.
4369 * @param[out] characteristic - Structure containing remote characteristic property.
4372 * @see bluetooth_gatt_free_char_property()
4374 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4375 bt_gatt_char_property_t *characteristic);
4378 * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
4379 * bt_gatt_char_property_t *characteristic);
4381 * @brief Provides characteristic descriptor value along with its UUID.
4383 * This function is a synchronous call.
4384 * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
4386 * @return BLUETOOTH_ERROR_NONE - Success \n
4387 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4388 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4389 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4392 * @param[in] desc_handle - Handle for Characteristic descriptor.
4393 * @param[out] descriptor - Structure containing remote characteristic descriptor property.
4396 * @see bluetooth_gatt_free_desc_property()
4398 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
4399 bt_gatt_char_descriptor_property_t *descriptor);
4403 * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4404 * const guint8 *value, int length)
4406 * @brief Set characteristic value.
4408 * This function is a synchronous call.
4410 * @return BLUETOOTH_ERROR_NONE - Success \n
4411 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4412 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4413 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4416 * @param[in] char_handle - Handle for Characteristic property.
4417 * @param[in] value - New value to set for characteristic property.
4418 * @param[in] length - Length of the value to be set.
4423 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4424 const guint8 *value, int length);
4427 * @fn int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4428 * const guint8 *value, int length, guint8 write_type)
4430 * @brief Set characteristic value by write type.
4432 * This function is a synchronous call if write type is "write without resonse"
4433 * and it is an asynchronous call if write type is "write with response"
4435 * @return BLUETOOTH_ERROR_NONE - Success \n
4436 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4437 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4438 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4441 * @param[in] char_handle - Handle for Characteristic property.
4442 * @param[in] value - New value to set for characteristic property.
4443 * @param[in] length - Length of the value to be set.
4444 * @param[in] write_type - Type of write.
4449 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4450 const guint8 *value, int length, guint8 write_type);
4454 * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4455 * const guint8 *value, int length)
4457 * @brief Set characteristic value request.
4459 * This function is an asynchronous call.
4461 * @return BLUETOOTH_ERROR_NONE - Success \n
4462 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4463 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4464 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4467 * @param[in] char_handle - Handle for Characteristic property.
4468 * @param[in] value - New value to set for characteristic property.
4469 * @param[in] length - Length of the value to be set.
4474 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4475 const guint8 *value, int length);
4478 * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
4480 * @brief Read characteristic value.
4482 * This function is a asynchronous call.
4484 * @return BLUETOOTH_ERROR_NONE - Success \n
4485 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4486 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4487 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4490 * @param[in] char_handle - Handle for Characteristic property.
4495 int bluetooth_gatt_read_characteristic_value(const char *char_handle);
4498 * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4499 * const char *service_uuid,
4500 * bt_gatt_service_property_t *service)
4502 * @brief Gets the service property from a device based on a particular uuid
4504 * This function is a synchronous call.
4506 * @return BLUETOOTH_ERROR_NONE - Success \n
4507 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4508 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4509 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4512 * @param[in] address - BD address of the remote device
4513 * @param[in] service_uuid - uuid of the service.
4514 * @param[out] service - Structure containing the service property.
4519 int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4520 const char *service_uuid,
4521 bt_gatt_service_property_t *service);
4524 * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4525 * const char *char_uuid)
4527 * @brief Gets the characteristic property from a service based on a particular char uuid
4529 * This function is an asynchronous call.
4530 * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
4532 * @return BLUETOOTH_ERROR_NONE - Success \n
4533 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4534 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4535 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4538 * @param[in] service_handle - Service handle.
4539 * @param[in] uuid - Characteristic uuid.
4544 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4545 const char *char_uuid);
4548 * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4550 * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
4552 * This function is a synchronous call.
4553 * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
4555 * @return BLUETOOTH_ERROR_NONE - Success \n
4556 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4559 * @param[in] prim_svc - GATT handle info structure
4562 * @see bluetooth_gatt_get_primary_services()
4564 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4567 * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4569 * @brief Releases the memory allocated by bluetooth_gatt_get_service_property()
4571 * This function is a synchronous call.
4572 * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
4574 * @return BLUETOOTH_ERROR_NONE - Success \n
4575 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4578 * @param[in] svc_pty - GATT service property structure.
4581 * @see bluetooth_gatt_get_service_property()
4583 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4586 * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4588 * @brief Provides characteristic value along with properties.
4590 * This function is a synchronous call.
4591 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4593 * @return BLUETOOTH_ERROR_NONE - Success \n
4594 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4597 * @param[in] char_pty - GATT characteristics property structure.
4600 * @see bluetooth_gatt_get_characteristics_property()
4602 int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4605 * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4607 * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
4609 * This function is a synchronous call.
4610 * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
4612 * @return BLUETOOTH_ERROR_NONE - Success \n
4613 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4616 * @param[in] desc_pty - GATT characteristics descriptor property structure.
4619 * @see bluetooth_gatt_get_char_descriptor_property()
4621 int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4624 int bluetooth_connect_le(const bluetooth_device_address_t *device_address, gboolean auto_connect);
4626 int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address);
4629 * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4631 * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
4633 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4635 * @return BLUETOOTH_ERROR_NONE - Success \n
4636 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4639 * @param[in] characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
4643 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4646 * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
4648 * @brief Read characteristic descriptor value.
4650 * This function is a asynchronous call.
4652 * @return BLUETOOTH_ERROR_NONE - Success \n
4653 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4654 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4655 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4658 * @param[in] desc_handle - Handle for Characteristic descriptor
4663 int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
4666 * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4667 * const guint8 *value, int length);
4669 * @brief Set characteristic descriptor value.
4671 * This function is a asynchronous call.
4673 * @return BLUETOOTH_ERROR_NONE - Success \n
4674 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4675 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4676 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4679 * @param[in] desc_handle - Handle for Characteristic descriptor
4680 * @param[in] value - New value to set for characteristic descriptor
4681 * @param[in] length - Length of the value to be set.
4686 int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4687 const guint8 *value, int length);
4689 /* @fn int bluetooth_gatt_init(void)
4691 * @brief Initializes the gatt service.
4693 * This function is a synchronous call.
4694 * @return BLUETOOTH_ERROR_NONE - Success \n
4695 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4696 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4697 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4700 * @remark Adapter should be enabled
4701 * @see bluetooth_gatt_deinit()
4703 int bluetooth_gatt_init(void);
4705 /* @fn int bluetooth_gatt_init(void)
4707 * @brief DeInitializes the gatt service.
4709 * This function is a synchronous call.
4710 * @return BLUETOOTH_ERROR_NONE - Success \n
4711 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4712 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4713 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4716 * @remark Adapter should be enabled
4717 * @see bluetooth_gatt_init()
4719 int bluetooth_gatt_deinit(void);
4721 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
4722 unsigned char **svc_path)
4724 * @brief Exports a new gatt service to the service interface.
4726 * This function is a synchronous call.
4728 * @return BLUETOOTH_ERROR_NONE - Success \n
4729 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4730 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4731 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4734 * @param[in] svc_uuid Gatt service uuid.
4735 * @param[out] svc_path service object path of the exported service.
4736 * @remark Adapter should be enabled
4737 * @see bluetooth_gatt_init()
4739 int bluetooth_gatt_add_service(const char *svc_uuid,
4742 /* @fn int bluetooth_gatt_add_new_characteristic(
4743 const char *svc_path, const char *char_uuid,
4744 bt_gatt_characteristic_property_t *properties,
4745 int flags_length, char **char_path);;
4747 * @brief Exports a new gatt characteristic to the characteristic interface.
4749 * This function is a synchronous call.
4750 * @return BLUETOOTH_ERROR_NONE - Success \n
4751 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4752 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4753 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4755 * @param[in] svc_path service object path of the exported service.
4756 * @param[in] char_uuid Gatt service uuid.
4757 * @param[in] properties GATT characteristic properties.
4758 * @param[out] char_path characteristic object path of the exported characteristic.
4760 * @remark Adapter should be enabled
4761 * @see bluetooth_gatt_add_service()
4763 int bluetooth_gatt_add_new_characteristic(
4764 const char *svc_path, const char *char_uuid,
4765 bt_gatt_characteristic_property_t properties,
4768 /* @fn bluetooth_gatt_set_characteristic_value(
4769 const char *characteristic, const char *char_value,
4772 * @brief adds gatt charactertisic value to the given charactertistic path.
4774 * This function is a synchronous call.
4775 * @return BLUETOOTH_ERROR_NONE - Success \n
4776 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4777 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4778 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4780 * @param[in] char_value Value of the GATT characteristic to be added.
4781 * @param[in] value_length length of the chantacteristic value..
4782 * @param[out] characteristic characteristic object path..
4784 * @remark Adapter should be enabled
4785 * @see bluetooth_gatt_add_service()
4787 int bluetooth_gatt_set_characteristic_value(
4788 const char *characteristic, const char *char_value,
4791 /* @fn int bluetooth_gatt_add_descriptor(const char *desc_uuid,
4792 const char *desc_value, int value_length,
4793 const char *permissions, const char *char_path,
4796 * @brief Exports a new gatt descriptor to the descriptor interface.
4798 * This function is a synchronous call.
4800 * @return BLUETOOTH_ERROR_NONE - Success \n
4801 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4802 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4803 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4806 * @param[in] desc_uuid Gatt descriptor uuid.
4807 * @param[in] desc_value GATT descriptor value.
4808 * @param[in] value_length Length of GATT descriptor value.
4809 * @param[in] permissions descriptor permissions.
4810 * @param[in] char_path characteristics object path of the exported character.
4812 * @remark Adapter should be enabled
4813 * @see bluetooth_gatt_add_service()
4814 * @see bluetooth_gatt_add_characteristics()
4816 int bluetooth_gatt_add_descriptor(const char *char_path,
4817 const char *desc_uuid,
4820 /* @fn int bluetooth_gatt_set_descriptor_value(
4821 const char *desc_path, const char *desc_value,
4824 * @brief Adds value to the given descriptor handle.
4826 * This function is a synchronous call.
4828 * @return BLUETOOTH_ERROR_NONE - Success \n
4829 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4830 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4831 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4834 * @param[in] desc_value GATT descriptor value.
4835 * @param[in] value_length Length of GATT descriptor value.
4836 * @param[in] desc_path descriptor path to which the value needs to be added.
4838 * @remark Adapter should be enabled
4839 * @see bluetooth_gatt_add_service()
4840 * @see bluetooth_gatt_add_characteristics()
4842 int bluetooth_gatt_set_descriptor_value(
4843 const char *desc_path, const char *desc_value,
4846 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
4848 * @brief Reads the Service registered on manager interface.
4850 * This function is a synchronous call.
4852 * @return BLUETOOTH_ERROR_NONE - Success \n
4853 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4854 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4855 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4858 * @param[in] svc_uuid Gatt Service uuid.
4860 * @remark Adapter should be enabled and service should be registered.
4861 * @see bluetooth_gatt_register_service()
4863 int bluetooth_gatt_get_service(const char *svc_uuid);
4865 /* @fn int bluetooth_gatt_register_service(const char *svc_path)
4867 * @brief Registers the given service path with the bluez gatt server.
4869 * This function is a synchronous call.
4871 * @return BLUETOOTH_ERROR_NONE - Success \n
4872 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4873 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4874 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4877 * @param[in] svc_path service object path of the exported service.
4879 * @remark Adapter should be enabled
4880 * @see bluetooth_gatt_add_service()
4881 * @see bluetooth_gatt_add_characteristics()
4882 * @see bluetooth_gatt_add_descriptor()
4884 int bluetooth_gatt_register_service(const char *svc_path);
4886 /* @fn int bluetooth_gatt_unregister_service(const char *svc_path)
4888 * @brief Removes(unregister) service from the bluez gatt server db.
4890 * This function is a synchronous call.
4892 * @return BLUETOOTH_ERROR_NONE - Success \n
4893 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4894 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4895 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4898 * @param[in] svc_path service object path of the exported service.
4900 * @remark Adapter should be enabled
4901 * @see bluetooth_gatt_add_service()
4902 * @see bluetooth_gatt_add_characteristics()
4903 * @see bluetooth_gatt_add_descriptor()
4904 * @see bluetooth_gatt_register_service()
4906 int bluetooth_gatt_unregister_service(const char *svc_path);
4908 /* @fn int bluetooth_gatt_send_response(int request_id,
4909 * int offset, char *value, int value_length)
4911 * @brief Updates the attribute value in local attribute list.
4913 * This function is a synchronous call.
4915 * @return BLUETOOTH_ERROR_NONE - Success \n
4916 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4917 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4918 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4921 * @param[in] request_id The identification of a read request
4922 * @param[in] offset The offset from where a value is read
4923 * @param[in] value The value to be sent. It will be sent from @a offset.
4924 * If it is NULL, a requested GATT handle's value will be sent from @a offset.
4925 * @param[in] value_length Value Length.
4927 * @remark Adapter should be enabled
4928 * @see bluetooth_gatt_add_service()
4929 * @see bluetooth_gatt_add_characteristics()
4930 * @see bluetooth_gatt_add_descriptor()
4931 * @see bluetooth_gatt_register_service()
4933 int bluetooth_gatt_send_response(int request_id,
4934 int offset, char *value, int value_length);
4937 /* @fn int bluetooth_gatt_delete_services(void)
4939 * @brief deletes (unregisters) all services from the gatt server database..
4941 * This function is a synchronous call.
4943 * @return BLUETOOTH_ERROR_NONE - Success \n
4944 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4945 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4946 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4950 * @remark Adapter should be enabled
4951 * @see bluetooth_gatt_add_service()
4952 * @see bluetooth_gatt_add_characteristics()
4953 * @see bluetooth_gatt_add_descriptor()
4954 * @see bluetooth_gatt_register_service()
4955 * @see bluetooth_gatt_unregister_service()
4957 int bluetooth_gatt_delete_services(void);
4959 /* @fn int bluetooth_gatt_update_characteristic(void)
4961 * @brief updates the given characteristic with a new value
4963 * This function is a synchronous call.
4965 * @return BLUETOOTH_ERROR_NONE - Success \n
4966 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4967 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4968 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4972 * @remark Adapter should be enabled
4973 * @see bluetooth_gatt_add_service()
4974 * @see bluetooth_gatt_add_characteristics()
4975 * @see bluetooth_gatt_add_descriptor()
4976 * @see bluetooth_gatt_register_service()
4977 * @see bluetooth_gatt_unregister_service()
4979 int bluetooth_gatt_update_characteristic(const char *char_path,
4980 const char* char_value, int value_length);
4983 * @fn int bluetooth_set_advertising(int handle, gboolean enable);
4985 * @brief Set advertising status.
4987 * This function is used to enable or disable LE advertising.
4988 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
4990 * This function is a synchronous call.
4992 * @return BLUETOOTH_ERROR_NONE - Success \n
4993 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
4994 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
4997 * @param[in] enable - The status of advertising
5000 * @see bluetooth_set_advertising_data
5002 int bluetooth_set_advertising(int handle, gboolean enable);
5005 * @fn int bluetooth_set_custom_advertising(int handle, gboolean enable, bluetooth_advertising_params_t *params);
5007 * @brief Set advertising status along with interval value.
5009 * This function is used to enable or disable LE advertising.
5010 * Interval_min and Interval_max is used to set the best advertising interval.
5011 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5013 * This function is a synchronous call.
5015 * @return BLUETOOTH_ERROR_NONE - Success \n
5016 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5017 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5020 * @param[in] enable - The status of advertising
5021 * @param[in] interval_min - Minimum interval of advertising (msec)
5022 * @param[in] interval_max - Maximum interval of advertising (msec)
5023 * @param[in] filter_policy - Advertising filter policy
5026 * @see bluetooth_set_advertising_data
5028 int bluetooth_set_custom_advertising(int handle, gboolean enable,
5029 bluetooth_advertising_params_t *params);
5032 * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5033 * @brief Get the advertising data
5035 * This function is used to get advertising data.
5036 * Before calling this API, the adapter should be enabled.
5038 * This function is a synchronous call.
5040 * @return BLUETOOTH_ERROR_NONE - Success \n
5041 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5042 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5043 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5045 * @param[out] value - Advertising data structure.
5046 * @param[out] length - The length of Advertising data.
5050 bluetooth_advertising_data_t *value = { {0} };
5053 ret = bluetooth_get_advertising_data(&value, &length);
5056 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5059 * @fn int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5061 * @brief Set advertising data with value
5063 * This function is used to set advertising data and Maximum size of advertising data
5064 * is 28 byte (Except Flag)
5066 * This function is a synchronous call.
5068 * @return BLUETOOTH_ERROR_NONE - Success \n
5069 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5070 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5073 * @param[in] value - Advertising data structure.
5077 int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5080 * @fn int bluetooth_check_privilege_advertising_parameter(void);
5082 * @brief Check the privilege for advertising parameter setting
5084 * This function is a synchronous call.
5086 * @return BLUETOOTH_ERROR_NONE - Success \n
5087 * BLUETOOTH_ERROR_PERMISSION_DEINED - Permission deined \n
5093 int bluetooth_check_privilege_advertising_parameter(void);
5096 * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5097 * @brief Get the LE scan response data
5099 * This function is used to get scan response data.
5100 * Before calling this API, the adapter should be enabled.
5102 * This function is a synchronous call.
5104 * @return BLUETOOTH_ERROR_NONE - Success \n
5105 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5106 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5107 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5109 * @param[out] value - Scan response data structure.
5110 * @param[out] length - The length of Scan response data.
5114 bluetooth_scan_resp_data_t *value = { {0} };
5117 ret = bluetooth_get_scan_response_data(&value, &length);
5120 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5123 * @fn int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5125 * @brief Set scan response data with value
5127 * This function is used to set scan response data and Maximum size of scan response data is 31 byte
5129 * This function is a synchronous call.
5131 * @return BLUETOOTH_ERROR_NONE - Success \n
5132 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5133 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5136 * @param[in] value - LE Scan response data structure.
5140 int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5143 * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5145 * @brief Set scan interval and window
5147 * This function is used to set LE scan interval and window size
5149 * This function is a synchronous call.
5151 * @return BLUETOOTH_ERROR_NONE - Success \n
5152 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5153 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5156 * @param[in] interval - Interval of LE scan (msec)
5157 * @param[in] window - Window size of LE scan (msec)
5161 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5164 * @fn int bluetooth_is_advertising(void)
5165 * @brief Check for the advertising is in-progress or not.
5167 * This API is used to check the current status of the advertising procedure.
5168 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5171 * This function checks whether the advertising is started or not.
5173 * This function is a synchronous call.
5175 * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c false = not in progress)
5177 * @return BLUETOOTH_ERROR_NONE - Success \n
5178 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5181 * @see bluetooth_set_advertising, bluetooth_set_custom_advertising
5185 gboolean is_advertising = 0;
5187 ret = bluetooth_is_advertising(&is_advertising);
5190 int bluetooth_is_advertising(gboolean *is_advertising);
5193 * @fn int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5194 * @brief Add LE device to white list
5196 * This API is used to add LE device to white list
5197 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5201 * This function is a synchronous call.
5203 * @param[in] address The address of remote device
5205 * @return BLUETOOTH_ERROR_NONE - Success \n
5206 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5209 * @see bluetooth_set_custom_advertising
5211 int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5214 * @fn int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5215 * @brief Remove LE device from white list
5217 * This API is used to remove LE device from white list
5218 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5222 * This function is a synchronous call.
5224 * @param[in] address The address of remote device
5226 * @return BLUETOOTH_ERROR_NONE - Success \n
5227 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5230 * @see bluetooth_set_custom_advertising
5232 int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5235 * @fn int bluetooth_clear_white_list(void)
5236 * @brief Clear white list
5238 * This API is used to clear white list
5239 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5243 * This function is a synchronous call.
5245 * @param[in] address The address of remote device
5247 * @return BLUETOOTH_ERROR_NONE - Success \n
5248 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5251 * @see bluetooth_set_custom_advertising
5253 int bluetooth_clear_white_list(void);
5256 * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
5257 * const bluetooth_le_conn_update_t *parameters)
5258 * @brief update connection paramter of LE connection.
5260 * This function is a synchronous call.
5262 * @return BLUETOOTH_ERROR_NONE - Success \n
5263 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5266 * @param[in] address - remote device address value.
5267 * @param[in] parameters - new connection parameters.
5270 * @see bluetooth_bond_device
5272 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
5273 const bluetooth_le_conn_update_t *parameters);
5277 * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
5279 * @brief Enable/Disable LE Privacy feature.
5281 * This function is used to enable or disable LE Privacy feature.
5282 * Once Privacy feature is enabled, Adapter can use Random Address for more security.
5284 * This function is a synchronous call.
5286 * @return BLUETOOTH_ERROR_NONE - Success \n
5287 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5288 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5291 * @param[in] enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
5295 int bluetooth_enable_le_privacy(gboolean enable_privacy);
5297 int bluetooth_pbap_init(void);
5298 int bluetooth_pbap_deinit(void);
5299 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
5300 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
5301 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
5302 bt_pbap_folder_t *folder);
5303 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
5304 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
5305 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
5306 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
5307 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
5308 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
5309 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
5310 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
5313 * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5315 * @brief Set manufacturer data with value
5317 * This function is used to set manufacturer data.
5319 * This function is a synchronous call.
5321 * @return BLUETOOTH_ERROR_NONE - Success \n
5322 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5323 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5326 * @param[in] value - Manufacturer data structure.
5330 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5337 #endif /* __cplusplus */
5338 #endif /* _BLUETOOTH_API_H_*/