Tizen Native API  6.5
Bluetooth HDP

Bluetooth HDP(Health Device Profile) API provides functions for managing connections to health devices and exchanging data.

Required Header

#include <bluetooth.h>

Overview

The Source is a transmitter of application data that is to be transferred to a Sink. The Sink is a receiver of application data delivered from a Source. This API supports the Sink role in HDP spec.

Related Features

This API is related with the following features:

  • http://tizen.org/feature/network.bluetooth.health

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_hdp_register_sink_app (unsigned short data_type, char **app_id)
 Registers an application that acts as the Sink role of HDP (Health Device Profile).
int bt_hdp_unregister_sink_app (const char *app_id)
 Unregisters the given application that acts as the Sink role of HDP (Health Device Profile).
int bt_hdp_connect_to_source (const char *remote_address, const char *app_id)
 Connects the remote device which acts as Source role, asynchronously.
int bt_hdp_disconnect (const char *remote_address, unsigned int channel)
 Disconnects the remote device, asynchronously.
int bt_hdp_send_data (unsigned int channel, const char *data, unsigned int size)
 Sends the data to the remote device.
int bt_hdp_set_connection_state_changed_cb (bt_hdp_connected_cb connected_cb, bt_hdp_disconnected_cb disconnected_cb, void *user_data)
 Registers a callback function that will be invoked when the connection state is changed.
int bt_hdp_unset_connection_state_changed_cb (void)
 Unregisters a callback function that will be invoked when the connection state is changed.
int bt_hdp_set_data_received_cb (bt_hdp_data_received_cb callback, void *user_data)
 Registers a callback function that will be invoked when you receive the data.
int bt_hdp_unset_data_received_cb (void)
 Unregisters a callback function that will be invoked when you receive the data.

Typedefs

typedef void(* bt_hdp_connected_cb )(int result, const char *remote_address, const char *app_id, bt_hdp_channel_type_e type, unsigned int channel, void *user_data)
 Called when the connection is established.
typedef void(* bt_hdp_disconnected_cb )(int result, const char *remote_address, unsigned int channel, void *user_data)
 Called when the connection is disconnected.
typedef void(* bt_hdp_data_received_cb )(unsigned int channel, const char *data, unsigned int size, void *user_data)
 Called when the you receive the data.

Typedef Documentation

typedef void(* bt_hdp_connected_cb)(int result, const char *remote_address, const char *app_id, bt_hdp_channel_type_e type, unsigned int channel, void *user_data)

Called when the connection is established.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]resultThe result of connecting to the remote device
[in]remote_addressThe address of connected remote device
[in]app_idThe ID of application
[in]typeThe type of HDP (Health Device Profile) channel
[in]channelThe connected data channel
[in]user_dataThe user data passed from the callback registration function
See also:
bt_hdp_set_connection_state_changed_cb()
bt_hdp_unset_connection_state_changed_cb()
typedef void(* bt_hdp_data_received_cb)(unsigned int channel, const char *data, unsigned int size, void *user_data)

Called when the you receive the data.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]channelThe connected data channel
[in]dataThe received data
[in]sizeThe size of received data (byte)
[in]user_dataThe user data passed from the callback registration function
See also:
bt_hdp_set_data_received_cb()
bt_hdp_unset_data_received_cb()
typedef void(* bt_hdp_disconnected_cb)(int result, const char *remote_address, unsigned int channel, void *user_data)

Called when the connection is disconnected.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]resultThe result of disconnecting from the remote device
[in]remote_addressThe address of disconnected remote device
[in]channelThe connected data channel
[in]user_dataThe user data passed from the callback registration function
See also:
bt_hdp_set_connection_state_changed_cb()
bt_hdp_unset_connection_state_changed_cb()

Enumeration Type Documentation

Enumerations for the data channel type.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Enumerator:
BT_HDP_CHANNEL_TYPE_RELIABLE 

Reliable Data Channel

BT_HDP_CHANNEL_TYPE_STREAMING 

Streaming Data Channel


Function Documentation

int bt_hdp_connect_to_source ( const char *  remote_address,
const char *  app_id 
)

Connects the remote device which acts as Source role, asynchronously.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]remote_addressThe remote address
[in]app_idThe ID of application
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OUT_OF_MEMORYOut of memory
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Sink role of HDP must be registered with bt_hdp_register_sink_app().
The local device must be bonded with the remote device by bt_device_create_bond().
Postcondition:
bt_hdp_connected_cb() will be invoked.
See also:
bt_hdp_disconnect()
bt_hdp_set_connection_state_changed_cb()
bt_hdp_unset_connection_state_changed_cb()
int bt_hdp_disconnect ( const char *  remote_address,
unsigned int  channel 
)

Disconnects the remote device, asynchronously.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]remote_addressThe remote address
[in]channelThe connected data channel
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_REMOTE_DEVICE_NOT_CONNECTEDRemote device is not connected
BT_ERROR_OUT_OF_MEMORYOut of memory
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The remote device must be connected.
Postcondition:
bt_hdp_disconnected_cb() will be invoked.
See also:
bt_hdp_set_connection_state_changed_cb()
bt_hdp_unset_connection_state_changed_cb()
int bt_hdp_register_sink_app ( unsigned short  data_type,
char **  app_id 
)

Registers an application that acts as the Sink role of HDP (Health Device Profile).

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
The app_id must be released with free() by you.
Deprecated, because of no usecase and supported devices.
Parameters:
[in]data_typeThe data type of MDEP. This value is defined in ISO/IEEE 11073-20601 spec. For example, pulse oximeter is 0x1004 and blood pressure monitor is 0x1007.
[out]app_idThe ID of application
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_OUT_OF_MEMORYOut of memory
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The state of local Bluetooth must be BT_ADAPTER_ENABLED.
See also:
bt_hdp_unregister_sink_app()
int bt_hdp_send_data ( unsigned int  channel,
const char *  data,
unsigned int  size 
)

Sends the data to the remote device.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]channelThe connected data channel
[in]dataThe data to send
[in]sizeThe size of data to send (byte)
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The remote device must be connected.
See also:
bt_hdp_data_received_cb()
bt_hdp_set_data_received_cb()
bt_hdp_unset_data_received_cb()
int bt_hdp_set_connection_state_changed_cb ( bt_hdp_connected_cb  connected_cb,
bt_hdp_disconnected_cb  disconnected_cb,
void *  user_data 
)

Registers a callback function that will be invoked when the connection state is changed.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]connected_cbThe callback function called when a connection is established
[in]disconnected_cbThe callback function called when a connection is disconnected
[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_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_hdp_unset_connection_state_changed_cb()
int bt_hdp_set_data_received_cb ( bt_hdp_data_received_cb  callback,
void *  user_data 
)

Registers a callback function that will be invoked when you receive the data.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]callbackThe callback function to register
[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_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_hdp_unset_data_received_cb()
int bt_hdp_unregister_sink_app ( const char *  app_id)

Unregisters the given application that acts as the Sink role of HDP (Health Device Profile).

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/bluetooth
Remarks:
Deprecated, because of no usecase and supported devices.
Parameters:
[in]app_idThe ID of application
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_ENABLEDNot enabled
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_PERMISSION_DENIEDPermission denied
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_hdp_register_sink_app()

Unregisters a callback function that will be invoked when the connection state is changed.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_hdp_set_connection_state_changed_cb()

Unregisters a callback function that will be invoked when you receive the data.

Deprecated:
Deprecated since 5.0.
Since :
2.3.1
Remarks:
Deprecated, because of no usecase and supported devices.
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_NOT_INITIALIZEDNot initialized
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
The Bluetooth service must be initialized with bt_initialize().
See also:
bt_hdp_set_data_received_cb()