Tizen Native API  5.0
Bluetooth Device

Bluetooth Device API provides functions for managing bonds with other devices and searching for supported services.

Required Header

#include <bluetooth.h>

Overview

This set of functions is used to handle the connection with other devices. Connected devices exchange keys needed for encrypted communication, but each connection has to be approved by the latest application user. You can also set authorization of other devices. Authorized devices are connected, and it is connected automatically without the latest user being asked for authorization. In addition, this is used to search for services available on remote devices.

Related Features

This API is related with the following features:

It is recommended to design feature related codes in your application for reliability.

You can check if a device supports the related features for this API by using System Information,thereby controlling the procedure of your application.

To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.

More details on featuring your application can be found from Feature Element.

Asynchronous Operations

FUNCTION CALLBACK DESCRIPTION
bt_device_create_bond()
bt_device_cancel_bonding()
bt_device_bond_created_cb() Used to create bond or cancel creating bond.
bt_device_destroy_bond() bt_device_bond_destroyed_cb() Used to destroy bond.
bt_device_set_authorization() bt_device_authorization_changed_cb() Used to set as authorized or unauthorized device.
bt_device_start_service_search() bt_device_service_searched_cb() Used to start or cancel service search.

Callback(Event) Operations


Please refer Bluetooth Tutorial if you want to get more detailed usages and information of this api.

Functions

int bt_device_get_service_mask_from_uuid_list (char **uuids, int no_of_service, bt_service_class_t *service_mask_list)
 Gets the service mask from the UUID list.
int bt_device_create_bond (const char *remote_address)
 Creates a bond with a remote Bluetooth device, asynchronously.
int bt_device_cancel_bonding (void)
 Cancels the bonding process.
int bt_device_destroy_bond (const char *remote_address)
 Destroys the bond, asynchronously.
int bt_device_set_alias (const char *remote_address, const char *alias)
 Sets an alias for the bonded device.
int bt_device_set_authorization (const char *remote_address, bt_device_authorization_e authorization_state)
 Sets the authorization of a bonded device, asynchronously.
int bt_device_start_service_search (const char *remote_address)
 Starts the search for services supported by the specified device, asynchronously.
int bt_device_foreach_connected_profiles (const char *remote_address, bt_device_connected_profile callback, void *user_data)
 Gets the connected profiles.
int bt_device_is_profile_connected (const char *remote_address, bt_profile_e bt_profile, bool *connected_status)
 Gets the profile connected status.
int bt_device_update_le_connection_mode (const char *remote_address, bt_device_le_connection_mode_e mode)
 Updates a LE connection mode.
int bt_device_set_bond_created_cb (bt_device_bond_created_cb callback, void *user_data)
 Registers a callback function to be invoked when the bond creates.
int bt_device_unset_bond_created_cb (void)
 Unregisters the callback function.
int bt_device_set_bond_destroyed_cb (bt_device_bond_destroyed_cb callback, void *user_data)
 Registers a callback function to be invoked when the bond destroys.
int bt_device_unset_bond_destroyed_cb (void)
 Unregisters the callback function.
int bt_device_set_authorization_changed_cb (bt_device_authorization_changed_cb callback, void *user_data)
 Registers a callback function to be invoked when the authorization of device changes.
int bt_device_unset_authorization_changed_cb (void)
 Unregisters the callback function.
int bt_device_set_service_searched_cb (bt_device_service_searched_cb callback, void *user_data)
 Registers a callback function to be invoked when the process of service search finishes.
int bt_device_unset_service_searched_cb (void)
 Unregisters the callback function.
int bt_device_set_connection_state_changed_cb (bt_device_connection_state_changed_cb callback, void *user_data)
 Registers a callback function to be invoked when the connection state is changed.
int bt_device_unset_connection_state_changed_cb (void)
 Unregisters the callback function to be invoked when the connection state is changed.

Typedefs

typedef void(* bt_device_bond_created_cb )(int result, bt_device_info_s *device_info, void *user_data)
 Called when the process of creating bond finishes.
typedef bool(* bt_device_connected_profile )(bt_profile_e profile, void *user_data)
 Called when you get connected profiles repeatedly.
typedef void(* bt_device_bond_destroyed_cb )(int result, char *remote_address, void *user_data)
 Called when the bond destroys.
typedef void(* bt_device_authorization_changed_cb )(bt_device_authorization_e authorization, char *remote_address, void *user_data)
 Called when the authorization of device changes.
typedef void(* bt_device_service_searched_cb )(int result, bt_device_sdp_info_s *sdp_info, void *user_data)
 Called when the process of service search finishes.
typedef void(* bt_device_connection_state_changed_cb )(bool connected, bt_device_connection_info_s *conn_info, void *user_data)
 Called when the connection state is changed.

Typedef Documentation

typedef void(* bt_device_authorization_changed_cb)(bt_device_authorization_e authorization, char *remote_address, void *user_data)

Called when the authorization of device changes.

Since :
2.3
Parameters:
[in]authorizationThe authorization of device
[in]remote_addressThe address of the remote Bluetooth device which is (un)authorized
[in]user_dataThe user data passed from the callback registration function
Precondition:
bt_device_set_authorization() will invoke this function if you register this callback using bt_device_set_authorization_changed_cb().
See also:
bt_device_set_authorization()
bt_device_set_authorization_changed_cb()
bt_device_unset_authorization_changed_cb()
typedef void(* bt_device_bond_created_cb)(int result, bt_device_info_s *device_info, void *user_data)

Called when the process of creating bond finishes.

Since :
2.3
Remarks:
If the remote user does not respond within 60 seconds, a time out will happen with BT_ERROR_TIMED_OUT result code.
If bt_device_cancel_bonding() is called and it returns BT_ERROR_NONE, then this callback function will be called
with BT_ERROR_CANCELLED result.
If creating a bond succeeds but service search fails, then this callback will be called with BT_ERROR_SERVICE_SEARCH_FAILED.
In this case, you should try service search again by bt_device_start_service_search() to get the supported service list.
Parameters:
[in]resultThe result of the bonding device
[in]device_infoThe device information which you creates bond with
[in]user_dataThe user data passed from the callback registration function
Precondition:
Either bt_device_create_bond() will invoke this function if you register this callback using bt_device_set_bond_created_cb().
See also:
bt_device_create_bond()
bt_device_cancel_bonding()
bt_device_set_bond_created_cb()
bt_device_unset_bond_created_cb()
typedef void(* bt_device_bond_destroyed_cb)(int result, char *remote_address, void *user_data)

Called when the bond destroys.

Since :
2.3
Parameters:
[in]resultThe result that a bond is destroyed
[in]remote_addressThe address of the remote Bluetooth device to destroy bond with
[in]user_dataThe user data passed from the callback registration function
Precondition:
bt_device_destroy_bond() will invoke this function if you register this callback using bt_device_set_bond_destroyed_cb().
See also:
bt_device_destroy_bond()
bt_device_set_bond_destroyed_cb()
bt_device_unset_bond_destroyed_cb()
typedef bool(* bt_device_connected_profile)(bt_profile_e profile, void *user_data)

Called when you get connected profiles repeatedly.

Since :
2.3
Parameters:
[in]profileThe connected Bluetooth profile
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop,
false to break out of the loop.
Precondition:
bt_device_foreach_connected_profiles() will invoke this function.
See also:
bt_device_foreach_connected_profiles()
typedef void(* bt_device_connection_state_changed_cb)(bool connected, bt_device_connection_info_s *conn_info, void *user_data)

Called when the connection state is changed.

Since :
2.3
Parameters:
[in]connectedThe connection status: (true = connected, false = disconnected)
[in]conn_infoThe connection information
[in]user_dataThe user data passed from the callback registration function
See also:
bt_device_set_connection_state_changed_cb()
bt_device_unset_connection_state_changed_cb()
typedef void(* bt_device_service_searched_cb)(int result, bt_device_sdp_info_s *sdp_info, void *user_data)

Called when the process of service search finishes.

Since :
2.3
Parameters:
[in]resultThe result of the service searching
[in]sdp_infoThe structure of service lists found on a device
[in]user_dataThe user data passed from the callback registration function
Precondition:
Either bt_device_start_service_search() will invoke this function if you register this callback using bt_device_set_service_searched_cb().
See also:
bt_device_start_service_search()
bt_device_set_service_searched_cb()
bt_device_unset_service_searched_cb()

Enumeration Type Documentation

Enumerations of gap appearance type.

Since :
2.3
Enumerator:
BT_APPEARANCE_TYPE_UNKNOWN 

Unknown appearance type

BT_APPEARANCE_TYPE_GENERIC_PHONE 

Generic Phone type - Generic category

BT_APPEARANCE_TYPE_GENERIC_COMPUTER 

Generic Computer type - Generic category

BT_APPEARANCE_TYPE_GENERIC_WATCH 

Generic Watch type - Generic category

Enumerations of device address type.

Since :
2.3
Enumerator:
BT_DEVICE_PUBLIC_ADDRESS 

Public address

BT_DEVICE_RANDOM_ADDRESS 

Random address

Enumerations of device authorization state.

Since :
2.3
Enumerator:
BT_DEVICE_AUTHORIZED 

The remote Bluetooth device is authorized

BT_DEVICE_UNAUTHORIZED 

The remote Bluetooth device is unauthorized

Enumerations of connection link type.

Since :
2.3
Enumerator:
BT_DEVICE_CONNECTION_LINK_BREDR 

BR/EDR link

BT_DEVICE_CONNECTION_LINK_LE 

LE link

BT_DEVICE_CONNECTION_LINK_DEFAULT 

The connection type default

Enumerations of device disconnect reason.

Since :
2.3
Enumerator:
BT_DEVICE_DISCONNECT_REASON_UNKNOWN 

Disconnected by unknown reason

BT_DEVICE_DISCONNECT_REASON_TIMEOUT 

Disconnected by timeout

BT_DEVICE_DISCONNECT_REASON_LOCAL_HOST 

Disconnected by local host

BT_DEVICE_DISCONNECT_REASON_REMOTE 

Disconnected by remote

Enumerations of the Bluetooth device's LE connection mode.

Since :
3.0
Enumerator:
BT_DEVICE_LE_CONNECTION_MODE_BALANCED 

Balanced mode of power consumption and connection latency

BT_DEVICE_LE_CONNECTION_MODE_LOW_LATENCY 

Low connection latency but high power consumption

BT_DEVICE_LE_CONNECTION_MODE_LOW_ENERGY 

Low power consumption but high connection latency

Enumerations of major device class.

Since :
2.3
Enumerator:
BT_MAJOR_DEVICE_CLASS_MISC 

Miscellaneous major device class

BT_MAJOR_DEVICE_CLASS_COMPUTER 

Computer major device class

BT_MAJOR_DEVICE_CLASS_PHONE 

Phone major device class

BT_MAJOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT 

LAN/Network access point major device class

BT_MAJOR_DEVICE_CLASS_AUDIO_VIDEO 

Audio/Video major device class

BT_MAJOR_DEVICE_CLASS_PERIPHERAL 

Peripheral major device class

BT_MAJOR_DEVICE_CLASS_IMAGING 

Imaging major device class

BT_MAJOR_DEVICE_CLASS_WEARABLE 

Wearable device class

BT_MAJOR_DEVICE_CLASS_TOY 

Toy device class

BT_MAJOR_DEVICE_CLASS_HEALTH 

Health device class

BT_MAJOR_DEVICE_CLASS_UNCATEGORIZED 

Uncategorized major device class

Enumerations of major service class.

Since :
2.3
Enumerator:
BT_MAJOR_SERVICE_CLASS_LIMITED_DISCOVERABLE_MODE 

Limited discoverable mode

BT_MAJOR_SERVICE_CLASS_POSITIONING 

Positioning class

BT_MAJOR_SERVICE_CLASS_NETWORKING 

Networking class

BT_MAJOR_SERVICE_CLASS_RENDERING 

Rendering class

BT_MAJOR_SERVICE_CLASS_CAPTURING 

Capturing class

BT_MAJOR_SERVICE_CLASS_OBJECT_TRANSFER 

Object transferring class

BT_MAJOR_SERVICE_CLASS_AUDIO 

Audio class

BT_MAJOR_SERVICE_CLASS_TELEPHONY 

Telephony class

BT_MAJOR_SERVICE_CLASS_INFORMATION 

Information class

Enumerations of minor device class.

Since :
2.3
Enumerator:
BT_MINOR_DEVICE_CLASS_COMPUTER_UNCATEGORIZED 

Uncategorized minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_DESKTOP_WORKSTATION 

Desktop workstation minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_SERVER_CLASS 

Server minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_LAPTOP 

Laptop minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_HANDHELD_PC_OR_PDA 

Handheld PC/PDA minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_PALM_SIZED_PC_OR_PDA 

Palm sized PC/PDA minor device class of computer

BT_MINOR_DEVICE_CLASS_COMPUTER_WEARABLE_COMPUTER 

Wearable(watch sized) minor device class of computer

BT_MINOR_DEVICE_CLASS_PHONE_UNCATEGORIZED 

Uncategorized minor device class of phone

BT_MINOR_DEVICE_CLASS_PHONE_CELLULAR 

Cellular minor device class of phone

BT_MINOR_DEVICE_CLASS_PHONE_CORDLESS 

Cordless minor device class of phone

BT_MINOR_DEVICE_CLASS_PHONE_SMART_PHONE 

Smart phone minor device class of phone

BT_MINOR_DEVICE_CLASS_PHONE_WIRED_MODEM_OR_VOICE_GATEWAY 

Wired modem or voice gateway minor device class of phone

BT_MINOR_DEVICE_CLASS_PHONE_COMMON_ISDN_ACCESS 

Common ISDN minor device class of phone

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_FULLY_AVAILABLE 

Fully available minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_1_TO_17_PERCENT_UTILIZED 

1-17% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_17_TO_33_PERCENT_UTILIZED 

17-33% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_33_TO_50_PERCENT_UTILIZED 

33-50% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_50_to_67_PERCENT_UTILIZED 

50-67% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_67_TO_83_PERCENT_UTILIZED 

67-83% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_83_TO_99_PERCENT_UTILIZED 

83-99% utilized minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_LAN_NETWORK_ACCESS_POINT_NO_SERVICE_AVAILABLE 

No service available minor device class of LAN/Network access point

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_UNCATEGORIZED 

Uncategorized minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_WEARABLE_HEADSET 

Wearable headset minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HANDS_FREE 

Hands-free minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_MICROPHONE 

Microphone minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_LOUDSPEAKER 

Loudspeaker minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HEADPHONES 

Headphones minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_PORTABLE_AUDIO 

Portable audio minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAR_AUDIO 

Car audio minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_SET_TOP_BOX 

Set-top box minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_HIFI_AUDIO_DEVICE 

Hifi audio minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VCR 

VCR minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CAMERA 

Video camera minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_CAMCORDER 

Camcorder minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_MONITOR 

Video monitor minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_DISPLAY_LOUDSPEAKER 

Video display and loudspeaker minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_VIDEO_CONFERENCING 

Video conferencing minor device class of audio/video

BT_MINOR_DEVICE_CLASS_AUDIO_VIDEO_GAMING_TOY 

Gaming/toy minor device class of audio/video

BT_MINOR_DEVICE_CLASS_PERIPHERA_UNCATEGORIZED 

Uncategorized minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_KEY_BOARD 

Key board minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_POINTING_DEVICE 

Pointing device minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_COMBO_KEYBOARD_POINTING_DEVICE 

Combo keyboard or pointing device minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_JOYSTICK 

Joystick minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_GAME_PAD 

Game pad minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_REMOTE_CONTROL 

Remote control minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_SENSING_DEVICE 

Sensing device minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITIZER_TABLET 

Digitizer minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_CARD_READER 

Card reader minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_DIGITAL_PEN 

Digital pen minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_SCANNER 

Handheld scanner minor device class of peripheral

BT_MINOR_DEVICE_CLASS_PERIPHERAL_HANDHELD_GESTURAL_INPUT_DEVICE 

Handheld gestural input device minor device class of peripheral

BT_MINOR_DEVICE_CLASS_IMAGING_DISPLAY 

Display minor device class of imaging

BT_MINOR_DEVICE_CLASS_IMAGING_CAMERA 

Camera minor device class of imaging

BT_MINOR_DEVICE_CLASS_IMAGING_SCANNER 

Scanner minor device class of imaging

BT_MINOR_DEVICE_CLASS_IMAGING_PRINTER 

Printer minor device class of imaging

BT_MINOR_DEVICE_CLASS_WEARABLE_WRIST_WATCH 

Wrist watch minor device class of wearable

BT_MINOR_DEVICE_CLASS_WEARABLE_PAGER 

Pager minor device class of wearable

BT_MINOR_DEVICE_CLASS_WEARABLE_JACKET 

Jacket minor device class of wearable

BT_MINOR_DEVICE_CLASS_WEARABLE_HELMET 

Helmet minor device class of wearable

BT_MINOR_DEVICE_CLASS_WEARABLE_GLASSES 

Glasses minor device class of wearable

BT_MINOR_DEVICE_CLASS_TOY_ROBOT 

Robot minor device class of toy

BT_MINOR_DEVICE_CLASS_TOY_VEHICLE 

Vehicle minor device class of toy

BT_MINOR_DEVICE_CLASS_TOY_DOLL_ACTION 

Doll/Action minor device class of toy

BT_MINOR_DEVICE_CLASS_TOY_CONTROLLER 

Controller minor device class of toy

BT_MINOR_DEVICE_CLASS_TOY_GAME 

Game minor device class of toy

BT_MINOR_DEVICE_CLASS_HEALTH_UNCATEGORIZED 

Uncategorized minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_BLOOD_PRESSURE_MONITOR 

Blood pressure monitor minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_THERMOMETER 

Thermometer minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_WEIGHING_SCALE 

Weighing scale minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_GLUCOSE_METER 

Glucose minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_PULSE_OXIMETER 

Pulse oximeter minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_HEART_PULSE_RATE_MONITOR 

Heart/Pulse rate monitor minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_DATA_DISPLAY 

Health data display minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_STEP_COUNTER 

Step counter minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_BODY_COMPOSITION_ANALYZER 

Body composition analyzer minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_PEAK_FLOW_MONITOR 

Peak flow monitor minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_MEDICATION_MONITOR 

Medication monitor minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_KNEE_PROSTHESIS 

Knee prosthesis minor device class of health

BT_MINOR_DEVICE_CLASS_HEALTH_ANKLE_PROSTHESIS 

Ankle prosthesis minor device class of health

Enumerations of Bluetooth profile.

Since :
2.3
Enumerator:
BT_PROFILE_RFCOMM 

RFCOMM Profile

BT_PROFILE_A2DP 

Advanced Audio Distribution Profile Source role

BT_PROFILE_HSP 

Headset Profile

BT_PROFILE_HID 

Human Interface Device Profile

BT_PROFILE_NAP 

Network Access Point Profile

BT_PROFILE_AG 

Audio Gateway Profile

BT_PROFILE_GATT 

Generic Attribute Profile

BT_PROFILE_NAP_SERVER 

NAP server Profile

BT_PROFILE_A2DP_SINK 

Advanced Audio Distribution Profile Sink role

Enumerations of service class.

Since :
2.3
Enumerator:
BT_SC_NONE 

No service class

BT_SC_RES_SERVICE_MASK 

RES service class

BT_SC_SPP_SERVICE_MASK 

SPP service class

BT_SC_DUN_SERVICE_MASK 

DUN service class

BT_SC_FAX_SERVICE_MASK 

FAX service class

BT_SC_LAP_SERVICE_MASK 

LAP service class

BT_SC_HSP_SERVICE_MASK 

HSP service class

BT_SC_HFP_SERVICE_MASK 

HFP service class

BT_SC_OPP_SERVICE_MASK 

OPP service class

BT_SC_FTP_SERVICE_MASK 

FTP service class

BT_SC_CTP_SERVICE_MASK 

CTP service class

BT_SC_ICP_SERVICE_MASK 

ICP service class

BT_SC_SYNC_SERVICE_MASK 

SYNC service class

BT_SC_BPP_SERVICE_MASK 

BPP service class

BT_SC_BIP_SERVICE_MASK 

BIP service class

BT_SC_PANU_SERVICE_MASK 

PANU service class

BT_SC_NAP_SERVICE_MASK 

NAP service class

BT_SC_GN_SERVICE_MASK 

GN service class

BT_SC_SAP_SERVICE_MASK 

SAP service class

BT_SC_A2DP_SERVICE_MASK 

A2DP service class

BT_SC_AVRCP_SERVICE_MASK 

AVRCP service class

BT_SC_PBAP_SERVICE_MASK 

PBAP service class

BT_SC_HID_SERVICE_MASK 

HID service class

BT_SC_A2DP_SOURCE_SERVICE_MASK 

A2DP SOURCE service class

BT_SC_ALL_SERVICE_MASK 

ALL service class

BT_SC_MAX 

MAX service class


Function Documentation

int bt_device_cancel_bonding ( void  )

Cancels the bonding process.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Use this function when the remote Bluetooth device is not responding to the
bond request or you wish to cancel the bonding request.
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_NOT_IN_PROGRESSOperation not in progress
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The creating a bond must be in progress by bt_device_create_bond().
See also:
bt_device_create_bond()
bt_device_bond_created_cb()
bt_device_set_bond_created_cb()
bt_device_unset_bond_created_cb()
int bt_device_create_bond ( const char *  remote_address)

Creates a bond with a remote Bluetooth device, asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
A bond can be destroyed by bt_device_destroy_bond().
The bonding request can be cancelled by bt_device_cancel_bonding().
Parameters:
[in]remote_addressThe address of the remote Bluetooth device with which the bond should be created
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_RESOURCE_BUSYDevice or resource busy
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
The remote device must be discoverable with bt_adapter_start_device_discovery().
Postcondition:
This function invokes bt_device_bond_created_cb().
See also:
bt_adapter_start_device_discovery()
bt_device_bond_created_cb()
bt_device_cancel_bonding()
bt_device_destroy_bond()
bt_device_set_bond_created_cb()
bt_device_unset_bond_created_cb()
int bt_device_destroy_bond ( const char *  remote_address)

Destroys the bond, asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]remote_addressThe address of the remote Bluetooth device to remove bonding
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_RESOURCE_BUSYDevice or resource busy
BT_ERROR_REMOTE_DEVICE_NOT_BONDEDRemote device not bonded
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
The bond with the remote device must be created with bt_device_create_bond().
Postcondition:
This function invokes bt_device_bond_destroyed_cb().
See also:
bt_device_create_bond()
bt_device_bond_destroyed_cb()
bt_device_set_bond_destroyed_cb()
bt_device_unset_bond_destroyed_cb()
int bt_device_foreach_connected_profiles ( const char *  remote_address,
bt_device_connected_profile  callback,
void *  user_data 
)

Gets the connected profiles.

Since :
2.3
Parameters:
[in]remote_addressThe address of the remote device
[in]callbackThe callback function to invoke
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
Postcondition:
bt_device_connected_profile() will be invoked.
See also:
bt_device_connected_profile()
int bt_device_get_service_mask_from_uuid_list ( char **  uuids,
int  no_of_service,
bt_service_class_t service_mask_list 
)

Gets the service mask from the UUID list.

Since :
2.3
Parameters:
[in]uuidsThe UUID list of the device.
[in]no_of_serviceThe number of the UUID list count.
[out]service_mask_listService mask list converted from the given UUID list.
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_service_class_t
int bt_device_is_profile_connected ( const char *  remote_address,
bt_profile_e  bt_profile,
bool *  connected_status 
)

Gets the profile connected status.

Since :
2.3
Parameters:
[in]remote_addressThe address of the remote device
[in]bt_profilewish to know bt_profile
[out]connected_statusthe connected status
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_REMOTE_DEVICE_NOT_BONDEDRemote device not bonded
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
int bt_device_set_alias ( const char *  remote_address,
const char *  alias 
)

Sets an alias for the bonded device.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]remote_addressThe address of the remote Bluetooth device
[in]aliasThe alias of the remote Bluetooth device
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_REMOTE_DEVICE_NOT_BONDEDRemote device not bonded
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
The bond with the remote device must be created with bt_device_create_bond().
See also:
bt_device_create_bond()
int bt_device_set_authorization ( const char *  remote_address,
bt_device_authorization_e  authorization_state 
)

Sets the authorization of a bonded device, asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Once a device is authorized, you don't need to receive a confirmation.
Parameters:
[in]remote_addressThe address of the remote Bluetooth device to authorize
[in]authorization_stateThe Bluetooth authorization state
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_REMOTE_DEVICE_NOT_BONDEDRemote device not bonded
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
The bond with the remote device must be created with bt_device_create_bond().
Postcondition:
bt_device_authorization_changed_cb() will be invoked.
See also:
bt_device_create_bond()
bt_device_authorization_changed_cb()
bt_device_set_authorization_changed_cb()
bt_device_unset_authorization_changed_cb()

Registers a callback function to be invoked when the authorization of device changes.

Since :
2.3
Parameters:
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
Postcondition:
bt_device_authorization_changed_cb() will be invoked.
See also:
bt_initialize()
bt_device_authorization_changed_cb()
bt_device_set_authorization_changed_cb()
bt_device_unset_authorization_changed_cb()
int bt_device_set_bond_created_cb ( bt_device_bond_created_cb  callback,
void *  user_data 
)

Registers a callback function to be invoked when the bond creates.

Since :
2.3
Parameters:
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
Postcondition:
bt_device_bond_created_cb() will be invoked.
See also:
bt_initialize()
bt_device_bond_created_cb()
bt_device_unset_bond_created_cb()
int bt_device_set_bond_destroyed_cb ( bt_device_bond_destroyed_cb  callback,
void *  user_data 
)

Registers a callback function to be invoked when the bond destroys.

Since :
2.3
Parameters:
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
Postcondition:
bt_device_bond_destroyed_cb() will be invoked.
See also:
bt_initialize()
bt_device_bond_destroyed_cb()
bt_device_unset_bond_destroyed_cb()

Registers a callback function to be invoked when the connection state is changed.

Since :
2.3
Parameters:
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
Postcondition:
bt_device_connection_state_changed_cb() will be invoked.
See also:
bt_initialize()
bt_device_connection_state_changed_cb()
bt_device_unset_connection_state_changed_cb()
int bt_device_set_service_searched_cb ( bt_device_service_searched_cb  callback,
void *  user_data 
)

Registers a callback function to be invoked when the process of service search finishes.

Since :
2.3
Parameters:
[in]callbackThe callback function to register
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
Postcondition:
bt_device_service_searched_cb() will be invoked.
See also:
bt_initialize()
bt_device_service_searched_cb()
bt_device_unset_service_searched_cb()
int bt_device_start_service_search ( const char *  remote_address)

Starts the search for services supported by the specified device, asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
If creating a bond succeeds, which means bt_device_bond_created_cb() is called with result BT_ERROR_NONE,
then you don't need to run this function.
The service search takes a couple of seconds to complete normally.
Parameters:
[in]remote_addressThe address of the remote Bluetooth device whose services need to be checked
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_REMOTE_DEVICE_NOT_BONDEDRemote device not bonded
BT_ERROR_SERVICE_SEARCH_FAILEDService search failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
The remote device must be discoverable with bt_adapter_start_device_discovery().
The bond with the remote device must be created with bt_device_create_bond().
Postcondition:
This function invokes bt_device_service_searched_cb().
See also:
bt_adapter_start_device_discovery()
bt_device_create_bond()
bt_device_bond_created_cb()
bt_device_service_searched_cb()
bt_device_set_service_searched_cb()
bt_device_unset_service_searched_cb()

Unregisters the callback function.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_initialize()
bt_device_set_authorization_changed_cb()

Unregisters the callback function.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_initialize()
bt_device_set_bond_created_cb()

Unregisters the callback function.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_initialize()
bt_device_set_bond_destroyed_cb()

Unregisters the callback function to be invoked when the connection state is changed.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_initialize()
bt_device_set_connection_state_changed_cb()

Unregisters the callback function.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_initialize()
bt_device_set_service_searched_cb()
int bt_device_update_le_connection_mode ( const char *  remote_address,
bt_device_le_connection_mode_e  mode 
)

Updates a LE connection mode.

Since :
3.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]remote_addressThe address of the remote Bluetooth device
[in]modeThe LE connection mode
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported