2 * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
18 #ifndef _BLUETOOTH_API_H_
19 #define _BLUETOOTH_API_H_
27 #endif /* __cplusplus */
30 * @defgroup BLUETOOTHFW BluetoothFW
32 * A base library for bluetooth framework
34 * @addtogroup BLUETOOTHFW
38 #define BLUETOOTH_ADDRESS_LENGTH 6 /**< This specifies bluetooth device address length */
39 #define BLUETOOTH_VERSION_LENGTH_MAX 30 /**< This specifies bluetooth device version length */
40 #define BLUETOOTH_INTERFACE_NAME_LENGTH 16
41 #define BLUETOOTH_DEVICE_NAME_LENGTH_MAX 248 /**< This specifies maximum device name length */
42 #define BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX 50 /**< This specifies maximum length of the passkey */
43 #define BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX 31 /**< This specifies maximum AD data length */
44 #define BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX 31 /**< This specifies maximum LE Scan response data length */
45 #define BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX 240 /**< This specifies maximum manufacturer data length */
47 #define BLUETOOTH_MAX_SERVICES_FOR_DEVICE 40 /**< This specifies maximum number of services
48 a device can support */
50 #define BLUETOOTH_UUID_STRING_MAX 50
51 #define BLUETOOTH_PATH_STRING 50
53 #define BLUETOOTH_OOB_DATA_LENGTH 16
55 #define BLUETOOTH_PIN_CODE_MAX_LENGTH 16
58 * This is Bluetooth Connected event role
60 #define RFCOMM_ROLE_SERVER 1
61 #define RFCOMM_ROLE_CLIENT 2
64 * This is RFCOMM default Channel Value
66 #define RFCOMM_DEFAULT_PROFILE_CHANNEL 0
69 * This is maximum length for search value string for PBAP Phonebook Search
71 #define BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH 100
75 * This is Bluetooth error code
77 #define BLUETOOTH_ERROR_BASE ((int)0) /**< Error code base */
79 #define BLUETOOTH_ERROR_NONE ((int)0) /**< No error #0 */
80 #define BLUETOOTH_ERROR_CANCEL ((int)BLUETOOTH_ERROR_BASE - 0x01)
82 #define BLUETOOTH_ERROR_INVALID_CALLBACK ((int)BLUETOOTH_ERROR_BASE - 0x02)
83 /**< Callback error */
84 #define BLUETOOTH_ERROR_INVALID_PARAM ((int)BLUETOOTH_ERROR_BASE - 0x03)
85 /**< invalid paramerror */
86 #define BLUETOOTH_ERROR_INVALID_DATA ((int)BLUETOOTH_ERROR_BASE - 0x04)
87 /**< invalid data error */
88 #define BLUETOOTH_ERROR_MEMORY_ALLOCATION ((int)BLUETOOTH_ERROR_BASE - 0x05)
89 /**< Memory allocation error */
90 #define BLUETOOTH_ERROR_OUT_OF_MEMORY ((int)BLUETOOTH_ERROR_BASE - 0x06)
91 /**< out of memory error */
92 #define BLUETOOTH_ERROR_TIMEOUT ((int)BLUETOOTH_ERROR_BASE - 0x07)
94 #define BLUETOOTH_ERROR_NO_RESOURCES ((int)BLUETOOTH_ERROR_BASE - 0x08)
95 /**< No resource error */
96 #define BLUETOOTH_ERROR_INTERNAL ((int)BLUETOOTH_ERROR_BASE - 0x09)
97 /**< internal error */
98 #define BLUETOOTH_ERROR_NOT_SUPPORT ((int)BLUETOOTH_ERROR_BASE - 0x0a)
99 /**< Not supported error */
100 #define BLUETOOTH_ERROR_DEVICE_NOT_ENABLED ((int)BLUETOOTH_ERROR_BASE - 0x0b)
101 /**< Operation is failed because
102 of not enabled BT Adapter */
103 #define BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED ((int)BLUETOOTH_ERROR_BASE - 0x0c)
104 /**< Enabling is failed because of
105 already enabled BT Adapter */
106 #define BLUETOOTH_ERROR_DEVICE_BUSY ((int)BLUETOOTH_ERROR_BASE - 0x0d)
107 /**< Operation is failed because of
108 other on going operation */
109 #define BLUETOOTH_ERROR_ACCESS_DENIED ((int)BLUETOOTH_ERROR_BASE - 0x0e)
110 /**< access denied error */
111 #define BLUETOOTH_ERROR_MAX_CLIENT ((int)BLUETOOTH_ERROR_BASE - 0x0f)
112 /**< max client error */
113 #define BLUETOOTH_ERROR_NOT_FOUND ((int)BLUETOOTH_ERROR_BASE - 0x10)
114 /**< not found error */
115 #define BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR ((int)BLUETOOTH_ERROR_BASE - 0x11)
116 /**< service search fail */
117 #define BLUETOOTH_ERROR_PARING_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x12)
118 /**< pairing failed error */
119 #define BLUETOOTH_ERROR_NOT_PAIRED ((int)BLUETOOTH_ERROR_BASE - 0x13)
120 /**< Not paired error */
121 #define BLUETOOTH_ERROR_SERVICE_NOT_FOUND ((int)BLUETOOTH_ERROR_BASE - 0x14)
122 /**< no service error */
123 #define BLUETOOTH_ERROR_NOT_CONNECTED ((int)BLUETOOTH_ERROR_BASE - 0x15)
124 /**< no connection error */
125 #define BLUETOOTH_ERROR_ALREADY_CONNECT ((int)BLUETOOTH_ERROR_BASE - 0x16)
126 /**< alread connected error */
127 #define BLUETOOTH_ERROR_CONNECTION_BUSY ((int)BLUETOOTH_ERROR_BASE - 0x17)
128 /**< connection busy error */
129 #define BLUETOOTH_ERROR_CONNECTION_ERROR ((int)BLUETOOTH_ERROR_BASE - 0x18)
130 /**< connection error */
131 #define BLUETOOTH_ERROR_MAX_CONNECTION ((int)BLUETOOTH_ERROR_BASE - 0x19)
132 /**< max connection error*/
133 #define BLUETOOTH_ERROR_NOT_IN_OPERATION ((int)BLUETOOTH_ERROR_BASE - 0x1a)
134 /**< Not in operation */
135 #define BLUETOOTH_ERROR_CANCEL_BY_USER ((int)BLUETOOTH_ERROR_BASE - 0x1b)
136 /**< Cancelled by user */
137 #define BLUETOOTH_ERROR_REGISTRATION_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x1c)
138 /**< Service record registration failed */
139 #define BLUETOOTH_ERROR_IN_PROGRESS ((int)BLUETOOTH_ERROR_BASE - 0x1d)
140 /**< Operation in progress */
141 #define BLUETOOTH_ERROR_AUTHENTICATION_FAILED ((int)BLUETOOTH_ERROR_BASE - 0x1e)
142 /**< authentication failed error when paring*/
143 #define BLUETOOTH_ERROR_HOST_DOWN ((int)BLUETOOTH_ERROR_BASE - 0x1f)
144 /**< Remote host is down */
145 #define BLUETOOTH_ERROR_END_OF_DEVICE_LIST ((int)BLUETOOTH_ERROR_BASE - 0x20)
146 /**< End of device list */
148 #define BLUETOOTH_ERROR_AGENT_ALREADY_EXIST ((int)BLUETOOTH_ERROR_BASE - 0x21)
149 /**< Obex agent already exists */
150 #define BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST ((int)BLUETOOTH_ERROR_BASE - 0x22)
151 /**< Obex agent does not exist */
153 #define BLUETOOTH_ERROR_ALREADY_INITIALIZED ((int)BLUETOOTH_ERROR_BASE - 0x23)
154 /**< Already initialized */
156 #define BLUETOOTH_ERROR_PERMISSION_DEINED ((int)BLUETOOTH_ERROR_BASE - 0x24)
157 /**< Permission deined */
159 #define BLUETOOTH_ERROR_ALREADY_DEACTIVATED ((int)BLUETOOTH_ERROR_BASE - 0x25)
160 /**< Nap already done */
162 #define BLUETOOTH_ERROR_NOT_INITIALIZED ((int)BLUETOOTH_ERROR_BASE - 0x26)
163 /**< Not initialized */
166 * Device disconnect reason
169 BLUETOOTH_DEVICE_DISCONNECT_UNKNOWN,
170 BLUETOOTH_DEVICE_DISCONNECT_TIMEOUT,
171 BLUETOOTH_DEVICE_DISCONNECT_LOCAL_HOST,
172 BLUETOOTH_DEVICE_DISCONNECT_REMOTE,
173 } bluetooth_device_disconnect_reason_t;
176 * This is Bluetooth device address type, fixed to 6 bytes ##:##:##:##:##:##
179 unsigned char addr[BLUETOOTH_ADDRESS_LENGTH];
180 } bluetooth_device_address_t;
183 * This is Bluetooth device address type
187 BLUETOOTH_DEVICE_PUBLIC_ADDRESS = 0x00,
188 BLUETOOTH_DEVICE_RANDOM_ADDRESS
189 } bluetooth_device_address_type_t;
192 * This is Bluetooth version
195 char version[BLUETOOTH_VERSION_LENGTH_MAX + 1];
196 } bluetooth_version_t;
199 * This is Bluetooth device name type, maximum size of Bluetooth device name is 248 bytes
202 char name[BLUETOOTH_DEVICE_NAME_LENGTH_MAX + 1];
203 } bluetooth_device_name_t;
206 * This is Bluetooth manufacturer specific data, maximum size of data is 240 bytes
209 int data_len; /**< manafacturer specific data length */
210 char data[BLUETOOTH_MANUFACTURER_DATA_LENGTH_MAX];
211 } bluetooth_manufacturer_data_t;
214 char pin_code[BLUETOOTH_PIN_CODE_MAX_LENGTH + 1];
215 } bluetooth_device_pin_code_t;
221 BLUETOOTH_ADAPTER_DISABLED, /**< Bluetooth adapter is disabled */
222 BLUETOOTH_ADAPTER_ENABLED, /**< Bluetooth adapter is enabled */
223 BLUETOOTH_ADAPTER_CHANGING_ENABLE, /**< Bluetooth adapter is currently enabling */
224 BLUETOOTH_ADAPTER_CHANGING_DISABLE, /**< Bluetooth adapter is currently disabling */
225 } bluetooth_adapter_state_t;
231 BLUETOOTH_ADAPTER_LE_DISABLED, /**< Bluetooth adapter le is disabled */
232 BLUETOOTH_ADAPTER_LE_ENABLED, /**< Bluetooth adapter le is enabled */
233 BLUETOOTH_ADAPTER_LE_CHANGING_ENABLE, /**< Bluetooth adapter le is currently enabling */
234 BLUETOOTH_ADAPTER_LE_CHANGING_DISABLE, /**< Bluetooth adapter le is currently disabling */
235 } bluetooth_adapter_le_state_t;
241 BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE, /**< Non discoverable mode */
242 /*Changed the order to make it compatable with old method */
243 BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE,/**< Discoverable mode */
244 BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE,
245 /**< Discoverable mode with time limit
246 After specific timeout, it is changed
247 to non discoverable mode */
248 } bluetooth_discoverable_mode_t;
251 * Network connect mode
254 BLUETOOTH_NETWORK_PANU_ROLE,
256 BLUETOOTH_NETWORK_NAP_ROLE,/**< Network Access Point */
257 BLUETOOTH_NETWORK_GN_ROLE, /**< Group ad-hoc Network */
258 BLUETOOTH_NETWORK_CUSTOM_UUID, /**< Custom role */
259 } bluetooth_network_role_t;
265 BLUETOOTH_RFCOMM_SERVICE = 0x01,
266 BLUETOOTH_A2DP_SERVICE = 0x02,
267 BLUETOOTH_HSP_SERVICE = 0x04,
268 BLUETOOTH_HID_SERVICE = 0x08,
269 BLUETOOTH_NAP_SERVICE = 0x10,
270 BLUETOOTH_HFG_SERVICE = 0x20,
271 BLUETOOTH_GATT_SERVICE = 0x40,
272 BLUETOOTH_NAP_SERVER_SERVICE = 0x80,
273 BLUETOOTH_A2DP_SINK_SERVICE = 0x100,
274 } bluetooth_service_type_t;
280 BLUETOOTH_DEV_CONN_DEFAULT = 0xFF, /* represents that connection
281 * type can both BR/EDR and LE */
282 BLUETOOTH_DEV_CONN_BREDR = 0x00,
283 BLUETOOTH_DEV_CONN_LE = 0x01,
284 } bluetooth_conn_type_t;
290 BLUETOOTH_CODEC_ID_CVSD = 0x01,
291 BLUETOOTH_CODEC_ID_MSBC = 0x02,
292 } bluetooth_codec_type_t;
298 BLUETOOTH_HF_AUDIO_DISCONNECTED = 0x00,
299 BLUETOOTH_HF_AUDIO_CONNECTED = 0x01,
300 } bluetooth_hf_audio_connected_type_t;
306 guint8 data[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX];
307 } bluetooth_advertising_data_t;
313 guint8 data[BLUETOOTH_SCAN_RESP_DATA_LENGTH_MAX];
314 } bluetooth_scan_resp_data_t;
317 * Advertising filter policy
320 BLUETOOTH_ALLOW_SCAN_CONN_ALL = 0x00,
321 BLUETOOTH_ALLOW_CONN_ALL_SCAN_WHITE_LIST = 0x01,
322 BLUETOOTH_ALLOW_SCAN_ALL_CONN_WHITE_LIST = 0x02,
323 BLUETOOTH_ALLOW_SCAN_CONN_WHITE_LIST = 0x03,
324 } bluetooth_advertising_filter_policy_t;
330 BLUETOOTH_ADV_CONNECTABLE = 0x00, /* ADV_IND */
331 BLUETOOTH_ADV_CONNECTABLE_DIRECT_HIGH = 0x01, /* ADV_DIRECT_IND, high duty cycle */
332 BLUETOOTH_ADV_SCANNABLE = 0x02, /* ADV_SCAN_IND */
333 BLUETOOTH_ADV_NON_CONNECTABLE = 0x03, /* ADV_NONCOND_IND */
334 BLUETOOTH_ADV_CONNECTABLE_DIRECT_LOW = 0x04, /* ADV_DIRECT_IND, low duty cycle */
335 } bluetooth_advertising_type_t;
339 BLUETOOTH_GATT_PERMISSION_READ = 0x01,
340 BLUETOOTH_GATT_PERMISSION_WRITE = 0x02,
341 BLUETOOTH_GATT_PERMISSION_ENCRYPT_READ = 0x04,
342 BLUETOOTH_GATT_PERMISSION_ENCRYPT_WRITE = 0x08,
343 BLUETOOTH_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_READ = 0x10,
344 BLUETOOTH_GATT_PERMISSION_ENCRYPT_AUTHENTICATED_WRITE = 0x20,
345 } bt_gatt_permission_t;
349 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_BROADCAST = 0x01,
350 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_READ = 0x02,
351 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE_NO_RESPONSE = 0x04,
352 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITE = 0x08,
353 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_NOTIFY = 0x10,
354 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_INDICATE = 0x20,
355 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_SIGNED_WRITE = 0x40,
356 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_RELIABLE_WRITE = 0x80,
357 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_WRITABLE_AUXILIARIES = 0x100,
358 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_READ = 0x200,
359 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_WRITE = 0x400,
360 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_READ = 0x800,
361 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_ENCRYPT_AUTHENTICATED_WRITE = 0x1000,
362 BLUETOOTH_GATT_CHARACTERISTIC_PROPERTY_EXTENDED_PROPS = 0xffff,
363 }bt_gatt_characteristic_property_t;
366 * Remote device request types for attributes
369 BLUETOOTH_GATT_ATT_REQUEST_TYPE_READ = 0x00, /* Read Requested*/
370 BLUETOOTH_GATT_ATT_REQUEST_TYPE_WRITE = 0x01, /* Write Requested*/
371 } bluetooth_gatt_att_request_tyep_t;
374 * Advertising parameters
379 guint8 filter_policy;
381 } bluetooth_advertising_params_t;
387 int type; /**< passive 0, active 1 */
388 float interval; /**< LE scan interval */
389 float window; /**< LE scan window */
390 } bluetooth_le_scan_params_t;
396 guint16 interval_min;
397 guint16 interval_max;
400 } bluetooth_le_connection_param_t;
403 LE Read Maximum Data Length
406 guint16 max_tx_octets;
408 guint16 max_rx_octets;
410 } bluetooth_le_read_maximum_data_length_t;
413 LE Read Host suggested default Data Length
416 guint16 def_tx_octets;
418 } bluetooth_le_read_host_suggested_data_length_t;
421 * Samsung XSAT Vendor dependent command
426 } bluetooth_vendor_dep_at_cmd_t;
429 #define BLUETOOTH_EVENT_BASE ((int)(0x0000)) /**< No event */
430 #define BLUETOOTH_EVENT_GAP_BASE ((int)(BLUETOOTH_EVENT_BASE + 0x0010))
431 /**< Base ID for GAP Event */
432 #define BLUETOOTH_EVENT_SDP_BASE ((int)(BLUETOOTH_EVENT_GAP_BASE + 0x0020))
433 /**< Base ID for SDP events */
434 #define BLUETOOTH_EVENT_RFCOMM_BASE ((int)(BLUETOOTH_EVENT_SDP_BASE + 0x0020))
435 /**< Base ID for RFCOMM events */
436 #define BLUETOOTH_EVENT_NETWORK_BASE ((int)(BLUETOOTH_EVENT_RFCOMM_BASE + 0x0020))
437 /**< Base ID for NETWORK events */
438 #define BLUETOOTH_EVENT_HDP_BASE ((int)(BLUETOOTH_EVENT_NETWORK_BASE + 0x0020))
439 /**< Base ID for HDP events */
440 #define BLUETOOTH_EVENT_OPC_BASE ((int)(BLUETOOTH_EVENT_HDP_BASE + 0x0020))
441 /**< Base ID for OPC events */
442 #define BLUETOOTH_EVENT_OBEX_SERVER_BASE ((int)(BLUETOOTH_EVENT_OPC_BASE + 0x0020))
443 /**< Base ID for Obex Server events */
444 #define BLUETOOTH_EVENT_GATT_BASE ((int)(BLUETOOTH_EVENT_OBEX_SERVER_BASE + 0x0020))
445 /**< Base ID for GATT events */
447 #define BLUETOOTH_EVENT_AUDIO_BASE ((int)(BLUETOOTH_EVENT_GATT_BASE + 0x0020))
448 /**< Base ID for Audio events */
449 #define BLUETOOTH_EVENT_HID_BASE ((int)(BLUETOOTH_EVENT_AUDIO_BASE + 0x0030))
450 /**< Base ID for HID events */
451 #define BLUETOOTH_EVENT_ADVERTISING_BASE ((int)(BLUETOOTH_EVENT_HID_BASE + 0x0020))
452 /**< Base ID for Advertising events */
453 #define BLUETOOTH_EVENT_PBAP_CLIENT_BASE ((int)(BLUETOOTH_EVENT_ADVERTISING_BASE + 0x0020))
454 /**< Base ID for PBAP Client events */
455 #define BLUETOOTH_EVENT_AVRCP_CONTROL_BASE ((int)(BLUETOOTH_EVENT_PBAP_CLIENT_BASE + 0x0020))
456 /**< Base ID for AVRCP events */
457 #define BLUETOOTH_EVENT_IPSP_BASE ((int)(BLUETOOTH_EVENT_AVRCP_CONTROL_BASE + 0x0020))
458 /**< Base ID for IPSP events */
461 * Bluetooth event type
464 BLUETOOTH_EVENT_NONE = BLUETOOTH_EVENT_BASE,/**< No event */
466 BLUETOOTH_EVENT_ENABLED, /**< Bluetooth event adpater enabled */
467 BLUETOOTH_EVENT_DISABLED, /**< Bluetooth event adpater disabled */
468 BLUETOOTH_EVENT_LE_ENABLED, /**< Bluetooth event adpater enabled */
469 BLUETOOTH_EVENT_LE_DISABLED, /**< Bluetooth event adpater disabled */
470 BLUETOOTH_EVENT_LOCAL_NAME_CHANGED, /**< Bluetooth event local name changed*/
471 BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_REQUESTED,
472 /**< Bluetooth event Discoverable timeout requested*/
473 BLUETOOTH_EVENT_DISCOVERABLE_MODE_CHANGED, /**< Bluetooth event mode changed */
474 BLUETOOTH_EVENT_DISCOVERY_OPTION_REQUESTED, /**< Bluetooth event discovery option */
475 BLUETOOTH_EVENT_DISCOVERY_STARTED, /**< Bluetooth event discovery started */
476 BLUETOOTH_EVENT_DISCOVERY_FINISHED, /**< Bluetooth event discovery finished */
477 BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, /**< Bluetooth event remote deice found */
478 BLUETOOTH_EVENT_LE_DISCOVERY_STARTED, /**< Bluetooth event LE discovery started */
479 BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, /**< Bluetooth event LE discovery finished */
480 BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND, /**< Bluetooth event remote deice found (LE dev) */
481 BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/
482 BLUETOOTH_EVENT_BONDING_FINISHED, /**< Bluetooth event bonding completed */
483 BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED, /**< Bluetooth event bonding removed */
484 BLUETOOTH_EVENT_BONDED_DEVICE_FOUND, /**< Bluetooth event paired device found */
485 BLUETOOTH_EVENT_REMOTE_DEVICE_READ, /**< Bluetooth event read remote device */
486 BLUETOOTH_EVENT_DEVICE_AUTHORIZED, /**< Bluetooth event authorize device */
487 BLUETOOTH_EVENT_DEVICE_UNAUTHORIZED, /**< Bluetooth event unauthorize device */
488 BLUETOOTH_EVENT_DISCOVERABLE_TIMEOUT_CHANGED, /**< Bluetooth event mode changed */
489 BLUETOOTH_EVENT_KEYBOARD_PASSKEY_DISPLAY, /**Bluetooth event for displaying keyboard passkey to user*/
490 BLUETOOTH_EVENT_PIN_REQUEST, /**Bluetooth event for PIN input by user*/
491 BLUETOOTH_EVENT_PASSKEY_REQUEST, /**Bluetooth event for entering Passkey by user*/
492 BLUETOOTH_EVENT_PASSKEY_CONFIRM_REQUEST, /**Bluetooth event for Passkey confirmation by user*/
493 BLUETOOTH_EVENT_CONNECTABLE_CHANGED, /**< Bluetooth event connectable changed */
495 BLUETOOTH_EVENT_RSSI_ENABLED, /**< Bluetooth event RSSI monitoring enabled */
496 BLUETOOTH_EVENT_RSSI_ALERT, /**< Bluetooth event RSSI Alert */
497 BLUETOOTH_EVENT_RAW_RSSI, /**< Bluetooth event Raw RSSI */
499 BLUETOOTH_EVENT_SERVICE_SEARCHED = BLUETOOTH_EVENT_SDP_BASE,
500 /**< Bluetooth event serice search base id */
501 BLUETOOTH_EVENT_SERVICE_SEARCH_CANCELLED, /**< Bluetooth event service search cancelled */
502 BLUETOOTH_EVENT_RFCOMM_DATA_RECEIVED = BLUETOOTH_EVENT_RFCOMM_BASE,
503 /**< RFCOMM data receive event */
504 BLUETOOTH_EVENT_RFCOMM_CONNECTED, /**< Rfcomm server incomming connection */
505 BLUETOOTH_EVENT_RFCOMM_DISCONNECTED, /**< Rfcomm server/client disconnect */
507 BLUETOOTH_EVENT_RFCOMM_AUTHORIZE,
509 BLUETOOTH_EVENT_DEVICE_CONNECTED, /**< Bluetooth event device connected */
510 BLUETOOTH_EVENT_DEVICE_DISCONNECTED, /**< Bluetooth event device disconnected */
512 BLUETOOTH_EVENT_RFCOMM_SERVER_REMOVED,
514 BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED = BLUETOOTH_EVENT_NETWORK_BASE,
515 /**< Bluetooth Network event */
516 BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED, /**< Network server deactivated */
517 BLUETOOTH_EVENT_NETWORK_SERVER_CONNECTED, /**< Network connected event in server */
518 BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED,
519 /**< Network disconnected evnet in server */
521 BLUETOOTH_EVENT_NETWORK_CONNECTED, /**< Network connected event in client*/
522 BLUETOOTH_EVENT_NETWORK_DISCONNECTED, /**< Network disconnected evnet in client*/
524 BLUETOOTH_EVENT_HDP_CONNECTED
525 = BLUETOOTH_EVENT_HDP_BASE, /**<HDP Connect>*/
526 BLUETOOTH_EVENT_HDP_DISCONNECTED, /**<HDP Disconnect>*/
527 BLUETOOTH_EVENT_HDP_DATA_RECEIVED, /**<HDP Data Indication>*/
529 BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE,
530 /* OPC Connected event */
531 BLUETOOTH_EVENT_OPC_DISCONNECTED, /* OPC Disonnected event */
532 BLUETOOTH_EVENT_OPC_TRANSFER_STARTED, /* OPC Transfer started event */
533 BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS, /* OPC Transfer progress event */
534 BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE, /* OPC Transfer Complete event */
536 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE,
537 /* Obex server authorize event*/
538 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED, /* Obex Server transfer started event*/
539 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_PROGRESS,/* Obex Server transfer progress event*/
540 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_COMPLETED,/* Obex Server transfer complete event*/
541 BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE,
542 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_CONNECTED, /* Obex Transfer connected event */
543 BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_DISCONNECTED, /* Obex Transfer disconnected event */
545 BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED = BLUETOOTH_EVENT_GATT_BASE,
546 /**<Discovered GATT service characteristics event*/
547 BLUETOOTH_EVENT_GATT_CHAR_VAL_CHANGED,
548 /**<Remote GATT charateristic value changed event*/
549 BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID,
550 BLUETOOTH_EVENT_GATT_READ_CHAR, /**<Gatt Read Characteristic Value */
551 BLUETOOTH_EVENT_GATT_WRITE_CHAR, /**<Gatt Write Characteristic Value */
552 BLUETOOTH_EVENT_GATT_READ_DESC, /**<Gatt Read Characteristic Descriptor Value */
553 BLUETOOTH_EVENT_GATT_WRITE_DESC, /**<Gatt Write Characteristic Descriptor Value */
554 BLUETOOTH_EVENT_GATT_SVC_CHAR_DESC_DISCOVERED, /**<Gatt Char Descriptors Discovered Event*/
555 BLUETOOTH_EVENT_GATT_CONNECTED,/**<Gatt connected event */
556 BLUETOOTH_EVENT_GATT_DISCONNECTED, /**<Gatt Disconnected event */
557 BLUETOOTH_EVENT_GATT_SERVER_CHARACTERISTIC_VALUE_CHANGED, /**<Gatt Char write callback event */
558 BLUETOOTH_EVENT_GATT_SERVER_READ_REQUESTED, /** <GATT Characteristic/Descriptor Read Request event */
559 BLUETOOTH_EVENT_GATT_SERVER_VALUE_CHANGED, /** <GATT Characteristic/Descriptor Value change event */
560 BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_STATE_CHANGED, /** <GATT Characteristic Notification change event */
561 BLUETOOTH_EVENT_GATT_SERVER_NOTIFICATION_COMPLETED, /** <GATT Characteristic Notification or Indication completed event */
563 BLUETOOTH_EVENT_AG_CONNECTED = BLUETOOTH_EVENT_AUDIO_BASE, /**<AG service connected event*/
564 BLUETOOTH_EVENT_AG_DISCONNECTED, /**<AG service disconnected event*/
565 BLUETOOTH_EVENT_AG_SPEAKER_GAIN, /**<Speaker gain request event*/
566 BLUETOOTH_EVENT_AG_MIC_GAIN, /**<Mic gain request event*/
567 BLUETOOTH_EVENT_AG_AUDIO_CONNECTED, /**<AV & AG service connected event*/
568 BLUETOOTH_EVENT_AG_AUDIO_DISCONNECTED, /**<AV & AG service disconnected event*/
569 BLUETOOTH_EVENT_AV_CONNECTED, /**<AV service connected event*/
570 BLUETOOTH_EVENT_AV_DISCONNECTED, /**<AV service disconnected event*/
571 BLUETOOTH_EVENT_AV_SOURCE_CONNECTED, /**<AV Source device connected event */
572 BLUETOOTH_EVENT_AV_SOURCE_DISCONNECTED, /**<AV Source device disconnected event */
573 BLUETOOTH_EVENT_AVRCP_CONNECTED, /**<AVRCP service connected event*/
574 BLUETOOTH_EVENT_AVRCP_DISCONNECTED, /**<AVRCP service disconnected event*/
575 BLUETOOTH_EVENT_AVRCP_SETTING_SHUFFLE_STATUS, /**<AVRCP service player suffle status event*/
576 BLUETOOTH_EVENT_AVRCP_SETTING_EQUALIZER_STATUS, /**<AVRCP service player equalizer status event*/
577 BLUETOOTH_EVENT_AVRCP_SETTING_REPEAT_STATUS, /**<AVRCP service player repeat status event*/
578 BLUETOOTH_EVENT_AVRCP_SETTING_SCAN_STATUS, /**<AVRCP service player scan status event*/
579 BLUETOOTH_EVENT_HF_CONNECTED,
580 BLUETOOTH_EVENT_HF_DISCONNECTED,
581 BLUETOOTH_EVENT_HF_AUDIO_CONNECTED,
582 BLUETOOTH_EVENT_HF_AUDIO_DISCONNECTED,
583 BLUETOOTH_EVENT_HF_RING_INDICATOR,
584 BLUETOOTH_EVENT_HF_CALL_WAITING,
585 BLUETOOTH_EVENT_HF_CALL_TERMINATED,
586 BLUETOOTH_EVENT_HF_CALL_STARTED,
587 BLUETOOTH_EVENT_HF_CALL_ENDED,
588 BLUETOOTH_EVENT_HF_CALL_UNHOLD,
589 BLUETOOTH_EVENT_HF_CALL_SWAPPED,
590 BLUETOOTH_EVENT_HF_CALL_ON_HOLD,
591 BLUETOOTH_EVENT_HF_CALL_STATUS,
592 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_ENABLED,
593 BLUETOOTH_EVENT_HF_VOICE_RECOGNITION_DISABLED,
594 BLUETOOTH_EVENT_HF_VOLUME_SPEAKER,
595 BLUETOOTH_EVENT_HF_VENDOR_DEP_CMD,
597 BLUETOOTH_HID_CONNECTED = BLUETOOTH_EVENT_HID_BASE, /**< Input connectd event*/
598 BLUETOOTH_HID_DISCONNECTED, /**< Input disconnectd event*/
599 BLUETOOTH_HID_DEVICE_CONNECTED, /**< HID Device connected event*/
600 BLUETOOTH_HID_DEVICE_DISCONNECTED, /**< HID Device disconnected event*/
601 BLUETOOTH_HID_DEVICE_DATA_RECEIVED, /**< HID Device data received event*/
603 BLUETOOTH_EVENT_ADVERTISING_STARTED = BLUETOOTH_EVENT_ADVERTISING_BASE, /**< Advertising started event */
604 BLUETOOTH_EVENT_ADVERTISING_STOPPED, /**< Advertising stopped event */
605 BLUETOOTH_EVENT_ADVERTISING_MANUFACTURER_DATA_CHANGED, /**< Advertising manufacturer data changed event */
606 BLUETOOTH_EVENT_SCAN_RESPONSE_MANUFACTURER_DATA_CHANGED, /**< Scan response manufacturer data changed event */
607 BLUETOOTH_EVENT_MANUFACTURER_DATA_CHANGED, /**< Manufacturer data changed event */
608 BLUETOOTH_EVENT_DEVICE_ERROR, /**< Hardware error */
609 BLUETOOTH_EVENT_TX_TIMEOUT_ERROR, /** TX Timeout Error*/
610 BLUETOOTH_EVENT_MAX, /**< Bluetooth event Max value */
612 BLUETOOTH_PBAP_CONNECTED = BLUETOOTH_EVENT_PBAP_CLIENT_BASE, /**< PBAP connected event*/
613 BLUETOOTH_PBAP_DISCONNECTED, /**< PBAP disconnectd event*/
614 BLUETOOTH_PBAP_PHONEBOOK_SIZE, /**< PBAP Phonebook Size event*/
615 BLUETOOTH_PBAP_PHONEBOOK_PULL, /**< PBAP Phonebook Pull event*/
616 BLUETOOTH_PBAP_VCARD_LIST, /**< PBAP vCard List event*/
617 BLUETOOTH_PBAP_VCARD_PULL, /**< PBAP vCard Pull event*/
618 BLUETOOTH_PBAP_PHONEBOOK_SEARCH, /**< PBAP Phonebook Search event*/
620 BLUETOOTH_EVENT_AVRCP_CONTROL_CONNECTED = BLUETOOTH_EVENT_AVRCP_CONTROL_BASE, /**<AVRCP service connected event*/
621 BLUETOOTH_EVENT_AVRCP_CONTROL_DISCONNECTED, /**<AVRCP service disconnected event*/
622 BLUETOOTH_EVENT_AVRCP_CONTROL_SHUFFLE_STATUS, /**<AVRCP control suffle status event*/
623 BLUETOOTH_EVENT_AVRCP_CONTROL_EQUALIZER_STATUS, /**<AVRCP control equalizer status event*/
624 BLUETOOTH_EVENT_AVRCP_CONTROL_REPEAT_STATUS, /**<AVRCP control repeat status event*/
625 BLUETOOTH_EVENT_AVRCP_CONTROL_SCAN_STATUS, /**<AVRCP control scan status event*/
626 BLUETOOTH_EVENT_AVRCP_SONG_POSITION_STATUS, /**<AVRCP control play Postion status event*/
627 BLUETOOTH_EVENT_AVRCP_PLAY_STATUS_CHANGED, /**<AVRCP control play status event*/
628 BLUETOOTH_EVENT_AVRCP_TRACK_CHANGED, /**<AVRCP control song metadata event*/
630 BLUETOOTH_EVENT_IPSP_INIT_STATE_CHANGED = BLUETOOTH_EVENT_IPSP_BASE, /**<IPSP init event*/
631 BLUETOOTH_EVENT_IPSP_CONNECTED, /**< IPSP connected event */
632 BLUETOOTH_EVENT_IPSP_DISCONNECTED, /**< IPSP Disconnected event */
633 BLUETOOTH_EVENT_LE_DATA_LENGTH_CHANGED, /** LE data length values changed */
634 } bluetooth_event_type_t;
637 * This bt_service_uuid_list_t enum indicates service uuid list .
638 * This values is stored the service_list_array in bt_sdp_info_t and bluetooth_device_info_t.
642 BLUETOOTH_SPP_PROFILE_UUID = ((unsigned short)0x1101), /**<SPP*/
643 BLUETOOTH_LAP_PROFILE_UUID = ((unsigned short)0x1102), /**<LAP*/
644 BLUETOOTH_DUN_PROFILE_UUID = ((unsigned short)0x1103), /**<DUN*/
645 BLUETOOTH_OBEX_IR_MC_SYNC_SERVICE_UUID = ((unsigned short)0x1104), /**<OBEX IR MC SYNC*/
646 BLUETOOTH_OBEX_OBJECT_PUSH_SERVICE_UUID = ((unsigned short)0x1105), /**<OPP*/
647 BLUETOOTH_OBEX_FILE_TRANSFER_UUID = ((unsigned short)0x1106), /**<FTP*/
648 BLUETOOTH_IRMC_SYNC_COMMAND_UUID = ((unsigned short)0x1107), /**<IRMC SYNC COMMAND*/
649 BLUETOOTH_HS_PROFILE_UUID = ((unsigned short)0x1108), /**<HS*/
650 BLUETOOTH_CTP_PROFILE_UUID = ((unsigned short)0x1109), /**<CTP*/
651 BLUETOOTH_AUDIO_SOURCE_UUID = ((unsigned short)0x110A), /**<AUDIO SOURCE*/
652 BLUETOOTH_AUDIO_SINK_UUID = ((unsigned short)0x110B), /**<AUDIO SINK*/
653 BLUETOOTH_AV_REMOTE_CONTROL_TARGET_UUID = ((unsigned short)0x110C), /**<AV REMOTE CONTROL
655 BLUETOOTH_ADVANCED_AUDIO_PROFILE_UUID = ((unsigned short)0x110D), /**<A2DP*/
656 BLUETOOTH_AV_REMOTE_CONTROL_UUID = ((unsigned short)0x110E), /**<AV REMOTE CONTROL UUID*/
657 BLUETOOTH_AV_REMOTE_CONTROL_CONTROLLER_UUID = ((unsigned short)0x110F), /**<AV REMOTE CONTROLLER UUID*/
658 BLUETOOTH_ICP_PROFILE_UUID = ((unsigned short)0x1110), /**<ICP*/
659 BLUETOOTH_FAX_PROFILE_UUID = ((unsigned short)0x1111), /**<FAX*/
660 BLUETOOTH_HEADSET_AG_SERVICE_UUID = ((unsigned short)0x1112), /**<HS AG */
661 BLUETOOTH_PAN_PANU_PROFILE_UUID = ((unsigned short)0x1115), /**<PAN*/
662 BLUETOOTH_PAN_NAP_PROFILE_UUID = ((unsigned short)0x1116), /**<PAN*/
663 BLUETOOTH_PAN_GN_PROFILE_UUID = ((unsigned short)0x1117), /**<PAN*/
664 BLUETOOTH_DIRECT_PRINTING = ((unsigned short)0x1118),
665 BLUETOOTH_OBEX_BPPS_PROFILE_UUID = ((unsigned short)0x1118), /**<OBEX BPPS*/ /* Will be removed */
666 BLUETOOTH_REFERENCE_PRINTING = ((unsigned short)0x1119),
667 BLUETOOTH_OBEX_IMAGING_UUID = ((unsigned short)0x111A), /**<OBEX_IMAGING*/
668 BLUETOOTH_OBEX_IMAGING_RESPONDER_UUID = ((unsigned short)0x111B), /**<OBEX_IMAGING
670 BLUETOOTH_IMAGING_AUTOMATIC_ARCHIVE_UUID = ((unsigned short)0x111C), /**<IMAGING AUTOMATIC ARCHIVE*/
671 BLUETOOTH_IMAGING_REFERENCED_OBJECTS_UUID = ((unsigned short)0x111D), /**<IMAGING REFERENCED OBJECTS*/
672 BLUETOOTH_HF_PROFILE_UUID = ((unsigned short)0x111E), /**<HF*/
673 BLUETOOTH_HFG_PROFILE_UUID = ((unsigned short)0x111F), /**<HFG*/
674 BLUETOOTH_DIRECT_PRINTING_REFERENCE_OBJ_UUID = ((unsigned short)0x1120),
675 /**<DIRECT PRINTING*/
676 BLUETOOTH_REFLECTED_UI = ((unsigned short)0x1121), /**<REFLECTED UI*/
677 BLUETOOTH_BASIC_PRINTING = ((unsigned short)0x1122), /**<BASIC PRINTING*/
678 BLUETOOTH_PRINTING_STATUS = ((unsigned short)0x1123), /**<PRINTING STATUS*/
679 BLUETOOTH_OBEX_PRINTING_STATUS_UUID = ((unsigned short)0x1123), /**<OBEX PRINTING STATUS*/ /* Will be removed */
680 BLUETOOTH_HID_PROFILE_UUID = ((unsigned short)0x1124), /**<HID*/
681 BLUETOOTH_HCR_PROFILE_UUID = ((unsigned short)0x1125), /**<HCRP*/
682 BLUETOOTH_HCR_PRINT_UUID = ((unsigned short)0x1126), /**<HCR PRINT*/
683 BLUETOOTH_HCR_SCAN_UUID = ((unsigned short)0x1127), /**<HCR SCAN*/
684 BLUETOOTH_SIM_ACCESS_PROFILE_UUID = ((unsigned short)0x112D), /**<SIM ACCESS PROFILE*/
685 BLUETOOTH_PBAP_PCE_UUID = ((unsigned short)0x112E), /**<PBAP - PCE*/
686 BLUETOOTH_PBAP_PSE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/
687 BLUETOOTH_OBEX_PBA_PROFILE_UUID = ((unsigned short)0x112F), /**<OBEX PBA*/ /* Will be removed */
688 BLUETOOTH_OBEX_PBAP_UUID = ((unsigned short)0x1130), /**<OBEX PBA*/
689 BLUETOOTH_HEADSET_HS_UUID = ((unsigned short)0x1131), /**<HEADSET HS*/
690 BLUETOOTH_MESSAGE_ACCESS_SERVER_UUID = ((unsigned short)0x1132),/**<MESSAGE ACCESS SERVER*/
691 BLUETOOTH_MESSAGE_NOTIFICATION_SERVER_UUID = ((unsigned short)0x1133),/**<MESSAGE NOTIFICATION SERVER*/
692 BLUETOOTH_MESSAGE_ACCESS_PROFILE_UUID = ((unsigned short)0x1134),/**<MESSAGE ACCESS PROFILE*/
693 BLUETOOTH_PNP_INFORMATION_UUID = ((unsigned short)0x1200), /**<PNP*/
694 BLUETOOTH_GENERIC_NETWORKING_UUID = ((unsigned short)0x1201), /**<GENERIC NETWORKING*/
695 BLUETOOTH_GENERIC_FILE_TRANSFER_UUID = ((unsigned short)0x1202),/**<GENERIC FILE TRANSFER*/
696 BLUETOOTH_GENERIC_AUDIO_UUID = ((unsigned short)0x1203), /**<GENERIC AUDIO*/
697 BLUETOOTH_GENERIC_TELEPHONY_UUID = ((unsigned short)0x1204), /**<GENERIC TELEPHONY*/
698 BLUETOOTH_VIDEO_SOURCE_UUID = ((unsigned short)0x1303), /**<VEDIO SOURCE*/
699 BLUETOOTH_VIDEO_SINK_UUID = ((unsigned short)0x1304), /**<VEDIO SINK*/
700 BLUETOOTH_VIDEO_DISTRIBUTION_UUID = ((unsigned short)0x1305), /**<VEDIO DISTRIBUTION*/
701 BLUETOOTH_HDP_UUID = ((unsigned short)0x1400), /**<HDP*/
702 BLUETOOTH_HDP_SOURCE_UUID = ((unsigned short)0x1401), /**<HDP SOURCE*/
703 BLUETOOTH_HDP_SINK_UUID = ((unsigned short)0x1402), /**<HDP SINK*/
704 BLUETOOTH_OBEX_SYNCML_TRANSFER_UUID = ((unsigned short)0x0000) /**<OBEX_SYNC*/ /* Will be removed */
705 } bluetooth_service_uuid_list_t;
708 * Service class part of class of device returned from device discovery
711 BLUETOOTH_DEVICE_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE = 0x002000,
712 BLUETOOTH_DEVICE_SERVICE_CLASS_POSITIONING = 0x010000, /**< */
713 BLUETOOTH_DEVICE_SERVICE_CLASS_NETWORKING = 0x020000, /**< */
714 BLUETOOTH_DEVICE_SERVICE_CLASS_RENDERING = 0x040000, /**< */
715 BLUETOOTH_DEVICE_SERVICE_CLASS_CAPTURING = 0x080000, /**< */
716 BLUETOOTH_DEVICE_SERVICE_CLASS_OBJECT_TRANSFER = 0x100000, /**< */
717 BLUETOOTH_DEVICE_SERVICE_CLASS_AUDIO = 0x200000, /**< */
718 BLUETOOTH_DEVICE_SERVICE_CLASS_TELEPHONY = 0x400000, /**< */
719 BLUETOOTH_DEVICE_SERVICE_CLASS_INFORMATION = 0x800000, /**< */
720 } bluetooth_device_service_class_t;
724 * Major device mask (For device discovery)
727 BLUETOOTH_DEVICE_MAJOR_MASK_MISC = 0x00,
728 BLUETOOTH_DEVICE_MAJOR_MASK_COMPUTER = 0x0001,
729 BLUETOOTH_DEVICE_MAJOR_MASK_PHONE = 0x0002,
730 BLUETOOTH_DEVICE_MAJOR_MASK_LAN_ACCESS_POINT = 0x0004,
731 BLUETOOTH_DEVICE_MAJOR_MASK_AUDIO = 0x0008,
732 BLUETOOTH_DEVICE_MAJOR_MASK_PERIPHERAL = 0x0010,
733 BLUETOOTH_DEVICE_MAJOR_MASK_IMAGING = 0x0020,
734 BLUETOOTH_DEVICE_MAJOR_MASK_WEARABLE = 0x0040,
735 BLUETOOTH_DEVICE_MAJOR_MASK_TOY = 0x0080,
736 BLUETOOTH_DEVICE_MAJOR_MASK_HEALTH = 0x0100,
737 } bluetooth_device_major_mask_t;
741 * Major device class (part of Class of Device)
744 BLUETOOTH_DEVICE_MAJOR_CLASS_MISC = 0x00, /**< Miscellaneous major device class*/
745 BLUETOOTH_DEVICE_MAJOR_CLASS_COMPUTER = 0x01, /**< Computer major device class*/
746 BLUETOOTH_DEVICE_MAJOR_CLASS_PHONE = 0x02, /**< Phone major device class*/
747 BLUETOOTH_DEVICE_MAJOR_CLASS_LAN_ACCESS_POINT = 0x03, /**< LAN major device class*/
748 BLUETOOTH_DEVICE_MAJOR_CLASS_AUDIO = 0x04, /**< AUDIO major device class*/
749 BLUETOOTH_DEVICE_MAJOR_CLASS_PERIPHERAL = 0x05, /**< Peripheral major device class*/
750 BLUETOOTH_DEVICE_MAJOR_CLASS_IMAGING = 0x06, /**< Imaging major device class*/
751 BLUETOOTH_DEVICE_MAJOR_CLASS_WEARABLE = 0x07, /**< Wearable device class*/
752 BLUETOOTH_DEVICE_MAJOR_CLASS_TOY = 0x08, /**< Toy device class*/
753 BLUETOOTH_DEVICE_MAJOR_CLASS_HEALTH = 0x09, /**< Health device class*/
754 BLUETOOTH_DEVICE_MAJOR_CLASS_UNCLASSIFIED = 0x1F /**< Unknown major device class*/
755 } bluetooth_device_major_class_t;
758 BLUETOOTH_DEVICE_MINOR_CLASS_UNCLASSIFIED = 0x00, /**< unclassified minor class */
760 /* About Computer Major class */
761 BLUETOOTH_DEVICE_MINOR_CLASS_DESKTOP_WORKSTATION = 0x04, /**< desktop workstation
763 BLUETOOTH_DEVICE_MINOR_CLASS_SERVER_CLASS_COMPUTER = 0x08, /**< server minor class */
764 BLUETOOTH_DEVICE_MINOR_CLASS_LAPTOP = 0x0C, /**< laptop minor class */
765 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_PC_OR_PDA = 0x10, /**< PDA minor class */
766 BLUETOOTH_DEVICE_MINOR_CLASS_PALM_SIZED_PC_OR_PDA = 0x14, /**< PALM minor class */
767 BLUETOOTH_DEVICE_MINOR_CLASS_WEARABLE_COMPUTER = 0x18, /**< Wearable PC minor class */
769 /* About Phone Major class */
770 BLUETOOTH_DEVICE_MINOR_CLASS_CELLULAR = 0x04, /**< Cellular minor class */
771 BLUETOOTH_DEVICE_MINOR_CLASS_CORDLESS = 0x08, /**< cordless minor class */
772 BLUETOOTH_DEVICE_MINOR_CLASS_SMART_PHONE = 0x0C, /**< smart phone minor class */
773 BLUETOOTH_DEVICE_MINOR_CLASS_WIRED_MODEM_OR_VOICE_GATEWAY = 0x10,
774 /**< voice gateway minor class */
775 BLUETOOTH_DEVICE_MINOR_CLASS_COMMON_ISDN_ACCESS = 0x14, /**< ISDN minor class */
777 /* About LAN/Network Access Point Major class */
778 BLUETOOTH_DEVICE_MINOR_CLASS_FULLY_AVAILABLE = 0x04, /**< Fully available minor class */
779 BLUETOOTH_DEVICE_MINOR_CLASS_1_TO_17_PERCENT_UTILIZED = 0x20, /**< 1-17% utilized minor class */
780 BLUETOOTH_DEVICE_MINOR_CLASS_17_TO_33_PERCENT_UTILIZED = 0x40, /**< 17-33% utilized minor class */
781 BLUETOOTH_DEVICE_MINOR_CLASS_33_TO_50_PERCENT_UTILIZED = 0x60, /**< 33-50% utilized minor class */
782 BLUETOOTH_DEVICE_MINOR_CLASS_50_to_67_PERCENT_UTILIZED = 0x80, /**< 50-67% utilized minor class */
783 BLUETOOTH_DEVICE_MINOR_CLASS_67_TO_83_PERCENT_UTILIZED = 0xA0, /**< 67-83% utilized minor class */
784 BLUETOOTH_DEVICE_MINOR_CLASS_83_TO_99_PERCENT_UTILIZED = 0xC0, /**< 83-99% utilized minor class */
785 BLUETOOTH_DEVICE_MINOR_CLASS_NO_SERVICE_AVAILABLE = 0xE0, /**< No service available minor class */
787 /* About Audio/Video Major class */
788 BLUETOOTH_DEVICE_MINOR_CLASS_HEADSET_PROFILE = 0x04, /**< Headset minor class */
789 BLUETOOTH_DEVICE_MINOR_CLASS_HANDSFREE = 0x08, /**< Handsfree minor class*/
791 BLUETOOTH_DEVICE_MINOR_CLASS_MICROPHONE = 0x10, /**< Microphone minor class */
792 BLUETOOTH_DEVICE_MINOR_CLASS_LOUD_SPEAKER = 0x14, /**< Loud Speaker minor class */
793 BLUETOOTH_DEVICE_MINOR_CLASS_HEADPHONES = 0x18, /**< Headphones minor class */
794 BLUETOOTH_DEVICE_MINOR_CLASS_PORTABLE_AUDIO = 0x1C, /**< Portable Audio minor class */
795 BLUETOOTH_DEVICE_MINOR_CLASS_CAR_AUDIO = 0x20, /**< Car Audio minor class */
796 BLUETOOTH_DEVICE_MINOR_CLASS_SET_TOP_BOX = 0x24, /**< Set top box minor class */
797 BLUETOOTH_DEVICE_MINOR_CLASS_HIFI_AUDIO_DEVICE = 0x28, /**< Hifi minor class */
798 BLUETOOTH_DEVICE_MINOR_CLASS_VCR = 0x2C, /**< VCR minor class */
799 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CAMERA = 0x30, /**< Video Camera minor class */
800 BLUETOOTH_DEVICE_MINOR_CLASS_CAM_CORDER = 0x34, /**< CAM Corder minor class */
801 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_MONITOR = 0x38, /**<Video Monitor minor class */
802 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_DISPLAY_AND_LOUD_SPEAKER = 0x3C,
803 /**< Video Display and Loud
804 Speaker minor class */
805 BLUETOOTH_DEVICE_MINOR_CLASS_VIDEO_CONFERENCING = 0x40, /**< Video Conferencing minor
808 BLUETOOTH_DEVICE_MINOR_CLASS_GAMING_OR_TOY = 0x48, /**< Gaming or toy minor class */
810 /* About Peripheral Major class */
811 BLUETOOTH_DEVICE_MINOR_CLASS_KEY_BOARD = 0x40, /**< Key board minor class */
812 BLUETOOTH_DEVICE_MINOR_CLASS_POINTING_DEVICE = 0x80, /**< Pointing Device minor class */
813 BLUETOOTH_DEVICE_MINOR_CLASS_COMBO_KEYBOARD_OR_POINTING_DEVICE = 0xC0,
814 /**< Combo Keyboard or pointing
817 BLUETOOTH_DEVICE_MINOR_CLASS_JOYSTICK = 0x04, /**< JoyStick minor class */
818 BLUETOOTH_DEVICE_MINOR_CLASS_GAME_PAD = 0x08, /**< Game Pad minor class */
819 BLUETOOTH_DEVICE_MINOR_CLASS_REMOTE_CONTROL = 0x0C, /**< Remote Control minor class */
820 BLUETOOTH_DEVICE_MINOR_CLASS_SENSING_DEVICE = 0x10, /**< Sensing Device minor class */
821 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITIZER_TABLET = 0x14, /**< Digitizer minor class */
822 BLUETOOTH_DEVICE_MINOR_CLASS_CARD_READER = 0x18, /**< Card Reader minor class */
823 BLUETOOTH_DEVICE_MINOR_CLASS_DIGITAL_PEN = 0x1C, /**< Digital pen minor class */
824 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_SCANNER = 0x20, /**< Handheld scanner for bar-codes, RFID minor class */
825 BLUETOOTH_DEVICE_MINOR_CLASS_HANDHELD_GESTURAL_INPUT_DEVICE = 0x24, /**< Handheld gestural input device minor class */
827 /* About Imaging Major class */
828 BLUETOOTH_DEVICE_MINOR_CLASS_DISPLAY = 0x10, /**< Display minor class */
829 BLUETOOTH_DEVICE_MINOR_CLASS_CAMERA = 0x20, /**< Camera minor class */
830 BLUETOOTH_DEVICE_MINOR_CLASS_SCANNER = 0x40, /**< Scanner minor class */
831 BLUETOOTH_DEVICE_MINOR_CLASS_PRINTER = 0x80, /**< Printer minor class */
833 /* About Wearable Major class */
834 BLUETOOTH_DEVICE_MINOR_CLASS_WRIST_WATCH = 0x04, /**< Wrist watch minor class */
835 BLUETOOTH_DEVICE_MINOR_CLASS_PAGER = 0x08, /**< Pager minor class */
836 BLUETOOTH_DEVICE_MINOR_CLASS_JACKET = 0x0C, /**< Jacket minor class */
837 BLUETOOTH_DEVICE_MINOR_CLASS_HELMET = 0x10, /**< Helmet minor class */
838 BLUETOOTH_DEVICE_MINOR_CLASS_GLASSES = 0x14, /**< Glasses minor class */
840 /* About Toy Major class */
841 BLUETOOTH_DEVICE_MINOR_CLASS_ROBOT = 0x04, /**< Robot minor class */
842 BLUETOOTH_DEVICE_MINOR_CLASS_VEHICLE = 0x08, /**< Vehicle minor class */
843 BLUETOOTH_DEVICE_MINOR_CLASS_DOLL_OR_ACTION = 0x0C, /**< Doll or Action minor class */
844 BLUETOOTH_DEVICE_MINOR_CLASS_CONTROLLER = 0x10, /**< Controller minor class */
845 BLUETOOTH_DEVICE_MINOR_CLASS_GAME = 0x14, /**< Game minor class */
847 /* About Health Major class */
848 BLUETOOTH_DEVICE_MINOR_CLASS_BLOOD_PRESSURE_MONITOR = 0x04, /**< Blood Pressure minor class */
849 BLUETOOTH_DEVICE_MINOR_CLASS_THERMOMETER = 0x08, /**< Thermometer minor class */
850 BLUETOOTH_DEVICE_MINOR_CLASS_WEIGHING_SCALE = 0x0C, /**< Weighing Scale minor class */
851 BLUETOOTH_DEVICE_MINOR_CLASS_GLUCOSE_METER = 0x10, /**< Glucose minor class */
852 BLUETOOTH_DEVICE_MINOR_CLASS_PULSE_OXIMETER = 0x14, /**< Pulse Oximeter minor class */
853 BLUETOOTH_DEVICE_MINOR_CLASS_HEART_OR_PULSE_RATE_MONITOR = 0x18,/**< Heart or pulse rate monitor minor class */
854 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICAL_DATA_DISPLAY = 0x1C, /**< Medical minor class */
855 BLUETOOTH_DEVICE_MINOR_CLASS_STEP_COUNTER = 0x20, /**< Step Counter minor class */
856 BLUETOOTH_DEVICE_MINOR_CLASS_BODY_COMPOSITION_ANALYZER = 0x24, /**< Body composition analyzer minor class */
857 BLUETOOTH_DEVICE_MINOR_CLASS_PEAK_FLOW_MONITOR = 0x28, /**< Peak flow monitor minor class */
858 BLUETOOTH_DEVICE_MINOR_CLASS_MEDICATION_MONITOR = 0x2C, /**< Medication monitor minor class */
859 BLUETOOTH_DEVICE_MINOR_CLASS_KNEE_PROSTHESIS = 0x30, /**< Knee prosthesis minor class */
860 BLUETOOTH_DEVICE_MINOR_CLASS_ANKLE_PROSTHESIS = 0x34, /**< Ankle prosthesis minor class */
861 } bluetooth_device_minor_class_t;
864 * structure to hold the device information
867 bluetooth_device_major_class_t major_class; /**< major device class */
868 bluetooth_device_minor_class_t minor_class; /**< minor device class */
869 bluetooth_device_service_class_t service_class;
870 /**< service device class */
871 } bluetooth_device_class_t;
874 * Discovery Role types
877 DISCOVERY_ROLE_BREDR = 0x1,
879 DISCOVERY_ROLE_LE_BREDR
880 } bt_discovery_role_type_t;
883 * Connected state types
886 BLUETOOTH_CONNECTED_LINK_NONE = 0x00,
887 BLUETOOTH_CONNECTED_LINK_BREDR = 0x01,
888 BLUETOOTH_CONNECTED_LINK_LE = 0x02,
889 BLUETOOTH_CONNECTED_LINK_BREDR_LE = 0x03,
890 } bluetooth_connected_link_t;
896 BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_ADDRESS = 0x01, /**< device address */
897 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_UUID = 0x04, /**< service uuid */
898 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_SOLICITATION_UUID = 0x08, /**< service solicitation uuid */
899 BLUETOOTH_LE_SCAN_FILTER_FEATURE_DEVICE_NAME = 0x10, /**< device name */
900 BLUETOOTH_LE_SCAN_FILTER_FEATURE_MANUFACTURER_DATA = 0x20, /**< manufacturer data */
901 BLUETOOTH_LE_SCAN_FILTER_FEATURE_SERVICE_DATA = 0x40, /**< service data */
902 } bluetooth_le_scan_filter_feature_t;
908 BLUETOOTH_LE_CONNECTION_MODE_BALANCED,
909 BLUETOOTH_LE_CONNECTION_MODE_LOW_LATENCY,
910 BLUETOOTH_LE_CONNECTION_MODE_LOW_POWER
911 } bluetooth_le_connection_mode_t;
914 * structure to hold the device information
917 bluetooth_device_address_t device_address; /**< device address */
918 bluetooth_device_name_t device_name; /**< device name */
919 bluetooth_device_class_t device_class; /**< device class */
920 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
921 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
923 int rssi; /**< received strength signal*/
924 gboolean paired; /**< paired flag */
925 bluetooth_connected_link_t connected; /**< connected link type */
926 gboolean trust; /**< trust flag */
927 bluetooth_manufacturer_data_t manufacturer_data; /**< manafacturer specific class */
928 } bluetooth_device_info_t;
931 * structure to hold the LE device information
934 int data_len; /**< manafacturer specific data length */
935 bluetooth_advertising_data_t data; /**< manafacturer specific data */
936 } bluetooth_le_advertising_data_t;
939 bluetooth_device_address_t device_address; /**< device address */
940 int addr_type; /**< address type*/
941 int rssi; /**< received strength signal*/
942 bluetooth_le_advertising_data_t adv_ind_data;
943 bluetooth_le_advertising_data_t scan_resp_data;
944 } bluetooth_le_device_info_t;
948 bluetooth_le_scan_filter_feature_t added_features; /**< added features */
949 bluetooth_device_address_t device_address; /**< device address */
950 char device_name[BLUETOOTH_ADVERTISING_DATA_LENGTH_MAX]; /**< device name */
951 bluetooth_le_advertising_data_t service_uuid; /**< service uuid */
952 bluetooth_le_advertising_data_t service_uuid_mask; /**< service uuid mask */
953 bluetooth_le_advertising_data_t service_solicitation_uuid; /**< service solicitation uuid */
954 bluetooth_le_advertising_data_t service_solicitation_uuid_mask; /**< service solicitation uuid mask */
955 bluetooth_le_advertising_data_t service_data; /**< service data */
956 bluetooth_le_advertising_data_t service_data_mask; /**< service data mask */
957 int manufacturer_id; /**< manufacturer ID */
958 bluetooth_le_advertising_data_t manufacturer_data; /**< manufacturer data */
959 bluetooth_le_advertising_data_t manufacturer_data_mask; /**< manufacturer data mask */
960 } bluetooth_le_scan_filter_t;
963 * structure to hold the paired device information
966 bluetooth_device_address_t device_address; /**< paired device address */
967 bluetooth_device_name_t device_name; /**< device name */
968 bluetooth_device_class_t device_class; /**< device class */
969 } bluetooth_paired_device_info_t;
972 * structure to hold the paired device information
975 bluetooth_device_address_t device_address;
976 /**< device address */
977 char interface_name[BLUETOOTH_INTERFACE_NAME_LENGTH + 1];
978 /**< network interface name */
979 } bluetooth_network_device_info_t;
982 * Authentication event types
986 BLUETOOTH_AUTH_KEYBOARD_PASSKEY_REQUEST = 0,
987 BLUETOOTH_AUTH_PIN_REQUEST,
988 BLUETOOTH_AUTH_PASSKEY_REQUEST,
989 BLUETOOTH_AUTH_PASSKEY_CONFIRM_REQUEST,
990 } bluetooth_auth_type_t;
993 * structure to hold the pincode/pass-key req informations
996 bluetooth_device_address_t device_address; /**< remote device address */
997 bluetooth_device_name_t device_name; /**< device name */
998 char str_passkey[BLUETOOTH_DEVICE_PASSKEY_LENGTH_MAX]; /**< pass-key string */
999 } bluetooth_authentication_request_info_t;
1002 * Stucture to hold discovery option
1005 unsigned short max_response; /**< the number of maximum response */
1006 unsigned short discovery_duration;
1007 /**< duration of discovery (seconds) */
1008 unsigned int classOfDeviceMask; /**< mask for values of class of device. to be used with
1009 classOfDevice variable */
1010 } bluetooth_discovery_option_t;
1013 * Stucture to hold event information
1016 int event; /**< event type */
1017 int result; /**< Success or error value */
1019 /**<parameter data pointer */
1021 } bluetooth_event_param_t;
1024 bluetooth_device_address_t device_addr;
1025 char uuids[BLUETOOTH_MAX_SERVICES_FOR_DEVICE][BLUETOOTH_UUID_STRING_MAX];
1026 unsigned int service_list_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE]; /**< Use enum values in bt_service_uuid_list_t */
1027 unsigned int service_name_array[BLUETOOTH_MAX_SERVICES_FOR_DEVICE];
1032 bluetooth_device_address_t device_addr;
1033 unsigned char addr_type;
1035 } bt_connection_info_t;
1038 * Stucture to rfcomm receive data
1043 /**< the socket fd */
1044 int buffer_size;/**< the length of the receive buffer */
1046 /**< the receive data buffer */
1047 } bluetooth_rfcomm_received_data_t;
1053 HTYPE_TRANS_HANDSHAKE,
1054 HTYPE_TRANS_HID_CONTROL,
1055 HTYPE_TRANS_GET_REPORT,
1056 HTYPE_TRANS_SET_REPORT,
1057 HTYPE_TRANS_GET_PROTOCOL,
1058 HTYPE_TRANS_SET_PROTOCOL,
1061 }bt_hid_header_type_t;
1067 PTYPE_DATA_RTYPE_INPUT,
1068 PTYPE_DATA_RTYPE_OUTPUT
1069 }bt_hid_param_type_t;
1072 * Stucture to hid receive data
1075 const char *address;
1076 bt_hid_header_type_t type;
1077 /**< Header type containing */
1078 bt_hid_param_type_t param;
1079 /**< Param type in header like INPUT Report or OutPut Report */
1080 int buffer_size;/**< the length of the receive buffer */
1082 /**< the receive data buffer */
1083 } bluetooth_hid_received_data_t;
1086 * Stucture to rfcomm connection
1090 int socket_fd; /**< the socket fd */
1091 int server_id; /* Server id */
1092 int device_role; /** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1093 bluetooth_device_address_t device_addr;
1094 /**< device address */
1095 char uuid[BLUETOOTH_UUID_STRING_MAX];
1096 } bluetooth_rfcomm_connection_t;
1099 * Stucture to rfcomm disconnection
1103 /**< the socket fd */
1104 int device_role;/** < Device role - RFCOMM_ROLE_SERVER or RFCOMM_ROLE_CLIENT */
1105 bluetooth_device_address_t device_addr;
1106 /**< device address */
1107 char uuid[BLUETOOTH_UUID_STRING_MAX];
1108 } bluetooth_rfcomm_disconnection_t;
1112 /**< the socket fd */
1113 bluetooth_device_address_t device_addr;
1114 /**< device address */
1115 } bluetooth_rfcomm_connection_request_t;
1119 /**< the socket fd */
1120 bluetooth_device_address_t device_addr;
1121 /**< device address */
1122 } bluetooth_hid_request_t;
1137 HDP_ROLE_SOURCE = 0x0,
1139 }bt_hdp_role_type_t;
1143 * Stucture to HDP connected
1146 const char *app_handle; /**< the application handle */
1147 unsigned int channel_id; /**< the channel id */
1148 bt_hdp_qos_type_t type; /**< the QOS type */
1149 bluetooth_device_address_t device_address; /**< the remote address */
1150 } bt_hdp_connected_t;
1153 * Stucture to HDP disconnected
1156 unsigned int channel_id; /**< the channel id */
1157 bluetooth_device_address_t device_address; /**< the remote address */
1158 } bt_hdp_disconnected_t;
1161 * Stucture to HDP data indication
1164 unsigned int channel_id; /**< the channel id */
1165 const char *buffer; /**< the RX data buffer */
1166 unsigned int size; /**< the RX data size */
1167 } bt_hdp_data_ind_t;
1170 * Stucture to OPP client transfer information
1176 }bt_opc_transfer_info_t;
1178 /* Obex Server transfer type */
1179 #define TRANSFER_PUT "PUT"
1180 #define TRANSFER_GET "GET"
1182 * Stucture to OPP/FTP Server authorize information
1187 } bt_obex_server_authorize_into_t;
1195 } bt_obex_server_type_t;
1198 * Stucture to OPP/FTP server transfer information
1206 unsigned long file_size;
1208 bt_obex_server_type_t server_type;
1209 } bt_obex_server_transfer_info_t;
1212 * Stucture to OOB data
1216 unsigned char hash[BLUETOOTH_OOB_DATA_LENGTH];
1217 unsigned char randomizer[BLUETOOTH_OOB_DATA_LENGTH];
1218 unsigned int hash_len;
1219 unsigned int randomizer_len;
1223 * Structure to GATT attribute handle data
1229 } bt_gatt_handle_info_t;
1232 * Structure to GATT Remote service data
1239 bt_gatt_handle_info_t include_handles;
1240 bt_gatt_handle_info_t char_handle;
1241 } bt_gatt_service_property_t;
1244 * Structure to GATT Remote characteristic data
1248 char *service_handle;
1249 bt_gatt_handle_info_t handle_info;
1250 } bt_gatt_discovered_char_t;
1253 * Structure to format of GATT Characteristic Value
1257 unsigned char format;
1258 unsigned char exponent;
1259 unsigned short unit;
1260 unsigned char name_space;
1261 unsigned short description;
1262 } bt_gatt_char_format_t;
1265 * Structure to GATT Characteristic property
1273 bt_gatt_char_format_t format;
1275 unsigned int val_len;
1276 unsigned int permission;
1277 char *representation;
1278 bt_gatt_handle_info_t char_desc_handle;
1279 } bt_gatt_char_property_t;
1282 * Structure to GATT Characteristic descriptor property
1289 unsigned int val_len;
1290 } bt_gatt_char_descriptor_property_t;
1293 * Structure to GATT Characteristic value
1300 } bt_gatt_char_value_t;
1303 * Structure to GATT Read Request
1307 char *service_handle;
1311 } bt_gatt_read_req_t;
1314 * Structure to GATT Value change
1318 char *service_handle;
1324 } bt_gatt_value_change_t;
1327 * Structure to GATT characteristc Notification change
1331 char *service_handle;
1332 gboolean att_notify;
1333 } bt_gatt_char_notify_change_t;
1336 * Structure to Indication confirmation
1340 char *service_handle;
1343 } bt_gatt_indicate_confirm_t;
1346 * Structure to RSSI Signal Strength Alert
1357 * Structure to RSSI Signal Strength
1367 * Structure for RSSI Enabled or Disabled
1373 gboolean rssi_enabled;
1374 } bt_rssi_enabled_t;
1377 * Structure for RSSI Threshold
1382 int in_range_threshold;
1384 } bt_rssi_threshold_t;
1387 * Structure for PBAP Folder Parameters
1390 unsigned char addressbook;
1391 unsigned char folder_type;
1395 * Structure for PBAP Pull application Parameters
1398 unsigned char format;
1399 unsigned char order;
1400 unsigned short offset;
1401 unsigned short maxlist;
1402 long long unsigned fields;
1403 } bt_pbap_pull_parameters_t;
1406 * Structure for PBAP List application Parameters
1409 unsigned char order;
1410 unsigned short offset;
1411 unsigned short maxlist;
1412 } bt_pbap_list_parameters_t;
1415 * Structure for PBAP Pull vCard application Parameters
1418 unsigned char format;
1419 long long unsigned fields;
1421 } bt_pbap_pull_vcard_parameters_t;
1424 * Structure for PBAP Search application Parameters
1427 unsigned char order;
1428 unsigned short offset;
1429 unsigned short maxlist;
1430 unsigned char search_attribute;
1431 char search_value[BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH];
1432 } bt_pbap_search_parameters_t;
1435 * Structure for PBAP Connection Status
1438 bluetooth_device_address_t btaddr;
1440 } bt_pbap_connected_t;
1443 * Structure for PBAP Phonebook Size
1446 bluetooth_device_address_t btaddr;
1448 } bt_pbap_phonebook_size_t;
1451 * Structure for PBAP Phonebook Pull
1454 bluetooth_device_address_t btaddr;
1457 } bt_pbap_phonebook_pull_t;
1460 * Structure for PBAP vCard List
1463 bluetooth_device_address_t btaddr;
1467 } bt_pbap_vcard_list_t;
1470 * Structure for PBAP vCard Pull
1473 bluetooth_device_address_t btaddr;
1476 } bt_pbap_vcard_pull_t;
1479 * Structure for PBAP Phonebook search List
1482 bluetooth_device_address_t btaddr;
1486 } bt_pbap_phonebook_search_list_t;
1489 * Stucture to HF Call status information
1493 char *number; /*Phone Number */
1494 int direction; /*Direction :Incoming(1), Outgoing(0)*/
1495 int status; /* Call Status :Active(0), Held(1), Waiting(5), Dailing(2)*/
1496 int mpart; /*Multiparty/conf call: Yes(1), No(0) */
1497 int idx; /*Call index/ID */
1498 } bt_hf_call_status_info_t;
1503 } bt_hf_call_list_s;
1506 * Structure for LE data length change params
1510 bluetooth_device_address_t device_address;
1511 guint16 max_tx_octets;
1512 guint16 max_tx_time;
1513 guint16 max_rx_octets;
1514 guint16 max_rx_time;
1515 } bt_le_data_length_params_t;
1518 * Callback pointer type
1520 typedef void (*bluetooth_cb_func_ptr) (int, bluetooth_event_param_t *, void *);
1523 * @fn int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1524 * @brief Set the callback function pointer for bluetooth event
1527 * This API will register the callback function, when any response and event are received from
1528 * bluetooth framework. @n
1529 * this registered callback function will be get called with appropriate event and data structures.
1530 * This function is a synchronous call. An application developer can call
1531 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1532 * type. This registered function will receive events of bluetooth_event_type_t type along with
1536 * @param[in] callback_ptr A pointer to the callback function
1537 * @param[in] user_data A pointer to user data
1538 * @return BLUETOOTH_ERROR_NONE - Success
1542 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1544 GMainLoop *main_loop = (GMainLoop*) user_data;
1548 // Code for each event
1550 g_main_loop_quit(main_loop);
1557 GMainLoop *main_loop = NULL;
1559 main_loop = g_main_loop_new(NULL, FALSE);
1560 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1561 if (ret >= BLUETOOTH_ERROR_NONE)
1563 // bluetooth_register_callback returned Success
1567 // bluetooth_register_callback returned failiure
1569 g_main_loop_run(main_loop);
1573 int bluetooth_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1576 * @fn int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data)
1577 * @brief Set the callback function pointer for bluetooth le event
1580 * This API will register the callback function, when any response and event are received from
1581 * bluetooth framework. @n
1582 * this registered callback function will be get called with appropriate event and data structures.
1583 * This function is a synchronous call. An application developer can call
1584 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1585 * type. This registered function will receive events of bluetooth_event_type_t type along with
1589 * @param[in] callback_ptr A pointer to the callback function
1590 * @param[in] user_data A pointer to user data
1591 * @return BLUETOOTH_ERROR_NONE - Success
1595 int bluetooth_le_register_callback(bluetooth_cb_func_ptr callback_ptr, void *user_data);
1598 * @fn int bluetooth_le_unregister_callback(void)
1599 * @brief Set the callback function pointer for bluetooth le event
1602 * This API will register the callback function, when any response and event are received from
1603 * bluetooth framework. @n
1604 * this registered callback function will be get called with appropriate event and data structures.
1605 * This function is a synchronous call. An application developer can call
1606 * bluetooth_le_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1607 * type. This registered function will receive events of bluetooth_event_type_t type along with
1612 * @return BLUETOOTH_ERROR_NONE - Success
1616 int bluetooth_le_unregister_callback(void);
1619 * @fn int bluetooth_deregister_callback(bluetooth_cb_func_ptr callback_ptr)
1620 * @brief Set the callback function pointer for bluetooth event
1623 * This API will register the callback function, when any response and event are received from
1624 * bluetooth framework. @n
1625 * this registered callback function will be get called with appropriate event and data structures.
1626 * This function is a synchronous call. An application developer can call
1627 * bluetooth_register_callback() function to register a callback function of bluetooth_cb_func_ptr
1628 * type. This registered function will receive events of bluetooth_event_type_t type along with
1633 * @return BLUETOOTH_ERROR_NONE - Success
1637 void bt_event_callback(int event, bluetooth_event_param_t *param, void *user_data)
1639 GMainLoop *main_loop = (GMainLoop*) user_data;
1643 // Code for each event
1645 g_main_loop_quit(main_loop);
1652 GMainLoop *main_loop = NULL;
1654 main_loop = g_main_loop_new(NULL, FALSE);
1655 ret = bluetooth_register_callback(bt_event_callback, (void*)main_loop);
1656 if (ret >= BLUETOOTH_ERROR_NONE)
1658 // bluetooth_register_callback returned Success
1662 // bluetooth_register_callback returned failiure
1664 ret = bluetooth_deregister_callback(void);
1665 g_main_loop_run(main_loop);
1669 int bluetooth_unregister_callback(void);
1672 * @fn int bluetooth_enable_adapter(void)
1673 * @brief Enable the Bluetooth H/W
1676 * This API can be used to activate Bluetooth. It initializes Bluetooth protocol stack for use and
1677 * send request to bluetooth chip for activation.
1678 * This function is typically called at startup or when Bluetooth services are required. This
1679 * function must be called before calling any other API of Bluetooth operations.
1681 * Before performing any operations like Device discover, service search etc.., the adapter must be
1684 * This function is a asynchronous call.
1685 * If the call is success then the application will receive BLUETOOTH_EVENT_ENABLED event
1686 * through registered callback function with appropriate result code
1687 * BLUETOOTH_CHANGE_STATUS_TIMEOUT - Timeout has happen \n
1688 * BLUETOOTH_ERROR_NONE - Success \n
1690 * If the adpter is not enabled with in 30 seconds then BLUETOOTH_EVENT_ENABLED with result code
1691 * BLUETOOTH_CHANGE_STATUS_TIMEOUT will come
1693 * @return BLUETOOTH_ERROR_NONE - Success\n
1694 * BLUETOOTH_ERROR_DEVICE_ALREADY_ENABLED - Adapter already enabled\n
1695 * BLUETOOTH_ERROR_ACCESS_DENIED - Enabling adapter is not allowed by MDM policy\n
1696 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1697 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1699 * @see bluetooth_check_adapter, bluetooth_disable_adapter
1701 void bt_event_callback(int event, bluetooth_event_param_t *param)
1705 case BLUETOOTH_EVENT_ENABLED:
1706 if (param->result == BLUETOOTH_ERROR_NONE)
1708 // Successfully Enabled
1721 ret = bluetooth_enable_adapter();
1725 int bluetooth_enable_adapter(void);
1728 * @fn int bluetooth_disable_adapter(void)
1729 * @brief Disable the Bluetooth H/W
1732 * This function disables Bluetooth protocol stack and hardware. This function is called when
1733 * Bluetooth is no longer used. It will internally free all resources and power off the RF radio.
1735 * Bluetooth adapter should be disabled to switch off Bluetooth chip (and thereby saving power).
1736 * bluetooth_disable_adapter() API will do that job for you. After switching off Bluetooth,
1737 * BLUETOOTH_EVENT_DISABLED will be sent by SDK to application for confirmation with appropriate
1739 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1742 * This function is a asynchronous call.
1743 * If this call is success then the applications will receive BLUETOOTH_EVENT_DISABLED event
1744 * through registered callback function.
1747 * @return BLUETOOTH_ERROR_NONE - Success\n
1748 * BLUETOOTH_ERROR_IN_PROGRESS - Adapter is activating or deactivating\n
1749 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled\n
1750 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1752 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1754 void bt_event_callback(int event, bluetooth_event_param_t *param)
1758 case BLUETOOTH_EVENT_DISABLED:
1759 if (param->result == BLUETOOTH_ERROR_NONE)
1761 // Successfully disabled
1774 ret = bluetooth_disable_adapter();
1777 int bluetooth_disable_adapter(void);
1778 int bluetooth_recover_adapter(void);
1779 int bluetooth_check_adapter_le(void);
1780 int bluetooth_enable_adapter_le(void);
1782 int bluetooth_disable_adapter_le(void);
1785 * @fn int bluetooth_reset_adapter(void)
1786 * @brief Reset the Bluetooth H/W and values
1789 * This function resets Bluetooth protocol stack and hardware. This function is called when
1790 * an user want to initialize Bluetooth environment.
1792 * The various error codes are BLUETOOTH_ERROR_NONE for success and BLUETOOTH_ERROR_INTERNAL for
1795 * This function is a synchronous call.
1797 * @return BLUETOOTH_ERROR_NONE - Success\n
1798 * @exception BLUETOOTH_ERROR_INTERNAL - Dbus proxy call is fail
1800 * @see bluetooth_check_adapter, bluetooth_enable_adapter
1805 ret = bluetooth_reset_adapter();
1808 int bluetooth_reset_adapter(void);
1811 * @fn int bluetooth_is_supported(void)
1812 * @brief Check if the bluetooth is supported or not by the current target
1814 * This API checks whether the bluetooth is supported or not.
1815 * This API only run by root permission.
1817 * This function is a synchronous call.
1819 * @return 0 - if bluetooth is not supported\n
1820 * 1 - if bluetooth is supported\n
1821 * BLUETOOTH_ERROR_INTERNAL - Error in API internal
1826 ret = bluetooth_is_supported();
1829 int bluetooth_is_supported(void);
1833 * @fn int bluetooth_check_adapter(void)
1834 * @brief Check the current status of the Bluetooth adapter
1837 * This API checks whether the Bluetooth adapter is enabled or not. Before performing any operations
1838 * the bluetooth adapter should be enabled. This API helps to find out the current state of the
1839 * bluetooth adapter.
1840 * This API get the adapter internal data structure and check current adapter status.
1842 * This function is a synchronous call.
1845 * @return BLUETOOTH_ADAPTER_DISABLED - if bluetooth adapter is disabled\n
1846 * BLUETOOTH_ADAPTER_ENABLED - if bluetooth adapter is enabled\n
1848 * @see bluetooth_enable_adapter, bluetooth_disable_adapter
1852 ret = bluetooth_check_adapter();
1855 int bluetooth_check_adapter(void);
1858 * @fn int bluetooth_get_local_address(bluetooth_device_address_t *local_address)
1859 * @brief Get the local adapter bluetooth address
1862 * This API is used, get the device address of the local bluetooth adapter. Before calling this API,
1863 * the adapter should be enabled.
1864 * In its output parameter, you can receive bluetooth_device_address_t type of pointer which will
1865 * contain Bluetooth address.
1866 * Since its inconvenient for user to remember the address, Bluetooth provides a method to have a
1867 * friendly name for each device.
1868 * There is no event callback for this API.
1870 * This function is a synchronous call.
1873 * @return BLUETOOTH_ERROR_NONE - Succeess \n
1874 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer) \n
1875 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
1876 * @param[out] local_address a device address of local bluetooth adapter
1881 bluetooth_device_address_t local_address={0,};
1884 ret = bluetooth_get_local_address(&local_address);
1887 int bluetooth_get_local_address(bluetooth_device_address_t *local_address);
1890 * @fn int bluetooth_get_local_version(bluetooth_version_t *version)
1891 * @brief Get the hci version
1894 * This function is used to get the bluetooth hci version
1895 * Before calling this API make sure that the adapter is enabled.
1897 * This function is a synchronous call.
1900 * @return BLUETOOTH_ERROR_NONE - Success \n
1901 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
1902 * @param[out] timeout remain visibility timeout value
1905 bluetooth_version_t *version;
1907 ret = bluetooth_get_local_version (&version);
1910 int bluetooth_get_local_version(bluetooth_version_t *version);
1913 * @fn int bluetooth_get_local_name(bluetooth_device_name_t* local_name)
1914 * @brief Get the local device name
1917 * This function is used, get the local device name. Since its difficult to remember the Adapter
1918 * address, the friendly name can be assigned to the adapter and we can get it using this API. This
1919 * friendly name is retrived by the remote device and displaying.
1920 * Before calling this API, the adapter should be enabled. There is no event callback for this API.
1922 * This function is a synchronous call.
1925 * @return BLUETOOTH_ERROR_NONE - Success \n
1926 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
1927 * @param[out] local_name a local device name
1931 bluetooth_device_name_t local_name={0,}
1933 ret = bluetooth_get_local_name (&local_name);
1936 int bluetooth_get_local_name(bluetooth_device_name_t *local_name);
1939 * @fn int bluetooth_set_local_name(const bluetooth_device_name_t *local_name)
1940 * @brief Set the local device name
1943 * This function is used to set the local device name. This is a human friendly name whose
1944 * length can be BLUETOOTH_DEVICE_NAME_LENGTH_MAX maximum
1946 * This function is a synchronous call.
1948 * @param[in] local_name bluetooth device name to set local device
1950 * @return BLUETOOTH_ERROR_NONE - Success \n
1951 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1952 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1953 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
1954 * BLUETOOTH_ERROR_NO_RESOURCES - Pre-allocated memory error \n
1955 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1960 bluetooth_device_name_t local_name={0,}
1962 ret = bluetooth_set_local_name (&local_name);
1965 int bluetooth_set_local_name(const bluetooth_device_name_t *local_name);
1969 * @fn int bluetooth_is_service_used(const char *service_uuid, gboolean *used)
1970 * @brief Check if the uuid is used or not
1972 * This function is used to check if the uuid is used or not.
1974 * This function is a synchronous call.
1976 * @param[in] service_uuid service uuid (UUID 128 bit as string)
1977 * @param[out] used if the uuid is used or not
1979 * @return BLUETOOTH_ERROR_NONE - Success \n
1980 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
1981 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
1982 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
1987 gboolean used = FALSE;
1988 const char *uuid ="00001101-0000-1000-8000-00805F9B34FB";
1989 ret = bluetooth_is_service_used(uuid, &used);
1992 int bluetooth_is_service_used(const char *service_uuid, gboolean *used);
1995 * @fn int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address, bluetooth_service_type_t type, gboolean *is_connected)
1996 * @brief Check if the device is connected to the specific service
1998 * This function is used to check if if the device is connected to the specific service.
2000 * This function is a synchronous call.
2002 * @param[in] local_address a device address of remote bluetooth device
2003 * @param[in] type the service type
2004 * @param[out] is_connected if the device is connected or not
2006 * @return BLUETOOTH_ERROR_NONE - Success \n
2007 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2008 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2009 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2014 gboolean is_connected = FALSE;
2015 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2016 ret = bluetooth_is_device_connected(&device_address, BLUETOOTH_HSP_SERVICE, &used);
2019 int bluetooth_is_device_connected(const bluetooth_device_address_t *device_address,
2020 bluetooth_service_type_t type,
2021 gboolean *is_connected);
2024 * @fn int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address, bluetooth_connected_link_t *connected_link)
2025 * @brief Gets device's connected link type
2027 * This function is used to get device's connected link type
2029 * This function is a synchronous call.
2031 * @param[in] device_address a device address of remote bluetooth device
2032 * @param[out] connected_link a device's connected link type
2034 * @return BLUETOOTH_ERROR_NONE - Success \n
2035 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2036 * BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
2037 * BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
2042 bluetooth_connected_link_t *connected_link = BLUETOOTH_CONNECTED_LINK_NONE;
2043 bluetooth_device_address_t device_address={{0x00,0x0D,0xFD,0x24,0x5E,0xFF}};
2044 ret = bluetooth_get_connected_link(&device_address, &connected_link);
2047 int bluetooth_get_connected_link_type(const bluetooth_device_address_t *device_address,
2048 bluetooth_connected_link_t *connected_link);
2051 * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
2052 * @brief Get the visibility mode
2055 * This function is used to get the discoverable mode (Visibility option). Depending upon the
2056 * visibity mode, the property of the device is determined whether it can be discoverable, non
2057 * discoverable, connectable etc. Before calling this API make sure that the adapter is enabled.
2059 * This function is a synchronous call.
2062 * @return BLUETOOTH_ERROR_NONE - Success \n
2063 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2064 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2065 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2066 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2067 * @param[out] discoverable_mode current bluetooth discoverable mode
2069 * @see bluetooth_set_discoverable_mode
2071 bluetooth_discoverable_mode_t discoverable_mode_ptr;
2073 ret = bluetooth_get_discoverable_mode (&discoverable_mode_ptr);
2076 int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr);
2079 * @fn int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2081 * @brief Set the visibility mode
2084 * This function is used to set the discoverable mode (Visibility option).
2086 * Many times user may want to keep his device discoverable so that when peer device is performing
2087 * device search, he/she can find user's device. Application programmer can keep the mode as
2088 * BLUETOOTH_DISCOVERABLE_MODE_GENERAL_DISCOVERABLE or
2089 * BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE for the same purpose. However, all these
2090 * modes cause bluetooth adapter to consume more battery. Hence developer should generally
2091 * keep discoverable mode as BLUETOOTH_DISCOVERABLE_MODE_CONNECTABLE.
2093 * This function is a synchronous call.
2095 * @return BLUETOOTH_ERROR_NONE - Success \n
2096 * BLUETOOTH_ERROR_NOT_SUPPORT - Requested mode is not supported \n
2098 * @param[in] discoverable_mode the bluetooth discoverable mode to set
2099 * @param[in] timeout discoverable time in only limited discoverable mode (second), default: 0
2101 * @see bluetooth_get_discoverable_mode
2105 bluetooth_discoverable_mode_t mode;
2107 mode= BLUETOOTH_DISCOVERABLE_MODE_TIME_LIMITED_DISCOVERABLE;
2108 ret = bluetooth_set_discoverable_mode (mode, 180);
2112 int bluetooth_set_discoverable_mode(bluetooth_discoverable_mode_t discoverable_mode,
2117 * @fn int bluetooth_get_timeout_value(int *timeout)
2118 * @brief Get the visibility timeout value
2121 * This function is used to get the visibility timeout
2122 * Before calling this API make sure that the adapter is enabled.
2124 * This function is a synchronous call.
2127 * @return BLUETOOTH_ERROR_NONE - Success \n
2128 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2129 * BLUETOOTH_ERROR_INVALID_DATA - Invalid data \n
2130 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2131 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
2132 * @param[out] timeout remain visibility timeout value
2134 * @see bluetooth_set_discoverable_mode
2138 ret = bluetooth_get_timeout_value (&timeout);
2141 int bluetooth_get_timeout_value(int *timeout);
2145 * @fn int bluetooth_start_discovery(unsigned short max_response, unsigned short discovery_duration,
2146 * unsigned int classOfDeviceMask)
2147 * @brief Start the generic device discovery which finds both the BR/EDR and LE devices.
2149 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2150 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_discovery() API. It
2151 * first performs an inquiry and try to find both the BREDR and LE devices. For each device found
2152 * from the inquiry it gets the remote name of the device. Bluetooth device address and name are
2153 * given to Application via BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. In param_data of
2154 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2155 * You will receive device address, device name, device class, rssi (received signal strength indicator).
2156 * please see bluetooth_device_info_t for more details.
2159 * This API provides searching options like max responses, discovery duration in seconds and class
2160 * of device mask to filter device search. some times there may be too many bluetooth devices in
2161 * vicinity of your device.in such scenario, application can request to reduce number of responces
2162 * (BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event) with help of max_response parameter. However if you
2163 * pass zero, bluetooth adapter will not restrict number of responses. you can also specify duration
2164 * of the seach in discovery_duration. bluetooth adapter will automatically stop device search after
2165 * application defined time. please note that discovery_duration should be mentioned in seconds.
2166 * Also note that search will end after 180 seconds automatically if you pass 0 in discovery
2169 * Sometimes user may want to search for a particular kind of device. for ex, mobile or pc. in such
2170 * case, you can use classOfDeviceMask parameter. please see bluetooth_device_service_class_t,
2171 * bluetooth_device_major_class_t and bluetooth_device_minor_class_t enums
2173 * This function is a asynchronous call.
2174 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2175 * through registered callback function.
2177 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2178 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2180 * The completion or cancellation of the discovery is indicated by an
2181 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2183 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2186 * @return BLUETOOTH_ERROR_NONE - Success \n
2187 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2188 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2189 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2190 agent is not running \n
2192 * @param[in] max_response define the maximum response of the number of founded devices
2194 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
2195 * @param[in] classOfDeviceMask define classes of the device mask which user wants
2196 (refer to class of device)
2198 * @see bluetooth_start_custom_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2201 void bt_event_callback(int event, bluetooth_event_param_t *param)
2205 case BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND:
2207 bluetooth_device_info_t *device_info = NULL;
2208 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2210 device_info = (bluetooth_device_info_t *)param->param_data;
2211 memcpy(&searched_device, &device_info->device_address,
2212 sizeof(bluetooth_device_address_t));
2213 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2214 device_info->device_address.addr[0],
2215 device_info->device_address.addr[1],
2216 device_info->device_address.addr[2],
2217 device_info->device_address.addr[3],
2218 device_info->device_address.addr[4],
2219 device_info->device_address.addr[5]);
2222 case BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED:
2224 bluetooth_device_info_t *device_info = NULL;
2225 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED, result [0x%04x]",
2227 device_info = (bluetooth_device_info_t *)param->param_data;
2228 memcpy(&searched_device, &device_info->device_address,
2229 sizeof(bluetooth_device_address_t));
2230 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2231 device_info->device_name.name,
2232 device_info->device_address.addr[0],
2233 device_info->device_address.addr[1],
2234 device_info->device_address.addr[2],
2235 device_info->device_address.addr[3],
2236 device_info->device_address.addr[4],
2237 device_info->device_address.addr[5]);
2241 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2242 printf("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2247 unsigned short max_response;
2248 unsigned short discovery_duration;
2249 unsigned classOfDeviceMask;
2253 discovery_duration =0;
2254 classOfDeviceMask =0;
2256 ret = bluetooth_start_discovery(max_response,discovery_duration,classOfDeviceMask);
2261 int bluetooth_start_discovery(unsigned short max_response,
2262 unsigned short discovery_duration,
2263 unsigned int classOfDeviceMask);
2266 * @fn int bluetooth_start_custom_discovery(bt_discovery_role_type_t role
2267 * unsigned short max_response,
2268 * unsigned short discovery_duration,
2269 * unsigned int classOfDeviceMask)
2270 * @brief Start the custom device discovery with specific type such as BR/EDR, LE, LE+BR/EDR etc.
2272 * Sometimes user may want to search for a particular kind of device. for ex, LE only or BR/EDR only.
2273 * In such case, you can use type parameter. This API is similar to that of bluetooth_start_discovery().
2274 * Please see bluetooth_start_discovery() for other parameters description.
2276 * This function is a asynchronous call.
2277 * If the call is success then the application will receive BLUETOOTH_EVENT_DISCOVERY_STARTED event
2278 * through registered callback function.
2280 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event for each device it
2281 * found and a BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED event for its name updation.
2283 * The completion or cancellation of the discovery is indicated by an
2284 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event.
2286 * The device discovery can be cancelled by calling bluetooth_stop_discovery().
2289 * @return BLUETOOTH_ERROR_NONE - Success \n
2290 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2291 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2292 * BLUETOOTH_ERROR_IN_PROGRESS - Bluetooth adapter is busy with another discovery \n
2293 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2294 agent is not running \n
2296 * @param[in] role define the role type of devices to be discovered. See enum bt_discovery_role_type_t.
2297 (DISCOVERY_ROLE_BREDR means BREDR only, DISCOVERY_ROLE_LE mean Low Energy only,
2298 DISCOVERY_ROLE_LE_BREDR means LE & BREDR - same as bluetooth_start_discovery())
2299 * @param[in] max_response define the maximum response of the number of founded devices
2301 * @param[in] discovery_duration define bluetooth discovery duration (0 means 180s )
2302 * @param[in] classOfDeviceMask define classes of the device mask which user wants
2303 (refer to class of device)
2305 * @see bluetooth_start_discovery(), bluetooth_cancel_discovery, bluetooth_device_info_t
2308 unsigned short type;
2309 unsigned short max_response;
2310 unsigned short discovery_duration;
2311 unsigned classOfDeviceMask;
2316 discovery_duration =0;
2317 classOfDeviceMask =0;
2319 ret = bluetooth_start_custom_discovery(type, max_response, discovery_duration, classOfDeviceMask);
2324 int bluetooth_start_custom_discovery(bt_discovery_role_type_t role,
2325 unsigned short max_response,
2326 unsigned short discovery_duration,
2327 unsigned int classOfDeviceMask);
2330 * @fn int bluetooth_cancel_discovery (void)
2331 * @brief Cancel the on-going device discovery operation
2334 * This function stops the on-going device discovery operation. This API has to be called after the
2335 * bluetooth_start_discovery API and before the BLUETOOTH_EVENT_DISCOVERY_FINISHED event comes of
2336 * the bluetooth_start_discovery API
2338 * Normally the device discovery takes a more time (~10.24 seconds) to get all the devices in its
2339 * vicinity and it recevies as BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND event. This API helps us to
2340 * cancel the discover request once the user received the device to which he wish to connect.
2342 * This function is a asynchronous call.
2343 * If the call is success to cancel discovey then the application will receive
2344 * BLUETOOTH_EVENT_DISCOVERY_FINISHED event through registered callback function
2345 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2346 * BLUETOOTH_ERROR_NONE
2349 * @return BLUETOOTH_ERROR_NONE - Success \n
2350 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2351 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2352 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2353 other application \n
2354 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2356 * @see bluetooth_start_discovery
2358 void bt_event_callback(int event, bluetooth_event_param_t *param)
2362 case BLUETOOTH_EVENT_DISCOVERY_FINISHED:
2363 TC_PRT("BLUETOOTH_EVENT_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2372 ret = bluetooth_cancel_discovery();
2375 int bluetooth_cancel_discovery(void);
2378 * @fn int bluetooth_start_le_discovery(void)
2379 * @brief Start the generic device discovery which finds the LE devices.
2381 * To connect connect to peer bluetooth device, you will need to know its bluetooth address and its
2382 * name. You can search for Bluetooth devices in vicinity by bluetooth_start_le_discovery() API.
2383 * It try to find LE devices. Bluetooth device address and name are
2384 * given to Application via BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event. In param_data of
2385 * bluetooth_event_param_t, you will receive a pointer to a structure of bluetooth_device_info_t type.
2386 * You will receive device address, device name, device class, rssi (received signal strength indicator).
2387 * please see bluetooth_device_info_t for more details.
2389 * This function is a asynchronous call.
2390 * If the call is success then the application will receive BLUETOOTH_EVENT_LE_DISCOVERY_STARTED event
2391 * through registered callback function.
2393 * The discovery is responded by an BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND event for each device it
2396 * The completion or cancellation of the discovery is indicated by an
2397 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event.
2399 * The device discovery can be cancelled by calling bluetooth_stop_le_discovery().
2402 * @return BLUETOOTH_ERROR_NONE - Success \n
2403 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2404 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2405 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2406 agent is not running \n
2409 * @see bluetooth_stop_le_discovery, bluetooth_device_info_t
2412 void bt_event_callback(int event, bluetooth_event_param_t *param)
2416 case BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND:
2418 bluetooth_device_info_t *device_info = NULL;
2419 printf("BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, result [0x%04x]",
2421 device_info = (bluetooth_device_info_t *)param->param_data;
2422 memcpy(&searched_device, &device_info->device_address,
2423 sizeof(bluetooth_device_address_t));
2424 printf("dev [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]",
2425 device_info->device_address.addr[0],
2426 device_info->device_address.addr[1],
2427 device_info->device_address.addr[2],
2428 device_info->device_address.addr[3],
2429 device_info->device_address.addr[4],
2430 device_info->device_address.addr[5]);
2434 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2435 printf("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2441 ret = bluetooth_start_discovery();
2446 int bluetooth_start_le_discovery(void);
2449 * @fn int bluetooth_stop_le_discovery (void)
2450 * @brief Cancel the on-going device LE discovery operation
2453 * This function stops the on-going device discovery operation. This API has to be called after the
2454 * bluetooth_start_le_discovery API and before the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event comes of
2455 * the bluetooth_start_le_discovery API
2458 * This function is a asynchronous call.
2459 * If the call is success to cancel discovey then the application will receive
2460 * BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED event through registered callback function
2461 * with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure the error code will be
2462 * BLUETOOTH_ERROR_NONE
2465 * @return BLUETOOTH_ERROR_NONE - Success \n
2466 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2467 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No Discovery operation in progess to cancel \n
2468 * BLUETOOTH_ERROR_ACCESS_DENIED - Currently in discovery but it is requested from
2469 other application \n
2470 * BLUETOOTH_ERROR_INTERNAL - Internel IPC error \n
2472 * @see bluetooth_start_discovery
2474 void bt_event_callback(int event, bluetooth_event_param_t *param)
2478 case BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED:
2479 TC_PRT("BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, result[0x%04x]", param->result);
2488 ret = bluetooth_stop_le_discovery();
2491 int bluetooth_stop_le_discovery(void);
2494 * @fn int bluetooth_is_discovering(void)
2495 * @brief Check for the device discovery is in-progress or not.
2497 * This API is used to check the current status of the Discovery operation.If discovery is in\
2498 * progress normally other operations are not allowed.
2499 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2500 * for the BLUETOOTH_EVENT_DISCOVERY_FINISHED
2501 * event before performing other operations. This API is used to get for the current discovery
2502 * operation status and using bluetooth_cancel_discovery()
2503 * we can cancell the ongoing discovery process.
2504 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2507 * This function checks whether the device discovery is started or not.
2509 * This function is a synchronous call.
2512 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2513 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2514 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2517 * @see bluetooth_start_discovery, bluetooth_cancel_discovery
2521 ret = bluetooth_is_discovering ();
2524 int bluetooth_is_discovering(void);
2527 * @fn int bluetooth_is_le_discovering(void)
2528 * @brief Check for the device LE discovery is in-progress or not.
2530 * This API is used to check the current status of the LE Discovery operation.If discovery is in\
2531 * progress normally other operations are not allowed.
2532 * If a device discovery is in progress, we have to either cancel the discovery operation or wait
2533 * for the BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED
2534 * event before performing other operations. This API is used to get for the current discovery
2535 * operation status and using bluetooth_stop_le_discovery()
2536 * we can cancell the ongoing LE discovery process.
2537 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
2540 * This function checks whether the device LE discovery is started or not.
2542 * This function is a synchronous call.
2545 * @return BLUETOOTH_ERROR_NONE - Discovery is not in progress \n
2546 * BLUETOOTH_ERROR_NONE+1 - Discovery in progress \n
2547 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2550 * @see bluetooth_start_le_discovery, bluetooth_stop_le_discovery
2554 ret = bluetooth_is_le_discovering ();
2557 int bluetooth_is_le_discovering(void);
2560 * @fn int bluetooth_is_le_scanning(void)
2561 * @brief Check for the device LE scan is in-progress or not.
2563 * This API is used to check the current status of the LE Scan operation.If discovery is in\
2564 * progress normally other operations are not allowed.
2566 * This function checks whether the device LE Scan is started or not.
2568 * This function is a synchronous call.
2570 * @return TRUE - LE Scan in progress \n
2571 * FALSE - LE Scan is not in progress \n
2576 gboolean is_le_scanning = 0;
2577 is_le_scanning = bluetooth_is_le_scanning ();
2580 gboolean bluetooth_is_le_scanning(void);
2583 * @fn int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id)
2584 * @brief Register scan filter.
2586 * This function registers the scan filter.
2588 * This function is a synchronous call.
2590 * @return BLUETOOTH_ERROR_NONE - Success \n
2592 * @param[in] filter scan filter to register
2593 * @param[out] slot_id the slot ID of scan filter
2597 int bluetooth_register_scan_filter(bluetooth_le_scan_filter_t *filter, int *slot_id);
2600 * @fn int bluetooth_unregister_scan_filter(int slot_id)
2601 * @brief Register scan filter.
2603 * This function unregisters the scan filter.
2605 * This function is a synchronous call.
2607 * @return BLUETOOTH_ERROR_NONE - Success \n
2609 * @param[in] slot_id the slot ID of scan filter
2613 int bluetooth_unregister_scan_filter(int slot_id);
2616 * @fn int bluetooth_unregister_all_scan_filters(void)
2617 * @brief Register scan filter.
2619 * This function usregisters all scan filters.
2621 * This function is a synchronous call.
2623 * @return BLUETOOTH_ERROR_NONE - Success \n
2627 int bluetooth_unregister_all_scan_filters(void);
2630 * @fn int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2631 int link_type, bt_rssi_threshold_t rssi_threshold)
2632 * @brief Enable RSSI monitoring
2634 * This function enables RSSI monitoring and sets threshold for a connection
2636 * @return BLUETOOTH_ERROR_NONE - Success \n
2639 * @see bluetooth_get_rssi_strength
2641 int bluetooth_enable_rssi(const bluetooth_device_address_t *remote_address,
2642 int link_type, bt_rssi_threshold_t *rssi_threshold);
2645 * @fn int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type)
2646 * @brief Gets Raw RSSI signal Strength
2648 * This function gives the Raw RSSI signal strength for a connection.
2650 * @return BLUETOOTH_ERROR_NONE - Success \n
2653 * @see bluetooth_enable_rssi
2655 int bluetooth_get_rssi_strength(const bluetooth_device_address_t *remote_address, int link_type);
2657 int bluetooth_set_connectable(gboolean is_connectable);
2659 int bluetooth_is_connectable(gboolean *is_connectable);
2662 * @fn int bluetooth_bond_device(const bluetooth_device_address_t *device_address)
2663 * @brief Initiate a bonding process
2666 * This function initiates a bonding procedure with a peer device. The bonding procedure
2667 * enables authentication and optionally encryption on the Bluetooth link.
2669 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2670 * inititate the bonding request to the devices already in the paired list.
2672 * Usually we call this API after the device discovery.
2673 * This function is a asynchronous call.
2675 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2676 * mentioed result code
2677 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2678 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2679 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2680 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2681 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2683 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2684 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2687 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2690 * @return BLUETOOTH_ERROR_NONE - Success \n
2691 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2692 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2693 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2694 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2696 * @param[in] device_address This indicates an address of the device with which the pairing
2697 * should be initiated
2699 * @see bluetooth_cancel_bonding
2701 void bt_event_callback(int event, bluetooth_event_param_t *param)
2705 case BLUETOOTH_EVENT_BONDING_FINISHED:
2707 TC_PRT("BLUETOOTH_EVENT_BONDING_FINISHED, result [0x%04x]", param->result);
2708 if (param->result >= BLUETOOTH_ERROR_NONE)
2710 bluetooth_device_info_t *device_info = NULL;
2711 device_info = (bluetooth_device_info_t *)param->param_data;
2712 printf("dev [%s] [%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X]
2713 mjr[%#x] min[%#x] srv[%#x]",
2714 device_info->device_name.name,
2715 device_info->device_address.addr[0],
2716 device_info->device_address.addr[1],
2717 device_info->device_address.addr[2],
2718 device_info->device_address.addr[3],
2719 device_info->device_address.addr[4],
2720 device_info->device_address.addr[5],
2721 device_info->device_class.major_class,
2722 device_info->device_class.minor_class,
2723 device_info->device_class.service_class);
2737 bluetooth_device_address_t device_address={{0}};
2739 ret = bluetooth_bond_device(&device_address);
2743 int bluetooth_bond_device(const bluetooth_device_address_t *device_address);
2746 * @fn int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2747 * bluetooth_conn_type_t conn_type)
2748 * @brief Initiate a bonding process
2751 * This function initiates a bonding procedure with a peer device on the basis of connection type (BLE or BREDR).
2752 * The bonding procedure enables authentication and optionally encryption on the Bluetooth link.
2754 * Bonding is applied to the discovered device to which we need a secure connection. We cannot
2755 * inititate the bonding request to the devices already in the paired list.
2757 * Usually we call this API after the device discovery.
2758 * This function is a asynchronous call.
2760 * Response will be received through BLUETOOTH_EVENT_BONDING_FINISHED event. It can any of the below
2761 * mentioed result code
2762 * BLUETOOTH_ERROR_PARING_FAILED - Pairing faied \n
2763 * BLUETOOTH_ERROR_ACCESS_DENIED - Authetication rejected \n
2764 * BLUETOOTH_ERROR_CANCEL_BY_USER - Cancelled by the user \n
2765 * BLUETOOTH_ERROR_PARING_FAILED - Pairing failed \n
2766 * BLUETOOTH_ERROR_TIMEOUT - Timeout has haapened \n
2768 * If the remote user is not responding with in a specific time(60 seconds), then a timeout happens
2769 * and BLUETOOTH_EVENT_BONDING_FINISHED callback event is called with and BLUETOOTH_ERROR_TIMEOUT
2772 * The bonding operation can be cancelled by calling bluetooth_cancel_bonding().
2775 * @return BLUETOOTH_ERROR_NONE - Success \n
2776 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
2777 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2778 * BLUETOOTH_ERROR_DEVICE_BUSY - Adapter is busy or Discovery is in Progress \n
2779 * BLUETOOTH_ERROR_INVALID_DATA - Invalid BD address \n
2781 * @param[in] device_address This indicates an address of the device with which pairing
2782 * should be initiated
2783 * @param[in] conn_type This Indicates the connection type to be used for pairing in case of
2786 * @see bluetooth_cancel_bonding
2788 int bluetooth_bond_device_by_type(const bluetooth_device_address_t *device_address,
2789 bluetooth_conn_type_t conn_type);
2792 * @fn int bluetooth_cancel_bonding(void)
2793 * @brief Cancel the on-going bonding process
2795 * This API is called to cancel the on-going bonding procedure. It should be called before the
2796 * BLUETOOTH_EVENT_BONDING_FINISHED event comes.
2797 * This API is useful when the remote device is not responding to the bond request or we wish to
2798 * cancel the bonding request. In this case we need not wait for the timeout to happen.
2800 * This function is a synchronous call.
2802 * @return BLUETOOTH_ERROR_NONE - Success \n
2803 * BLUETOOTH_ERROR_NOT_IN_OPERATION - No bonding request in progress \n
2804 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
2807 * @see bluetooth_bond_device
2813 ret = bluetooth_cancel_bonding();
2816 int bluetooth_cancel_bonding(void);
2819 * @fn int bluetooth_unbond_device(const bluetooth_device_address_t *device_address)
2820 * @brief Remove bonding
2823 * To communicate with remote device over bluetooth link, user should bond with peer device.
2824 * After bonding is over, peer device is added to list of bonded devices. bluetooth_unbond_device()
2825 * API is used to remove peer device from the list. Please note that after removing the device
2826 * from bonded device list, you cannot communication with peer device until bonding happens again.
2828 * User can call this function by passing bluetooth device address of any bonded device. Please note
2829 * that after successful return of this function, any bluetooth application running on your device
2830 * will not be able to communicate with unbonded device until bond operation happens again using
2831 * bluetooth_bond_device()
2834 * This function is a asynchronous call. The request to remove the specified device from the bonded
2835 * list is responded by an BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED event. if the operation is success,
2836 * you will receive BLUETOOTH_ERROR_NONE. BLUETOOTH_ERROR_NOT_PAIRED may be received in result code
2837 * in case if there is a problem in locating given bluetooth device address in bonded devices list
2841 * @return BLUETOOTH_ERROR_NONE - Success \n
2842 * BLUETOOTH_ERROR_INVALID_PARAM - Device address is not valid \n
2843 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Bluetooth adapter is not enabled \n
2844 * BLUETOOTH_ERROR_DEVICE_BUSY - Bluetooth adapter is busy doing some operation \n
2845 * BLUETOOTH_ERROR_INVALID_DATA - Device address provided is incorrect \n
2846 * BLUETOOTH_ERROR_INTERNAL - System error like heap full has occured or bluetooth
2847 * agent is not running \n
2848 * BLUETOOTH_ERROR_NOT_PAIRED - Device address mentioned in the argument is not a
2851 * @param[in] device_address This indicates an address of the device to remove bonding
2855 * @see bluetooth_bond_device, bluetooth_cancel_bonding
2858 void bt_event_callback(int event, bluetooth_event_param_t *param)
2861 case BLUETOOTH_EVENT_BONDED_DEVICE_REMOVED: {
2862 bluetooth_device_address_t *dev_addr = NULL;
2864 if (param->result == BLUETOOTH_ERROR_NONE) {
2865 dev_addr = (bluetooth_device_address_t *)param->param_data;
2867 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2868 dev_addr->addr[0], dev_addr->addr[1]
2869 dev_addr->addr[2], dev_addr->addr[3]
2870 dev_addr->addr[4], dev_addr->addr[5]
2881 bluetooth_device_address_t *device_address;
2883 // copy valid device address in device_address
2885 ret = bluetooth_unbond_device(device_address);
2888 int bluetooth_unbond_device(const bluetooth_device_address_t *device_address);
2891 * @fn int bluetooth_get_bonded_device_list(GPtrArray **dev_list)
2892 * @brief Get bonded(paired) device list
2895 * This API gets all bonded device list.
2896 * The devices in the bonded device list further can be used to perform the authorization by calling
2897 * bluetooth_authorize_device API.
2899 * This function is a synchronous call.
2900 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2901 * there is no valid information in the dev_list.
2902 * The len field in the dev_list represents the number of bonded devices. The data structure for
2903 * bonded device information is bluetooth_device_info_t.
2906 * @return BLUETOOTH_ERROR_NONE - Success \n
2907 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2909 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2911 void bt_get_bonded_devices(void)
2915 GPtrArray *devinfo = NULL;
2916 bluetooth_device_info_t *ptr;
2918 // allocate the g_pointer_array
2919 devinfo = g_ptr_array_new();
2921 ret = bluetooth_get_bonded_device_list(&devinfo);
2922 if (ret != BLUETOOTH_ERROR_NONE)
2924 printf("bluetooth_get_bonded_device_list failed with [%d]",ret);
2928 printf("g pointer arrary count : [%d]", devinfo->len);
2929 for (i=0; i<devinfo->len; i++)
2931 ptr = g_ptr_array_index(devinfo, i);
2934 printf("Name [%s]\n", ptr->device_name.name);
2935 printf("Major Class [%d]\n", ptr->device_class.major_class);
2936 printf("Minor Class [%d]\n", ptr->device_class.minor_class);
2937 printf("Service Class [%d]\n", ptr->device_class.service_class);
2938 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
2939 ptr->device_address.addr[0],
2940 ptr->device_address.addr[1], ptr->device_address.addr[2],
2941 ptr->device_address.addr[3],
2942 ptr->device_address.addr[4], ptr->device_address.addr[5]);
2949 // free g_pointer_array
2950 g_ptr_array_free(devinfo, TRUE);
2955 int bluetooth_get_bonded_device_list(GPtrArray **dev_list);
2958 * @fn int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
2959 * bluetooth_device_info_t *dev_info)
2960 * @brief Get a bonded(paired) device
2963 * This API gets a bonded device.
2965 * This function is a synchronous call.
2966 * Information for bonded devices can be obtained when result code is BLUETOOTH_ERROR_NONE. If not,
2967 * there is no valid information in the dev_info.
2968 * The data structure for bonded device information is bluetooth_device_info_t.
2971 * @return BLUETOOTH_ERROR_NONE - Success \n
2972 * BLUETOOTH_ERROR_NOT_SUPPORT - Opreation not supported \n
2974 * @see bluetooth_bond_device, bluetooth_unbond_device, bluetooth_authorize_device
2976 void bt_get_bonded_device(void)
2980 bluetooth_device_info_t devinfo = {0};
2981 bluetooth_device_address_t device_address={{0x00,0x1C,0x43,0x2B,0x1A,0xE5}};
2983 ret = bluetooth_get_bonded_device(&device_address, &devinfo);
2984 if (ret != BLUETOOTH_ERROR_NONE)
2986 printf("bluetooth_get_bonded_device failed with [%d]",ret);
2990 printf("Name [%s]\n", devinfo.device_name.name);
2991 printf("Major Class [%d]\n", devinfo.device_class.major_class);
2992 printf("Minor Class [%d]\n", devinfo.device_class.minor_class);
2993 printf("Service Class [%d]\n", devinfo.device_class.service_class);
2994 printf("%2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n", devinfo.device_address.addr[0],
2995 devinfo.device_address.addr[1], devinfo.device_address.addr[2],
2996 devinfo.device_address.addr[3], devinfo.device_address.addr[4],
2997 devinfo.device_address.addr[5]);
3006 int bluetooth_get_bonded_device(const bluetooth_device_address_t *device_address,
3007 bluetooth_device_info_t *dev_info);
3010 * @fn int bluetooth_set_alias(const bluetooth_device_address_t *device_address, const char *alias)
3011 * @brief set alias for bonded device
3014 * This function set alias for bonded device.
3016 * This function is a synchronous call.
3019 * @return BLUETOOTH_ERROR_NONE - Success \n
3020 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3021 * @param[in] device_address This indicates an address of the remote device
3022 * @param[in] alias This indicates an alias to set
3027 ret = bluetooth_set_alias(&remote_address);
3030 int bluetooth_set_alias(const bluetooth_device_address_t *device_address,
3034 * @fn int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address)
3035 * @brief Get remote deivice
3038 * This function gets specific remote device.
3040 * This function is a asynchronous call.
3041 * This API is responded by an BLUETOOTH_EVENT_REMOTE_DEVICE_READ event.
3044 * @return BLUETOOTH_ERROR_NONE - Success \n
3045 * BLUETOOTH_ERROR_NOT_SUPPORT - Operation not supported \n
3046 * @param[in] device_address This indicates an address of the remote device
3051 ret = bluetooth_get_remote_device(&remote_address);
3054 int bluetooth_get_remote_device(const bluetooth_device_address_t *device_address);
3057 * @fn int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3058 * gboolean authorized)
3059 * @brief Authorize/Unauthorize a bonded device
3062 * This function authorizes/unauthorize a bonded device. It decides the device to connect
3063 * with/without user confirmation.
3065 * If we select a paired device and make it authorized by calling this API with the authorized
3066 * parameter to TRUE, then it will not ask for the user conformation before connecting. Similarly
3067 * if we unauthorize the paired device by calling this API with the authorized parameter to FALSE,
3068 * then it will ask for the user conformation before the connection.
3070 * This API supposed to be called on the paired devices. Which means we have to use this API only
3071 * after successful pairing.
3073 * This function is a asynchronous call.
3074 * Response will be received through BLUETOOTH_EVENT_DEVICE_AUTHORIZED event.
3076 * @return BLUETOOTH_ERROR_NONE - Success \n
3077 * @exception BLUETOOTH_ERROR_INTERNAL - Cannot get the interal DBUS proxy \n
3078 * @param[in] device_address This indicates an address of the device to authorize \n
3079 * @param[in] authorized TRUE : authorize FALSE: unauthorize
3081 * @see bluetooth_get_bonded_device_list
3083 void bt_event_callback(int event, bluetooth_event_param_t *param)
3087 case BLUETOOTH_EVENT_DEVICE_AUTHORIZED :
3089 if (param->result == BLUETOOTH_ERROR_NONE)
3093 //device authorization failed failure
3101 bluetooth_device_address_t device_address={{0}};
3102 gboolean authorized;
3106 ret = bluetooth_authorize_device(&device_address,authorized);
3109 int bluetooth_authorize_device(const bluetooth_device_address_t *device_address,
3110 gboolean authorized);
3112 int bluetooth_set_pin_code(const bluetooth_device_address_t *device_address,
3113 const bluetooth_device_pin_code_t *pin_code);
3115 int bluetooth_unset_pin_code(const bluetooth_device_address_t *device_address);
3118 * @fn int bluetooth_passkey_reply(char *passkey, gboolean reply)
3120 * @brief Receives Legacy Passkey\pin with following authentication response types
3122 * @param[in] passkey : This is the PIN or PASSKEY string required for remote device authentication
3123 * @param[in] reply TRUE : Accept AUthentication FALSE: Cancels authentication
3126 int bluetooth_passkey_reply(char *passkey, gboolean reply);
3129 * @fn int bluetooth_passkey_confirmation_reply(gboolean reply);
3131 * @brief This API sends user confirmation reply to the local adapter.
3133 * @param[in] reply TRUE : Accept AUthentication FALSE: Cancels authentication
3136 int bluetooth_passkey_confirmation_reply(gboolean reply);
3139 * @fn int bluetooth_search_service(const bluetooth_device_address_t *device_address)
3140 * @brief Get all services supported by remote device
3143 * This API call initiates the search for the services supported by the specified device. Normally
3144 * the service search will take a couple of seconds to get it completed. Before calling this API
3145 * make sure that the Adapter is enabled. We have to give the device address of the remote device to
3146 * perform the service search. We can get the device address by doing a device discovery operation.
3149 * This function is a asynchronous call.
3150 * The service search request is responded by BLUETOOTH_EVENT_SERVICE_SEARCHED event.
3152 * There is a timeout associated with the service search. The default time out is 40 seconds. If the
3153 * remove device did not respond with in the time out period the BLUETOOTH_EVENT_SERVICE_SEARCHED
3154 * event is generated with appropriate result code.
3156 * @return BLUETOOTH_ERROR_NONE - Success \n
3157 * BLUETOOTH_ERROR_SERVICE_SEARCH_ERROR - Service search error (NULL device address) \n
3158 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
3159 * @param[in] device_address This indicates an address of the device
3160 * whose services need to be found
3162 * @see bluetooth_cancel_service_search
3164 int bluetooth_search_service(const bluetooth_device_address_t *device_address);
3167 * @fn int bluetooth_cancel_service_search(void)
3168 * @brief Cancel the ongoing service search operation
3171 * This function cancel the ongoing service search operation. This API is usually calling after the
3172 * bluetooth_search_service API.
3173 * Normally service search will take a more time (> 5 seconds) to complete. This API will be called
3174 * if the user wish to cancel the Ongoing service search operation.
3176 * This API should be called just after the bluetooth_search_service API and before the
3177 * BLUETOOTH_EVENT_SERVICE_SEARCHED event
3179 * This function is a synchronous call.
3181 * @return BLUETOOTH_ERROR_NONE - Success \n
3182 * BLUETOOTH_ERROR_CANCEL - Error in service search cancel operation \n
3183 * BLUETOOTH_ERROR_NOT_PAIRED - Not paired device \n
3184 * BLUETOOTH_ERROR_NOT_IN_OPERATION - Searching service is not in operation \n
3187 * @see bluetooth_search_service
3192 ret = bluetooth_cancel_service_search();
3195 int bluetooth_cancel_service_search(void);
3198 * @fn int bluetooth_rfcomm_create_socket(const char *uuid)
3199 * @brief Register rfcomm socket with a specific uuid
3202 * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3203 * descriptor of the server.
3204 * This is the first API which is called to create the server. Once we created the server socket,
3205 * we will listen on that return socket.
3206 * So a bluetooth_rfcomm_listen_and_accept should follow this API call. This is a synchronous call.
3209 * @return socket FD on Success \n
3210 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3211 * BLUETOOTH_ERROR_INTERNAL - Internal error\n
3212 * BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3213 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3214 * @param[in] UUID (128 bits)
3217 * @see bluetooth_rfcomm_listen_and_accept, bluetooth_rfcomm_remove_socket
3221 const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3222 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3226 int bluetooth_rfcomm_create_socket(const char *uuid);
3229 * @fn int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path)
3230 * @brief Register rfcomm socket with a specific uuid
3233 * This API register rfcomm socket with the given UUID. The return value of this API is the socket
3234 * descriptor of the server.
3235 * This is the first API which is called to create the server. Once we created the server socket,
3236 * we will listen on that return socket.
3237 * So a bluetooth_rfcomm_listen_and_accept_ex should follow this API call. This is a synchronous call.
3240 * @return socket FD on Success \n
3241 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3242 * BLUETOOTH_ERROR_INTERNAL - Internal error\n
3243 * BLUETOOTH_ERROR_MAX_CONNECTION - Maximum connection reached\n
3244 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3245 * @param[in] UUID (128 bits)
3246 * @param[in] bus_name (const char)
3247 * @param[in] path (const char)
3250 * @see bluetooth_rfcomm_listen_and_accept_ex, bluetooth_rfcomm_remove_socket
3254 const char *rfcomm_test_uuid="00001101-0000-1000-8000-00805F9B34FB";
3255 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, bus_name, path);
3259 int bluetooth_rfcomm_create_socket_ex(const char *uuid, const char *bus_name, const char *path);
3262 * @fn int bluetooth_rfcomm_remove_socket(int socket_fd, const char *uuid)
3263 * @brief De-register the rfcomm socket
3266 * This API deregister rfcomm socket with the given socket fd and UUID. If the remote device is
3267 * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3268 * descriptor else no event will come. We will call this API only after the
3269 * bluetooth_rfcomm_listen_and_accept.
3270 * This is a synchronous call.
3272 * @return BLUETOOTH_ERROR_NONE - Success \n
3273 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3274 * BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3275 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3276 * @param[in] int socket_fd
3279 * @see bluetooth_rfcomm_create_socket, bluetooth_rfcomm_listen_and_accept
3282 void bt_event_callback(int event, bluetooth_event_param_t *param)
3286 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3288 bluetooth_rfcomm_connection_t *discon_ind =
3289 (bluetooth_rfcomm_connection_t *)param->param_data;
3291 printf("\nDisconnected from FD %d", discon_ind->socket_fd);
3299 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3300 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3302 ret = bluetooth_rfcomm_remove_socket(fd);
3305 int bluetooth_rfcomm_remove_socket(int socket_fd);
3308 * @fn int bluetooth_rfcomm_remove_socket(const char *uuid)
3309 * @brief De-register the rfcomm socket
3312 * This API deregister rfcomm socket with the given socket UUID. If the remote device is
3313 * already connected then we will receive the BLUETOOTH_EVENT_RFCOMM_DISCONNECTED with socket
3314 * descriptor else no event will come. We will call this API only after the
3315 * bluetooth_rfcomm_listen_and_accept_ex.
3316 * This is a synchronous call.
3318 * @return BLUETOOTH_ERROR_NONE - Success \n
3319 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3320 * BLUETOOTH_ERROR_NOT_FOUND - Cannot find the proxy\n
3321 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3322 * @param[in] UUID (128 bits)
3325 * @see bluetooth_rfcomm_create_socket_ex, bluetooth_rfcomm_listen_and_accept_ex
3328 void bt_event_callback(int event, bluetooth_event_param_t *param)
3332 case BLUETOOTH_EVENT_RFCOMM_DISCONNECTED:
3334 bluetooth_rfcomm_connection_t *discon_ind =
3335 (bluetooth_rfcomm_connection_t *)param->param_data;
3337 printf("\nDisconnected from FD %d", discon_ind->socket_fd);
3345 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid, path, bus_name);
3346 ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3348 ret = bluetooth_rfcomm_remove_socket_ex(rfcomm_test_uuid);
3351 int bluetooth_rfcomm_remove_socket_ex(const char *uuid);
3354 * @fn int bluetooth_rfcomm_server_disconnect(int socket_fd)
3355 * @brief Disconnect rfcomm connection
3358 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
3359 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3362 * @return BLUETOOTH_ERROR_NONE - Success \n
3363 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3364 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3365 * @param[in] int socket_fd the sending socket fd
3371 ret = bluetooth_rfcomm_server_disconnect(g_ret_fd);
3373 printf("Disconnection failed");
3375 printf("Disconnection Success");
3379 int bluetooth_rfcomm_server_disconnect(int socket_fd);
3382 * @fn int bluetooth_rfcomm_listen_and_accept(int socket_fd,int max_pending_connection)
3383 * @brief Rfcomm socket listen
3386 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3387 * after the bluetooth_rfcomm_create_socket API.
3388 * This API listen for the incomming connection and once it receives a connection, it will give
3389 * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3390 * event to the application. This is an Asynchronous API call.
3393 * @return BLUETOOTH_ERROR_NONE - Success \n
3394 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3395 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3397 * @param[in] int socket_fd
3398 * @param[in] max pending connection.
3401 * @see bluetooth_rfcomm_create_socket
3404 void bt_event_callback(int event, bluetooth_event_param_t* param)
3408 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3410 bluetooth_rfcomm_connection_t *conn_ind =
3411 (bluetooth_rfcomm_connection_t *)param->param_data;
3413 printf("\nConnected from FD %d", conn_ind->socket_fd);
3421 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3422 ret = bluetooth_rfcomm_listen_and_accept(fd, 1);
3426 int bluetooth_rfcomm_listen_and_accept(int socket_fd, int max_pending_connection);
3429 * @fn int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path)
3430 * @brief Rfcomm socket listen
3433 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3434 * after the bluetooth_rfcomm_create_socket API.
3435 * This API listen for the incomming connection and once it receives a connection, it will give
3436 * BLUETOOTH_EVENT_RFCOMM_CONNECTED
3437 * event to the application. This is an Asynchronous API call.
3440 * @return BLUETOOTH_ERROR_NONE - Success \n
3441 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3442 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3444 * @param[in] int socket_fd
3445 * @param[in] max pending connection.
3450 * @see bluetooth_rfcomm_create_socket_ex
3453 void bt_event_callback(int event, bluetooth_event_param_t* param)
3457 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3459 bluetooth_rfcomm_connection_t *conn_ind =
3460 (bluetooth_rfcomm_connection_t *)param->param_data;
3462 printf("\nConnected from FD %d", conn_ind->socket_fd);
3470 fd = bluetooth_rfcomm_create_socket_ex(rfcomm_test_uuid);
3471 ret = bluetooth_rfcomm_listen_and_accept_ex(rfcomm_test_uuid, 1, bus_name, path);
3476 int bluetooth_rfcomm_listen_and_accept_ex(const char *uuid, int max_pending_connection, const char *bus_name, const char *path);
3479 * @fn int bluetooth_rfcomm_listen(int socket_fd,int max_pending_connection)
3480 * @brief Rfcomm socket listen
3483 * This API make rfcomm socket listen and accept with socket. We will call this API immediatly
3484 * after the bluetooth_rfcomm_create_socket API.
3485 * This API listen for the incomming connection and once it receives a connection, it will give
3486 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE
3487 * event to the application. This is an Asynchronous API call.
3490 * @return BLUETOOTH_ERROR_NONE - Success \n
3491 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3492 * BLUETOOTH_ERROR_CONNECTION_ERROR - Listen failed \n
3494 * @param[in] int socket_fd
3495 * @param[in] max pending connection.
3498 * @see bluetooth_rfcomm_create_socket
3501 void bt_event_callback(int event, bluetooth_event_param_t* param)
3505 case BLUETOOTH_EVENT_RFCOMM_AUTHORIZE:
3507 char *name = (char *)param->param_data;
3509 printf("\nConnected from %s", name);
3511 bluetooth_rfcomm_accept_connection();
3519 fd = bluetooth_rfcomm_create_socket(rfcomm_test_uuid);
3520 ret = bluetooth_rfcomm_listen(fd, 1);
3524 int bluetooth_rfcomm_listen(int socket_fd, int max_pending_connection);
3527 * @fn int bluetooth_rfcomm_accept_connection()
3528 * @brief Accepts the authorization request indicated by the event
3529 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3531 * This function is a synchronous call.
3533 * @return BLUETOOTH_ERROR_NONE - Success \n
3534 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3536 * @param[in] the socket fd of the server
3537 * @param[out] the socket fd of the client
3541 * @see bluetooth_rfcomm_reject_connection
3543 int bluetooth_rfcomm_accept_connection(int server_fd);
3546 * @fn int bluetooth_rfcomm_reject_connection()
3547 * @brief Rejects the authorization request indicated by the event
3548 * BLUETOOTH_EVENT_RFCOMM_AUTHORIZE.
3550 * This function is a synchronous call.
3552 * @return BLUETOOTH_ERROR_NONE - Success \n
3553 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
3555 * @param[in] the socket fd of the server
3559 * @see bluetooth_rfcomm_accept_connection
3561 int bluetooth_rfcomm_reject_connection(int server_fd);
3564 * @fn gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid)
3565 * @brief Informs whether rfcomm server uuid is available or not.
3567 * This function is a synchronous call.
3569 * @return TRUE - RFCOMM uuid is available \n
3570 * FALSE - RFCOMM uuid is not available \n
3572 * @param[in] uuid UUID string
3578 gboolean bluetooth_rfcomm_is_server_uuid_available(const char *uuid);
3581 * @fn int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3582 * const char *remote_uuid)
3583 * @brief Connect to the remote device rfcomm *
3585 * Connect to a specific RFCOMM based service on a remote device UUID. This is a Async call. Once
3586 * the connection is successful callback BLUETOOTH_EVENT_RFCOMM_CONNECTED events is generated,
3587 * which contains the socket_fd, device role (RFCOMM_ROLE_SERVER/RFCOMM_ROLE_CLIENT), device addess
3588 * etc. The socket_fd can be further used to send the data. It better to do a sevice search before
3589 * initiating a connection.
3591 * @return BLUETOOTH_ERROR_NONE - Success \n
3592 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3593 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3594 * BLUETOOTH_ERROR_CONNECTION_BUSY - Connection in progress \n
3595 * BLUETOOTH_ERROR_INTERNAL - Internal Error\n
3596 * @param[in] bluetooth_device_address_t remote bt_address
3597 * @param[in] char remote uuid
3599 * @see bluetooth_rfcomm_disconnect, bluetooth_rfcomm_write, bluetooth_search_service
3603 void bt_event_callback(int event, bluetooth_event_param_t *param)
3607 case BLUETOOTH_EVENT_SERVICE_SEARCHED:
3609 if (param->result >= BLUETOOTH_ERROR_NONE)
3611 bt_sdp_info_t *bt_sdp_info=param->param_data;
3613 printf("Dev add = %2.2X:%2.2X:%2.2X:%2.2X:%2.2X:%2.2X\n",
3614 bt_sdp_info->device_addr.addr[0],
3615 bt_sdp_info->device_addr.addr[1],
3616 bt_sdp_info->device_addr.addr[2],
3617 bt_sdp_info->device_addr.addr[3],
3618 bt_sdp_info->device_addr.addr[4],
3619 bt_sdp_info->device_addr.addr[5]);
3621 printf("Supported service list:\n");
3622 for(i=0; i<bt_sdp_info->service_index; i++)
3624 bt_sdp_info->service_list_array[i]);
3627 //ret = bluetooth_rfcomm_connect(bt_sdp_info->device_addr,
3628 //rfcomm_test_uuid);
3632 case BLUETOOTH_EVENT_RFCOMM_CONNECTED:
3634 bluetooth_rfcomm_connection_t *conn_ind =
3635 (bluetooth_rfcomm_connection_t *)param->param_data;
3637 printf("\nConnected from FD %d, Role = %s", conn_ind->socket_fd,
3638 (conn_ind->device_role == RFCOMM_ROLE_SERVER) ?
3639 "SERVER" : "CLIENT");
3644 bluetooth_device_address_t remote_address = {{0},};
3645 remote_address.addr[0] = 0x0; remote_address.addr[1] = 0x0A; remote_address.addr[2] = 0x3A;
3646 remote_address.addr[3]= 0x54; remote_address.addr[4] = 0x19; remote_address.addr[5]= 0x36;
3647 ret = bluetooth_search_service(&remote_address);
3649 printf("Seach failed, Reason = %d", ret);
3651 printf("Search Success, Ret = %d", ret);
3653 ret = bluetooth_rfcomm_connect(&remote_address, rfcomm_test_uuid);
3655 printf("Connection failed, Reason = %d", ret);
3657 printf("Connection Success, Ret = %d", ret);
3661 int bluetooth_rfcomm_connect(const bluetooth_device_address_t *remote_bt_address,
3662 const char *remote_uuid);
3665 * @fn int bluetooth_rfcomm_disconnect(int socket_fd)
3666 * @brief Disconnect rfcomm connection
3669 * Disconnect a specific(device node fd) RFCOMM connection. This is a Synchronous call and there
3670 * is no cabbback events for this API. We have to provice the valid client fd to disconnect from the
3673 * @return BLUETOOTH_ERROR_NONE - Success \n
3674 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3675 * BLUETOOTH_ERROR_NOT_CONNECTED - Not connected \n
3676 * @param[in] char remote bt_address
3679 * @see bluetooth_rfcomm_connect
3683 ret = bluetooth_rfcomm_disconnect(g_ret_fd);
3685 printf("Disconnection failed");
3687 printf("Disconnection Success");
3692 int bluetooth_rfcomm_disconnect(int socket_fd);
3695 * @fn int bluetooth_rfcomm_write (int fd, const char *buff, int length)
3696 * @brief Write to rfcomm connection
3699 * This API is used to send the data over the rfcomm connection. This is a synchronous API. The same
3700 * API is used to send the data for server and the client.
3702 * @return BLUETOOTH_ERROR_NONE - Success \n
3703 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3704 * BLUETOOTH_ERROR_NOT_IN_OPERATION - The Fd is currently not in operation\n
3706 * @param[in] const char *buff Data buffer to send
3707 * @param[in] int length Length of the data
3710 * @see bluetooth_rfcomm_connect
3713 char *buff = "Test data 123456789"
3714 ret = bluetooth_rfcomm_write(g_ret_fd, buff, 15);
3716 printf("Send failed");
3718 printf("Send success");
3722 int bluetooth_rfcomm_write(int fd, const char *buf, int length);
3725 * @fn gboolean bluetooth_rfcomm_is_client_connected(void)
3726 * @brief Informs whether rfcomm client is connected.
3728 * This function is a synchronous call.
3730 * @return TRUE - RFCOMM client is connected \n
3731 * FALSE - RFCOMM client is not connected \n
3737 gboolean bluetooth_rfcomm_is_client_connected(void);
3738 int bluetooth_rfcomm_client_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3739 int bluetooth_rfcomm_server_is_connected(const bluetooth_device_address_t *device_address, gboolean *connected);
3742 * @fn int bluetooth_network_activate_server(void)
3743 * @brief Activate the NAP (Network Access Point) service
3745 * This function is a asynchronous call.
3746 * The activate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_ACTIVATED event.
3748 * @return BLUETOOTH_ERROR_NONE - Success \n
3749 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3750 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3751 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3754 * @see bluetooth_network_deactivate_server
3757 int bluetooth_network_activate_server(void);
3760 * @fn int bluetooth_network_deactivate_server(void)
3761 * @brief Deactivate the NAP (Network Access Point) service
3763 * This function is a asynchronous call.
3764 * The deactivate server request is responded by BLUETOOTH_EVENT_NETWORK_SERVER_DEACTIVATED event.
3766 * @return BLUETOOTH_ERROR_NONE - Success \n
3767 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3768 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3769 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3772 * @see bluetooth_network_activate_server
3775 int bluetooth_network_deactivate_server(void);
3778 * @fn int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3779 * bluetooth_network_role_t role,
3781 * @brief Connect the network server in the peer
3783 * This function is a asynchronous call.
3784 * The network connect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3786 * @return BLUETOOTH_ERROR_NONE - Success \n
3787 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3788 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3789 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3792 * @param[in] device_address This indicates an address of the device with which the pairing
3793 * should be initiated
3794 * @param[in] role The role to connect. PANU / GN / NAP / CUSTOM. If use the CUSTOM value,
3795 * need to use the third parameter.
3796 * @param[in] custom_uuid If use the CUSTOM value in second parameter, use this parameter to
3797 * connect. UUID string
3799 * @see bluetooth_network_disconnect
3801 int bluetooth_network_connect(const bluetooth_device_address_t *device_address,
3802 bluetooth_network_role_t role, char *custom_uuid);
3805 * @fn int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address,
3806 * bluetooth_network_role_t role,
3807 * char *custom_uuid)
3808 * @brief Connect the network server in the peer
3810 * This function is a asynchronous call.
3811 * The network disconnect request is responded by BLUETOOTH_EVENT_NETWORK_CONNECTED event.
3813 * @return BLUETOOTH_ERROR_NONE - Success \n
3814 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3815 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3816 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3819 * @param[in] device_address This indicates an address of the device with which the pairing
3820 * should be initiated
3822 * @see bluetooth_network_connect
3824 int bluetooth_network_disconnect(const bluetooth_device_address_t *device_address);
3827 * @fn int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address)
3828 * @brief Disconnect the device from the network
3830 * This function is an asynchronous call.
3831 * The network server disconnect request is responded by
3832 * BLUETOOTH_EVENT_NETWORK_SERVER_DISCONNECTED event.
3834 * @return BLUETOOTH_ERROR_NONE - Success \n
3835 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3836 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3837 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
3840 * @param[in] device_address This indicates an address of the connected client device
3842 * @see bluetooth_network_activate_server
3844 int bluetooth_network_server_disconnect(const bluetooth_device_address_t *device_address);
3849 * @fn int bluetooth_hdp_activate(unsigned short data_type,
3850 * bt_hdp_role_type_t role,
3851 * bt_hdp_qos_type_t channel_type,
3852 * char **app_handle)
3853 * @brief Activate the HDP service for a particular data type
3855 * This function is a synchronous call.
3857 * @return BLUETOOTH_ERROR_NONE - Success \n
3858 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3859 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3860 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3863 * @param[in] data_type The data type against corresponding service
3864 * @param[in] role The role of HDP. HDP_ROLE_SOURCE/HDP_ROLE_SINK.
3865 * @param[in] channel_type The QOS type for the channel.
3866 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING/HDP_QOS_ANY.
3867 * For role = HDP_ROLE_SINK, the channel_type
3868 * should be HDP_QOS_ANY.
3869 * @param[out] app_handle The application handler against corresponding service
3871 * @see bluetooth_hdp_deactivate
3873 int bluetooth_hdp_activate(unsigned short data_type,
3874 bt_hdp_role_type_t role,
3875 bt_hdp_qos_type_t channel_type,
3878 * @fn int bluetooth_hdp_deactivate(const char *app_handle)
3879 * @brief Deactivate the HDP service for a particular service using the handler
3881 * This function is a synchronous call.
3883 * @return BLUETOOTH_ERROR_NONE - Success \n
3884 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3885 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3886 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3889 * @param[in] app_handle The application handler against corresponding service
3891 * @see bluetooth_hdp_deactivate
3893 int bluetooth_hdp_deactivate(const char *app_handle);
3896 * @fn int bluetooth_hdp_send_data(unsigned int channel_id,
3897 * const char *buffer, unsigned int size)
3898 * @brief Send data to the remote HDP device
3900 * This function is a synchronous call.
3902 * @return BLUETOOTH_ERROR_NONE - Success \n
3903 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3904 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3905 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3906 * BLUETOOTH_ERROR_NOT_IN_OPERATION - FD is invalid \n
3909 * @param[in] channel_id The channel id for the connection.
3910 * @param[in] buffer The pdu buffer.
3911 * @param[in] size Size of the buffer.
3913 * @see bluetooth_hdp_connect
3915 int bluetooth_hdp_send_data(unsigned int channel_id,
3916 const char *buffer, unsigned int size);
3918 * @fn int bluetooth_hdp_connect(const char *app_handle,
3919 * bt_hdp_qos_type_t channel_type,
3920 * const bluetooth_device_address_t *device_address)
3921 * @brief Connect to the remote device(Mainly used by source)
3923 * This function is a asynchronous call.
3924 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_CONNECTED event.
3926 * @return BLUETOOTH_ERROR_NONE - Success \n
3927 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3928 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3929 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3930 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3933 * @param[in] app_handle The application handler against corresponding service
3934 * @param[in] channel_type The QOS type for the channel.
3935 * HDP_QOS_RELIABLE/HDP_QOS_STREAMING.
3936 * @param[in] device_address The remote device Bd address.
3939 * @see bluetooth_hdp_disconnect
3941 int bluetooth_hdp_connect(const char *app_handle,
3942 bt_hdp_qos_type_t channel_type,
3943 const bluetooth_device_address_t *device_address);
3945 * @fn int bluetooth_hdp_disconnect(unsigned int channel_id,
3946 * const bluetooth_device_address_t *device_address)
3947 * @brief Disconnect from the remote device(Mainly used by source)
3949 * This function is a asynchronous call.
3950 * The HDP activate is responded by BLUETOOTH_EVENT_HDP_DISCONNECTED event.
3952 * @return BLUETOOTH_ERROR_NONE - Success \n
3953 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
3954 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3955 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3956 * BLUETOOTH_ERROR_MEMORY_ALLOCATION -Memory allocation failed \n
3959 * @param[in] channel_id The channel id for the connection.
3960 * @param[in] device_address The remote device Bd address.
3963 * @see bluetooth_hdp_connect
3965 int bluetooth_hdp_disconnect(unsigned int channel_id,
3966 const bluetooth_device_address_t *device_address);
3970 * @fn int bluetooth_opc_init(void)
3971 * @brief Initialize OPP client.
3973 * This function is a synchronous call.
3974 * No event corresponding to this api
3976 * @return BLUETOOTH_ERROR_NONE - Success \n
3977 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3978 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
3979 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
3980 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
3985 * @see bluetooth_opc_deinit
3987 int bluetooth_opc_init(void);
3990 * @fn int bluetooth_opc_deinit(void)
3991 * @brief Deinitialize OPP client.
3993 * This function is a synchronous call.
3994 * No event corresponding to this api
3996 * @return BLUETOOTH_ERROR_NONE - Success \n
3997 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
3998 * BLUETOOTH_ERROR_ACCESS_DENIED -Memory allocation failed \n
4003 * @see bluetooth_opc_init
4006 int bluetooth_opc_deinit(void);
4009 * @fn int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4010 char **file_name_array)
4011 * @brief Send multiple files to a remote device.
4013 * This function is a asynchronous call.
4014 * This api is responded by BLUETOOTH_EVENT_OPC_CONNECTED event.
4016 * @return BLUETOOTH_ERROR_NONE - Success \n
4017 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4018 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4019 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4020 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4021 * BLUETOOTH_ERROR_IN_PROGRESS -Already one push in progress \n
4022 * BLUETOOTH_ERROR_ACCESS_DENIED - Not allowed by MDM policy \n
4025 * @param[in] device_address The remote device Bd address.
4026 * @param[in] file_name_array Array of filepaths to be sent.
4029 * @see bluetooth_opc_cancel_push
4032 int bluetooth_opc_push_files(bluetooth_device_address_t *remote_address,
4033 char **file_name_array);
4036 * @fn int bluetooth_opc_cancel_push(void)
4037 * @brief Cancels the ongoing file push.
4039 * This function is a asynchronous call.
4040 * This api is responded with either BLUETOOTH_EVENT_OPC_CONNECTED or
4041 * BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETED event.
4043 * @return BLUETOOTH_ERROR_NONE - Success \n
4044 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4045 * BLUETOOTH_ERROR_ACCESS_DENIED - No push in progress \n
4050 * @see bluetooth_opc_push_files
4053 int bluetooth_opc_cancel_push(void);
4056 * @fn gboolean bluetooth_opc_session_is_exist(void)
4057 * @brief Informs whether opc session exists or not.
4059 * This function is a synchronous call.
4061 * @return TRUE - OPC session exists \n
4062 * FALSE - OPC session does not exist \n
4070 gboolean bluetooth_opc_session_is_exist(void);
4073 * @fn int bluetooth_opc_is_sending(gboolean *is_sending)
4074 * @brief Informs whether opc session exists or not.
4076 * This function is a synchronous call.
4078 * @return BLUETOOTH_ERROR_NONE - Success \n
4079 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4080 * BLUETOOTH_ERROR_INTERNAL \n
4083 * @param[out] is_sending The sending status: (@c TRUE = in sending , @c false = not in sending)
4088 int bluetooth_opc_is_sending(gboolean *is_sending);
4091 * @fn int bluetooth_obex_server_init(const char *dst_path)
4092 * @brief Initialize OPP and FTP server.
4094 * This function is a synchronous call.
4095 * No event corresponding to this api
4097 * @return BLUETOOTH_ERROR_NONE - Success \n
4098 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4099 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4100 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4101 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4104 * @param[in] dst_path OPS destination file path.
4106 * @see bluetooth_obex_server_deinit
4108 int bluetooth_obex_server_init(const char *dst_path);
4112 * @fn int bluetooth_obex_server_deinit(void)
4113 * @brief Deinitialize OPP and FTP server.
4115 * This function is a synchronous call.
4116 * No event corresponding to this api
4118 * @return BLUETOOTH_ERROR_NONE - Success \n
4119 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4120 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4125 * @see bluetooth_obex_server_init
4127 int bluetooth_obex_server_deinit(void);
4131 * @fn gboolean bluetooth_obex_server_is_activated(void)
4132 * @brief Informs whether obex server is activated or not.
4134 * This function is a synchronous call.
4136 * @return TRUE - OBEX server is activated \n
4137 * FALSE - OBEX server is not activated \n
4144 gboolean bluetooth_obex_server_is_activated(void);
4148 * @fn int bluetooth_obex_server_init_without_agent(const char *dst_path)
4149 * @brief Initialize OPP and FTP server without the conneciton authorization of the agent
4151 * This function is a synchronous call.
4152 * No event corresponding to this api
4154 * @return BLUETOOTH_ERROR_NONE - Success \n
4155 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4156 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4157 * BLUETOOTH_ERROR_AGENT_ALREADY_EXIST - Obex agent already registered \n
4158 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4162 * @param[in] dst_path OPS destination file path.
4164 * @see bluetooth_obex_server_deinit_without_agent
4166 int bluetooth_obex_server_init_without_agent(const char *dst_path);
4170 * @fn int bluetooth_obex_server_deinit_without_agent(void)
4171 * @brief Deinitialize OPP and FTP server without the conneciton authorization of the agent
4173 * This function is a synchronous call.
4174 * No event corresponding to this api
4176 * @return BLUETOOTH_ERROR_NONE - Success \n
4177 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4178 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4183 * @see bluetooth_obex_server_init_without_agent
4185 int bluetooth_obex_server_deinit_without_agent(void);
4189 * @fn int bluetooth_obex_server_accept_connection(void)
4190 * @brief Accepts the authorization request indicated by the event
4191 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4193 * This function is a synchronous call.
4195 * @return BLUETOOTH_ERROR_NONE - Success \n
4196 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4197 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
4201 * @see bluetooth_obex_server_reject_authorize
4203 int bluetooth_obex_server_accept_connection(void);
4207 * @fn int bluetooth_obex_server_reject_connection(void)
4208 * @brief Rejects the authorization request indicated by the event
4209 * BLUETOOTH_EVENT_OBEX_SERVER_CONNECTION_AUTHORIZE.
4211 * This function is a synchronous call.
4213 * @return BLUETOOTH_ERROR_NONE - Success \n
4214 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4215 * BLUETOOTH_ERROR_INTERNAL - Internal error \n
4219 * @see bluetooth_obex_server_reject_authorize
4221 int bluetooth_obex_server_reject_connection(void);
4225 * @fn int bluetooth_obex_server_accept_authorize(const char *filename)
4226 * @brief Accepts the authorization request indicated by the event
4227 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4229 * This function is a asynchronous call.
4230 * This api will be responded with the event BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED.
4232 * @return BLUETOOTH_ERROR_NONE - Success \n
4233 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4234 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4235 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4238 * @param[in] filename Authorized filename.
4241 * @see bluetooth_obex_server_reject_authorize
4244 int bluetooth_obex_server_accept_authorize(const char *filename);
4247 * @fn int bluetooth_obex_server_reject_authorize(void)
4248 * @brief Reject the authorization request indicated by the event
4249 * BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE.
4251 * This function is a asynchronous call.
4252 * No event for this api..
4254 * @return BLUETOOTH_ERROR_NONE - Success \n
4255 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4256 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4261 * @see bluetooth_obex_server_accept_authorize
4264 int bluetooth_obex_server_reject_authorize(void);
4267 * @fn int bluetooth_obex_server_set_destination_path(const char *dst_path)
4268 * @brief Set the OPS destination file path..
4270 * This function is a asynchronous call.
4271 * No event for this api..
4273 * @return BLUETOOTH_ERROR_NONE - Success \n
4274 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4275 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4276 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid Param \n
4279 * @param[in] dst_path OPS destination file path.
4285 int bluetooth_obex_server_set_destination_path(const char *dst_path);
4288 * @fn int bluetooth_obex_server_set_root(const char *root)
4289 * @brief Set the FTS root folder..
4291 * This function is a asynchronous call.
4292 * No event for this api..
4294 * @return BLUETOOTH_ERROR_NONE - Success \n
4295 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Device is not enabled \n
4296 * BLUETOOTH_ERROR_NO_RESOURCES - Not resource available \n
4297 * BLUETOOTH_ERROR_ACCESS_DENIED - Operation not allowed \n
4298 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter \n
4299 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4302 * @param[in] root FTS root folder.
4308 int bluetooth_obex_server_set_root(const char *root);
4311 * @fn int bluetooth_obex_server_cancel_transfer(int transfer_id)
4312 * @brief Cancel the transfer on server
4314 * This function is an asynchronous call.
4315 * If the function call that cancels transfer is successful, the application would receive
4316 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4317 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4318 * the error code will be BLUETOOTH_ERROR_NONE
4320 * @return BLUETOOTH_ERROR_NONE - Success \n
4321 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4322 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4323 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4324 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4327 * @param[in] transfer_id transfer ID
4332 int bluetooth_obex_server_cancel_transfer(int transfer_id);
4336 * @fn int bluetooth_obex_server_cancel_all_transfers(void)
4337 * @brief Cancel the transfer on server
4339 * This function is an asynchronous call.
4340 * If the function call that cancels transfer is successful, the application would receive
4341 * BLUETOOTH_EVENT_TRANSFER_COMPLETED event through registered callback
4342 * function with an error code BLUETOOTH_ERROR_CANCEL. In the case of failure
4343 * the error code will be BLUETOOTH_ERROR_NONE
4345 * @return BLUETOOTH_ERROR_NONE - Success \n
4346 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4347 * BLUETOOTH_ERROR_AGENT_DOES_NOT_EXIST -Obex agent not registered \n
4348 * BLUETOOTH_ERROR_INTERNAL - internal error (proxy does not exist) \n
4349 * BLUETOOTH_ERROR_NOT_FOUND - The transfer is not found \n
4356 int bluetooth_obex_server_cancel_all_transfers(void);
4360 * @fn int bluetooth_obex_server_is_receiving(gboolean *is_receiving)
4361 * @brief Informs whether obex server is receiving or not.
4363 * This function is a synchronous call.
4365 * @return BLUETOOTH_ERROR_NONE - Success \n
4366 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Not enabled \n
4367 * BLUETOOTH_ERROR_INTERNAL \n
4370 * @param[out] is_receiving The receiving status: (@c TRUE = in receiving , @c false = not in receiving)
4375 int bluetooth_obex_server_is_receiving(gboolean *is_receiving);
4379 * @fn int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data)
4380 * @brief Read the local Hash and Randmizer.
4382 * This function is a synchronous call.
4384 * @return BLUETOOTH_ERROR_NONE - Success \n
4385 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4389 * @param[out] local_oob_data - Pointer to the local OOB data
4395 int bluetooth_oob_read_local_data(bt_oob_data_t *local_oob_data);
4399 * @fn int bluetooth_oob_add_remote_data(
4400 * const bluetooth_device_address_t *remote_device_address,
4401 * bt_oob_data_t *oob_data)
4402 * @brief Add/updated the remote device Hash and Randmizer.
4404 * This function is a synchronous call.
4405 * No event for this api..
4407 * @return BLUETOOTH_ERROR_NONE - Success \n
4408 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4411 * @param[in] remote_device_address - Remote device address
4412 * remote_oob_data - Ponter to Hash and Randomizer oob data structure
4418 int bluetooth_oob_add_remote_data(
4419 const bluetooth_device_address_t *remote_device_address,
4420 bt_oob_data_t *remote_oob_data);
4424 * @fn int bluetooth_oob_remove_remote_data(
4425 * const bluetooth_device_address_t *remote_device_address)
4426 * @brief Delete the Hash and Randomizer w.r.t the remote device address.
4428 * This function is a synchronous call.
4429 * No event for this api..
4431 * @return BLUETOOTH_ERROR_NONE - Success \n
4432 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4435 * @param[in] remote_device_address - Remote device address
4441 int bluetooth_oob_remove_remote_data(
4442 const bluetooth_device_address_t *remote_device_address);
4445 * @fn int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4446 * bt_gatt_handle_info_t *prim_svc);
4448 * @brief Gets the GATT based primary services handle supported by remote device
4450 * This function is a synchronous call.
4451 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4453 * @return BLUETOOTH_ERROR_NONE - Success \n
4454 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4455 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4456 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4459 * @param[in] address - Remote device address
4460 * @param[out] prim_svc - Structure containing remote service count and handle list.
4463 * @see bluetooth_gatt_free_primary_services()
4465 int bluetooth_gatt_get_primary_services(const bluetooth_device_address_t *address,
4466 bt_gatt_handle_info_t *prim_svc);
4469 * @fn int bluetooth_gatt_discover_service_characteristics(const char *service_handle)
4471 * @brief Discovers the characteristics of GATT based service of remote device
4473 * This function is an asynchronous call.
4474 * This API is responded with BLUETOOTH_EVENT_GATT_SVC_CHAR_DISCOVERED
4476 * @return BLUETOOTH_ERROR_NONE - Success \n
4477 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4478 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4479 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4482 * @param[in] service_handle - Handle for remote service.
4487 int bluetooth_gatt_discover_service_characteristics(const char *service_handle);
4490 * @fn int bluetooth_gatt_get_service_property(const char *service_handle,
4491 * bt_gatt_service_property_t *service);
4493 * @brief Gets the properties of GATT based service of remote device
4495 * This function is a synchronous call.
4496 * The output parameter needs to be freed by calling bluetooth_gatt_free_primary_services()
4498 * @return BLUETOOTH_ERROR_NONE - Success \n
4499 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4500 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4501 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4504 * @param[in] service_handle - Handle for remote service.
4505 * @param[out] service - Structure containing remote service property.
4508 * @see bluetooth_gatt_free_service_property()
4510 int bluetooth_gatt_get_service_property(const char *service_handle,
4511 bt_gatt_service_property_t *service);
4514 * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
4516 * @brief Register to GATT based service to receive value change notification/indication.
4518 * This function is a synchronous call.
4519 * No event for this api.
4521 * @return BLUETOOTH_ERROR_NONE - Success \n
4522 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4523 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4524 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4527 * @param[in] service_handle - Handle for remote service.
4532 int bluetooth_gatt_watch_characteristics(const char *service_handle);
4535 * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
4537 * @brief Unregister GATT based service to receive value change notification/indication.
4539 * This function is a synchronous call.
4540 * No event for this api.
4542 * @return BLUETOOTH_ERROR_NONE - Success \n
4543 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4544 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4545 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4548 * @param[in] service_handle - Handle for remote service.
4553 int bluetooth_gatt_unwatch_characteristics(const char *service_handle);
4556 * @fn int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4557 * bt_gatt_char_property_t *characteristic);
4559 * @brief Provides characteristic value along with properties.
4561 * This function is a synchronous call.
4562 * The output parameter needs to be freed by calling bluetooth_gatt_free_char_property()
4564 * @return BLUETOOTH_ERROR_NONE - Success \n
4565 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4566 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4567 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4570 * @param[in] char_handle - Handle for Characteristic property.
4571 * @param[out] characteristic - Structure containing remote characteristic property.
4574 * @see bluetooth_gatt_free_char_property()
4576 int bluetooth_gatt_get_characteristics_property(const char *char_handle,
4577 bt_gatt_char_property_t *characteristic);
4580 * @fn int bluetooth_gatt_get_char_descriptor_property(const char *char_handle,
4581 * bt_gatt_char_property_t *characteristic);
4583 * @brief Provides characteristic descriptor value along with its UUID.
4585 * This function is a synchronous call.
4586 * The output parameter needs to be freed by calling bluetooth_gatt_free_desc_property()
4588 * @return BLUETOOTH_ERROR_NONE - Success \n
4589 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4590 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4591 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4594 * @param[in] desc_handle - Handle for Characteristic descriptor.
4595 * @param[out] descriptor - Structure containing remote characteristic descriptor property.
4598 * @see bluetooth_gatt_free_desc_property()
4600 int bluetooth_gatt_get_char_descriptor_property(const char *desc_handle,
4601 bt_gatt_char_descriptor_property_t *descriptor);
4605 * @fn int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4606 * const guint8 *value, int length)
4608 * @brief Set characteristic value.
4610 * This function is a synchronous call.
4612 * @return BLUETOOTH_ERROR_NONE - Success \n
4613 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4614 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4615 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4618 * @param[in] char_handle - Handle for Characteristic property.
4619 * @param[in] value - New value to set for characteristic property.
4620 * @param[in] length - Length of the value to be set.
4625 int bluetooth_gatt_set_characteristics_value(const char *char_handle,
4626 const guint8 *value, int length);
4629 * @fn int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4630 * const guint8 *value, int length, guint8 write_type)
4632 * @brief Set characteristic value by write type.
4634 * This function is a synchronous call if write type is "write without resonse"
4635 * and it is an asynchronous call if write type is "write with response"
4637 * @return BLUETOOTH_ERROR_NONE - Success \n
4638 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4639 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4640 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4643 * @param[in] char_handle - Handle for Characteristic property.
4644 * @param[in] value - New value to set for characteristic property.
4645 * @param[in] length - Length of the value to be set.
4646 * @param[in] write_type - Type of write.
4651 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
4652 const guint8 *value, int length, guint8 write_type);
4656 * @fn int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4657 * const guint8 *value, int length)
4659 * @brief Set characteristic value request.
4661 * This function is an asynchronous call.
4663 * @return BLUETOOTH_ERROR_NONE - Success \n
4664 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4665 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4666 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4669 * @param[in] char_handle - Handle for Characteristic property.
4670 * @param[in] value - New value to set for characteristic property.
4671 * @param[in] length - Length of the value to be set.
4676 int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
4677 const guint8 *value, int length);
4680 * @fn int bluetooth_gatt_read_characteristic_value(const char *char_handle)
4682 * @brief Read characteristic value.
4684 * This function is a asynchronous call.
4686 * @return BLUETOOTH_ERROR_NONE - Success \n
4687 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4688 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4689 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4692 * @param[in] char_handle - Handle for Characteristic property.
4697 int bluetooth_gatt_read_characteristic_value(const char *char_handle);
4700 * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4701 * const char *service_uuid,
4702 * bt_gatt_service_property_t *service)
4704 * @brief Gets the service property from a device based on a particular uuid
4706 * This function is a synchronous call.
4708 * @return BLUETOOTH_ERROR_NONE - Success \n
4709 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4710 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4711 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4714 * @param[in] address - BD address of the remote device
4715 * @param[in] service_uuid - uuid of the service.
4716 * @param[out] service - Structure containing the service property.
4721 int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
4722 const char *service_uuid,
4723 bt_gatt_service_property_t *service);
4726 * @fn int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4727 * const char *char_uuid)
4729 * @brief Gets the characteristic property from a service based on a particular char uuid
4731 * This function is an asynchronous call.
4732 * This API is responded with BLUETOOTH_EVENT_GATT_GET_CHAR_FROM_UUID
4734 * @return BLUETOOTH_ERROR_NONE - Success \n
4735 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4736 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4737 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4740 * @param[in] service_handle - Service handle.
4741 * @param[in] uuid - Characteristic uuid.
4746 int bluetooth_gatt_get_char_from_uuid(const char *service_handle,
4747 const char *char_uuid);
4750 * @fn int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4752 * @brief Releases the memory allocated by bluetooth_gatt_get_primary_services()
4754 * This function is a synchronous call.
4755 * The input parameter is obtained by calling bluetooth_gatt_get_primary_services()
4757 * @return BLUETOOTH_ERROR_NONE - Success \n
4758 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4761 * @param[in] prim_svc - GATT handle info structure
4764 * @see bluetooth_gatt_get_primary_services()
4766 int bluetooth_gatt_free_primary_services(bt_gatt_handle_info_t *prim_svc);
4769 * @fn int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4771 * @brief Releases the memory allocated by bluetooth_gatt_get_service_property()
4773 * This function is a synchronous call.
4774 * The input parameter is obtained by calling bluetooth_gatt_get_service_property()
4776 * @return BLUETOOTH_ERROR_NONE - Success \n
4777 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4780 * @param[in] svc_pty - GATT service property structure.
4783 * @see bluetooth_gatt_get_service_property()
4785 int bluetooth_gatt_free_service_property(bt_gatt_service_property_t *svc_pty);
4788 * @fn int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4790 * @brief Provides characteristic value along with properties.
4792 * This function is a synchronous call.
4793 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4795 * @return BLUETOOTH_ERROR_NONE - Success \n
4796 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4799 * @param[in] char_pty - GATT characteristics property structure.
4802 * @see bluetooth_gatt_get_characteristics_property()
4804 int bluetooth_gatt_free_char_property(bt_gatt_char_property_t *char_pty);
4807 * @fn int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4809 * @brief Releases the memory allocated by bluetooth_gatt_get_char_descriptor_property()
4811 * This function is a synchronous call.
4812 * The input parameter is obtained by calling bluetooth_gatt_get_char_descriptor_property()
4814 * @return BLUETOOTH_ERROR_NONE - Success \n
4815 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4818 * @param[in] desc_pty - GATT characteristics descriptor property structure.
4821 * @see bluetooth_gatt_get_char_descriptor_property()
4823 int bluetooth_gatt_free_desc_property(bt_gatt_char_descriptor_property_t *desc_pty);
4826 int bluetooth_connect_le(const bluetooth_device_address_t *device_address, gboolean auto_connect);
4828 int bluetooth_disconnect_le(const bluetooth_device_address_t *device_address);
4831 * @fn int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4833 * @brief Discovers the characteristic descriptor value of a characteristic within its definition, asynchronously
4835 * The input parameter is obtained by calling bluetooth_gatt_get_characteristics_property()
4837 * @return BLUETOOTH_ERROR_NONE - Success \n
4838 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4841 * @param[in] characteristic_handle - The characteristic handle for which characteristic descriptor has to be discovered.
4845 int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic_handle);
4848 * @fn int bluetooth_gatt_read_descriptor_value(const char *desc_handle)
4850 * @brief Read characteristic descriptor value.
4852 * This function is a asynchronous call.
4854 * @return BLUETOOTH_ERROR_NONE - Success \n
4855 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4856 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4857 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4860 * @param[in] desc_handle - Handle for Characteristic descriptor
4865 int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
4868 * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4869 * const guint8 *value, int length);
4871 * @brief Set characteristic descriptor value.
4873 * This function is a asynchronous call.
4875 * @return BLUETOOTH_ERROR_NONE - Success \n
4876 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4877 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4878 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4881 * @param[in] desc_handle - Handle for Characteristic descriptor
4882 * @param[in] value - New value to set for characteristic descriptor
4883 * @param[in] length - Length of the value to be set.
4888 int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
4889 const guint8 *value, int length);
4891 /* @fn int bluetooth_gatt_init(void)
4893 * @brief Initializes the gatt service.
4895 * This function is a synchronous call.
4896 * @return BLUETOOTH_ERROR_NONE - Success \n
4897 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4898 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4899 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4902 * @remark Adapter should be enabled
4903 * @see bluetooth_gatt_deinit()
4905 int bluetooth_gatt_init(void);
4907 /* @fn int bluetooth_gatt_init(void)
4909 * @brief DeInitializes the gatt service.
4911 * This function is a synchronous call.
4912 * @return BLUETOOTH_ERROR_NONE - Success \n
4913 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4914 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4915 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4918 * @remark Adapter should be enabled
4919 * @see bluetooth_gatt_init()
4921 int bluetooth_gatt_deinit(void);
4923 /* @fn int bluetooth_gatt_add_service(const char *svc_uuid,
4924 unsigned char **svc_path)
4926 * @brief Exports a new gatt service to the service interface.
4928 * This function is a synchronous call.
4930 * @return BLUETOOTH_ERROR_NONE - Success \n
4931 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4932 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4933 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4936 * @param[in] svc_uuid Gatt service uuid.
4937 * @param[out] svc_path service object path of the exported service.
4938 * @remark Adapter should be enabled
4939 * @see bluetooth_gatt_init()
4941 int bluetooth_gatt_add_service(const char *svc_uuid,
4944 /* @fn int bluetooth_gatt_add_new_characteristic(
4945 const char *svc_path, const char *char_uuid,
4946 bt_gatt_permission_t permissions,
4947 bt_gatt_characteristic_property_t properties,
4948 int flags_length, char **char_path);;
4950 * @brief Exports a new gatt characteristic to the characteristic interface.
4952 * This function is a synchronous call.
4953 * @return BLUETOOTH_ERROR_NONE - Success \n
4954 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4955 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4956 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4958 * @param[in] svc_path service object path of the exported service.
4959 * @param[in] char_uuid Gatt service uuid.
4960 * @param[in] properties GATT characteristic properties.
4961 * @param[out] char_path characteristic object path of the exported characteristic.
4963 * @remark Adapter should be enabled
4964 * @see bluetooth_gatt_add_service()
4966 int bluetooth_gatt_add_new_characteristic(
4967 const char *svc_path, const char *char_uuid,
4968 bt_gatt_permission_t permissions,
4969 bt_gatt_characteristic_property_t properties,
4972 /* @fn bluetooth_gatt_set_characteristic_value(
4973 const char *characteristic, const char *char_value,
4976 * @brief adds gatt charactertisic value to the given charactertistic path.
4978 * This function is a synchronous call.
4979 * @return BLUETOOTH_ERROR_NONE - Success \n
4980 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
4981 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
4982 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
4984 * @param[in] char_value Value of the GATT characteristic to be added.
4985 * @param[in] value_length length of the chantacteristic value..
4986 * @param[out] characteristic characteristic object path..
4988 * @remark Adapter should be enabled
4989 * @see bluetooth_gatt_add_service()
4991 int bluetooth_gatt_set_characteristic_value(
4992 const char *characteristic, const char *char_value,
4995 /* @fn int bluetooth_gatt_add_descriptor(
4996 const char *char_path, const char *desc_uuid,
4997 bt_gatt_permission_t permissions,
5000 * @brief Exports a new gatt descriptor to the descriptor interface.
5002 * This function is a synchronous call.
5004 * @return BLUETOOTH_ERROR_NONE - Success \n
5005 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5006 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5007 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5010 * @param[in] desc_uuid Gatt descriptor uuid.
5011 * @param[in] desc_value GATT descriptor value.
5012 * @param[in] value_length Length of GATT descriptor value.
5013 * @param[in] permissions descriptor permissions.
5014 * @param[in] properties GATT descriptor properties.
5015 * @param[in] char_path characteristics object path of the exported character.
5017 * @remark Adapter should be enabled
5018 * @see bluetooth_gatt_add_service()
5019 * @see bluetooth_gatt_add_characteristics()
5021 int bluetooth_gatt_add_descriptor(
5022 const char *char_path, const char *desc_uuid,
5023 bt_gatt_permission_t permissions,
5026 /* @fn int bluetooth_gatt_set_descriptor_value(
5027 const char *desc_path, const char *desc_value,
5030 * @brief Adds value to the given descriptor handle.
5032 * This function is a synchronous call.
5034 * @return BLUETOOTH_ERROR_NONE - Success \n
5035 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5036 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5037 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5040 * @param[in] desc_value GATT descriptor value.
5041 * @param[in] value_length Length of GATT descriptor value.
5042 * @param[in] desc_path descriptor path to which the value needs to be added.
5044 * @remark Adapter should be enabled
5045 * @see bluetooth_gatt_add_service()
5046 * @see bluetooth_gatt_add_characteristics()
5048 int bluetooth_gatt_set_descriptor_value(
5049 const char *desc_path, const char *desc_value,
5052 /* @fn int bluetooth_gatt_get_service(const char *svc_uuid);
5054 * @brief Reads the Service registered on manager interface.
5056 * This function is a synchronous call.
5058 * @return BLUETOOTH_ERROR_NONE - Success \n
5059 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5060 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5061 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5064 * @param[in] svc_uuid Gatt Service uuid.
5066 * @remark Adapter should be enabled and service should be registered.
5067 * @see bluetooth_gatt_register_service()
5069 int bluetooth_gatt_get_service(const char *svc_uuid);
5071 /* @fn int bluetooth_gatt_register_service(const char *svc_path)
5073 * @brief Registers the given service path with the bluez gatt server.
5075 * This function is a synchronous call.
5077 * @return BLUETOOTH_ERROR_NONE - Success \n
5078 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5079 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5080 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5083 * @param[in] svc_path service object path of the exported service.
5085 * @remark Adapter should be enabled
5086 * @see bluetooth_gatt_add_service()
5087 * @see bluetooth_gatt_add_characteristics()
5088 * @see bluetooth_gatt_add_descriptor()
5089 * @see bluetooth_gatt_register_application()
5091 int bluetooth_gatt_register_service(const char *svc_path);
5093 /* @fn int bluetooth_gatt_register_application(void)
5095 * @brief Registers the application with the bluez gatt server.
5097 * This function is a synchronous call.
5099 * @return BLUETOOTH_ERROR_NONE - Success \n
5100 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5101 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5102 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5106 * @remark Adapter should be enabled
5107 * @see bluetooth_gatt_init()
5108 * @see bluetooth_gatt_add_service()
5109 * @see bluetooth_gatt_add_characteristics()
5110 * @see bluetooth_gatt_add_descriptor()
5111 * @see bluetooth_gatt_register_service()
5113 int bluetooth_gatt_register_application(void);
5115 /* @fn int bluetooth_gatt_unregister_service(const char *svc_path)
5117 * @brief Removes(unregister) service from the bluez gatt server db.
5119 * This function is a synchronous call.
5121 * @return BLUETOOTH_ERROR_NONE - Success \n
5122 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5123 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5124 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5127 * @param[in] svc_path service object path of the exported service.
5129 * @remark Adapter should be enabled
5130 * @see bluetooth_gatt_add_service()
5131 * @see bluetooth_gatt_add_characteristics()
5132 * @see bluetooth_gatt_add_descriptor()
5133 * @see bluetooth_gatt_register_service()
5135 int bluetooth_gatt_unregister_service(const char *svc_path);
5137 /* @fn int bluetooth_gatt_unregister_application(void)
5139 * @brief Removes(unregister) the application with the bluez gatt server,
5140 * and deletes all the service registered.
5142 * This function is a synchronous call.
5144 * @return BLUETOOTH_ERROR_NONE - Success \n
5145 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5146 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5147 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5151 * @remark Adapter should be enabled
5152 * @see bluetooth_gatt_init()
5153 * @see bluetooth_gatt_add_service()
5154 * @see bluetooth_gatt_add_characteristics()
5155 * @see bluetooth_gatt_add_descriptor()
5156 * @see bluetooth_gatt_register_service()
5157 * @see bluetooth_gatt_unregister_service()
5159 int bluetooth_gatt_unregister_application(void);
5161 /* @fn int bluetooth_gatt_send_response(int request_id,
5162 * int offset, char *value, int value_length)
5164 * @brief Updates the attribute value in local attribute list.
5166 * This function is a synchronous call.
5168 * @return BLUETOOTH_ERROR_NONE - Success \n
5169 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5170 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5171 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5174 * @param[in] request_id The identification of a read request
5175 * @param[in] req_type The identification of request type (TRUE for Read request and FALSE for write request)
5176 * @param[in] resp_state The identification of response state
5177 * @param[in] offset The offset from where a value is read
5178 * @param[in] value The value to be sent. It will be sent from @a offset.
5179 * If it is NULL, a requested GATT handle's value will be sent from @a offset.
5180 * @param[in] value_length Value Length.
5182 * @remark Adapter should be enabled
5183 * @see bluetooth_gatt_add_service()
5184 * @see bluetooth_gatt_add_characteristics()
5185 * @see bluetooth_gatt_add_descriptor()
5186 * @see bluetooth_gatt_register_service()
5188 int bluetooth_gatt_send_response(int request_id, guint req_type,
5189 int resp_state, int offset, char *value, int value_length);
5191 /* @fn bluetooth_gatt_server_set_notification(const char *char_path)
5193 * @brief Sets the notification property for a characteristic.
5195 * This function is a synchronous call.
5197 * @return BLUETOOTH_ERROR_NONE - Success \n
5198 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5199 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5200 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5203 * @param[in] char_path characteristic object path.
5204 * @param[in] unicast_address remote device address. if set notification is sent to only one device.
5206 * @remark Adapter should be enabled
5207 * @see bluetooth_gatt_update_characteristic()
5209 int bluetooth_gatt_server_set_notification(const char *char_path,
5210 bluetooth_device_address_t *unicast_address);
5212 /* @fn int bluetooth_gatt_delete_services(void)
5214 * @brief deletes (unregisters) all services from the gatt server database..
5216 * This function is a synchronous call.
5218 * @return BLUETOOTH_ERROR_NONE - Success \n
5219 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5220 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5221 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5225 * @remark Adapter should be enabled
5226 * @see bluetooth_gatt_add_service()
5227 * @see bluetooth_gatt_add_characteristics()
5228 * @see bluetooth_gatt_add_descriptor()
5229 * @see bluetooth_gatt_register_service()
5230 * @see bluetooth_gatt_unregister_service()
5232 int bluetooth_gatt_delete_services(void);
5234 /* @fn int bluetooth_gatt_update_characteristic(void)
5236 * @brief updates the given characteristic with a new value
5238 * This function is a synchronous call.
5240 * @return BLUETOOTH_ERROR_NONE - Success \n
5241 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5242 * BLUETOOTH_ERROR_INVALID_PARAM -Invalid Parameters \n
5243 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is disabled \n
5247 * @remark Adapter should be enabled
5248 * @see bluetooth_gatt_add_service()
5249 * @see bluetooth_gatt_add_characteristics()
5250 * @see bluetooth_gatt_add_descriptor()
5251 * @see bluetooth_gatt_register_service()
5252 * @see bluetooth_gatt_unregister_service()
5254 int bluetooth_gatt_update_characteristic(const char *char_path,
5255 const char* char_value, int value_length);
5258 * @fn int bluetooth_set_advertising(int handle, gboolean enable);
5260 * @brief Set advertising status.
5262 * This function is used to enable or disable LE advertising.
5263 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5265 * This function is a synchronous call.
5267 * @return BLUETOOTH_ERROR_NONE - Success \n
5268 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5269 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5272 * @param[in] enable - The status of advertising
5275 * @see bluetooth_set_advertising_data
5277 int bluetooth_set_advertising(int handle, gboolean enable);
5280 * @fn int bluetooth_set_custom_advertising(int handle, gboolean enable, bluetooth_advertising_params_t *params);
5282 * @brief Set advertising status along with interval value.
5284 * This function is used to enable or disable LE advertising.
5285 * Interval_min and Interval_max is used to set the best advertising interval.
5286 * Once advertising is enabled, Advertising data is transmitted in the advertising packets
5288 * This function is a synchronous call.
5290 * @return BLUETOOTH_ERROR_NONE - Success \n
5291 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5292 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5295 * @param[in] enable - The status of advertising
5296 * @param[in] interval_min - Minimum interval of advertising (msec)
5297 * @param[in] interval_max - Maximum interval of advertising (msec)
5298 * @param[in] filter_policy - Advertising filter policy
5301 * @see bluetooth_set_advertising_data
5303 int bluetooth_set_custom_advertising(int handle, gboolean enable,
5304 bluetooth_advertising_params_t *params);
5307 * @fn int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5308 * @brief Get the advertising data
5310 * This function is used to get advertising data.
5311 * Before calling this API, the adapter should be enabled.
5313 * This function is a synchronous call.
5315 * @return BLUETOOTH_ERROR_NONE - Success \n
5316 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5317 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5318 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5320 * @param[out] value - Advertising data structure.
5321 * @param[out] length - The length of Advertising data.
5325 bluetooth_advertising_data_t *value = { {0} };
5328 ret = bluetooth_get_advertising_data(&value, &length);
5331 int bluetooth_get_advertising_data(bluetooth_advertising_data_t *value, int *length);
5334 * @fn int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5336 * @brief Set advertising data with value
5338 * This function is used to set advertising data and Maximum size of advertising data
5339 * is 28 byte (Except Flag)
5341 * This function is a synchronous call.
5343 * @return BLUETOOTH_ERROR_NONE - Success \n
5344 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5345 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5348 * @param[in] value - Advertising data structure.
5352 int bluetooth_set_advertising_data(int handle, const bluetooth_advertising_data_t *value, int length);
5355 * @fn int bluetooth_check_privilege_advertising_parameter(void);
5357 * @brief Check the privilege for advertising parameter setting
5359 * This function is a synchronous call.
5361 * @return BLUETOOTH_ERROR_NONE - Success \n
5362 * BLUETOOTH_ERROR_PERMISSION_DEINED - Permission deined \n
5368 int bluetooth_check_privilege_advertising_parameter(void);
5371 * @fn int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5372 * @brief Get the LE scan response data
5374 * This function is used to get scan response data.
5375 * Before calling this API, the adapter should be enabled.
5377 * This function is a synchronous call.
5379 * @return BLUETOOTH_ERROR_NONE - Success \n
5380 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5381 * BLUETOOTH_ERROR_INVALID_PARAM - Invalid parameter (NULL buffer)\n
5382 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5384 * @param[out] value - Scan response data structure.
5385 * @param[out] length - The length of Scan response data.
5389 bluetooth_scan_resp_data_t *value = { {0} };
5392 ret = bluetooth_get_scan_response_data(&value, &length);
5395 int bluetooth_get_scan_response_data(bluetooth_scan_resp_data_t *value, int *length);
5398 * @fn int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5400 * @brief Set scan response data with value
5402 * This function is used to set scan response data and Maximum size of scan response data is 31 byte
5404 * This function is a synchronous call.
5406 * @return BLUETOOTH_ERROR_NONE - Success \n
5407 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5408 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5411 * @param[in] value - LE Scan response data structure.
5415 int bluetooth_set_scan_response_data(int handle, const bluetooth_scan_resp_data_t *value, int length);
5418 * @fn int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5420 * @brief Set scan interval and window
5422 * This function is used to set LE scan interval and window size
5424 * This function is a synchronous call.
5426 * @return BLUETOOTH_ERROR_NONE - Success \n
5427 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5428 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5431 * @param[in] interval - Interval of LE scan (msec)
5432 * @param[in] window - Window size of LE scan (msec)
5436 int bluetooth_set_scan_parameters(bluetooth_le_scan_params_t *params);
5439 * @fn int bluetooth_is_advertising(void)
5440 * @brief Check for the advertising is in-progress or not.
5442 * This API is used to check the current status of the advertising procedure.
5443 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5446 * This function checks whether the advertising is started or not.
5448 * This function is a synchronous call.
5450 * @param[out] is_advertising The advertising status: (@c TRUE = in progress, @c false = not in progress)
5452 * @return BLUETOOTH_ERROR_NONE - Success \n
5453 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5456 * @see bluetooth_set_advertising, bluetooth_set_custom_advertising
5460 gboolean is_advertising = 0;
5462 ret = bluetooth_is_advertising(&is_advertising);
5465 int bluetooth_is_advertising(gboolean *is_advertising);
5468 * @fn int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5469 * @brief Add LE device to white list
5471 * This API is used to add LE device to white list
5472 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5476 * This function is a synchronous call.
5478 * @param[in] address The address of remote device
5480 * @return BLUETOOTH_ERROR_NONE - Success \n
5481 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5484 * @see bluetooth_set_custom_advertising
5486 int bluetooth_add_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5489 * @fn int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type)
5490 * @brief Remove LE device from white list
5492 * This API is used to remove LE device from white list
5493 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5497 * This function is a synchronous call.
5499 * @param[in] address The address of remote device
5501 * @return BLUETOOTH_ERROR_NONE - Success \n
5502 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5505 * @see bluetooth_set_custom_advertising
5507 int bluetooth_remove_white_list(bluetooth_device_address_t *address, bluetooth_device_address_type_t address_type);
5510 * @fn int bluetooth_clear_white_list(void)
5511 * @brief Clear white list
5513 * This API is used to clear white list
5514 * Before calling this API, make sure that the adapter is enabled. There is no callback event for
5518 * This function is a synchronous call.
5520 * @param[in] address The address of remote device
5522 * @return BLUETOOTH_ERROR_NONE - Success \n
5523 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5526 * @see bluetooth_set_custom_advertising
5528 int bluetooth_clear_white_list(void);
5531 * @fn int bluetooth_le_conn_update(bluetooth_device_address_t *address,
5532 * const bluetooth_le_connection_param_t *parameters)
5533 * @brief update connection paramter of LE connection.
5535 * This function is a synchronous call.
5537 * @return BLUETOOTH_ERROR_NONE - Success \n
5538 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5541 * @param[in] address - remote device address value.
5542 * @param[in] parameters - new connection parameters.
5545 * @see bluetooth_bond_device
5547 int bluetooth_le_conn_update(const bluetooth_device_address_t *address,
5548 const bluetooth_le_connection_param_t *parameters);
5552 * @fn int bluetooth_enable_le_privacy(gboolean enable_privacy);
5554 * @brief Enable/Disable LE Privacy feature.
5556 * This function is used to enable or disable LE Privacy feature.
5557 * Once Privacy feature is enabled, Adapter can use Random Address for more security.
5559 * This function is a synchronous call.
5561 * @return BLUETOOTH_ERROR_NONE - Success \n
5562 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5563 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5566 * @param[in] enable_privacy - The status of Privacy feature to be activated/deactivated[True/False].
5570 int bluetooth_enable_le_privacy(gboolean enable_privacy);
5573 * @fn int bluetooth_update_le_connection_mode(bluetooth_device_address_t *address,
5574 * bluetooth_le_connection_mode_t mode)
5575 * @brief update connection paramter of LE connection.
5577 * This function is a synchronous call.
5579 * @return BLUETOOTH_ERROR_NONE - Success \n
5580 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5581 * BLUETOOTH_ERROR_INVALID_PARAM - Parameter is not valid \n
5584 * @param[in] address - remote device address value.
5585 * @param[in] mode - new connection mode.
5589 int bluetooth_update_le_connection_mode(const bluetooth_device_address_t *address,
5590 bluetooth_le_connection_mode_t mode);
5593 * @fn int bluetooth_le_read_maximum_data_length()
5594 * @brief reads the maximum LE data length supported in the controller.
5596 * This function is a synchronous call.
5598 * @return BLUETOOTH_ERROR_NONE - Success \n
5599 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5605 int bluetooth_le_read_maximum_data_length(
5606 bluetooth_le_read_maximum_data_length_t *max_le_datalength);
5608 * @fn int bluetooth_le_write_host_suggested_default_data_length()
5609 * @brief writes the host suggested values for the controllers max transmitted no of payload
5610 * octects to be used for new connections.
5612 * This function is a synchronous call.
5614 * @return BLUETOOTH_ERROR_NONE - Success \n
5615 * BLUETOOTH_ERROR_INTERNAL - Internal Error \n
5621 int bluetooth_le_write_host_suggested_default_data_length(
5622 const unsigned int def_tx_Octets, const unsigned int def_tx_Time);
5624 int bluetooth_le_read_suggested_default_data_length(
5625 bluetooth_le_read_host_suggested_data_length_t *le_data_length);
5627 int bluetooth_le_set_data_length(bluetooth_device_address_t *address,
5628 const unsigned int max_tx_octets, const unsigned int max_tx_time);
5630 int bluetooth_pbap_init(void);
5631 int bluetooth_pbap_deinit(void);
5632 int bluetooth_pbap_connect(const bluetooth_device_address_t *address);
5633 int bluetooth_pbap_disconnect(const bluetooth_device_address_t *address);
5634 int bluetooth_pbap_get_phonebook_size(const bluetooth_device_address_t *address,
5635 bt_pbap_folder_t *folder);
5636 int bluetooth_pbap_get_phonebook(const bluetooth_device_address_t *address,
5637 bt_pbap_folder_t *folder, bt_pbap_pull_parameters_t *app_param);
5638 int bluetooth_pbap_get_list(const bluetooth_device_address_t *address,
5639 bt_pbap_folder_t *folder, bt_pbap_list_parameters_t *app_param);
5640 int bluetooth_pbap_pull_vcard(const bluetooth_device_address_t *address,
5641 bt_pbap_folder_t *folder, bt_pbap_pull_vcard_parameters_t *app_param);
5642 int bluetooth_pbap_phonebook_search(const bluetooth_device_address_t *address,
5643 bt_pbap_folder_t *folder, bt_pbap_search_parameters_t *app_param);
5646 * @fn int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5648 * @brief Set manufacturer data with value
5650 * This function is used to set manufacturer data.
5652 * This function is a synchronous call.
5654 * @return BLUETOOTH_ERROR_NONE - Success \n
5655 * BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
5656 * BLUETOOTH_ERROR_INTERNAL - Internal IPC error \n
5659 * @param[in] value - Manufacturer data structure.
5663 int bluetooth_set_manufacturer_data(const bluetooth_manufacturer_data_t *value);
5670 #endif /* __cplusplus */
5671 #endif /* _BLUETOOTH_API_H_*/