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:
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
Called when the connection is established.
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Parameters:
-
[in] | result | The result of connecting to the remote device |
[in] | remote_address | The address of connected remote device |
[in] | app_id | The ID of application |
[in] | type | The type of HDP (Health Device Profile) channel |
[in] | channel | The connected data channel |
[in] | user_data | The 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) |
typedef void(* bt_hdp_disconnected_cb)(int result, const char *remote_address, unsigned int channel, void *user_data) |
Enumeration Type Documentation
Enumerations for the data channel type.
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Enumerator:
BT_HDP_CHANNEL_TYPE_RELIABLE |
Reliable Data Channel
|
BT_HDP_CHANNEL_TYPE_STREAMING |
Streaming Data Channel
|
Function Documentation
Registers an application that acts as the Sink role of HDP (Health Device Profile).
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] | data_type | The 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_id | The ID of application |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- 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
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] | channel | The connected data channel |
[in] | data | The data to send |
[in] | size | The size of data to send (byte) |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- 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()
Registers a callback function that will be invoked when the connection state is changed.
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Parameters:
-
[in] | connected_cb | The callback function called when a connection is established |
[in] | disconnected_cb | The callback function called when a connection is disconnected |
[in] | user_data | The user data to be passed to the callback function |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_hdp_unset_connection_state_changed_cb()
Registers a callback function that will be invoked when you receive the data.
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Parameters:
-
[in] | callback | The callback function to register |
[in] | user_data | The user data to be passed to the callback function |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_hdp_unset_data_received_cb()
Unregisters the given application that acts as the Sink role of HDP (Health Device Profile).
- Deprecated:
- Deprecated since 5.0.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] | app_id | The ID of application |
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- 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
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- 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
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().
- See also:
- bt_hdp_set_data_received_cb()