Tizen Native API
7.0
|
Bluetooth HID(Human Interface Device) API provides functions for connecting to Bluetooth HID such as keyboards and mouse.
Required Header
#include <bluetooth.h>
Overview
In HID Profile, there are two roles - Host and Device. The Host is a device that uses or requests the services of a HID. The Device is a device that provides the service of human data input and output to and from the Host. This API only supports Host role.
Related Features
This API is related with the following features:
- http://tizen.org/feature/network.bluetooth.hid
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_hid_host_initialize (bt_hid_host_connection_state_changed_cb connection_cb, void *user_data) |
Initializes the Bluetooth HID (Human Interface Device) Host. | |
int | bt_hid_host_deinitialize (void) |
Deinitializes the Bluetooth HID (Human Interface Device) Host. | |
int | bt_hid_host_connect (const char *remote_address) |
Connects the remote device with the HID (Human Interface Device) service, asynchronously. | |
int | bt_hid_host_disconnect (const char *remote_address) |
Disconnects the remote device with the HID (Human Interface Device) service, asynchronously. | |
Typedefs | |
typedef void(* | bt_hid_host_connection_state_changed_cb )(int result, bool connected, const char *remote_address, void *user_data) |
Called when the connection state is changed. |
Typedef Documentation
typedef void(* bt_hid_host_connection_state_changed_cb)(int result, bool connected, const char *remote_address, void *user_data) |
Called when the connection state is changed.
This callback is called when the connection state is changed. When you call bt_hid_host_connect() or bt_hid_host_disconnect(), this callback is also called with error result even though these functions fail.
- Since :
- 2.3
- Parameters:
-
[in] result The result of changing the connection state [in] connected The state to be changed. true means connected state, Otherwise, false. [in] remote_address The remote address [in] user_data The user data passed from the callback registration function
Function Documentation
int bt_hid_host_connect | ( | const char * | remote_address | ) |
Connects the remote device with the HID (Human Interface Device) service, asynchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address The remote address
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter 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:
- The local device must be bonded with the remote device by bt_device_create_bond().
- The Bluetooth HID service must be initialized with bt_hid_host_initialize().
- Postcondition:
- bt_hid_host_connection_state_changed_cb() will be invoked.
int bt_hid_host_deinitialize | ( | void | ) |
Deinitializes the Bluetooth HID (Human Interface Device) Host.
- 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_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth HID service must be initialized with bt_hid_host_initialize().
- See also:
- bt_hid_host_initialize()
int bt_hid_host_disconnect | ( | const char * | remote_address | ) |
Disconnects the remote device with the HID (Human Interface Device) service, asynchronously.
- Since :
- 2.3
- Privilege Level:
- public
- Privilege:
- http://tizen.org/privilege/bluetooth
- Parameters:
-
[in] remote_address The remote address
- Returns:
- 0 on success, otherwise a negative error value.
- Return values:
-
BT_ERROR_NONE Successful BT_ERROR_NOT_INITIALIZED Not initialized BT_ERROR_INVALID_PARAMETER Invalid parameter BT_ERROR_NOT_ENABLED Not enabled BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED Remote device is not connected BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_PERMISSION_DENIED Permission denied BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The remote device must be connected by bt_hid_host_connect().
- Postcondition:
- bt_hid_host_connection_state_changed_cb() will be invoked.
int bt_hid_host_initialize | ( | bt_hid_host_connection_state_changed_cb | connection_cb, |
void * | user_data | ||
) |
Initializes the Bluetooth HID (Human Interface Device) Host.
- Since :
- 2.3
- Remarks:
- This function must be called before Bluetooth HID Host starts.
You must free all resources of the Bluetooth service by calling bt_hid_host_deinitialize()
if Bluetooth HID Host service is no longer needed.
- Parameters:
-
[in] connection_cb The callback called when the connection state is changed [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_INVALID_PARAMETER Invalid parameter BT_ERROR_OPERATION_FAILED Operation failed BT_ERROR_NOT_SUPPORTED Not supported
- Precondition:
- The Bluetooth service must be initialized with bt_initialize().