Tizen Native API
7.0
|
Bluetooth OPP(Object Push Profile) Client API provides functions for pushing objects such as pictures.
Required Header
#include <bluetooth.h>
Overview
This is OPP Client APIs.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.bluetooth.opp
It is recommended to design feature related codes in your application for reliability.
You can check if a device supports the related features for this API by using System Information,thereby controlling the procedure of your application.
To ensure your application is only running on the device with specific features, please define the features in your manifest file using the manifest editor in the SDK.
More details on featuring your application can be found from Feature Element.
Functions | |
int | bt_opp_client_initialize (void) |
Initializes the Bluetooth OPP client. | |
int | bt_opp_client_deinitialize (void) |
Deinitializes the Bluetooth OPP client. | |
int | bt_opp_client_add_file (const char *file) |
Adds file to be pushed. | |
int | bt_opp_client_clear_files (void) |
Adds file to be pushed. | |
int | bt_opp_client_push_files (const char *remote_address, bt_opp_client_push_responded_cb responded_cb, bt_opp_client_push_progress_cb progress_cb, bt_opp_client_push_finished_cb finished_cb, void *user_data) |
Pushes the file to the remote device, asynchronously. | |
int | bt_opp_client_cancel_push (void) |
Cancels the push request in progress, asynchronously. | |
Typedefs | |
typedef void(* | bt_opp_client_push_responded_cb )(int result, const char *remote_address, void *user_data) |
Called when OPP server responds to the push request. | |
typedef void(* | bt_opp_client_push_progress_cb )(const char *file, long long size, int percent, void *user_data) |
Called when each file is being transferred. | |
typedef void(* | bt_opp_client_push_finished_cb )(int result, const char *remote_address, void *user_data) |
Called when the push request is finished. |
Typedef Documentation
typedef void(* bt_opp_client_push_finished_cb)(int result, const char *remote_address, void *user_data) |
Called when the push request is finished.
- Since :
- 2.3.1
- Parameters:
-
[in] result The result of the push request [in] remote_address The remote address [in] user_data The user data passed from the callback registration function
- See also:
- bt_opp_client_push_files()
typedef void(* bt_opp_client_push_progress_cb)(const char *file, long long size, int percent, void *user_data) |
Called when each file is being transferred.
- Since :
- 2.3.1
- Parameters:
-
[in] file The path of file to be pushed [in] size The file size (bytes) [in] percent The progress in percentage (1 ~ 100). 100 means that a file is transferred completely. [in] user_data The user data passed from the callback registration function
- Precondition:
- bt_opp_client_push_files() will invoke this function.
- See also:
- bt_opp_client_push_files()
typedef void(* bt_opp_client_push_responded_cb)(int result, const char *remote_address, void *user_data) |
Called when OPP server responds to the push request.
- Since :
- 2.3.1
- Parameters:
-
[in] result The result of OPP server response [in] remote_address The remote address [in] user_data The user data passed from the callback registration function
- Precondition:
- bt_opp_client_push_files() will invoke this function.
- See also:
- bt_opp_client_push_files()
Function Documentation
int bt_opp_client_add_file | ( | const char * | file | ) |
Adds file to be pushed.
- Since :
- 2.3.1
- Parameters:
-
[in] file The path of file to be pushed
- 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 BT_ERROR_INVALID_PARAMETER Invalid parameter
int bt_opp_client_cancel_push | ( | void | ) |
Cancels the push request in progress, asynchronously.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- 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_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- bt_opp_client_push_files() must be called.
- Postcondition:
- bt_opp_client_push_finished_cb() will be invoked with result BT_ERROR_CANCELLED, which is a parameter of bt_opp_client_push_files().
int bt_opp_client_clear_files | ( | void | ) |
Adds file to be pushed.
- Since :
- 2.3.1
- 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
int bt_opp_client_deinitialize | ( | void | ) |
Deinitializes the Bluetooth OPP client.
- Since :
- 2.3.1
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_opp_client_initialize()
int bt_opp_client_initialize | ( | void | ) |
Initializes the Bluetooth OPP client.
- Since :
- 2.3.1
- Remarks:
- This function must be called before Bluetooth OPP client starts.
You must free all resources of the Bluetooth service by calling bt_opp_client_deinitialize()
if Bluetooth OPP service 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_RESOURCE_BUSY Device or resource busy BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_opp_client_deinitialize()
int bt_opp_client_push_files | ( | const char * | remote_address, |
bt_opp_client_push_responded_cb | responded_cb, | ||
bt_opp_client_push_progress_cb | progress_cb, | ||
bt_opp_client_push_finished_cb | finished_cb, | ||
void * | user_data | ||
) |
Pushes the file to the remote device, asynchronously.
At first, bt_opp_client_push_responded_cb() will be called when OPP server responds to the push request.
After connection is established, bt_opp_client_push_progress_cb() will be called repeatedly until a file is transferred completely.
If you send several files, then bt_opp_client_push_progress_cb() with another file will be called repeatedly until the file is transferred completely.
bt_opp_client_push_finished_cb() will be called when the push request is finished.
- Since :
- 2.3.1
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address The remote address [in] responded_cb The callback called when OPP server responds to the push request [in] progress_cb The callback called when each file is being transferred [in] finished_cb The callback called when the push request is finished [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_NOT_ENABLED Not enabled BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOW_IN_PROGRESS Operation now in progress BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported