X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=include%2Fbluetooth-api.h;h=c0249b44b3754f1f80b24f6e74027c65fc93334c;hb=e3503dd377cadd114917a37fd27f25967a315606;hp=2a6831816776586f4bfaf1a1a0e7a6e351f21b78;hpb=4e138fae22855ada65d59d0d16a292a2ebee3800;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index 2a68318..c0249b4 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -19,8 +19,11 @@ #define _BLUETOOTH_API_H_ #include +#include #include #include +#include + #ifdef __cplusplus extern "C" { @@ -35,6 +38,7 @@ extern "C" { * @{ */ +#define BLUETOOTH_ADDRESS_STRING_LENGTH 18 /**< This specifies bluetooth device address length (AA:BB:CC:DD:EE:FF) */ #define BLUETOOTH_ADDRESS_LENGTH 6 /**< This specifies bluetooth device address length */ #define BLUETOOTH_VERSION_LENGTH_MAX 30 /**< This specifies bluetooth device version length */ #define BLUETOOTH_INTERFACE_NAME_LENGTH 16 @@ -54,8 +58,14 @@ extern "C" { #define BLUETOOTH_OOB_DATA_LENGTH 16 +#define BLUETOOTH_LE_OOB_DATA_LENGTH 100 + #define BLUETOOTH_PIN_CODE_MAX_LENGTH 16 +#ifdef TIZEN_GATT_CLIENT +#define BLUETOOTH_GATT_ATT_DATA_LENGTH_MAX 610 /**< GATT ATT value max len */ +#endif + /** * This is Bluetooth Connected event role */ @@ -76,6 +86,16 @@ extern "C" { #define BLUETOOTH_MAX_DPM_LIST 20 /**< This specifies maximum number of devices/uuids dpm shall store */ +#define BLUETOOTH_TDS_DATA_LENGTH_MAX 239 /**< This specifies maximum AD data length: 0xEF */ +#define BLUETOOTH_TDS_CONTROL_POINT_PARAM_LENGTH_MAX 500 /**< TDS Control Point parameter Max length */ + +/* + * < This defines the maximum size of OTP server directory name + */ +#define BLUETOOTH_MAX_OTP_SERVER_DIR_NAME 100 + +#define BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH 500 /**< OTP Characteristics Value Max length */ + /** * This is Bluetooth error code */ @@ -173,6 +193,55 @@ extern "C" { #define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION ((int)BLUETOOTH_ERROR_BASE - 0x28) /**< Device Policy Restricted */ +#define BLUETOOTH_ERROR_NO_DATA ((int)BLUETOOTH_ERROR_BASE - 0x29) + /**< No data */ + +#define BLUETOOTH_ERROR_AUTHORIZATION_REJECTED ((int)BLUETOOTH_ERROR_BASE - 0x2a) + /**< Authorization rejected */ + +/** +* Error codes for ATT Error response * +*/ +#define BLUETOOTH_ATT_ERROR_INTERNAL -1 +#define BLUETOOTH_ATT_ERROR_NONE 0x00 +#define BLUETOOTH_ATT_ERROR_INVALID_HANDLE 0x01 +#define BLUETOOTH_ATT_ERROR_READ_NOT_PERMITTED 0x02 +#define BLUETOOTH_ATT_ERROR_WRITE_NOT_PERMITTED 0x03 +#define BLUETOOTH_ATT_ERROR_INVALID_PDU 0x04 +#define BLUETOOTH_ATT_ERROR_AUTHENTICATION 0x05 +#define BLUETOOTH_ATT_ERROR_REQUEST_NOT_SUPPORTED 0x06 +#define BLUETOOTH_ATT_ERROR_INVALID_OFFSET 0x07 +#define BLUETOOTH_ATT_ERROR_AUTHORIZATION 0x08 +#define BLUETOOTH_ATT_ERROR_PREPARE_QUEUE_FULL 0x09 +#define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_FOUND 0x0A +#define BLUETOOTH_ATT_ERROR_ATTRIBUTE_NOT_LONG 0x0B +#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION_KEY_SIZE 0x0C +#define BLUETOOTH_ATT_ERROR_INVALID_ATTRIBUTE_VALUE_LEN 0x0D +#define BLUETOOTH_ATT_ERROR_UNLIKELY 0x0E +#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_ENCRYPTION 0x0F +#define BLUETOOTH_ATT_ERROR_UNSUPPORTED_GROUP_TYPE 0x10 +#define BLUETOOTH_ATT_ERROR_INSUFFICIENT_RESOURCES 0x11 +/* Common profile error codes */ +#define BLUETOOTH_ATT_ERROR_WRITE_REQUEST_REJECTED 0xFC +#define BLUETOOTH_ATT_ERROR_CCCD_IMPROPERLY_CONFIGURED 0xFD +#define BLUETOOTH_ATT_ERROR_PROCEDURE_ALREADY_IN_PROGRESS 0xFE +#define BLUETOOTH_ATT_ERROR_OUT_OF_RANGE 0xFF + +/* + * Bluetooth ATT error codes specific to OTP + */ +#define BLUETOOTH_OTP_ERROR_WRITE_REQUEST_REJECTED 0x80 +#define BLUETOOTH_OTP_ERROR_OBJECT_NOT_SELECTED 0x81 +#define BLUETOOTH_OTP_ERROR_CONCURRENCY_LIMIT_EXCEEDED 0x82 +#define BLUETOOTH_OTP_ERROR_OBJECT_NAME_EXISTS 0x83 + +/* + * Bluetooth OTP error codes + * TODO: Check error code conflict + */ +#define BLUETOOTH_ERROR_INVALID_DIRECTORY 0x01 +#define BLUETOOTH_ERROR_NO_OBJECTS_FOUND 0x02 + /** * Device disconnection reasons; received from stack */ @@ -180,16 +249,19 @@ extern "C" { #define BLUETOOTH_ERROR_AUTH_FAILURE 0x05 #define BLUETOOTH_ERROR_PIN_OR_KEY_MISSING 0x06 #define BLUETOOTH_ERROR_CONNECTION_TIMEOUT 0x08 +#define BLUETOOTH_ERROR_CONNECTION_REJECTED_DUE_TO_SECURITY_REASONS 0x0e #define BLUETOOTH_ERROR_REMOTE_USER_TERM 0x13 #define BLUETOOTH_ERROR_REMOTE_LOW_RESOURCES 0x14 #define BLUETOOTH_ERROR_REMOTE_POWER_OFF 0x15 #define BLUETOOTH_ERROR_LOCAL_HOST_TERM 0x16 #define BLUETOOTH_ERROR_REPEATED_ATTEMPTS 0x17 #define BLUETOOTH_ERROR_LMP_RESPONSE_TIMEOUT 0x22 +#define BLUETOOTH_ERROR_LMP_TRANSACTION_COLLISION 0x23 +#define BLUETOOTH_ERROR_INSTANT_PASSED 0x28 +#define BLUETOOTH_ERROR_INSUFFICIENT_SECURITY 0x2f +#define BLUETOOTH_ERROR_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3d #define BLUETOOTH_ERROR_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3e - - /** * Device disconnect reason */ @@ -216,6 +288,15 @@ typedef enum { } bluetooth_device_address_type_t; /** + * This is BD Address type defined in kernel BT header + */ +typedef enum { + BLUETOOTH_BDADDR_BREDR = 0x00, + BLUETOOTH_BDADDR_LE_PUBLIC = 0x01, + BLUETOOTH_BDADDR_LE_RANDOM = 0x02 +} bluetooth_bdaddr_type_e; + +/** * This is Bluetooth version */ typedef struct { @@ -242,6 +323,26 @@ typedef struct { } bluetooth_device_pin_code_t; /** + * This is data for battery usage monitoring + */ + +typedef struct { + time_t session_start_time; + time_t session_end_time; + uint16_t session_connected_time; + uint16_t session_scan_time; + GSList *atm_list; +} bt_battery_data; + +typedef struct { + uid_t uid; + pid_t pid; + uint16_t rx_bytes; + uint16_t tx_bytes; + uint time; +} bt_battery_app_data; + +/** * Adapter state */ typedef enum { @@ -287,6 +388,7 @@ typedef enum { /** * Service type + * Service type matched to bt_profile_type_t of bt-service-common.h */ typedef enum { BLUETOOTH_RFCOMM_SERVICE = 0x01, @@ -298,16 +400,18 @@ typedef enum { BLUETOOTH_GATT_SERVICE = 0x40, BLUETOOTH_NAP_SERVER_SERVICE = 0x80, BLUETOOTH_A2DP_SINK_SERVICE = 0x100, + BLUETOOTH_PBAP_SERVICE = 0x200, } bluetooth_service_type_t; /** * Service type */ typedef enum { - BLUETOOTH_DEV_CONN_DEFAULT = 0xFF, /* represents that connection - * type can both BR/EDR and LE */ - BLUETOOTH_DEV_CONN_BREDR = 0x00, - BLUETOOTH_DEV_CONN_LE = 0x01, + BLUETOOTH_DEV_CONN_DEFAULT = 0xFF, + /* represents that connection + * type can both BR/EDR and LE */ + BLUETOOTH_DEV_CONN_BREDR = 0x00, + BLUETOOTH_DEV_CONN_LE = 0x01, } bluetooth_conn_type_t; /** @@ -401,6 +505,103 @@ typedef enum { } bluetooth_gatt_att_request_tyep_t; /** + * Proximity Property Type + */ +typedef enum { + BLUETOOTH_PXP_PROPERTY_LLS = 0x01, /* Link Loss Alert Proeprty */ + BLUETOOTH_PXP_PROPERTY_IAS = 0x02, /* Immediate Alert Proeprty */ + BLUETOOTH_PXP_PROPERTY_TX_POWER = 0x04, /* TX Power */ +} bluetooth_pxp_poperty_t; + +/** + * TDS transport Type + */ +typedef enum { + BLUETOOTH_TDS_TRANSPORT_BT = 0x01, /* Transport type BR-EDR */ + BLUETOOTH_TDS_TRANSPORT_CUSTOM, /* Transport type custom */ + /* ... */ + BLUETOOTH_TDS_TRANSPORT_INVALID +} bluetooth_tds_transport_t; + +/** + * TDS transport state + */ +typedef enum { + BLUETOOTH_TDS_TRANSPORT_STATE_OFF = 0, + BLUETOOTH_TDS_TRANSPORT_STATE_ON, + BLUETOOTH_TDS_TRANSPORT_STATE_UNAVAILABLE, + BLUETOOTH_TDS_TRANSPORT_STATE_RESERVED +} bluetooth_tds_transport_state_t; + +/** +* TDS data +*/ +typedef struct { + int length; + guint8 data[BLUETOOTH_TDS_DATA_LENGTH_MAX]; +} bluetooth_tds_data_t; + +/** +* TDS activation request +*/ +typedef struct { + bluetooth_device_address_t rem_addr; + bluetooth_tds_transport_t transport; + bluetooth_tds_data_t tds_data; +} bluetooth_tds_activation_req_t; + +/** +* TDS Control Point data +*/ +typedef struct { + int length; /**< Control point data length */ + guint8 data[BLUETOOTH_TDS_CONTROL_POINT_PARAM_LENGTH_MAX]; /**< Control pint param data */ +} bluetooth_control_point_data_t; + +/** +* TDS Indication Response data +*/ +typedef struct { + bluetooth_device_address_t rem_addr; /**< Device address */ + bluetooth_control_point_data_t tds_data; /**< TDS Control Point Indication params */ +} bluetooth_tds_indication_res_t; + +/** +* Structure to hold the TDS Complete data information which is read from remote TDS provider +*/ +typedef struct { + bluetooth_device_address_t device_address; /**< Device address */ + int data_length; /**< Data length */ + char *data; /**< Complete Transport Specific data */ +} bluetooth_tds_transport_data_info_t; + +/** +* OTP Characteristics Value +*/ +typedef struct { + int length; /**< Characteristics value length */ + guint8 data[BLUETOOTH_OTP_CHARC_VAL_MAX_LENGTH]; /**< Characteristics data */ +} bluetooth_otp_charc_data_t; + +/** +* Structure to hold the OTP response data from remote OTP server +*/ +typedef struct { + char *handle; /**< Handle */ + int data_length; /**< Data length */ + char *data; /**< Read data */ +} bluetooth_otp_resp_info_t; + +/** +* Structure to hold the OTC Channel Info +*/ +typedef struct { + gboolean connected; /**< Connection Status */ + int fd; /**< Fd */ + char *address; /**< Remote address */ +} bluetooth_otc_info_t; + +/** * Advertising parameters */ typedef struct { @@ -408,6 +609,7 @@ typedef struct { float interval_max; guint8 filter_policy; guint8 type; + int tx_power_level; } bluetooth_advertising_params_t; /** @@ -419,6 +621,14 @@ typedef struct { float window; /**< LE scan window */ } bluetooth_le_scan_params_t; +/** +* LE Scan type +*/ +typedef enum { + BLUETOOTH_LE_PASSIVE_SCAN = 0x00, + BLUETOOTH_LE_ACTIVE_SCAN +} bluetooth_le_scan_type_t; + /* LE Connection Update */ @@ -498,6 +708,8 @@ typedef struct { /**< Base ID for AVRCP events */ #define BLUETOOTH_EVENT_IPSP_BASE ((int)(BLUETOOTH_EVENT_AVRCP_CONTROL_BASE + 0x0020)) /**< Base ID for IPSP events */ +#define BLUETOOTH_EVENT_MAP_BASE ((int)(BLUETOOTH_EVENT_IPSP_BASE + 0x0020)) + /**< Base ID for MAP events */ /** * Bluetooth event type @@ -507,6 +719,7 @@ typedef enum { BLUETOOTH_EVENT_ENABLED, /**< Bluetooth event adpater enabled */ BLUETOOTH_EVENT_DISABLED, /**< Bluetooth event adpater disabled */ + BLUETOOTH_EVENT_DISABLED_BATTERY_DATA, /**< Bluetooth event adapter disabled battery data*/ BLUETOOTH_EVENT_LE_ENABLED, /**< Bluetooth event adpater enabled */ BLUETOOTH_EVENT_LE_DISABLED, /**< Bluetooth event adpater disabled */ BLUETOOTH_EVENT_LOCAL_NAME_CHANGED, /**< Bluetooth event local name changed*/ @@ -518,7 +731,7 @@ typedef enum { BLUETOOTH_EVENT_DISCOVERY_FINISHED, /**< Bluetooth event discovery finished */ BLUETOOTH_EVENT_REMOTE_DEVICE_FOUND, /**< Bluetooth event remote deice found */ BLUETOOTH_EVENT_LE_DISCOVERY_STARTED, /**< Bluetooth event LE discovery started */ - BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, /**< Bluetooth event LE discovery finished */ + BLUETOOTH_EVENT_LE_DISCOVERY_FINISHED, /**< Bluetooth event LE discovery finished */ BLUETOOTH_EVENT_REMOTE_LE_DEVICE_FOUND, /**< Bluetooth event remote deice found (LE dev) */ BLUETOOTH_EVENT_REMOTE_DEVICE_NAME_UPDATED,/**< Bluetooth event remote device name updated*/ BLUETOOTH_EVENT_BONDING_FINISHED, /**< Bluetooth event bonding completed */ @@ -572,11 +785,34 @@ typedef enum { BLUETOOTH_EVENT_OPC_CONNECTED = BLUETOOTH_EVENT_OPC_BASE, /* OPC Connected event */ - BLUETOOTH_EVENT_OPC_DISCONNECTED, /* OPC Disonnected event */ + BLUETOOTH_EVENT_OPC_DISCONNECTED, /* OPC Disonnected event */ BLUETOOTH_EVENT_OPC_TRANSFER_STARTED, /* OPC Transfer started event */ BLUETOOTH_EVENT_OPC_TRANSFER_PROGRESS, /* OPC Transfer progress event */ BLUETOOTH_EVENT_OPC_TRANSFER_COMPLETE, /* OPC Transfer Complete event */ + BLUETOOTH_EVENT_MAP_CONNECTED = BLUETOOTH_EVENT_MAP_BASE, + BLUETOOTH_EVENT_MAP_DISCONNECTED, + /* + BLUETOOTH_EVENT_MAP_SET_FOLDER_COMPLETE, + BLUETOOTH_EVENT_MAP_SET_FOLDER_INVALID_ARGUMENTS, + BLUETOOTH_EVENT_MAP_SET_FOLDER_FAILED, + BLUETOOTH_EVENT_MAP_UPDATE_INBOX_COMPLETE, + BLUETOOTH_EVENT_MAP_UPDATE_INBOX_FAILED, + */ + BLUETOOTH_EVENT_MAP_LIST_FOLDERS_COMPLETE, + BLUETOOTH_EVENT_MAP_LIST_FOLDERS_INVALID_ARGUMENTS, + BLUETOOTH_EVENT_MAP_LIST_FOLDERS_FAILED, + BLUETOOTH_EVENT_MAP_LIST_MESSAGES_COMPLETE, + BLUETOOTH_EVENT_MAP_LIST_MESSAGES_INVALID_ARGUMENTS, + BLUETOOTH_EVENT_MAP_LIST_MESSAGES_FAILED, + BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_COMPLETE, + BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_INVALID_ARGUMENTS, + BLUETOOTH_EVENT_MAP_PUSH_MESSAGE_FAILED, + BLUETOOTH_EVENT_MAP_GET_MESSAGE_COMPLETE, + BLUETOOTH_EVENT_MAP_GET_MESSAGE_INVALID_ARGUMENTS, + BLUETOOTH_EVENT_MAP_GET_MESSAGE_FAILED, + BLUETOOTH_EVENT_MAP_LIST_FILTER_FIELD_COMPLETE, + BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_AUTHORIZE = BLUETOOTH_EVENT_OBEX_SERVER_BASE, /* Obex server authorize event*/ BLUETOOTH_EVENT_OBEX_SERVER_TRANSFER_STARTED, /* Obex Server transfer started event*/ @@ -596,16 +832,25 @@ typedef enum { BLUETOOTH_EVENT_GATT_READ_DESC, /**