Tizen Native API  7.0
Bluetooth OPP Client

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
Parameters:
[in]resultThe result of the push request
[in]remote_addressThe remote address
[in]user_dataThe 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
Parameters:
[in]fileThe path of file to be pushed
[in]sizeThe file size (bytes)
[in]percentThe progress in percentage (1 ~ 100). 100 means that a file is transferred completely.
[in]user_dataThe 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
Parameters:
[in]resultThe result of OPP server response
[in]remote_addressThe remote address
[in]user_dataThe 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
Parameters:
[in]fileThe path of file to be pushed
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
BT_ERROR_INVALID_PARAMETERInvalid parameter
See also:
bt_opp_client_clear_files()
bt_opp_client_push_files()
int bt_opp_client_cancel_push ( void  )

Cancels the push request in progress, asynchronously.

Since :
2.3
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot 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().
See also:
bt_opp_client_initialize()
bt_opp_client_push_files()
int bt_opp_client_clear_files ( void  )

Adds file to be pushed.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_opp_client_add_file()
bt_opp_client_push_files()

Deinitializes the Bluetooth OPP client.

Since :
2.3
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_opp_client_initialize()
int bt_opp_client_initialize ( void  )

Initializes the Bluetooth OPP client.

Since :
2.3
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_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_RESOURCE_BUSYDevice or resource busy
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot 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
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Parameters:
[in]remote_addressThe remote address
[in]responded_cbThe callback called when OPP server responds to the push request
[in]progress_cbThe callback called when each file is being transferred
[in]finished_cbThe callback called when the push request is finished
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOW_IN_PROGRESSOperation now in progress
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_opp_client_initialize()
bt_opp_client_cancel_push()