Move PBAP client APIs header into bluetooth.h 22/66422/33
authorDoHyun Pyun <dh79.pyun@samsung.com>
Tue, 19 Apr 2016 02:09:19 +0000 (11:09 +0900)
committerPyun DoHyun <dh79.pyun@samsung.com>
Fri, 27 May 2016 06:56:27 +0000 (23:56 -0700)
We will provide PBAP client APIs as public API on tizen 3.0

Change-Id: I8b5c29b3e361ff01c3a639b9ed80231a6f3b524c
Signed-off-by: DoHyun Pyun <dh79.pyun@samsung.com>
include/wearable/bluetooth.h
include/wearable/bluetooth_internal.h
include/wearable/bluetooth_type.h
include/wearable/bluetooth_type_internal.h
src/bluetooth-common.c
src/bluetooth-pbap.c
test/bt_unit_test.c
test/bt_unit_test.h

index cc0615e..22c294d 100644 (file)
@@ -4045,9 +4045,358 @@ int bt_gatt_set_connection_state_changed_cb(bt_gatt_connection_state_changed_cb
 int bt_gatt_unset_connection_state_changed_cb(void);
 
 /**
- * @}
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Initializes the Bluetooth PBAP Client.
+ * @details This initialization is necessary to call other PBAP client APIs.
+ * @since_tizen 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.
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ *
+ * @see  bt_pbap_client_deinitialize()
+ * @see  bt_pbap_client_connect()
+ * @see  bt_pbap_client_disconnect()
+ * @see  bt_pbap_client_get_phone_book_size()
+ * @see  bt_pbap_client_get_phone_book()
+ * @see  bt_pbap_client_get_list()
+ * @see  bt_pbap_client_pull_vcard()
+ * @see  bt_pbap_client_search_phone_book()
+ */
+int bt_pbap_client_initialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Deinitializes the Bluetooth PBAP Client.
+ * @details This deinitialization must be done to free resources when the PBAP client is not longer needed.
+ * @since_tizen 3.0
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_NOT_ENABLED  Not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ *     The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @see  bt_pbap_client_deinitialize()
+ * @see  bt_pbap_client_connect()
+ * @see  bt_pbap_client_disconnect()
+ * @see  bt_pbap_client_get_phone_book_size()
+ * @see  bt_pbap_client_get_phone_book()
+ * @see  bt_pbap_client_get_list()
+ * @see  bt_pbap_client_pull_vcard()
+ * @see  bt_pbap_client_search_phone_book()
+ */
+int bt_pbap_client_deinitialize(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Registers a callback function that will be invoked when the connection state is changed.
+ * @since_tizen 3.0
+ * @param[in] callback The callback function to register
+ * @param[in] user_data The user data to be passed to the callback function
+ * @return   0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @see bt_pbap_client_initialize()
  */
+int bt_pbap_client_set_connection_state_changed_cb(bt_pbap_connection_state_changed_cb callback, void *user_data);
 
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Unregisters a callback function that will be invoked when the connection state is changed.
+ * @since_tizen 3.0
+ * @return   0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @see bt_pbap_client_initialize()
+ */
+int bt_pbap_client_unset_connection_state_changed_cb(void);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Connects to PBAP server, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] address The other device's address
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre The local device must be bonded with the remote device by bt_device_create_bond().
+ * @post bt_pbap_connection_state_changed_cb() will be invoked.
+ * @see bt_pbap_client_disconnect()
+ * @see bt_pbap_client_set_connection_state_changed_cb()
+ */
+int bt_pbap_client_connect(const char *address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Disconnects from PBAP server, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] address The other device's address
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ * @post bt_pbap_connection_state_changed_cb() will be invoked.
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_set_connection_state_changed_cb()
+ */
+int bt_pbap_client_disconnect(const char *address);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Gets size of phone book from PBAP server, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] address The other device's address
+ * @param[in] source Source of the phone book (Phone/SIM)
+ * @param[in] folder_type Type of folder
+ * @param[in] callback The callback function called when PBAP phone book size is returned.
+ * @param[in] user_data Data to be passed to the PBAP phone book size callback.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ *
+ * @see 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);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Gets all contacts and call logs as vCard from PBAP server, asynchronously.
+ * @details The received phone book file will be saved in the platform downloads folder.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *                 http://tizen.org/privilege/mediastorage
+ *
+ * @param[in] address The other device's address
+ * @param[in] source Source of phone book (Phone/SIM)
+ * @param[in] folder_type Type of folder
+ * @param[in] format The vCard format
+ * @param[in] order Specifies which field shall be used to sort vCards.
+ * @param[in] offset The number of vCards to be excluded, counting from the beginning
+ * @param[in] max_list_count The maximum number of vCards to be fetched
+ * @param[in] fields vCard fields to be fetched; one or more #bt_pbap_field_e values combined with bitwise 'or'
+ * @param[in] callback The callback function called when PBAP phone book is Pulled.
+ * @param[in] user_data Data to be passed to the PBAP phone book pulling callback.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ *
+ * @see 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);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Gets contact and call log information from the PBAP server, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] address The other device's address
+ * @param[in] source Source of phone book (Phone/SIM)
+ * @param[in] folder_type Type of folder
+ * @param[in] order Specifies which field shall be used to sort vCards.
+ * @param[in] offset vCards to be excluded from beginning.
+ * @param[in] max_list_count Maximum number of vCards to be fetched
+ * @param[in] callback The callback function called when PBAP List is returned.
+ * @param[in] user_data Data to be passed to the PBAP phone book pulling callback.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ *
+ * @see bt_pbap_client_connect()
+ */
+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);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Gets the selected contact using the index parameter as vCard from PBAP server, asynchronously.
+ * @details The received phone book file will be saved in the platform downloads folder.
+ *              The @a index value should be equal to the value of the @a 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_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *                 http://tizen.org/privilege/mediastorage
+ *
+ * @param[in] address The other device's address
+ * @param[in] source Source of phone book (Phone/SIM)
+ * @param[in] folder_type Type of folder
+ * @param[in] index The handle index of vCard to be fetched
+ * @param[in] format Format of vCard
+ * @param[in] fields vCard fields to be fetched; one or more #bt_pbap_field_e values combined with bitwise 'or'
+ * @param[in] callback The callback function called when PBAP phone book is Pulled.
+ * @param[in] user_data Data to be passed to the PBAP phone book Pulling callback.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ * @pre The vCard information (#bt_pbap_vcard_info_s) must be obtained with bt_pbap_client_get_list() or bt_pbap_client_search_phone_book().
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_get_list()
+ * @see bt_pbap_client_search_phone_book()
+ */
+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);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief Finds and fetches the contact and call log information from the PBAP server, asynchronously.
+ * @since_tizen 3.0
+ * @privlevel public
+ * @privilege http://tizen.org/privilege/bluetooth
+ *
+ * @param[in] address The other device's address
+ * @param[in] source Source of phone book (Phone/SIM)
+ * @param[in] folder_type Type of folder
+ * @param[in] search_attribute field to be search
+ * @param[in] search_value pattern to be searched for
+ * @param[in] order Specifies which field shall be used to sort vCards.
+ * @param[in] offset vCards to be excluded from beginning.
+ * @param[in] max_list_count Maximum number of vCards to be fetched
+ * @param[in] callback The callback function called when PBAP List is returned.
+ * @param[in] user_data Data to be passed to the PBAP phone book pulling callback.
+ *
+ * @return 0 on success, otherwise a negative error value.
+ * @retval #BT_ERROR_NONE  Successful
+ * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
+ * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
+ * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
+ * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
+ * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
+ * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
+ *
+ * @pre The state of the local Bluetooth adapter must be #BT_ADAPTER_ENABLED.
+ * @pre The PBAP client must be initialized with bt_pbap_client_initialize().
+ * @pre PBAP connection must be created with bt_pbap_client_connect().
+ *
+ * @see bt_pbap_client_connect()
+ */
+int bt_pbap_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);
+
+/**
+ * @}
+ */
 
 #ifdef __cplusplus
 }
index f0068a3..626b6de 100644 (file)
@@ -2079,305 +2079,6 @@ int bt_hf_get_call_status_info_list(GSList **call_list);
 int bt_hf_free_call_status_info_list(GSList *call_list);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief Initializes the Bluetooth PBAP Client.
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @details Initializes the Bluetooth PBAP Client.
- *  This initialization is necessary to call other PBAP client APIs.
- *
- * @remarks This function must be called to initiatize Bluetooth PBAP client. You must free all resources of the Bluetooth service
- * by calling bt_pbap_deinit() if Bluetooth PBAP Client is no longer needed.
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *
- * @see  bt_pbap_deinit()
- * @see  bt_pbap_connect()
- * @see  bt_pbap_disconnect()
- * @see  bt_pbap_get_phonebook_size()
- * @see  bt_pbap_get_phonebook()
- * @see  bt_pbap_get_list()
- * @see  bt_pbap_pull_vcard()
- * @see  bt_pbap_phonebook_search()
- */
-int bt_pbap_init(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief De-initializes the Bluetooth PBAP Client.
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @details De-Initializes the Bluetooth PBAP Client.
- *  This deinitialization must be done to free resource when PBAP client is not longer needed.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_NOT_ENABLED  Not enabled
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- * @see  bt_pbap_deinit()
- * @see  bt_pbap_connect()
- * @see  bt_pbap_disconnect()
- * @see  bt_pbap_get_phonebook_size()
- * @see  bt_pbap_get_phonebook()
- * @see  bt_pbap_get_list()
- * @see  bt_pbap_pull_vcard()
- * @see  bt_pbap_phonebook_search()
- */
-int bt_pbap_deinit(void);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To connect to PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] Callback to be called when PBAP session is Connected.
- * @param[in] user_data Data to be passed to PBAP enabled/disabled callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_ALREADY_CONNECT PBAP client already connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- * @see bt_pbap_disconnect()
- */
-int bt_pbap_connect(const char *address, bt_pbap_enabled_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To disconnect from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] Callback to be called when PBAP session is disconnected.
- * @param[in] user_data Data to be passed to PBAP enabled/disabled callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_disconnect(const char *address, bt_pbap_enabled_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To get size of phonebook from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] source Source of Phonebook (Phone/SIM)
- * @param[in] type Type of folder
- * @param[in] Callback to be called when PBAP Phonebook Size is Returned.
- * @param[in] user_data Data to be passed to the PBAP Phonebook Size callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_get_phonebook_size(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_phonebook_size_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To get contacts/call logs as vCards from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] source Source of Phonebook (Phone/SIM)
- * @param[in] type Type of folder
- * @param[in] format Format of vCard
- * @param[in] order Specifies which field shall be used to sort vCards.
- * @param[in] offset vCards to be excluded from beginning.
- * @param[in] maxlistcount Maximum number of vCards to be fetched
- * @param[in] fields Fields of vCard to be fetched.
- * @param[in] Callback to be called when PBAP Phonebook is Pulled.
- * @param[in] user_data Data to be passed to the PBAP Phonebook Pull callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_get_phonebook(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_filter_vcard_format_e format,
-               bt_pbap_filter_sort_order_e order, unsigned short offset,
-               unsigned short maxlistcount, long long unsigned fields,
-               bt_pbap_phonebook_pull_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To get Contact or Call List from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] source Source of Phonebook (Phone/SIM)
- * @param[in] type Type of folder
- * @param[in] order Specifies which field shall be used to sort vCards.
- * @param[in] offset vCards to be excluded from beginning.
- * @param[in] maxlistcount Maximum number of vCards to be fetched
- * @param[in] Callback to be called when PBAP List is returned.
- * @param[in] user_data Data to be passed to the PBAP Phonebook Pull callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_get_list(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_filter_sort_order_e order,
-               unsigned short offset, unsigned short maxlistcount,
-               bt_pbap_list_vcards_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To get a contact/call log from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] source Source of Phonebook (Phone/SIM)
- * @param[in] type Type of folder
- * @param[in] index Handle of vCard to be fetched
- * @param[in] format Format of vCard
- * @param[in] fields Fields of vCard to be fetched.
- * @param[in] Callback to be called when PBAP Phonebook is Pulled.
- * @param[in] user_data Data to be passed to the PBAP Phonebook Pull callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_pull_vcard(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, int index,
-               bt_pbap_filter_vcard_format_e format, long long unsigned fields,
-               bt_pbap_get_vcard_cb callback, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief To get Contact or Call List from PBAP server
- * @since_tizen @if MOBILE @elseif WEARABLE 2.3.1 @endif
- * @privlevel platform
- * @privilege http://tizen.org/privilege/bluetooth.admin
- *
- * @param[in] address The other device's address
- * @param[in] source Source of Phonebook (Phone/SIM)
- * @param[in] type Type of folder
- * @param[in] search_attribute field to be search
- * @param[in] search_value pattern to be searched for
- * @param[in] order Specifies which field shall be used to sort vCards.
- * @param[in] offset vCards to be excluded from beginning.
- * @param[in] maxlistcount Maximum number of vCards to be fetched
- * @param[in] Callback to be called when PBAP List is returned.
- * @param[in] user_data Data to be passed to the PBAP Phonebook Pull callback.
- *
- * @return 0 on success, otherwise a negative error value.
- * @retval #BT_ERROR_NONE  Successful
- * @retval #BT_ERROR_NOT_INITIALIZED  Not initialized
- * @retval #BT_ERROR_INVALID_PARAMETER  Invalid parameter
- * @retval #BT_ERROR_NOT_ENABLED  Adapter is not enabled
- * @retval #BLUETOOTH_ERROR_NOT_CONNECTED PBAP Client is not connected
- * @retval #BT_ERROR_OPERATION_FAILED  Operation failed
- * @retval #BT_ERROR_PERMISSION_DENIED  Permission denied
- * @retval #BT_ERROR_NOT_SUPPORTED  Not supported
- *
- * @pre The state of local Bluetooth must be #BT_ADAPTER_ENABLED.
- *     PBAP client must be initialized with bt_pbap_init()
- *     PBAP connection must be created with bt_pbap_connect().
- *
- * @see bt_pbap_connect()
- */
-int bt_pbap_phonebook_search(const char *address,
-               bt_pbap_addressbook_source_e source, bt_pbap_folder_type_e type,
-               bt_pbap_search_field_e search_attribute, const char *search_value,
-               bt_pbap_filter_sort_order_e order,
-               unsigned short offset, unsigned short maxlistcount,
-               bt_pbap_search_list_cb callback, void *user_data);
-
-/**
  * @internal
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
  * @brief Gets the specification name from the UUID
index 4338ad1..b21c27a 100644 (file)
@@ -36,6 +36,44 @@ extern "C"
 
 
 /**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of PBAP fields.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_FIELD_ALL = (0xFFFFFFFFU), /**< All field */
+       BT_PBAP_FIELD_VERSION = (1U << 0), /**< vCard Version */
+       BT_PBAP_FIELD_FN = (1U << 1), /**< Formatted Name */
+       BT_PBAP_FIELD_N = (1U << 2), /**< Structured Presentation of Name */
+       BT_PBAP_FIELD_PHOTO = (1U << 3), /**< Associated Image or Photo */
+       BT_PBAP_FIELD_BDAY = (1U << 4), /**< Birthday */
+       BT_PBAP_FIELD_ADR = (1U << 5), /**< Delivery Address */
+       BT_PBAP_FIELD_LABEL = (1U << 6), /**< Delivery */
+       BT_PBAP_FIELD_TEL = (1U << 7), /**< Telephone Number */
+       BT_PBAP_FIELD_EMAIL = (1U << 8), /**< Electronic Mail Address */
+       BT_PBAP_FIELD_MAILER = (1U << 9), /**< Electronic Mail */
+       BT_PBAP_FIELD_TZ = (1U << 10), /**< Time Zone */
+       BT_PBAP_FIELD_GEO = (1U << 11), /**< Geographic Position */
+       BT_PBAP_FIELD_TITLE = (1U << 12), /**< Job */
+       BT_PBAP_FIELD_ROLE = (1U << 13), /**< Role within the Organization */
+       BT_PBAP_FIELD_LOGO = (1U << 14), /**< Organization Logo */
+       BT_PBAP_FIELD_AGENT = (1U << 15), /**< vCard of Person Representing */
+       BT_PBAP_FIELD_ORG = (1U << 16), /**< Name of Organization */
+       BT_PBAP_FIELD_NOTE = (1U << 17), /**< Comments */
+       BT_PBAP_FIELD_REV = (1U << 18), /**< Revision */
+       BT_PBAP_FIELD_SOUND = (1U << 19), /**< Pronunciation of Name */
+       BT_PBAP_FIELD_URL = (1U << 20), /**< Uniform Resource Locator */
+       BT_PBAP_FIELD_UID = (1U << 21), /**< Unique ID */
+       BT_PBAP_FIELD_KEY = (1U << 22), /**< Public Encryption Key */
+       BT_PBAP_FIELD_NICKNAME = (1U << 23), /**< Nickname */
+       BT_PBAP_FIELD_CATEGORIES = (1U << 24), /**< Categories */
+       BT_PBAP_FIELD_PROID = (1U << 25), /**< Product ID */
+       BT_PBAP_FIELD_CLASS = (1U << 26), /**< Class information */
+       BT_PBAP_FIELD_SORT_STRING = (1U << 27), /**< String used for sorting operations */
+       BT_PBAP_FIELD_X_IRMC_CALL_DATETIME = (1U << 28), /**< Time stamp */
+} bt_pbap_field_e;
+
+/**
  * @ingroup CAPI_NETWORK_BLUETOOTH_MODULE
  * @brief Enumerations of Bluetooth error codes.
  * @since_tizen 2.3.1
@@ -666,6 +704,61 @@ typedef enum {
 } bt_panu_service_type_e;
 
 /**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of address book location for PBAP.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_SOURCE_DEVICE = 0x00, /**< Request for Addressbook from remote device */
+       BT_PBAP_SOURCE_SIM , /**< Request for address book from SIM */
+} bt_pbap_address_book_source_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of folder type.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_FOLDER_PHONE_BOOK = 0x00, /**< Request for address book */
+       BT_PBAP_FOLDER_INCOMING , /**< Request for incoming calls */
+       BT_PBAP_FOLDER_OUTGOING , /**< Request for outgoing calls */
+       BT_PBAP_FOLDER_MISSED , /**< Request for missed calls */
+       BT_PBAP_FOLDER_COMBINED , /**< Request for combined calls */
+} bt_pbap_folder_type_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of phone book search fields.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_SEARCH_NAME = 0x00, /**< Request for search by name (default) */
+       BT_PBAP_SEARCH_NUMBER, /**< Request for search by phone number */
+       BT_PBAP_SEARCH_SOUND, /**< Request for search by sound */
+} bt_pbap_search_field_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of vCard Formats.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_VCARD_FORMAT_VCARD21 = 0x00, /**< vCard format 2.1 (default) */
+       BT_PBAP_VCARD_FORMAT_VCARD30, /**< vCard format 3.0 */
+} bt_pbap_vcard_format_e;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Enumeration of sorting orders.
+ * @since_tizen 3.0
+ */
+typedef enum {
+       BT_PBAP_ORDER_INDEXED = 0x00, /**< Filter order indexed (default) */
+       BT_PBAP_ORDER_ALPHANUMERIC, /**< Filter order alphanumeric */
+       BT_PBAP_ORDER_PHONETIC, /**< Filter order phonetic */
+} bt_pbap_sort_order_e;
+
+/**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
  * @brief The handle to control Bluetooth LE advertising
  * @since_tizen 2.3.1
@@ -1574,6 +1667,98 @@ typedef void (*bt_hid_device_connection_state_changed_cb) (int result,
 typedef void (*bt_hid_device_data_received_cb)(const bt_hid_device_received_data_s *data, void *user_data);
 /* HID device related type */
 
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief The structure type containing vCard information.
+ * @since_tizen 3.0
+ *
+ * @see bt_pbap_client_pull_vcard()
+ */
+typedef struct {
+       int index;                                      /**< The vcard index, used as a parameter for bt_pbap_client_pull_vcard() */
+       const char *contact_name;       /**< The contact name of the vCard */
+} bt_pbap_vcard_info_s;
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Called when PBAP is Connected or Disconnected.
+ * @details The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in] result The result of connecting to or disconnecting from the remote device
+ * @param[in] connected The PBAP connection status (@c true = connected, @c false = disconnected)
+ * @param[in] remote_address The remote device address (@a remote_address is valid only inside this function. To use outside the callback, make a copy. @a remote_address should not be freed.)
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_disconnect()
+ */
+typedef void (*bt_pbap_connection_state_changed_cb)(int result, bool connected,
+               const char *remote_address, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Called when PBAP Phonebook size calculation completes.
+ * @details The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in] result The result of getting the phone book size
+ * @param[in] remote_address The remote device address (@a remote_address is valid only inside this function. To use outside the callback, make a copy. @a remote_address should not be freed.)
+ * @param[in] size Size of Phonebook
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_pbap_client_get_phone_book_size()
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_disconnect()
+ */
+typedef void (*bt_pbap_phone_book_size_cb)(int result, const char *remote_address,
+               int size, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Called when PBAP Phonebook Pull completes.
+ * @details The received phone book file will be saved in the platform downloads folder. \n
+ *              The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in] result The result of getting the phone book
+ * @param[in] remote_address The remote device address (@a remote_address is valid only inside this function. To use outside the callback, make a copy. @a remote_address should not be freed.)
+ * @param[in] vcf_file The absolute path of the file in which the vCards are saved (@a vcf_file is valid only inside this function. To use outside the callback, make a copy. @a vcf_file should not be freed.)
+ * @param[in] successful true if the operation was successful, false if not
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_pbap_client_get_phone_book()
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_disconnect()
+ */
+typedef void (*bt_pbap_phone_book_received_cb)(int result, const char *remote_address,
+               const char *vcf_file, void *user_data);
+
+/**
+ * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
+ * @brief  Called when PBAP List vCards completes.
+ * @details The following error codes can be delivered: \n
+ *             #BT_ERROR_NONE \n
+ *             #BT_ERROR_OPERATION_FAILED \n
+ * @since_tizen 3.0
+ *
+ * @param[in] result The result of getting the vcard list
+ * @param[in] remote_address The remote device address (@a remote_address is valid only inside this function. To use outside the callback, make a copy. @a remote_address should not be freed.)
+ * @param[in] vcard_info List of vcard information (@a vcard_info is valid only inside this function. To use outside the callback, make a copy. @a vcard_info should not be freed.)
+ * @param[in] count Number of contacts in the list
+ * @param[in] successful true if the operation was successful, false if not
+ * @param[in] user_data The user data passed from the callback registration function
+ * @see bt_pbap_client_get_list()
+ * @see bt_pbap_client_connect()
+ * @see bt_pbap_client_disconnect()
+ */
+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);
+
 #ifdef __cplusplus
 }
 #endif /* __cplusplus */
index d6232df..9acb808 100644 (file)
@@ -30,42 +30,6 @@ extern "C"
  */
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  definitions for PBAP fields.
- * @since_tizen 2.3
- */
-#define BT_PBAP_FIELD_ALL              (0xFFFFFFFFFFFFFFFFULL)
-#define BT_PBAP_FIELD_VERSION  (1ULL << 0)
-#define BT_PBAP_FIELD_FN               (1ULL << 1)
-#define BT_PBAP_FIELD_N                        (1ULL << 2)
-#define BT_PBAP_FIELD_PHOTO            (1ULL << 3)
-#define BT_PBAP_FIELD_BDAY             (1ULL << 4)
-#define BT_PBAP_FIELD_ADR              (1ULL << 5)
-#define BT_PBAP_FIELD_LABEL            (1ULL << 6)
-#define BT_PBAP_FIELD_TEL              (1ULL << 7)
-#define BT_PBAP_FIELD_EMAIL            (1ULL << 8)
-#define BT_PBAP_FIELD_MAILER   (1ULL << 9)
-#define BT_PBAP_FIELD_TZ               (1ULL << 10)
-#define BT_PBAP_FIELD_GEO              (1ULL << 11)
-#define BT_PBAP_FIELD_TITLE            (1ULL << 12)
-#define BT_PBAP_FIELD_ROLE             (1ULL << 13)
-#define BT_PBAP_FIELD_LOGO             (1ULL << 14)
-#define BT_PBAP_FIELD_AGENT            (1ULL << 15)
-#define BT_PBAP_FIELD_ORG              (1ULL << 16)
-#define BT_PBAP_FIELD_NOTE             (1ULL << 17)
-#define BT_PBAP_FIELD_REV              (1ULL << 18)
-#define BT_PBAP_FIELD_SOUND            (1ULL << 19)
-#define BT_PBAP_FIELD_URL              (1ULL << 20)
-#define BT_PBAP_FIELD_UID              (1ULL << 21)
-#define BT_PBAP_FIELD_KEY              (1ULL << 22)
-#define BT_PBAP_FIELD_NICKNAME (1ULL << 23)
-#define BT_PBAP_FIELD_CATEGORIES       (1ULL << 24)
-#define BT_PBAP_FIELD_PROID            (1ULL << 25)
-#define BT_PBAP_FIELD_CLASS            (1ULL << 26)
-#define BT_PBAP_FIELD_SORT_STRING      (1ULL << 27)
-#define BT_PBAP_FIELD_X_IRMC_CALL_DATETIME             (1ULL << 28)
-
-/**
  * @ingroup CAPI_NETWORK_BLUETOOTH_ADAPTER_LE_MODULE
  * @brief  Enumerations of the Bluetooth adapter le state.
  * @since_tizen 2.3.1
@@ -232,61 +196,6 @@ typedef enum {
 } bt_hf_call_event_e;
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Enumerations of Addressbook memory for PBAP.
- * @since_tizen 2.3
- */
-typedef enum {
-       BT_PBAP_PHONE = 0x00, /**< Request for Addressbook from Phone*/
-       BT_PBAP_SIM , /**< Request for Addressbook from SIM*/
-} bt_pbap_addressbook_source_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Enumerations of Folder type.
- * @since_tizen 2.3
- */
-typedef enum {
-       BT_PBAP_PHONEBOOK = 0x00, /**< Request for Addressbook*/
-       BT_PBAP_INCOMING , /**< Request for Incoming Calls*/
-       BT_PBAP_OUTGOING , /**< Request for Outgoing Calls*/
-       BT_PBAP_MISSED , /**< Request for Missed Calls*/
-       BT_PBAP_COMBINED , /**< Request for Combined Calls*/
-} bt_pbap_folder_type_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Enumerations of Phonebook Search field.
- * @since_tizen 2.3
- */
-typedef enum {
-       BT_PBAP_SEARCH_NAME = 0x00, /**< Request for Search by name (default)*/
-       BT_PBAP_SEARCH_NUMBER, /**< Request for Search by phone number*/
-       BT_PBAP_SEARCH_SOUND, /**< Request for Search by sound*/
-} bt_pbap_search_field_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Enumerations of vCard Formats.
- * @since_tizen 2.3
- */
-typedef enum {
-       BT_PBAP_APP_PARAM_VCARD21 = 0x00, /**< vCard Format 2.1 (default)*/
-       BT_PBAP_APP_PARAM_VCARD30, /**< vCard Format 3.0*/
-} bt_pbap_filter_vcard_format_e;
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Enumerations of Sorting Orders.
- * @since_tizen 2.3
- */
-typedef enum {
-       BT_PBAP_APP_PARAM_ORDER_INDEXED = 0x00, /**< Filter Order Indexed (default)*/
-       BT_PBAP_APP_PARAM_ORDER_ALPHANUMERIC, /**< Filter Order Alphanumeric*/
-       BT_PBAP_APP_PARAM_ORDER_PHONETIC, /**< Filter Order Phonetic*/
-} bt_pbap_filter_sort_order_e;
-
-/**
  * @ingroup CAPI_NETWORK_BLUETOOTH_AUDIO_HF_MODULE
  * @brief  HF Call status information.
  * @since_tizen 2.3
@@ -387,101 +296,6 @@ typedef void (*bt_hf_speaker_gain_changed_cb) (int gain, void *user_data);
 typedef void (*bt_hf_call_status_updated_event_cb) (GSList *call_info_list, void *user_data);
 
 /**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP is Connected or Disconnected.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] pbap_enabled PBAP connection status (@c 1 = enabled, @c 0 = disabled)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_enabled_cb)(const char *remote_address,
-               int pbap_enabled, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP Phonebook Size is returned.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] size Size of Phonebook
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_get_phonebook_size()
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_phonebook_size_cb)(const char *remote_address,
-               int size, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP Phonebook Pull returns all contacts.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] vcf_file File in which vCards are saved
- * @param[in] status Status for successful Transfer (@c 0 = Unsuccessful, @c 1 = Successful)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_get_phonebook()
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_phonebook_pull_cb)(const char *remote_address,
-               char *vcf_file, int status, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP List vCards returns the handles and Names.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] vcards List of vCards
- * @param[in] count Number of contacts in the list
- * @param[in] status Status for successful Transfer (@c 0 = Unsuccessful, @c 1 = Successful)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_get_phonebook()
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_list_vcards_cb)(const char *remote_address,
-               char **vcards, int count, int status, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP Get vCard returns the contact.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] vcard Contact as vCard
- * @param[in] status Status for successful Transfer (@c 0 = Unsuccessful, @c 1 = Successful)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_get_phonebook()
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_get_vcard_cb)(const char *remote_address,
-               char *vcard, int status, void *user_data);
-
-/**
- * @ingroup CAPI_NETWORK_BLUETOOTH_PBAP_MODULE
- * @brief  Called when PBAP Phonebook Search returns the handles and Names.
- * @since_tizen 2.3
- *
- * @param[in] remote_address Remote Device address
- * @param[in] vcards List of vCards
- * @param[in] count Number of contacts in the list
- * @param[in] status Status for successful Transfer (@c 0 = Unsuccessful, @c 1 = Successful)
- * @param[in] user_data The user data passed from the callback registration function
- * @see bt_pbap_get_phonebook()
- * @see bt_pbap_connect()
- * @see bt_pbap_disconnect()
- */
-typedef void (*bt_pbap_search_list_cb)(const char *remote_address,
-               char **vcards, int count, int status, void *user_data);
-
-/**
  * @ingroup CAPI_NETWORK_BLUETOOTH_GATT_MODULE
  * @brief  Enumerations of the attribute's permission
  * @since_tizen 2.4
index 12ff325..e6714d4 100644 (file)
@@ -1847,15 +1847,29 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                break;
 #ifdef TIZEN_WEARABLE
        case BLUETOOTH_PBAP_CONNECTED: {
-               bt_pbap_enabled_cb cb = bt_event_slot_container[event_index].callback;
+               bt_pbap_connection_state_changed_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_connected_t *connected = (bt_pbap_connected_t *)param->param_data;
 
-               BT_INFO("BLUETOOTH_PBAP_CONNECTED/DISCONNECTED");
-               if (connected->connected == 0)
-                       _bt_unset_cb(BT_EVENT_PBAP_CONNECTION_STATUS);
+               BT_INFO("BLUETOOTH_PBAP_CONNECTED");
+
                _bt_convert_address_to_string(&device_addr, &connected->btaddr);
-               cb(device_addr, connected->connected, user_data);
+               cb(_bt_get_error_code(param->result), true, device_addr, user_data);
+
+               if (device_addr != NULL)
+                       free(device_addr);
+
+               break;
+       }
+       case BLUETOOTH_PBAP_DISCONNECTED: {
+               bt_pbap_connection_state_changed_cb cb = bt_event_slot_container[event_index].callback;
+               void *user_data = bt_event_slot_container[event_index].user_data;
+               bt_pbap_connected_t *connected = (bt_pbap_connected_t *)param->param_data;
+
+               BT_INFO("BLUETOOTH_PBAP_DISCONNECTED");
+
+               _bt_convert_address_to_string(&device_addr, &connected->btaddr);
+               cb(_bt_get_error_code(param->result), false, device_addr, user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
@@ -1863,7 +1877,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                break;
        }
        case BLUETOOTH_PBAP_PHONEBOOK_SIZE: {
-               bt_pbap_phonebook_size_cb cb = bt_event_slot_container[event_index].callback;
+               bt_pbap_phone_book_size_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_phonebook_size_t *pb_size = (bt_pbap_phonebook_size_t *)param->param_data;
 
@@ -1871,7 +1885,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
 
                _bt_unset_cb(BT_EVENT_PBAP_PHONEBOOK_SIZE);
                _bt_convert_address_to_string(&device_addr, &pb_size->btaddr);
-               cb(device_addr, pb_size->size, user_data);
+               cb(_bt_get_error_code(param->result), device_addr, pb_size->size, user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
@@ -1879,7 +1893,7 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                break;
        }
        case BLUETOOTH_PBAP_PHONEBOOK_PULL: {
-               bt_pbap_phonebook_pull_cb cb = bt_event_slot_container[event_index].callback;
+               bt_pbap_phone_book_received_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_phonebook_pull_t *pb_pull = (bt_pbap_phonebook_pull_t *)(param->param_data);
 
@@ -1887,7 +1901,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
 
                _bt_unset_cb(BT_EVENT_PBAP_PHONEBOOK_PULL);
                _bt_convert_address_to_string(&device_addr, &pb_pull->btaddr);
-               cb(device_addr, pb_pull->vcf_file, pb_pull->success, user_data);
+               cb(_bt_get_error_code(param->result), device_addr,
+                       (const char *)pb_pull->vcf_file, user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
@@ -1898,20 +1913,29 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                bt_pbap_list_vcards_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_vcard_list_t *vc_list = (bt_pbap_vcard_list_t *)(param->param_data);
+               bt_pbap_vcard_info_s *vcard_info = NULL;
+
+               if (vc_list->length > 0)
+                       vcard_info = g_malloc0(vc_list->length * sizeof(bt_pbap_vcard_info_s));
 
                BT_INFO("BLUETOOTH_PBAP_VCARD_LIST");
 
                _bt_unset_cb(BT_EVENT_PBAP_VCARD_LIST);
                _bt_convert_address_to_string(&device_addr, &vc_list->btaddr);
-               cb(device_addr, vc_list->vcards, vc_list->length, vc_list->success, user_data);
+               cb(_bt_get_error_code(param->result), device_addr,
+                       (const bt_pbap_vcard_info_s *)vcard_info, vc_list->length,
+                       user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
 
+               if (vcard_info != NULL)
+                       free(vcard_info);
+
                break;
        }
        case BLUETOOTH_PBAP_VCARD_PULL: {
-               bt_pbap_get_vcard_cb cb = bt_event_slot_container[event_index].callback;
+               bt_pbap_phone_book_received_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_vcard_pull_t *vc_pull = (bt_pbap_vcard_pull_t *)(param->param_data);
 
@@ -1919,7 +1943,8 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
 
                _bt_unset_cb(BT_EVENT_PBAP_VCARD_PULL);
                _bt_convert_address_to_string(&device_addr, &vc_pull->btaddr);
-               cb(device_addr, vc_pull->vcf_file, vc_pull->success, user_data);
+               cb(_bt_get_error_code(param->result), device_addr,
+                       (const char *)vc_pull->vcf_file, user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
@@ -1927,19 +1952,28 @@ static void __bt_event_proxy(int event, bluetooth_event_param_t *param, void *us
                break;
        }
        case BLUETOOTH_PBAP_PHONEBOOK_SEARCH: {
-               bt_pbap_search_list_cb cb = bt_event_slot_container[event_index].callback;
+               bt_pbap_list_vcards_cb cb = bt_event_slot_container[event_index].callback;
                void *user_data = bt_event_slot_container[event_index].user_data;
                bt_pbap_phonebook_search_list_t *vc_list = (bt_pbap_phonebook_search_list_t *)(param->param_data);
+               bt_pbap_vcard_info_s *vcard_info = NULL;
+
+               if (vc_list->length > 0)
+                       vcard_info = g_malloc0(vc_list->length * sizeof(bt_pbap_vcard_info_s));
 
                BT_INFO("BLUETOOTH_PBAP_PHONEBOOK_SEARCH");
 
                _bt_unset_cb(BT_EVENT_PBAP_PHONEBOOK_SEARCH);
                _bt_convert_address_to_string(&device_addr, &vc_list->btaddr);
-               cb(device_addr, vc_list->vcards, vc_list->length, vc_list->success, user_data);
+               cb(_bt_get_error_code(param->result), device_addr,
+                       (const bt_pbap_vcard_info_s *)vcard_info, vc_list->length,
+                       user_data);
 
                if (device_addr != NULL)
                        free(device_addr);
 
+               if (vcard_info != NULL)
+                       free(vcard_info);
+
                break;
        }
        case BLUETOOTH_EVENT_HF_CONNECTED:
@@ -2549,6 +2583,7 @@ static int __bt_get_cb_index(int event)
                return BT_EVENT_LE_DATA_LENGTH_CHANGED; /* LCOV_EXCL_LINE */
 #ifdef TIZEN_WEARABLE
        case BLUETOOTH_PBAP_CONNECTED:
+       case BLUETOOTH_PBAP_DISCONNECTED:
                return BT_EVENT_PBAP_CONNECTION_STATUS;
        case BLUETOOTH_PBAP_PHONEBOOK_SIZE:
                return BT_EVENT_PBAP_PHONEBOOK_SIZE;
index 9072d8d..a34b839 100644 (file)
@@ -36,7 +36,7 @@
 #define BT_CHECK_PBAP_SUPPORT()
 #endif
 
-int bt_pbap_init(void)
+int bt_pbap_client_initialize(void)
 {
        BT_CHECK_PBAP_SUPPORT();
        BT_CHECK_INIT_STATUS();
@@ -48,7 +48,7 @@ int bt_pbap_init(void)
        return error_code;
 }
 
-int bt_pbap_deinit(void)
+int bt_pbap_client_deinitialize(void)
 {
        BT_CHECK_PBAP_SUPPORT();
        BT_CHECK_INIT_STATUS();
@@ -60,7 +60,25 @@ int bt_pbap_deinit(void)
        return error_code;
 }
 
-int bt_pbap_connect(const char *address, bt_pbap_enabled_cb callback, void *user_data)
+int bt_pbap_client_set_connection_state_changed_cb(bt_pbap_connection_state_changed_cb callback, void *user_data)
+{
+       BT_CHECK_PBAP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       BT_CHECK_INPUT_PARAMETER(callback);
+       _bt_set_cb(BT_EVENT_PBAP_CONNECTION_STATUS, callback, user_data);
+       return BT_ERROR_NONE;
+
+}
+int bt_pbap_client_unset_connection_state_changed_cb(void)
+{
+       BT_CHECK_PBAP_SUPPORT();
+       BT_CHECK_INIT_STATUS();
+       if (_bt_check_cb(BT_EVENT_PBAP_CONNECTION_STATUS) == true)
+               _bt_unset_cb(BT_EVENT_PBAP_CONNECTION_STATUS);
+       return BT_ERROR_NONE;
+}
+
+int bt_pbap_client_connect(const char *address)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        int error_code = BT_ERROR_NONE;
@@ -68,21 +86,18 @@ int bt_pbap_connect(const char *address, bt_pbap_enabled_cb callback, void *user
        BT_CHECK_PBAP_SUPPORT();
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(address);
-       BT_CHECK_INPUT_PARAMETER(callback);
 
        _bt_convert_address_to_hex(&addr_hex, address);
-       _bt_set_cb(BT_EVENT_PBAP_CONNECTION_STATUS, callback, user_data);
 
        error_code = _bt_get_error_code(bluetooth_pbap_connect(&addr_hex));
        if (error_code != BT_ERROR_NONE) {
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-               _bt_unset_cb(BT_EVENT_PBAP_CONNECTION_STATUS);
        }
 
        return error_code;
 }
 
-int bt_pbap_disconnect(const char *address, bt_pbap_enabled_cb callback, void *user_data)
+int bt_pbap_client_disconnect(const char *address)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        int error_code = BT_ERROR_NONE;
@@ -90,22 +105,19 @@ int bt_pbap_disconnect(const char *address, bt_pbap_enabled_cb callback, void *u
        BT_CHECK_PBAP_SUPPORT();
        BT_CHECK_INIT_STATUS();
        BT_CHECK_INPUT_PARAMETER(address);
-       BT_CHECK_INPUT_PARAMETER(callback);
 
        _bt_convert_address_to_hex(&addr_hex, address);
-       _bt_set_cb(BT_EVENT_PBAP_CONNECTION_STATUS, callback, user_data);
 
        error_code = _bt_get_error_code(bluetooth_pbap_disconnect(&addr_hex));
        if (error_code != BT_ERROR_NONE) {
                BT_ERR("%s(0x%08x)", _bt_convert_error_to_string(error_code), error_code);
-               _bt_unset_cb(BT_EVENT_PBAP_CONNECTION_STATUS);
        }
 
        return error_code;
 }
 
-int bt_pbap_get_phonebook_size(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_phonebook_size_cb callback, void *user_data)
+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)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        bt_pbap_folder_t folder = { 0, };
@@ -117,7 +129,7 @@ int bt_pbap_get_phonebook_size(const char *address, bt_pbap_addressbook_source_e
        BT_CHECK_INPUT_PARAMETER(callback);
 
        folder.addressbook = source;
-       folder.folder_type = type;
+       folder.folder_type = folder_type;
        _bt_convert_address_to_hex(&addr_hex, address);
        _bt_set_cb(BT_EVENT_PBAP_PHONEBOOK_SIZE, callback, user_data);
        error_code = _bt_get_error_code(bluetooth_pbap_get_phonebook_size(&addr_hex, &folder));
@@ -129,11 +141,11 @@ int bt_pbap_get_phonebook_size(const char *address, bt_pbap_addressbook_source_e
        return error_code;
 }
 
-int bt_pbap_get_phonebook(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_filter_vcard_format_e format,
-               bt_pbap_filter_sort_order_e order, unsigned short offset,
-               unsigned short maxlistcount, long long unsigned fields,
-               bt_pbap_phonebook_pull_cb callback, void *user_data)
+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)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        bt_pbap_pull_parameters_t app_param = { 0, };
@@ -146,22 +158,22 @@ int bt_pbap_get_phonebook(const char *address, bt_pbap_addressbook_source_e sour
        BT_CHECK_INPUT_PARAMETER(callback);
 
        /* To get size of phonebook, a separate API is provided
-        * Hence, passing maxlistcount as 0 is restricted. */
-       if (maxlistcount <= 0)
+        * Hence, passing max_list_count as 0 is restricted. */
+       if (max_list_count <= 0)
                return BT_ERROR_INVALID_PARAMETER;
 
        /* Maximum value of maxlistcount is 65535 */
-       if (maxlistcount > 65535)
-               maxlistcount = 65535;
+       if (max_list_count > 65535)
+               max_list_count = 65535;
 
        app_param.format = format;
        app_param.order = order;
        app_param.offset = offset;
-       app_param.maxlist = maxlistcount;
+       app_param.maxlist = max_list_count;
        app_param.fields = fields;
 
        folder.addressbook = source;
-       folder.folder_type = type;
+       folder.folder_type = folder_type;
 
        _bt_convert_address_to_hex(&addr_hex, address);
        _bt_set_cb(BT_EVENT_PBAP_PHONEBOOK_PULL, callback, user_data);
@@ -174,9 +186,9 @@ int bt_pbap_get_phonebook(const char *address, bt_pbap_addressbook_source_e sour
        return error_code;
 }
 
-int bt_pbap_get_list(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, bt_pbap_filter_sort_order_e order,
-               unsigned short offset, unsigned short maxlistcount,
+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)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
@@ -192,10 +204,10 @@ int bt_pbap_get_list(const char *address, bt_pbap_addressbook_source_e source,
        _bt_convert_address_to_hex(&addr_hex, address);
        app_param.order = order;
        app_param.offset = offset;
-       app_param.maxlist = maxlistcount;
+       app_param.maxlist = max_list_count;
 
        folder.addressbook = source;
-       folder.folder_type = type;
+       folder.folder_type = folder_type;
 
        _bt_set_cb(BT_EVENT_PBAP_VCARD_LIST, callback, user_data);
        error_code = _bt_get_error_code(bluetooth_pbap_get_list(&addr_hex, &folder, &app_param));
@@ -207,10 +219,10 @@ int bt_pbap_get_list(const char *address, bt_pbap_addressbook_source_e source,
        return error_code;
 }
 
-int bt_pbap_pull_vcard(const char *address, bt_pbap_addressbook_source_e source,
-               bt_pbap_folder_type_e type, int index,
-               bt_pbap_filter_vcard_format_e format, long long unsigned fields,
-               bt_pbap_get_vcard_cb callback, void *user_data)
+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)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        bt_pbap_pull_vcard_parameters_t app_param = { 0, };
@@ -229,7 +241,7 @@ int bt_pbap_pull_vcard(const char *address, bt_pbap_addressbook_source_e source,
        app_param.index = index;
 
        folder.addressbook = source;
-       folder.folder_type = type;
+       folder.folder_type = folder_type;
 
        _bt_set_cb(BT_EVENT_PBAP_VCARD_PULL, callback, user_data);
        error_code = _bt_get_error_code(bluetooth_pbap_pull_vcard(&addr_hex, &folder, &app_param));
@@ -241,12 +253,12 @@ int bt_pbap_pull_vcard(const char *address, bt_pbap_addressbook_source_e source,
        return error_code;
 }
 
-int bt_pbap_phonebook_search(const char *address,
-               bt_pbap_addressbook_source_e source, bt_pbap_folder_type_e type,
+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_filter_sort_order_e order,
-               unsigned short offset, unsigned short maxlistcount,
-               bt_pbap_search_list_cb callback, void *user_data)
+               bt_pbap_sort_order_e order,
+               unsigned short offset, unsigned short max_list_count,
+               bt_pbap_list_vcards_cb callback, void *user_data)
 {
        bluetooth_device_address_t addr_hex = { {0,} };
        bt_pbap_folder_t folder = { 0, };
@@ -260,11 +272,11 @@ int bt_pbap_phonebook_search(const char *address,
 
        _bt_convert_address_to_hex(&addr_hex, address);
        folder.addressbook = source;
-       folder.folder_type = type;
+       folder.folder_type = folder_type;
 
        app_param.order = order;
        app_param.offset = offset;
-       app_param.maxlist = maxlistcount;
+       app_param.maxlist = max_list_count;
        app_param.search_attribute = search_attribute;
        strncpy(app_param.search_value, search_value,
                        BLUETOOTH_PBAP_MAX_SEARCH_VALUE_LENGTH - 1);
index 70a63fc..1b5be64 100644 (file)
@@ -961,25 +961,29 @@ tc_table_t tc_pbap_client[] = {
        /* PBAP Functions*/
        {"BACK"
                , BT_UNIT_TEST_FUNCTION_BACK},
-       {"bt_pbap_init()"
+       {"bt_pbap_client_initialize()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_INITIALIZE},
-       {"bt_pbap_deinit()"
+       {"bt_pbap_client_deinitialize()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DEINITIALIZE},
-       {"bt_pbap_connect()"
+       {"bt_pbap_client_set_connection_state_changed_cb()"
+               , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_SET_CONNECTION_STATE_CHANGED_CB},
+       {"bt_pbap_client_unset_connection_state_changed_cb()"
+               , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_UNSET_CONNECTION_STATE_CHANGED_CB},
+       {"bt_pbap_client_connect()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_CONNECT},
-       {"bt_pbap_disconnect()"
+       {"bt_pbap_client_disconnect()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DISCONNECT},
-       {"bt_pbap_get_phonebook_size()"
+       {"bt_pbap_client_get_phone_book_size()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_GETSIZE},
-       {"bt_pbap_get_phonebook()"
+       {"bt_pbap_client_get_phone_book()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_PHONEBOOKPULL},
-       {"bt_pbap_get_list()"
+       {"bt_pbap_client_get_list()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDLIST},
-       {"bt_pbap_pull_vcard()"
+       {"bt_pbap_client_pull_vcard()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDPULL},
-       {"bt_pbap_phonebook_search()"
+       {"bt_pbap_client_search_phone_book()"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_PHONEBOOKSEARCH},
-       {"bt_pbap_get_list() Maxlist=0"
+       {"bt_pbap_client_get_list() Maxlist=0"
                , BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDLIST_MAXLIST_ZERO},
        {"Select this menu to set parameters and then select the function again."
                , BT_UNIT_TEST_FUNCTION_ACTIVATE_FLAG_TO_SET_PARAMETERS},
@@ -2722,40 +2726,49 @@ void __bt_hf_speaker_gain_changed_cb(int gain,
        TC_PRT("Gain= %d", gain);
 }
 
-void __bt_pbap_enabled_cb(const char *remote_address,
-       int pbap_enabled, void *user_data)
+void __bt_pbap_connection_state_changed_cb(int result, bool connected, const char *remote_address, void *user_data)
 {
-       TC_PRT("__bt_pbap_enabled_cb");
+       TC_PRT("__bt_pbap_connection_state_changed_cb");
+       TC_PRT("Result: %d", result);
        TC_PRT("Remote Device: %s", remote_address);
-       TC_PRT("Connected Status: %d", pbap_enabled);
+       TC_PRT("Connected Status: %d", connected);
 }
 
-void __bt_pbap_phonebook_size_cb(const char *remote_address,
+void __bt_pbap_phonebook_size_cb(int result, const char *remote_address,
        int size, void *user_data)
 {
        TC_PRT("__bt_pbap_phonebook_size_cb");
+       TC_PRT("Result: %d", result);
        TC_PRT("Remote Device: %s", remote_address);
        TC_PRT("Phonebook Size: %d", size);
 }
 
-void __bt_pbap_phonebook_pull_cb(const char *remote_address,
-       char *vcf_file, int status, void *user_data)
+void __bt_pbap_phonebook_pull_cb(int result, const char *remote_address,
+       const char *vcf_file, void *user_data)
 {
        TC_PRT("__bt_pbap_phonebook_pull_cb");
+       TC_PRT("Result: %d", result);
        TC_PRT("Remote Device: %s", remote_address);
        TC_PRT("Phonebook Download File: %s", vcf_file);
        TC_PRT("Phonebook Download Status: %s",
-               status ? "Successful" : "Unsuccessful");
+               (result == BT_ERROR_NONE) ? "Successful" : "Unsuccessful");
 }
 
-void __bt_pbap_vcard_list_cb(const char *remote_address,
-       char **vcards, int count, int status, void *user_data)
+void __bt_pbap_vcard_list_cb(int result, const char *remote_address,
+       const bt_pbap_vcard_info_s *vcard_info, int count, void *user_data)
 {
+       int i;
+
        TC_PRT("__bt_pbap_vcard_list_cb");
+       TC_PRT("Result: %d", result);
        TC_PRT("Remote Device: %s", remote_address);
-       TC_PRT("vCard List: %s", vcards[0]);
        TC_PRT("vCard Count: %d", count);
-       TC_PRT("Listing Status: %s", status ? "Successful" : "Unsuccessful");
+
+       for (i = 0; i <count; i++)
+               TC_PRT("vCard[%d]: %s", vcard_info[i].index, vcard_info[i].contact_name);
+
+       TC_PRT("Listing Status: %s",
+               (result == BT_ERROR_NONE) ? "Successful" : "Unsuccessful");
 }
 #endif
 
@@ -2832,6 +2845,11 @@ static void __bt_initialize_all(void)
                __bt_adapter_le_device_discovery_state_changed_cb, NULL);
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
+#else
+       ret = bt_pbap_client_set_connection_state_changed_cb(__bt_pbap_connection_state_changed_cb,
+                       NULL);
+       if (ret != BT_ERROR_NONE)
+               TC_PRT("returns %s\n", __bt_get_error_message(ret));
 #endif
        ret = bt_socket_set_connection_state_changed_cb(
                __bt_socket_connection_state_changed_cb, NULL);
@@ -2842,6 +2860,7 @@ static void __bt_initialize_all(void)
                        __bt_adapter_le_state_changed_cb, NULL);
        if (ret != BT_ERROR_NONE)
                TC_PRT("returns %s\n", __bt_get_error_message(ret));
+
        return;
 }
 
@@ -8220,27 +8239,36 @@ int test_input_callback(void *data)
 
                /*PBAP Test Cases */
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_INITIALIZE:
-                       ret = bt_pbap_init();
+                       ret = bt_pbap_client_initialize();
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DEINITIALIZE:
-                       ret = bt_pbap_deinit();
+                       ret = bt_pbap_client_deinitialize();
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
+               case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_SET_CONNECTION_STATE_CHANGED_CB: {
+                       ret = bt_pbap_client_set_connection_state_changed_cb(__bt_pbap_connection_state_changed_cb,
+                                       NULL);
+                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
+                       break;
+               }
+               case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_UNSET_CONNECTION_STATE_CHANGED_CB: {
+                       ret = bt_pbap_client_unset_connection_state_changed_cb();
+                       TC_PRT("returns %s\n", __bt_get_error_message(ret));
+                       break;
+               }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_CONNECT: {
-                       ret = bt_pbap_connect(remote_addr,
-                                       __bt_pbap_enabled_cb, NULL);
+                       ret = bt_pbap_client_connect(remote_addr);
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DISCONNECT: {
-                       ret = bt_pbap_disconnect(remote_addr,
-                                       __bt_pbap_enabled_cb, NULL);
+                       ret = bt_pbap_client_disconnect(remote_addr);
                        TC_PRT("returns %s\n", __bt_get_error_message(ret));
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_GETSIZE: {
-                       ret = bt_pbap_get_phonebook_size(remote_addr,
+                       ret = bt_pbap_client_get_phone_book_size(remote_addr,
                                        0, 0,
                                        __bt_pbap_phonebook_size_cb,
                                        NULL);
@@ -8248,8 +8276,9 @@ int test_input_callback(void *data)
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_PHONEBOOKPULL: {
-                       long long unsigned fields = BT_PBAP_FIELD_PHOTO | BT_PBAP_FIELD_EMAIL | BT_PBAP_FIELD_ORG;
-                       ret = bt_pbap_get_phonebook(remote_addr,
+                       unsigned int fields = BT_PBAP_FIELD_PHOTO | BT_PBAP_FIELD_EMAIL | BT_PBAP_FIELD_ORG | BT_PBAP_FIELD_X_IRMC_CALL_DATETIME;
+
+                       ret = bt_pbap_client_get_phone_book(remote_addr,
                                        0, 0, 0, 0, 0, 100,
                                        fields, __bt_pbap_phonebook_pull_cb,
                                        NULL);
@@ -8257,7 +8286,7 @@ int test_input_callback(void *data)
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDLIST: {
-                       ret = bt_pbap_get_list(remote_addr,
+                       ret = bt_pbap_client_get_list(remote_addr,
                                        0, 0, 0, 0, 100,
                                        __bt_pbap_vcard_list_cb,
                                        NULL);
@@ -8266,7 +8295,7 @@ int test_input_callback(void *data)
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDPULL: {
                        long long unsigned fields = BT_PBAP_FIELD_PHOTO | BT_PBAP_FIELD_EMAIL | BT_PBAP_FIELD_ORG;
-                       ret = bt_pbap_pull_vcard(remote_addr,
+                       ret = bt_pbap_client_pull_vcard(remote_addr,
                                        0, 0, 0, 0, fields,
                                        __bt_pbap_phonebook_pull_cb,
                                        NULL);
@@ -8274,9 +8303,9 @@ int test_input_callback(void *data)
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_PHONEBOOKSEARCH: {
-                       ret = bt_pbap_phonebook_search(remote_addr,
+                       ret = bt_pbap_client_search_phone_book(remote_addr,
                                        0, 0,
-                                       0, "abc",
+                                       0, "ff",
                                        0, 0, 100,
                                        __bt_pbap_vcard_list_cb,
                                        NULL);
@@ -8284,7 +8313,7 @@ int test_input_callback(void *data)
                        break;
                }
                case BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_VCARDLIST_MAXLIST_ZERO: {
-                       ret = bt_pbap_get_list(remote_addr,
+                       ret = bt_pbap_client_get_list(remote_addr,
                                        0, 0, 0, 0, 0,
                                        __bt_pbap_vcard_list_cb,
                                        NULL);
index 123eb3d..60fd18b 100644 (file)
@@ -403,6 +403,8 @@ typedef enum {
        BT_UNIT_TEST_FUNCTION_HF_UNSET_VENDOR_CMD_EVENT_CB,
        BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_INITIALIZE = 1,
        BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DEINITIALIZE,
+       BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_SET_CONNECTION_STATE_CHANGED_CB,
+       BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_UNSET_CONNECTION_STATE_CHANGED_CB,
        BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_CONNECT,
        BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_DISCONNECT,
        BT_UNIT_TEST_FUNCTION_PBAP_CLIENT_GETSIZE,