Tizen Native API  4.0
Bluetooth

Bluetooth Service provides API to manage Bluetooth device.

Required Header

#include <bluetooth.h>

Overview

Bluetooth Service consists of Bluetooth Adapter, Bluetooth Device and Bluetooth Socket.


In order to use the above APIs, you must call bt_initialize() in advance. In addition, bt_deinitialize() should be called when Bluetooth Service is no longer needed. Please refer Bluetooth Tutorial if you want to get more detailed usages and information of this api.

Note on callbacks: All callbacks in this module are called in the main loop context.

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_initialize (void)
 Initializes the Bluetooth API.
int bt_deinitialize (void)
 Releases all resources of the Bluetooth API.
int bt_get_uuid_name (const char *uuid, char **name)
 Gets the specification name for the given UUID.

Enumeration Type Documentation

enum bt_error_e

Enumerations of Bluetooth error codes.

Since :
2.3.1
Enumerator:
BT_ERROR_NONE 

Successful

BT_ERROR_CANCELLED 

Operation cancelled

BT_ERROR_INVALID_PARAMETER 

Invalid parameter

BT_ERROR_OUT_OF_MEMORY 

Out of memory

BT_ERROR_RESOURCE_BUSY 

Device or resource busy

BT_ERROR_TIMED_OUT 

Timeout error

BT_ERROR_NOW_IN_PROGRESS 

Operation now in progress

BT_ERROR_NOT_SUPPORTED 

BT is Not Supported

BT_ERROR_PERMISSION_DENIED 

Permission denied

BT_ERROR_QUOTA_EXCEEDED 

Quota exceeded

BT_ERROR_NO_DATA 

No data available

BT_ERROR_DEVICE_POLICY_RESTRICTION 

Device policy restriction (Since 3.0)

BT_ERROR_NOT_INITIALIZED 

Local adapter not initialized

BT_ERROR_NOT_ENABLED 

Local adapter not enabled

BT_ERROR_ALREADY_DONE 

Operation already done

BT_ERROR_OPERATION_FAILED 

Operation failed

BT_ERROR_NOT_IN_PROGRESS 

Operation not in progress

BT_ERROR_REMOTE_DEVICE_NOT_BONDED 

Remote device not bonded

BT_ERROR_AUTH_REJECTED 

Authentication rejected

BT_ERROR_AUTH_FAILED 

Authentication failed

BT_ERROR_REMOTE_DEVICE_NOT_FOUND 

Remote device not found

BT_ERROR_SERVICE_SEARCH_FAILED 

Service search failed

BT_ERROR_REMOTE_DEVICE_NOT_CONNECTED 

Remote device is not connected

BT_ERROR_AGAIN 

Resource temporarily unavailable

BT_ERROR_SERVICE_NOT_FOUND 

Service Not Found


Function Documentation

int bt_deinitialize ( void  )

Releases all resources of the Bluetooth API.

Since :
2.3.1
Remarks:
This function must be called if Bluetooth API 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_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
Precondition:
Bluetooth API must be initialized with bt_initialize().
See also:
bt_initialize()
int bt_get_uuid_name ( const char *  uuid,
char **  name 
)

Gets the specification name for the given UUID.

Since :
3.0
Remarks:
The name must be released using free().
Parameters:
[in]uuidThe UUID
[out]nameThe specification name defined at www.bluetooth.com
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_INVALID_PARAMETERInvalid parameter
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_gatt_get_uuid()
int bt_initialize ( void  )

Initializes the Bluetooth API.

Since :
2.3.1
Remarks:
This function must be called before Bluetooth API starts.
You must free all resources of the Bluetooth service by calling bt_deinitialize() if Bluetooth service is no longer needed.
Returns:
0 on success, otherwise a negative error value.
Return values:
BT_ERROR_NONESuccessful
BT_ERROR_OPERATION_FAILEDOperation failed
BT_ERROR_NOT_SUPPORTEDNot supported
See also:
bt_deinitialize()