X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;ds=sidebyside;f=include%2Fbluetooth-api.h;h=a1335c13bcd844980ed2f14cb2506d25dd0bd960;hb=34389ab8d8f647d553404f074e2e93e62480e1f4;hp=6a0c717551a992b35cad421fa9200223cfb22f61;hpb=0beafff38fb90ccd8086be57a80b8a8acd344230;p=platform%2Fcore%2Fconnectivity%2Fbluetooth-frwk.git diff --git a/include/bluetooth-api.h b/include/bluetooth-api.h index 6a0c717..a1335c1 100644 --- a/include/bluetooth-api.h +++ b/include/bluetooth-api.h @@ -22,6 +22,8 @@ #include #include #include +#include + #ifdef __cplusplus extern "C" { @@ -36,7 +38,7 @@ extern "C" { * @{ */ -#define BLUETOOTH_ADDRESS_STRING_LENGTH 17 /**< This specifies bluetooth device address length (AA:BB:CC:DD:EE:FF) */ +#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 @@ -56,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 */ @@ -185,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 */ @@ -192,6 +249,7 @@ 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 @@ -204,17 +262,6 @@ extern "C" { #define BLUETOOTH_ERROR_CONNECTION_TERMINATED_DUE_TO_MIC_FAILURE 0x3d #define BLUETOOTH_ERROR_CONNECTION_FAILED_TO_BE_ESTABLISHED 0x3e -/* - * Bluetooth OTP error codes - */ -#define BLUETOOTH_ERROR_INVALID_DIRECTORY 0x01 -#define BLUETOOTH_ERROR_NO_OBJECTS_FOUND 0x02 -#define BLUETOOTH_ERROR_WRITE_REQUEST_REJECTED 0x80 -#define BLUETOOTH_ERROR_OBJECT_NOT_SELECTED 0x81 -#define BLUETOOTH_ERROR_CONCURRENCY_LIMIT_EXCEEDED 0x82 -#define BLUETOOTH_ERROR_OBJECT_NAME_EXISITS 0x83 -#define BLUETOOTH_ERROR_CCC_IMPROPERLY_CONFIGURED 0xfd - /** * Device disconnect reason */ @@ -276,6 +323,29 @@ 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; + uint32_t tx_time; + uint32_t rx_time; + uint32_t idle_time; + uint32_t session_connected_time; + uint32_t session_scan_time; + GSList *atm_list; +} bt_battery_data; + +typedef struct { + uid_t uid; + pid_t pid; + uint32_t rx_bytes; + uint32_t tx_bytes; + uint time; +} bt_battery_app_data; + +/** * Adapter state */ typedef enum { @@ -542,6 +612,7 @@ typedef struct { float interval_max; guint8 filter_policy; guint8 type; + int tx_power_level; } bluetooth_advertising_params_t; /** @@ -553,6 +624,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 */ @@ -643,6 +722,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*/ @@ -755,16 +835,25 @@ typedef enum { BLUETOOTH_EVENT_GATT_READ_DESC, /**