Fix tizen coding style errors and warnings
[platform/core/connectivity/bluetooth-frwk.git] / include / bluetooth-api.h
index 6a0c717..2d23b9c 100644 (file)
@@ -184,6 +184,48 @@ extern "C" {
 
 #define BLUETOOTH_ERROR_DEVICE_POLICY_RESTRICTION    ((int)BLUETOOTH_ERROR_BASE - 0x28)
                                                                /**< Device Policy Restricted */
+/**
+* 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
@@ -204,17 +246,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
 */
@@ -1290,7 +1321,9 @@ typedef enum {
        HTYPE_TRANS_GET_PROTOCOL,
        HTYPE_TRANS_SET_PROTOCOL,
        HTYPE_TRANS_DATA,
-       HTYPE_TRANS_UNKNOWN
+       HTYPE_TRANS_UNKNOWN,
+       HTYPE_TRANS_GET_IDLE = 0xF0,
+       HTYPE_TRANS_SET_IDLE = 0xF1,
 } bt_hid_header_type_t;
 
 /**
@@ -1612,6 +1645,15 @@ typedef struct {
 } bt_gatt_indicate_confirm_t;
 
 /**
+ * Structure for GATT response data
+ */
+typedef struct {
+       guint8 *value;
+       guint32 len;
+       gpointer user_data;
+} bt_gatt_resp_data_t;
+
+/**
  * Structure to RSSI Signal Strength Alert
  */
 
@@ -1789,18 +1831,12 @@ typedef enum {
        TRUSTED_PROFILE_PBAP = 1,
        TRUSTED_PROFILE_MAP,
        TRUSTED_PROFILE_SAP,
+       TRUSTED_PROFILE_HFP_HF,
+       TRUSTED_PROFILE_A2DP,
        TRUSTED_PROFILE_ALL = 0xFFFFFFFF,
 } bluetooth_trusted_profile_t;
 
 /**
- * Restricted Profile types
- */
-typedef enum {
-       RESTRICTED_PROFILE_HFP_HS = 1,
-       RESTRICTED_PROFILE_A2DP,
-} bluetooth_restricted_profile_t;
-
-/**
  * Structure for LE data length change params
  */
 typedef struct {
@@ -2287,6 +2323,7 @@ int bluetooth_check_adapter_le(void);
 int bluetooth_enable_adapter_le(void);
 
 int bluetooth_disable_adapter_le(void);
+int bluetooth_get_uuid_name(const char *uuid, char **name);
 
 /**
  * @fn int bluetooth_reset_adapter(void)
@@ -2601,52 +2638,6 @@ int bluetooth_get_profile_trusted(
                int profile, int *trust);
 
 /**
- * @fn int bluetooth_set_profile_restricted(const bluetooth_device_address_t *device_address, int profile, int restricted)
- * @brief Sets a profile restricted connection for a device
- *
- * This function is used to Set a profile as restricted for a device
- *
- * This function is a synchronous call.
- *
- * @param[in]  device_address  a device address of remote bluetooth device
- * @param[in]  profile profile which is to be set as restricted[1-HFP_HS, 2-A2DP]
- * @param[in]  restricted      to set as restricted or not[1-restricted 0-permitted]
- *
- * @return     BLUETOOTH_ERROR_NONE - Success \n
- *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
- *             BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
- *             BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
- *
- * @remark      None
- */
-int bluetooth_set_profile_restricted(
-               const bluetooth_device_address_t *device_address,
-               int profile, int restricted);
-
-/**
- * @fn int bluetooth_get_profile_restricted(const bluetooth_device_address_t *device_address, int profile, int *restricted)
- * @brief Gets a restricted connection state
- *
- * This function is used to Get a profile is restricted or not for a device
- *
- * This function is a synchronous call.
- *
- * @param[in]  device_address  a device address of remote bluetooth device
- * @param[in]  profile profile whose restricted status is needed[1-HFP_HS, 2-A2DP]
- * @param[out] restricted      profile is set as restricted or not[1-restricted 0-permitted]
- *
- * @return     BLUETOOTH_ERROR_NONE - Success \n
- *             BLUETOOTH_ERROR_DEVICE_NOT_ENABLED - Adapter is not enabled \n
- *             BLUETOOTH_ERROR_INVALID_PARAM - Bluetooth name parameter is incorrect \n
- *             BLUETOOTH_ERROR_INTERNAL - The dbus method call is fail \n
- *
- * @remark      None
- */
-int bluetooth_get_profile_restricted(
-               const bluetooth_device_address_t *device_address,
-               int profile, int *restricted);
-
-/**
  * @fn int bluetooth_get_discoverable_mode(bluetooth_discoverable_mode_t *discoverable_mode_ptr)
  * @brief Get the visibility mode
  *
@@ -5251,7 +5242,7 @@ int bluetooth_gatt_get_service_property(const char *service_handle,
                                                bt_gatt_service_property_t *service);
 
 /**
- * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle)
+ * @fn int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name)
  *
  * @brief Register to GATT based service to receive value change notification/indication.
  *
@@ -5265,11 +5256,12 @@ int bluetooth_gatt_get_service_property(const char *service_handle,
  *
  * @exception  None
  * @param[in]  service_handle - Handle for remote service.
+ * @param[in]  service_name - Friednly name of service uuid.
  *
  * @remark     None
  * @see        None
  */
-int bluetooth_gatt_watch_characteristics(const char *service_handle);
+int bluetooth_gatt_watch_characteristics(const char *service_handle, const char *svc_name);
 
 /**
  * @fn int bluetooth_gatt_unwatch_characteristics(const char *service_handle)
@@ -5389,7 +5381,8 @@ int bluetooth_gatt_set_characteristics_value(const char *char_handle,
  * @see                None
  */
 int bluetooth_gatt_set_characteristics_value_by_type(const char *char_handle,
-                               const guint8 *value, int length, guint8 write_type);
+                                       const guint8 *value, int length,
+                                       guint8 write_type, gpointer app_data);
 
 
 /**
@@ -5434,7 +5427,7 @@ int bluetooth_gatt_set_characteristics_value_request(const char *char_handle,
  * @remark     None
  * @see        None
  */
-int bluetooth_gatt_read_characteristic_value(const char *char_handle);
+int bluetooth_gatt_read_characteristic_value(const char *char_handle, gpointer app_data);
 
 /**
  * @fn int bluetooth_gatt_get_service_from_uuid(bluetooth_device_address_t *address,
@@ -5601,7 +5594,7 @@ int bluetooth_gatt_discover_characteristic_descriptor(const char *characteristic
  * @remark     None
  * @see        None
  */
-int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
+int bluetooth_gatt_read_descriptor_value(const char *desc_handle, gpointer app_data);
 
 /**
  * @fn int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
@@ -5625,7 +5618,7 @@ int bluetooth_gatt_read_descriptor_value(const char *desc_handle);
  * @see        None
  */
 int bluetooth_gatt_write_descriptor_value(const char *desc_handle,
-                       const guint8 *value, int length);
+                       const guint8 *value, int length, gpointer app_data);
 
 /* @fn int bluetooth_gatt_init(void)
 *
@@ -7636,7 +7629,7 @@ int bluetooth_otp_enable_notification(const char *handle);
  *
  * @remark     None
  */
-int bluetooth_otp_write_characteristics_value( const char *handle,
+int bluetooth_otp_write_characteristics_value(const char *handle,
                                        unsigned char *buf, int length);
 
 /**