Tizen Native API
6.0
|
Bluetooth PBAP (Phone Book Access Profile) API provides functions for managing connections to a phone book server and retrieving phone book data.
Required Header
#include <bluetooth.h>
Overview
The PBAP involves two roles, Server and Client. The Server is a device that has phone book data. The Client is a device that requests the phone book data from the Server. This API only supports Client role.
Related Features
This API is related to the following features:
- http://tizen.org/feature/network.bluetooth.phonebook.client
It is recommended to use features in your application for reliability.
You can check if a device supports features related to this API by using System Information, thereby controlling your application's actions.
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.
Functions | |
int | bt_pbap_client_initialize (void) |
Initializes the Bluetooth PBAP Client. | |
int | bt_pbap_client_deinitialize (void) |
Deinitializes the Bluetooth PBAP Client. | |
int | bt_pbap_client_set_connection_state_changed_cb (bt_pbap_connection_state_changed_cb callback, void *user_data) |
Registers a callback function that will be invoked when the connection state is changed. | |
int | bt_pbap_client_unset_connection_state_changed_cb (void) |
Unregisters a callback function that will be invoked when the connection state is changed. | |
int | bt_pbap_client_connect (const char *address) |
Connects to PBAP server, asynchronously. | |
int | bt_pbap_client_disconnect (const char *address) |
Disconnects from PBAP server, asynchronously. | |
int | bt_pbap_client_get_phone_book_size (const char *address, bt_pbap_address_book_source_e source, bt_pbap_folder_type_e folder_type, bt_pbap_phone_book_size_cb callback, void *user_data) |
Gets size of phone book from PBAP server, asynchronously. | |
int | bt_pbap_client_get_phone_book (const char *address, bt_pbap_address_book_source_e source, bt_pbap_folder_type_e folder_type, bt_pbap_vcard_format_e format, bt_pbap_sort_order_e order, unsigned short offset, unsigned short max_list_count, unsigned int fields, bt_pbap_phone_book_received_cb callback, void *user_data) |
Gets all contacts and call logs as vCard from PBAP server, asynchronously. | |
int | bt_pbap_client_get_list (const char *address, bt_pbap_address_book_source_e source, bt_pbap_folder_type_e folder_type, bt_pbap_sort_order_e order, unsigned short offset, unsigned short max_list_count, bt_pbap_list_vcards_cb callback, void *user_data) |
Gets contact and call log information from the PBAP server, asynchronously. | |
int | bt_pbap_client_pull_vcard (const char *address, bt_pbap_address_book_source_e source, bt_pbap_folder_type_e folder_type, int index, bt_pbap_vcard_format_e format, unsigned int fields, bt_pbap_phone_book_received_cb callback, void *user_data) |
Gets the selected contact using the index parameter as vCard from PBAP server, asynchronously. | |
int | bt_pbap_client_search_phone_book (const char *address, bt_pbap_address_book_source_e source, bt_pbap_folder_type_e folder_type, bt_pbap_search_field_e search_attribute, const char *search_value, bt_pbap_sort_order_e order, unsigned short offset, unsigned short max_list_count, bt_pbap_list_vcards_cb callback, void *user_data) |
Finds and fetches the contact and call log information from the PBAP server, asynchronously. | |
Typedefs | |
typedef void(* | bt_pbap_connection_state_changed_cb )(int result, bool connected, const char *remote_address, void *user_data) |
Called when PBAP is Connected or Disconnected. | |
typedef void(* | bt_pbap_phone_book_size_cb )(int result, const char *remote_address, int size, void *user_data) |
Called when PBAP Phonebook size calculation completes. | |
typedef void(* | bt_pbap_phone_book_received_cb )(int result, const char *remote_address, const char *vcf_file, void *user_data) |
Called when PBAP Phonebook Pull completes. | |
typedef void(* | bt_pbap_list_vcards_cb )(int result, const char *remote_address, const bt_pbap_vcard_info_s *vcard_info, int count, void *user_data) |
Called when PBAP List vCards completes. |
Typedef Documentation
typedef void(* bt_pbap_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data) |
Called when PBAP is Connected or Disconnected.
The following error codes can be delivered:
BT_ERROR_NONE
BT_ERROR_AUTH_REJECTED
BT_ERROR_AUTHORIZATION_REJECTED
BT_ERROR_SERVICE_NOT_FOUND
BT_ERROR_TIMED_OUT
BT_ERROR_OPERATION_FAILED
- Since :
- 3.0
- Parameters:
-
[in] result The result of connecting to or disconnecting from the remote device [in] connected The PBAP connection status ( true
= connected,false
= disconnected)[in] remote_address The remote device address (remote_address is valid only inside this function. To use outside the callback, make a copy. remote_address should not be freed.) [in] user_data The user data passed from the callback registration function
typedef void(* bt_pbap_list_vcards_cb)(int result, const char *remote_address, const bt_pbap_vcard_info_s *vcard_info, int count, void *user_data) |
Called when PBAP List vCards completes.
The following error codes can be delivered:
BT_ERROR_NONE
BT_ERROR_OPERATION_FAILED
- Since :
- 3.0
- Parameters:
-
[in] result The result of getting the vcard list [in] remote_address The remote device address (remote_address is valid only inside this function. To use outside the callback, make a copy. remote_address should not be freed.) [in] vcard_info List of vcard information (vcard_info is valid only inside this function. To use outside the callback, make a copy. vcard_info should not be freed.) [in] count Number of contacts in the list [in] user_data The user data passed from the callback registration function
typedef void(* bt_pbap_phone_book_received_cb)(int result, const char *remote_address, const char *vcf_file, void *user_data) |
Called when PBAP Phonebook Pull completes.
The received phone book file will be saved in the platform downloads folder.
The following error codes can be delivered:
BT_ERROR_NONE
BT_ERROR_OPERATION_FAILED
- Since :
- 3.0
- Parameters:
-
[in] result The result of getting the phone book [in] remote_address The remote device address (remote_address is valid only inside this function. To use outside the callback, make a copy. remote_address should not be freed.) [in] vcf_file The absolute path of the file in which the vCards are saved (vcf_file is valid only inside this function. To use outside the callback, make a copy. vcf_file should not be freed.) [in] user_data The user data passed from the callback registration function
typedef void(* bt_pbap_phone_book_size_cb)(int result, const char *remote_address, int size, void *user_data) |
Called when PBAP Phonebook size calculation completes.
The following error codes can be delivered:
BT_ERROR_NONE
BT_ERROR_OPERATION_FAILED
- Since :
- 3.0
- Parameters:
-
[in] result The result of getting the phone book size [in] remote_address The remote device address (remote_address is valid only inside this function. To use outside the callback, make a copy. remote_address should not be freed.) [in] size Size of Phonebook [in] user_data The user data passed from the callback registration function
Enumeration Type Documentation
enum bt_pbap_field_e |
Enumeration of PBAP fields.
- Since :
- 3.0
- Enumerator:
Enumeration of folder type.
- Since :
- 3.0
enum bt_pbap_sort_order_e |
Function Documentation
int bt_pbap_client_connect | ( | const char * | address | ) |
Connects to PBAP server, asynchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] address The other device's address
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported BT_ERROR_NOW_IN_PROGRESS Operation is in progress
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- The local device must be bonded with the remote device by bt_device_create_bond().
- Postcondition:
- bt_pbap_connection_state_changed_cb() will be invoked.
int bt_pbap_client_deinitialize | ( | void | ) |
Deinitializes the Bluetooth PBAP Client.
This deinitialization must be done to free resources when the PBAP client is not longer needed.
- Since :
- 3.0
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED. The PBAP client must be initialized with bt_pbap_client_initialize().
int bt_pbap_client_disconnect | ( | const char * | address | ) |
Disconnects from PBAP server, asynchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] address The other device's address
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported BT_ERROR_NOW_IN_PROGRESS Operation is in progress
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- Postcondition:
- bt_pbap_connection_state_changed_cb() will be invoked.
int bt_pbap_client_get_list | ( | const char * | address, |
bt_pbap_address_book_source_e | source, | ||
bt_pbap_folder_type_e | folder_type, | ||
bt_pbap_sort_order_e | order, | ||
unsigned short | offset, | ||
unsigned short | max_list_count, | ||
bt_pbap_list_vcards_cb | callback, | ||
void * | user_data | ||
) |
Gets contact and call log information from the PBAP server, asynchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] address The other device's address [in] source Source of phone book (Phone/SIM) [in] folder_type Type of folder [in] order Specifies which field shall be used to sort vCards. [in] offset vCards to be excluded from beginning. [in] max_list_count Maximum number of vCards to be fetched [in] callback The callback function called when PBAP List is returned. [in] user_data Data to be passed to the PBAP phone book pulling callback.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- See also:
- bt_pbap_client_connect()
int bt_pbap_client_get_phone_book | ( | const char * | address, |
bt_pbap_address_book_source_e | source, | ||
bt_pbap_folder_type_e | folder_type, | ||
bt_pbap_vcard_format_e | format, | ||
bt_pbap_sort_order_e | order, | ||
unsigned short | offset, | ||
unsigned short | max_list_count, | ||
unsigned int | fields, | ||
bt_pbap_phone_book_received_cb | callback, | ||
void * | user_data | ||
) |
Gets all contacts and call logs as vCard from PBAP server, asynchronously.
The received phone book file will be saved in the platform downloads folder.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth http://tizen.org/privilege/mediastorage
- Parameters:
-
[in] address The other device's address [in] source Source of phone book (Phone/SIM) [in] folder_type Type of folder [in] format The vCard format [in] order Specifies which field shall be used to sort vCards. [in] offset The number of vCards to be excluded, counting from the beginning [in] max_list_count The maximum number of vCards to be fetched [in] fields vCard fields to be fetched; one or more bt_pbap_field_e values combined with bitwise 'or' [in] callback The callback function called when PBAP phone book is Pulled. [in] user_data Data to be passed to the PBAP phone book pulling callback.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- See also:
- bt_pbap_client_connect()
int bt_pbap_client_get_phone_book_size | ( | const char * | address, |
bt_pbap_address_book_source_e | source, | ||
bt_pbap_folder_type_e | folder_type, | ||
bt_pbap_phone_book_size_cb | callback, | ||
void * | user_data | ||
) |
Gets size of phone book from PBAP server, asynchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] address The other device's address [in] source Source of the phone book (Phone/SIM) [in] folder_type Type of folder [in] callback The callback function called when PBAP phone book size is returned. [in] user_data Data to be passed to the PBAP phone book size callback.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- See also:
- bt_pbap_client_connect()
int bt_pbap_client_initialize | ( | void | ) |
Initializes the Bluetooth PBAP Client.
This initialization is necessary to call other PBAP client APIs.
- Since :
- 3.0
- Remarks:
- This function must be called to initialize Bluetooth PBAP client. You must free all resources of the Bluetooth service
by calling bt_pbap_client_deinitialize() if Bluetooth PBAP Client is no longer needed.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
int bt_pbap_client_pull_vcard | ( | const char * | address, |
bt_pbap_address_book_source_e | source, | ||
bt_pbap_folder_type_e | folder_type, | ||
int | index, | ||
bt_pbap_vcard_format_e | format, | ||
unsigned int | fields, | ||
bt_pbap_phone_book_received_cb | callback, | ||
void * | user_data | ||
) |
Gets the selected contact using the index parameter as vCard from PBAP server, asynchronously.
The received phone book file will be saved in the platform downloads folder. The index value should be equal to the value of the index field in the bt_pbap_vcard_info_s structure, which can be obtained with bt_pbap_client_get_list() or bt_pbap_client_search_phone_book().
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth http://tizen.org/privilege/mediastorage
- Parameters:
-
[in] address The other device's address [in] source Source of phone book (Phone/SIM) [in] folder_type Type of folder [in] index The handle index of vCard to be fetched [in] format Format of vCard [in] fields vCard fields to be fetched; one or more bt_pbap_field_e values combined with bitwise 'or' [in] callback The callback function called when PBAP phone book is Pulled. [in] user_data Data to be passed to the PBAP phone book Pulling callback.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- The vCard information (bt_pbap_vcard_info_s) must be obtained with bt_pbap_client_get_list() or bt_pbap_client_search_phone_book().
int bt_pbap_client_search_phone_book | ( | const char * | address, |
bt_pbap_address_book_source_e | source, | ||
bt_pbap_folder_type_e | folder_type, | ||
bt_pbap_search_field_e | search_attribute, | ||
const char * | search_value, | ||
bt_pbap_sort_order_e | order, | ||
unsigned short | offset, | ||
unsigned short | max_list_count, | ||
bt_pbap_list_vcards_cb | callback, | ||
void * | user_data | ||
) |
Finds and fetches the contact and call log information from the PBAP server, asynchronously.
- Since :
- 3.0
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] address The other device's address [in] source Source of phone book (Phone/SIM) [in] folder_type Type of folder [in] search_attribute field to be search [in] search_value pattern to be searched for [in] order Specifies which field shall be used to sort vCards. [in] offset vCards to be excluded from beginning. [in] max_list_count Maximum number of vCards to be fetched [in] callback The callback function called when PBAP List is returned. [in] user_data Data to be passed to the PBAP phone book pulling callback.
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Adapter is not enabled BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The state of the local Bluetooth adapter must be BT_ADAPTER_ENABLED.
- The PBAP client must be initialized with bt_pbap_client_initialize().
- PBAP connection must be created with bt_pbap_client_connect().
- See also:
- bt_pbap_client_connect()
int bt_pbap_client_set_connection_state_changed_cb | ( | bt_pbap_connection_state_changed_cb | callback, |
void * | user_data | ||
) |
Registers a callback function that will be invoked when the connection state is changed.
- Since :
- 3.0
- Parameters:
-
[in] callback The callback function to register [in] user_data The user data to be passed to the callback function
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The PBAP client must be initialized with bt_pbap_client_initialize().
- See also:
- bt_pbap_client_initialize()
int bt_pbap_client_unset_connection_state_changed_cb | ( | void | ) |
Unregisters a callback function that will be invoked when the connection state is changed.
- Since :
- 3.0
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The PBAP client must be initialized with bt_pbap_client_initialize().
- See also:
- bt_pbap_client_initialize()