Tizen(Headless) Native API
6.5
|
Bluetooth OPP(Object Push Profile) Server API provides functions for accepting objects such as pictures.
Required Header
#include <bluetooth.h>
Overview
This is OPP server 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_server_initialize_by_connection_request (const char *destination, bt_opp_server_connection_requested_cb connection_requested_cb, void *user_data) |
Initializes the Bluetooth OPP server requested by bt_opp_server_connection_requested_cb(). | |
int | bt_opp_server_deinitialize (void) |
Deinitializes the Bluetooth OPP server. | |
int | bt_opp_server_accept (bt_opp_server_transfer_progress_cb progress_cb, bt_opp_server_transfer_finished_cb finished_cb, const char *name, void *user_data, int *transfer_id) |
Accepts the push request from the remote device. | |
int | bt_opp_server_reject (void) |
Rejects the push request from the remote device. | |
int | bt_opp_server_cancel_transfer (int transfer_id) |
Cancels the transfer. | |
int | bt_opp_server_set_destination (const char *destination) |
Sets the destination path of file to be pushed. | |
Typedefs | |
typedef void(* | bt_opp_server_connection_requested_cb )(const char *remote_address, void *user_data) |
Called when an OPP connection is requested. | |
typedef void(* | bt_opp_server_transfer_progress_cb )(const char *file, long long size, int percent, void *user_data) |
Called when a file is being transferred. | |
typedef void(* | bt_opp_server_transfer_finished_cb )(int result, const char *file, long long size, void *user_data) |
Called when a transfer is finished. |
Typedef Documentation
typedef void(* bt_opp_server_connection_requested_cb)(const char *remote_address, void *user_data) |
Called when an OPP connection is requested.
You must call bt_opp_server_accept() if you want to accept. Otherwise, you must call bt_opp_server_reject().
- Since :
- 2.3
- Parameters:
-
[in] remote_address The address of remote device [in] user_data The user data passed from the callback registration function
typedef void(* bt_opp_server_transfer_finished_cb)(int result, const char *file, long long size, void *user_data) |
Called when a transfer is finished.
- Since :
- 2.3
- Parameters:
-
[in] result The result of push [in] file The path of file to be pushed [in] size The file size (bytes) [in] user_data The user data passed from the callback registration function
- See also:
- bt_opp_server_accept()
typedef void(* bt_opp_server_transfer_progress_cb)(const char *file, long long size, int percent, void *user_data) |
Called when a file is being transferred.
- Since :
- 2.3
- Parameters:
-
[in] file The path of file to be pushed [in] size The file size (bytes) [in] percent The progress in percentage (1 ~ 100) [in] user_data The user data passed from the callback registration function
- See also:
- bt_opp_server_accept()
Function Documentation
int bt_opp_server_accept | ( | bt_opp_server_transfer_progress_cb | progress_cb, |
bt_opp_server_transfer_finished_cb | finished_cb, | ||
const char * | name, | ||
void * | user_data, | ||
int * | transfer_id | ||
) |
Accepts the push request from the remote device.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Remarks:
- If you initialize OPP server by bt_opp_server_initialize_by_connection_request(), then name is ignored. You can cancel the pushes by bt_opp_server_cancel_transfer() with transfer_id.
- Parameters:
-
[in] progress_cb The callback called when a file is being transferred [in] finished_cb The callback called when a transfer is finished [in] name The name to store. This can be NULL if you initialize OPP server by bt_opp_server_initialize_by_connection_request(). [in] user_data The user data to be passed to the callback function [out] transfer_id The ID of transfer
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_NOT_ENABLED Not enabled 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
- See also:
- bt_opp_server_reject()
int bt_opp_server_cancel_transfer | ( | int | transfer_id | ) |
Cancels the transfer.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] transfer_id The ID of transfer
- 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_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- See also:
- bt_opp_server_accept()
int bt_opp_server_deinitialize | ( | void | ) |
Deinitializes the Bluetooth OPP server.
- Since :
- 2.3
- 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_server_initialize_by_connection_request | ( | const char * | destination, |
bt_opp_server_connection_requested_cb | connection_requested_cb, | ||
void * | user_data | ||
) |
Initializes the Bluetooth OPP server requested by bt_opp_server_connection_requested_cb().
No popup appears when an OPP connection is requested from a remote device.
Instead, connection_requested_cb() will be called.
At that time, you can call either bt_opp_server_accept() or bt_opp_server_reject().
- Since :
- 2.3
- Remarks:
- This function must be called to start Bluetooth OPP server.
You must free all resources of the Bluetooth service by calling bt_opp_server_deinitialize() if Bluetooth OPP service is no longer needed.
- Parameters:
-
[in] destination The destination path [in] connection_requested_cb The callback called when an OPP connection is requested [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_RESOURCE_BUSY Device or resource busy BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
int bt_opp_server_reject | ( | void | ) |
Rejects the push request from the remote device.
- 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_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
- See also:
- bt_opp_server_accept()
int bt_opp_server_set_destination | ( | const char * | destination | ) |
Sets the destination path of file to be pushed.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] destination The destination 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_INVALID_PARAMETER Invalid parameter BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported