]> granicus.if.org Git - esp-idf/commitdiff
component/bt : fix bugs of some constant value not equal internal define but quotes...
authorTian Hao <tianhao@espressif.com>
Thu, 25 May 2017 07:39:01 +0000 (15:39 +0800)
committerTian Hao <tianhao@espressif.com>
Thu, 25 May 2017 08:12:48 +0000 (16:12 +0800)
components/bt/bluedroid/api/include/esp_bt_defs.h
components/bt/bluedroid/api/include/esp_gap_ble_api.h
components/bt/bluedroid/api/include/esp_gatt_defs.h
components/bt/bluedroid/bta/include/bta_api.h
components/bt/bluedroid/bta/include/bta_gatt_api.h
components/bt/bluedroid/include/bt_defs.h
components/bt/bluedroid/stack/gatt/gatt_db.c
components/bt/bluedroid/stack/gatt/gatt_sr.c
components/bt/bluedroid/stack/include/btm_api.h
components/bt/bluedroid/stack/include/btm_ble_api.h
components/bt/bluedroid/stack/include/gatt_api.h

index 85b0aff9968683b04964bdefe162c2bd79235a20..97f76fd05a21b292445d3092b28dd00eea43888c 100644 (file)
 extern "C" {
 #endif
 
+/* relate to BT_STATUS_xxx in bt_def.h */
 /// Status Return Value
 typedef enum {
-    ESP_BT_STATUS_SUCCESS          =  0,          /* Successful operation. */
-    ESP_BT_STATUS_FAILURE          =  1,          /* Generic failure. */
-    ESP_BT_STATUS_PENDING          =  2,          /* API cannot be completed right now */
-    ESP_BT_STATUS_BUSY             =  3,
-    ESP_BT_STATUS_NO_RESOURCES     =  4,
-    ESP_BT_STATUS_WRONG_MODE       =  5,
+    ESP_BT_STATUS_SUCCESS = 0,                  /* relate to BT_STATUS_SUCCESS in bt_def.h */
+    ESP_BT_STATUS_FAIL,                         /* relate to BT_STATUS_FAIL in bt_def.h */
+    ESP_BT_STATUS_NOT_READY,                    /* relate to BT_STATUS_NOT_READY in bt_def.h */
+    ESP_BT_STATUS_NOMEM,                        /* relate to BT_STATUS_NOMEM in bt_def.h */
+    ESP_BT_STATUS_BUSY,                         /* relate to BT_STATUS_BUSY in bt_def.h */
+    ESP_BT_STATUS_DONE,                         /* relate to BT_STATUS_DONE in bt_def.h */
+    ESP_BT_STATUS_UNSUPPORTED,                  /* relate to BT_STATUS_UNSUPPORTED in bt_def.h */
+    ESP_BT_STATUS_PARM_INVALID,                 /* relate to BT_STATUS_PARM_INVALID in bt_def.h */
+    ESP_BT_STATUS_UNHANDLED,                    /* relate to BT_STATUS_UNHANDLED in bt_def.h */
+    ESP_BT_STATUS_AUTH_FAILURE,                 /* relate to BT_STATUS_AUTH_FAILURE in bt_def.h */
+    ESP_BT_STATUS_RMT_DEV_DOWN,                 /* relate to BT_STATUS_RMT_DEV_DOWN in bt_def.h */
+    ESP_BT_STATUS_AUTH_REJECTED,                /* relate to BT_STATUS_AUTH_REJECTED in bt_def.h */
 } esp_bt_status_t;
 
 
@@ -86,13 +93,13 @@ typedef enum {
 } esp_ble_addr_type_t;
 
 /// Used to exchange the encrytyption key in the init key & response key
-#define ESP_BLE_ENC_KEY_MASK    (1 << 0)
+#define ESP_BLE_ENC_KEY_MASK    (1 << 0)            /* relate to BTM_BLE_ENC_KEY_MASK in btm_api.h */
 /// Used to exchange the IRK key in the init key & response key
-#define ESP_BLE_ID_KEY_MASK     (1 << 1)
+#define ESP_BLE_ID_KEY_MASK     (1 << 1)            /* relate to BTM_BLE_ID_KEY_MASK in btm_api.h */
 /// Used to exchange the CSRK key in the init key & response key
-#define ESP_BLE_CSR_KEY_MASK    (1 << 2)
+#define ESP_BLE_CSR_KEY_MASK    (1 << 2)            /* relate to BTM_BLE_CSR_KEY_MASK in btm_api.h */
 /// Used to exchange the link key(this key just used in the BLE & BR/EDR coexist mode) in the init key & response key
-#define ESP_BLE_LINK_KEY_MASK   (1 << 3)
+#define ESP_BLE_LINK_KEY_MASK   (1 << 3)            /* relate to BTM_BLE_LINK_KEY_MASK in btm_api.h */
 
 /// Minimum of the application id
 #define ESP_APP_ID_MIN  0x0000
index 45c14b5096f0add6fb407ed51bea4344168f15c4..59a42e04d24b0f308099fa937aec0080ba62a67d 100644 (file)
@@ -38,31 +38,34 @@ extern "C" {
  * @}
  */
 
-#define ESP_LE_KEY_NONE                    0
-#define ESP_LE_KEY_PENC                    (1 << 0)                     /*!< encryption key, encryption information of peer device */
-#define ESP_LE_KEY_PID                     (1 << 1)                     /*!< identity key of the peer device */
-#define ESP_LE_KEY_PCSRK                   (1 << 2)                     /*!< peer SRK */
-#define ESP_LE_KEY_PLK                     (1 << 3)                     /*!< Link key*/        
-#define ESP_LE_KEY_LLK                     (ESP_LE_KEY_PLK << 4)
-#define ESP_LE_KEY_LENC                    (ESP_LE_KEY_PENC << 4)                   /*!< master role security information:div */
-#define ESP_LE_KEY_LID                     (ESP_LE_KEY_PID << 4)                    /*!< master device ID key */
-#define ESP_LE_KEY_LCSRK                   (ESP_LE_KEY_PCSRK << 4)                  /*!< local CSRK has been deliver to peer */
-typedef uint8_t        esp_ble_key_type_t;
-
-#define ESP_LE_AUTH_NO_BOND                 0x00                                     /*!< 0*/
-#define ESP_LE_AUTH_BOND                    0x01                                     /*!< 1 << 0 */
-#define ESP_LE_AUTH_REQ_MITM                (1 << 2)                                 /*!< 1 << 2 */
-#define ESP_LE_AUTH_REQ_SC_ONLY             (1 << 3)                                 /*!< 1 << 3 */
-#define ESP_LE_AUTH_REQ_SC_BOND             (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY)            /*!< 1001 */
-#define ESP_LE_AUTH_REQ_SC_MITM             (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY)        /*!< 1100 */
-#define ESP_LE_AUTH_REQ_SC_MITM_BOND        (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND)   /*!< 1101 */
+/* relate to BTM_LE_KEY_xxx in btm_api.h */
+#define ESP_LE_KEY_NONE                    0                                                                         /* relate to BTM_LE_KEY_NONE in btm_api.h */
+#define ESP_LE_KEY_PENC                    (1 << 0)   /*!< encryption key, encryption information of peer device */  /* relate to BTM_LE_KEY_PENC in btm_api.h */
+#define ESP_LE_KEY_PID                     (1 << 1)   /*!< identity key of the peer device */                        /* relate to BTM_LE_KEY_PID in btm_api.h */
+#define ESP_LE_KEY_PCSRK                   (1 << 2)   /*!< peer SRK */                                               /* relate to BTM_LE_KEY_PCSRK in btm_api.h */
+#define ESP_LE_KEY_PLK                     (1 << 3)   /*!< Link key*/                                                /* relate to BTM_LE_KEY_PLK in btm_api.h */
+#define ESP_LE_KEY_LLK                     (ESP_LE_KEY_PLK << 4)                                                     /* relate to BTM_LE_KEY_LLK in btm_api.h */
+#define ESP_LE_KEY_LENC                    (ESP_LE_KEY_PENC << 4)   /*!< master role security information:div */     /* relate to BTM_LE_KEY_LENC in btm_api.h */
+#define ESP_LE_KEY_LID                     (ESP_LE_KEY_PID << 4)    /*!< master device ID key */                     /* relate to BTM_LE_KEY_LID in btm_api.h */
+#define ESP_LE_KEY_LCSRK                   (ESP_LE_KEY_PCSRK << 4)  /*!< local CSRK has been deliver to peer */      /* relate to BTM_LE_KEY_LCSRK in btm_api.h */
+typedef uint8_t esp_ble_key_type_t;
+
+/* relate to BTM_LE_AUTH_xxx in btm_api.h */
+#define ESP_LE_AUTH_NO_BOND                 0x00                                     /*!< 0*/                     /* relate to BTM_LE_AUTH_NO_BOND in btm_api.h */
+#define ESP_LE_AUTH_BOND                    0x01                                     /*!< 1 << 0 */               /* relate to BTM_LE_AUTH_BOND in btm_api.h */
+#define ESP_LE_AUTH_REQ_MITM                (1 << 2)                                 /*!< 1 << 2 */               /* relate to BTM_LE_AUTH_REQ_MITM in btm_api.h */
+#define ESP_LE_AUTH_REQ_SC_ONLY             (1 << 3)                                 /*!< 1 << 3 */               /* relate to BTM_LE_AUTH_REQ_SC_ONLY in btm_api.h */
+#define ESP_LE_AUTH_REQ_SC_BOND             (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY)            /*!< 1001 */  /* relate to BTM_LE_AUTH_REQ_SC_BOND in btm_api.h */
+#define ESP_LE_AUTH_REQ_SC_MITM             (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY)        /*!< 1100 */  /* relate to BTM_LE_AUTH_REQ_SC_MITM in btm_api.h */
+#define ESP_LE_AUTH_REQ_SC_MITM_BOND        (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND)   /*!< 1101 */  /* relate to BTM_LE_AUTH_REQ_SC_MITM_BOND in btm_api.h */
 typedef uint8_t   esp_ble_auth_req_t;         /*!< combination of the above bit pattern */
 
-#define ESP_IO_CAP_OUT                      0   /*!< DisplayOnly */
-#define ESP_IO_CAP_IO                       1   /*!< DisplayYesNo */
-#define ESP_IO_CAP_IN                       2   /*!< KeyboardOnly */
-#define ESP_IO_CAP_NONE                     3   /*!< NoInputNoOutput */
-#define ESP_IO_CAP_KBDISP                   4   /*!< Keyboard display */
+/* relate to BTM_IO_CAP_xxx in btm_api.h */
+#define ESP_IO_CAP_OUT                      0   /*!< DisplayOnly */         /* relate to BTM_IO_CAP_OUT in btm_api.h */
+#define ESP_IO_CAP_IO                       1   /*!< DisplayYesNo */        /* relate to BTM_IO_CAP_IO in btm_api.h */
+#define ESP_IO_CAP_IN                       2   /*!< KeyboardOnly */        /* relate to BTM_IO_CAP_IN in btm_api.h */
+#define ESP_IO_CAP_NONE                     3   /*!< NoInputNoOutput */     /* relate to BTM_IO_CAP_NONE in btm_api.h */
+#define ESP_IO_CAP_KBDISP                   4   /*!< Keyboard display */    /* relate to BTM_IO_CAP_KBDISP in btm_api.h */
 typedef uint8_t esp_ble_io_cap_t;               /*!< combination of the io capability */
 
 
@@ -94,33 +97,45 @@ typedef enum {
 /// Scan response data maximum length
 #define ESP_BLE_SCAN_RSP_DATA_LEN_MAX          31
 
+/* relate to BTM_BLE_AD_TYPE_xxx in btm_ble_api.h */
 /// The type of advertising data(not adv_type)
 typedef enum {
-    ESP_BLE_AD_TYPE_FLAG                     = 0x01,
-    ESP_BLE_AD_TYPE_16SRV_PART               = 0x02,
-    ESP_BLE_AD_TYPE_16SRV_CMPL               = 0x03,
-    ESP_BLE_AD_TYPE_32SRV_PART               = 0x04,
-    ESP_BLE_AD_TYPE_32SRV_CMPL               = 0x05,
-    ESP_BLE_AD_TYPE_128SRV_PART              = 0x06,
-    ESP_BLE_AD_TYPE_128SRV_CMPL              = 0x07,
-    ESP_BLE_AD_TYPE_NAME_SHORT               = 0x08,
-    ESP_BLE_AD_TYPE_NAME_CMPL                = 0x09,
-    ESP_BLE_AD_TYPE_TX_PWR                   = 0x0A,
-    ESP_BLE_AD_TYPE_DEV_CLASS                = 0x0D,
-    ESP_BLE_AD_TYPE_SM_TK                    = 0x10,
-    ESP_BLE_AD_TYPE_SM_OOB_FLAG              = 0x11,
-    ESP_BLE_AD_TYPE_INT_RANGE                = 0x12,
-    ESP_BLE_AD_TYPE_SOL_SRV_UUID             = 0x14,
-    ESP_BLE_AD_TYPE_128SOL_SRV_UUID          = 0x15,
-    ESP_BLE_AD_TYPE_SERVICE_DATA             = 0x16,
-    ESP_BLE_AD_TYPE_PUBLIC_TARGET            = 0x17,
-    ESP_BLE_AD_TYPE_RANDOM_TARGET            = 0x18,
-    ESP_BLE_AD_TYPE_APPEARANCE               = 0x19,
-    ESP_BLE_AD_TYPE_ADV_INT                  = 0x1A,
-    ESP_BLE_AD_TYPE_32SOL_SRV_UUID           = 0x1B,
-    ESP_BLE_AD_TYPE_32SERVICE_DATA           = 0x1C,
-    ESP_BLE_AD_TYPE_128SERVICE_DATA          = 0x1D,
-    ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE    = 0xFF,
+    ESP_BLE_AD_TYPE_FLAG                     = 0x01,    /* relate to BTM_BLE_AD_TYPE_FLAG in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_16SRV_PART               = 0x02,    /* relate to BTM_BLE_AD_TYPE_16SRV_PART in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_16SRV_CMPL               = 0x03,    /* relate to BTM_BLE_AD_TYPE_16SRV_CMPL in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_32SRV_PART               = 0x04,    /* relate to BTM_BLE_AD_TYPE_32SRV_PART in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_32SRV_CMPL               = 0x05,    /* relate to BTM_BLE_AD_TYPE_32SRV_CMPL in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_128SRV_PART              = 0x06,    /* relate to BTM_BLE_AD_TYPE_128SRV_PART in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_128SRV_CMPL              = 0x07,    /* relate to BTM_BLE_AD_TYPE_128SRV_CMPL in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_NAME_SHORT               = 0x08,    /* relate to BTM_BLE_AD_TYPE_NAME_SHORT in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_NAME_CMPL                = 0x09,    /* relate to BTM_BLE_AD_TYPE_NAME_CMPL in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_TX_PWR                   = 0x0A,    /* relate to BTM_BLE_AD_TYPE_TX_PWR in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_DEV_CLASS                = 0x0D,    /* relate to BTM_BLE_AD_TYPE_DEV_CLASS in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SM_TK                    = 0x10,    /* relate to BTM_BLE_AD_TYPE_SM_TK in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SM_OOB_FLAG              = 0x11,    /* relate to BTM_BLE_AD_TYPE_SM_OOB_FLAG in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_INT_RANGE                = 0x12,    /* relate to BTM_BLE_AD_TYPE_INT_RANGE in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SOL_SRV_UUID             = 0x14,    /* relate to BTM_BLE_AD_TYPE_SOL_SRV_UUID in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_128SOL_SRV_UUID          = 0x15,    /* relate to BTM_BLE_AD_TYPE_128SOL_SRV_UUID in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SERVICE_DATA             = 0x16,    /* relate to BTM_BLE_AD_TYPE_SERVICE_DATA in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_PUBLIC_TARGET            = 0x17,    /* relate to BTM_BLE_AD_TYPE_PUBLIC_TARGET in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_RANDOM_TARGET            = 0x18,    /* relate to BTM_BLE_AD_TYPE_RANDOM_TARGET in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_APPEARANCE               = 0x19,    /* relate to BTM_BLE_AD_TYPE_APPEARANCE in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_ADV_INT                  = 0x1A,    /* relate to BTM_BLE_AD_TYPE_ADV_INT in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_LE_DEV_ADDR              = 0x1b,    /* relate to BTM_BLE_AD_TYPE_LE_DEV_ADDR in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_LE_ROLE                  = 0x1c,    /* relate to BTM_BLE_AD_TYPE_LE_ROLE in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SPAIR_C256               = 0x1d,    /* relate to BTM_BLE_AD_TYPE_SPAIR_C256 in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_SPAIR_R256               = 0x1e,    /* relate to BTM_BLE_AD_TYPE_SPAIR_R256 in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_32SOL_SRV_UUID           = 0x1f,    /* relate to BTM_BLE_AD_TYPE_32SOL_SRV_UUID in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_32SERVICE_DATA           = 0x20,    /* relate to BTM_BLE_AD_TYPE_32SERVICE_DATA in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_128SERVICE_DATA          = 0x21,    /* relate to BTM_BLE_AD_TYPE_128SERVICE_DATA in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_LE_SECURE_CONFIRM        = 0x22,    /* relate to BTM_BLE_AD_TYPE_LE_SECURE_CONFIRM in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_LE_SECURE_RANDOM         = 0x23,    /* relate to BTM_BLE_AD_TYPE_LE_SECURE_RANDOM in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_URI                      = 0x24,    /* relate to BTM_BLE_AD_TYPE_URI in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_INDOOR_POSITION          = 0x25,    /* relate to BTM_BLE_AD_TYPE_INDOOR_POSITION in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_TRANS_DISC_DATA          = 0x26,    /* relate to BTM_BLE_AD_TYPE_TRANS_DISC_DATA in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_LE_SUPPORT_FEATURE       = 0x27,    /* relate to BTM_BLE_AD_TYPE_LE_SUPPORT_FEATURE in btm_ble_api.h */
+    ESP_BLE_AD_TYPE_CHAN_MAP_UPDATE          = 0x28,    /* relate to BTM_BLE_AD_TYPE_CHAN_MAP_UPDATE in btm_ble_api.h */
+    ESP_BLE_AD_MANUFACTURER_SPECIFIC_TYPE    = 0xFF,    /* relate to BTM_BLE_AD_MANUFACTURER_SPECIFIC_TYPE in btm_ble_api.h */
 } esp_ble_adv_data_type;
 
 /// Advertising mode
@@ -153,15 +168,16 @@ typedef enum {
 } esp_ble_adv_filter_t;
 
 
+/* relate to BTA_DM_BLE_SEC_xxx in bta_api.h */
 typedef enum {
-    ESP_BLE_SEC_NONE,                
-    ESP_BLE_SEC_ENCRYPT,             
-    ESP_BLE_SEC_ENCRYPT_NO_MITM,     
-    ESP_BLE_SEC_ENCRYPT_MITM,        
+    ESP_BLE_SEC_NONE = 0,               /* relate to BTA_DM_BLE_SEC_NONE in bta_api.h */
+    ESP_BLE_SEC_ENCRYPT,                /* relate to BTA_DM_BLE_SEC_ENCRYPT in bta_api.h */
+    ESP_BLE_SEC_ENCRYPT_NO_MITM,        /* relate to BTA_DM_BLE_SEC_ENCRYPT_NO_MITM in bta_api.h */
+    ESP_BLE_SEC_ENCRYPT_MITM,           /* relate to BTA_DM_BLE_SEC_ENCRYPT_MITM in bta_api.h */
 }esp_ble_sec_act_t;
 
 typedef enum {
-    ESP_BLE_SM_PASSKEY,
+    ESP_BLE_SM_PASSKEY = 0,
     ESP_BLE_SM_AUTHEN_REQ_MODE,
     ESP_BLE_SM_IOCAP_MODE,
     ESP_BLE_SM_SET_INIT_KEY,
@@ -364,7 +380,7 @@ typedef struct {
   */
 typedef struct
 {
-    esp_bd_addr_t         bd_addr;               /*!< BD address peer device. */       
+    esp_bd_addr_t         bd_addr;               /*!< BD address peer device. */
     bool                  key_present;           /*!< Valid link key value in key element */
     esp_link_key          key;                   /*!< Link key associated with peer device. */
     uint8_t               key_type;              /*!< The type of Link Key */
@@ -699,7 +715,7 @@ esp_err_t esp_ble_gap_config_scan_rsp_data_raw(uint8_t *raw_data, uint32_t raw_d
 * @param[out]     len : the length of the param value
 *
 * @return            - ESP_OK : success
-*                              - other  : failed
+*                       - other  : failed
 *
 */
 esp_err_t esp_ble_gap_set_security_param(esp_ble_sm_param_t param_type,
@@ -724,8 +740,8 @@ esp_err_t esp_ble_gap_security_rsp(esp_bd_addr_t bd_addr,  bool accept);
 *
 * @param[in]       bd_addr : the address of the peer device need to encryption
 * @param[in]       sec_act  : This is the security action to indicate
-*                                      what kind of BLE security level is required for
-*                                      the BLE link if the BLE is supported
+*                                   what kind of BLE security level is required for
+*                                   the BLE link if the BLE is supported
 *
 * @return            - ESP_OK : success
 *                       - other  : failed
index b092e2c8c96fc90cb77c723a57ce65ba716575db..a5721e0af0fd88c792e617ec567580770f5cffe3 100644 (file)
@@ -153,75 +153,81 @@ extern "C" {
  * @}
  */
 
+/* relate to BTA_GATT_PREP_WRITE_xxx in bta_gatt_api.h */
 /// Attribute write data type from the client
 typedef enum {
-    ESP_GATT_PREP_WRITE_CANCEL    = 0x00,       /*!< Prepare write cancel */
-    ESP_GATT_PREP_WRITE_EXEC      = 0x01,       /*!< Prepare write execute */
+    ESP_GATT_PREP_WRITE_CANCEL    = 0x00,       /*!< Prepare write cancel */  /* relate to BTA_GATT_PREP_WRITE_CANCEL in bta_gatt_api.h */
+    ESP_GATT_PREP_WRITE_EXEC      = 0x01,       /*!< Prepare write execute */ /* relate to BTA_GATT_PREP_WRITE_EXEC in bta_gatt_api.h */
 } esp_gatt_prep_write_type;
 
+/* relate to BTA_GATT_xxx in bta_gatt_api.h */
 /**
  * @brief GATT success code and error codes
  */
 typedef enum {
-    ESP_GATT_OK                     =   0x0,
-    ESP_GATT_INVALID_HANDLE         =   0x01,   /* 0x0001 */
-    ESP_GATT_READ_NOT_PERMIT        =   0x02,   /* 0x0002 */
-    ESP_GATT_WRITE_NOT_PERMIT       =   0x03,   /* 0x0003 */
-    ESP_GATT_INVALID_PDU            =   0x04,   /* 0x0004 */
-    ESP_GATT_INSUF_AUTHENTICATION   =   0x05,   /* 0x0005 */
-    ESP_GATT_REQ_NOT_SUPPORTED      =   0x06,   /* 0x0006 */
-    ESP_GATT_INVALID_OFFSET         =   0x07,   /* 0x0007 */
-    ESP_GATT_INSUF_AUTHORIZATION    =   0x08,   /* 0x0008 */
-    ESP_GATT_PREPARE_Q_FULL         =   0x09,   /* 0x0009 */
-    ESP_GATT_NOT_FOUND              =   0x0a,   /* 0x000a */
-    ESP_GATT_NOT_LONG               =   0x0b,   /* 0x000b */
-    ESP_GATT_INSUF_KEY_SIZE         =   0x0c,   /* 0x000c */
-    ESP_GATT_INVALID_ATTR_LEN       =   0x0d,   /* 0x000d */
-    ESP_GATT_ERR_UNLIKELY           =   0x0e,   /* 0x000e */
-    ESP_GATT_INSUF_ENCRYPTION       =   0x0f,   /* 0x000f */
-    ESP_GATT_UNSUPPORT_GRP_TYPE     =   0x10,   /* 0x0010 */
-    ESP_GATT_INSUF_RESOURCE         =   0x11,   /* 0x0011 */
-
-    ESP_GATT_NO_RESOURCES           =   0x80,   /* 0x80 */
-    ESP_GATT_INTERNAL_ERROR         =   0x81,   /* 0x81 */
-    ESP_GATT_WRONG_STATE            =   0x82,   /* 0x82 */
-    ESP_GATT_DB_FULL                =   0x83,   /* 0x83 */
-    ESP_GATT_BUSY                   =   0x84,   /* 0x84 */
-    ESP_GATT_ERROR                  =   0x85,   /* 0x85 */
-    ESP_GATT_CMD_STARTED            =   0x86,   /* 0x86 */
-    ESP_GATT_ILLEGAL_PARAMETER      =   0x87,   /* 0x87 */
-    ESP_GATT_PENDING                =   0x88,   /* 0x88 */
-    ESP_GATT_AUTH_FAIL              =   0x89,   /* 0x89 */
-    ESP_GATT_MORE                   =   0x8a,   /* 0x8a */
-    ESP_GATT_INVALID_CFG            =   0x8b,   /* 0x8b */
-    ESP_GATT_SERVICE_STARTED        =   0x8c,   /* 0x8c */
-    ESP_GATT_ENCRYPED_MITM          =   ESP_GATT_OK,
-    ESP_GATT_ENCRYPED_NO_MITM       =   0x8d,   /* 0x8d */
-    ESP_GATT_NOT_ENCRYPTED          =   0x8e,   /* 0x8e */
-    ESP_GATT_CONGESTED              =   0x8f,   /* 0x8f */
-    ESP_GATT_DUP_REG                =   0x90,   /* 0x90 */
-    ESP_GATT_ALREADY_OPEN           =   0x91,   /* 0x91 */
-    ESP_GATT_CANCEL                 =   0x92,   /* 0x92 */
-
+    ESP_GATT_OK                     =   0x0,                    /* relate to BTA_GATT_OK in bta_gatt_api.h */
+    ESP_GATT_INVALID_HANDLE         =   0x01,   /* 0x0001 */    /* relate to BTA_GATT_INVALID_HANDLE in bta_gatt_api.h */
+    ESP_GATT_READ_NOT_PERMIT        =   0x02,   /* 0x0002 */    /* relate to BTA_GATT_READ_NOT_PERMIT in bta_gatt_api.h */
+    ESP_GATT_WRITE_NOT_PERMIT       =   0x03,   /* 0x0003 */    /* relate to BTA_GATT_WRITE_NOT_PERMIT in bta_gatt_api.h */
+    ESP_GATT_INVALID_PDU            =   0x04,   /* 0x0004 */    /* relate to BTA_GATT_INVALID_PDU in bta_gatt_api.h */
+    ESP_GATT_INSUF_AUTHENTICATION   =   0x05,   /* 0x0005 */    /* relate to BTA_GATT_INSUF_AUTHENTICATION in bta_gatt_api.h */
+    ESP_GATT_REQ_NOT_SUPPORTED      =   0x06,   /* 0x0006 */    /* relate to BTA_GATT_REQ_NOT_SUPPORTED in bta_gatt_api.h */
+    ESP_GATT_INVALID_OFFSET         =   0x07,   /* 0x0007 */    /* relate to BTA_GATT_INVALID_OFFSET in bta_gatt_api.h */
+    ESP_GATT_INSUF_AUTHORIZATION    =   0x08,   /* 0x0008 */    /* relate to BTA_GATT_INSUF_AUTHORIZATION in bta_gatt_api.h */
+    ESP_GATT_PREPARE_Q_FULL         =   0x09,   /* 0x0009 */    /* relate to BTA_GATT_PREPARE_Q_FULL in bta_gatt_api.h */
+    ESP_GATT_NOT_FOUND              =   0x0a,   /* 0x000a */    /* relate to BTA_GATT_NOT_FOUND in bta_gatt_api.h */
+    ESP_GATT_NOT_LONG               =   0x0b,   /* 0x000b */    /* relate to BTA_GATT_NOT_LONG in bta_gatt_api.h */
+    ESP_GATT_INSUF_KEY_SIZE         =   0x0c,   /* 0x000c */    /* relate to BTA_GATT_INSUF_KEY_SIZE in bta_gatt_api.h */
+    ESP_GATT_INVALID_ATTR_LEN       =   0x0d,   /* 0x000d */    /* relate to BTA_GATT_INVALID_ATTR_LEN in bta_gatt_api.h */
+    ESP_GATT_ERR_UNLIKELY           =   0x0e,   /* 0x000e */    /* relate to BTA_GATT_ERR_UNLIKELY in bta_gatt_api.h */
+    ESP_GATT_INSUF_ENCRYPTION       =   0x0f,   /* 0x000f */    /* relate to BTA_GATT_INSUF_ENCRYPTION in bta_gatt_api.h */
+    ESP_GATT_UNSUPPORT_GRP_TYPE     =   0x10,   /* 0x0010 */    /* relate to BTA_GATT_UNSUPPORT_GRP_TYPE in bta_gatt_api.h */
+    ESP_GATT_INSUF_RESOURCE         =   0x11,   /* 0x0011 */    /* relate to BTA_GATT_INSUF_RESOURCE in bta_gatt_api.h */
+
+    ESP_GATT_NO_RESOURCES           =   0x80,   /* 0x80 */    /* relate to BTA_GATT_NO_RESOURCES in bta_gatt_api.h */
+    ESP_GATT_INTERNAL_ERROR         =   0x81,   /* 0x81 */    /* relate to BTA_GATT_INTERNAL_ERROR in bta_gatt_api.h */
+    ESP_GATT_WRONG_STATE            =   0x82,   /* 0x82 */    /* relate to BTA_GATT_WRONG_STATE in bta_gatt_api.h */
+    ESP_GATT_DB_FULL                =   0x83,   /* 0x83 */    /* relate to BTA_GATT_DB_FULL in bta_gatt_api.h */
+    ESP_GATT_BUSY                   =   0x84,   /* 0x84 */    /* relate to BTA_GATT_BUSY in bta_gatt_api.h */
+    ESP_GATT_ERROR                  =   0x85,   /* 0x85 */    /* relate to BTA_GATT_ERROR in bta_gatt_api.h */
+    ESP_GATT_CMD_STARTED            =   0x86,   /* 0x86 */    /* relate to BTA_GATT_CMD_STARTED in bta_gatt_api.h */
+    ESP_GATT_ILLEGAL_PARAMETER      =   0x87,   /* 0x87 */    /* relate to BTA_GATT_ILLEGAL_PARAMETER in bta_gatt_api.h */
+    ESP_GATT_PENDING                =   0x88,   /* 0x88 */    /* relate to BTA_GATT_PENDING in bta_gatt_api.h */
+    ESP_GATT_AUTH_FAIL              =   0x89,   /* 0x89 */    /* relate to BTA_GATT_AUTH_FAIL in bta_gatt_api.h */
+    ESP_GATT_MORE                   =   0x8a,   /* 0x8a */    /* relate to BTA_GATT_MORE in bta_gatt_api.h */
+    ESP_GATT_INVALID_CFG            =   0x8b,   /* 0x8b */    /* relate to BTA_GATT_INVALID_CFG in bta_gatt_api.h */
+    ESP_GATT_SERVICE_STARTED        =   0x8c,   /* 0x8c */    /* relate to BTA_GATT_SERVICE_STARTED in bta_gatt_api.h */
+    ESP_GATT_ENCRYPED_MITM          =   ESP_GATT_OK,    /* relate to BTA_GATT_ENCRYPED_MITM in bta_gatt_api.h */
+    ESP_GATT_ENCRYPED_NO_MITM       =   0x8d,   /* 0x8d */    /* relate to BTA_GATT_ENCRYPED_NO_MITM in bta_gatt_api.h */
+    ESP_GATT_NOT_ENCRYPTED          =   0x8e,   /* 0x8e */    /* relate to BTA_GATT_NOT_ENCRYPTED in bta_gatt_api.h */
+    ESP_GATT_CONGESTED              =   0x8f,   /* 0x8f */    /* relate to BTA_GATT_CONGESTED in bta_gatt_api.h */
+    ESP_GATT_DUP_REG                =   0x90,   /* 0x90 */    /* relate to BTA_GATT_DUP_REG in bta_gatt_api.h */
+    ESP_GATT_ALREADY_OPEN           =   0x91,   /* 0x91 */    /* relate to BTA_GATT_ALREADY_OPEN in bta_gatt_api.h */
+    ESP_GATT_CANCEL                 =   0x92,   /* 0x92 */    /* relate to BTA_GATT_CANCEL in bta_gatt_api.h */
     /* 0xE0 ~ 0xFC reserved for future use */
-    ESP_GATT_CCC_CFG_ERR            =   0xfd,   /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
-    ESP_GATT_PRC_IN_PROGRESS        =   0xfe,   /* 0xFE Procedure Already in progress */
-    ESP_GATT_OUT_OF_RANGE           =   0xff,   /* 0xFFAttribute value out of range */
+    ESP_GATT_STACK_RSP              =   0xe0,   /* 0xe0 */    /* relate to BTA_GATT_STACK_RSP in bta_gatt_api.h */
+    ESP_GATT_APP_RSP                =   0xe1,   /* 0xe1 */    /* relate to BTA_GATT_APP_RSP in bta_gatt_api.h */
+    //Error caused by customer application or stack bug
+    ESP_GATT_UNKNOWN_ERROR          =   0xef,   /* 0xef */    /* relate to BTA_GATT_UNKNOWN_ERROR in bta_gatt_api.h */
+    ESP_GATT_CCC_CFG_ERR            =   0xfd,   /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */    /* relate to BTA_GATT_CCC_CFG_ERR in bta_gatt_api.h */
+    ESP_GATT_PRC_IN_PROGRESS        =   0xfe,   /* 0xFE Procedure Already in progress */  /* relate to BTA_GATT_PRC_IN_PROGRESS in bta_gatt_api.h */
+    ESP_GATT_OUT_OF_RANGE           =   0xff,   /* 0xFFAttribute value out of range */    /* relate to BTA_GATT_OUT_OF_RANGE in bta_gatt_api.h */
 } esp_gatt_status_t;
 
+/* relate to BTA_GATT_CONN_xxx in bta_gatt_api.h */
 /**
  * @brief Gatt Connection reason enum
  */
 typedef enum {
-    ESP_GATT_CONN_UNKNOWN = 0,                      /*!< Gatt connection unknown */
-    ESP_GATT_CONN_L2C_FAILURE = 1,                  /*!< General L2cap failure  */
-    ESP_GATT_CONN_TIMEOUT = 0x08,                   /*!< Connection timeout  */
-    ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13,       /*!< Connection terminate by peer user  */
-    ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16,      /*!< Connectionterminated by local host */
-    ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e,            /*!< Connection fail to establish  */
-    ESP_GATT_CONN_LMP_TIMEOUT = 0x22,               /*!< Connection fail for LMP response tout */
-    ESP_GATT_CONN_CONN_CANCEL = 0x0100,             /*!< L2CAP connection cancelled  */
-    ESP_GATT_CONN_NONE = 0x0101                     /*!< No connection to cancel  */
+    ESP_GATT_CONN_UNKNOWN = 0,                      /*!< Gatt connection unknown */               /* relate to BTA_GATT_CONN_UNKNOWN in bta_gatt_api.h */
+    ESP_GATT_CONN_L2C_FAILURE = 1,                  /*!< General L2cap failure  */                /* relate to BTA_GATT_CONN_L2C_FAILURE in bta_gatt_api.h */
+    ESP_GATT_CONN_TIMEOUT = 0x08,                   /*!< Connection timeout  */                   /* relate to BTA_GATT_CONN_TIMEOUT in bta_gatt_api.h */
+    ESP_GATT_CONN_TERMINATE_PEER_USER = 0x13,       /*!< Connection terminate by peer user  */    /* relate to BTA_GATT_CONN_TERMINATE_PEER_USER in bta_gatt_api.h */
+    ESP_GATT_CONN_TERMINATE_LOCAL_HOST = 0x16,      /*!< Connectionterminated by local host */    /* relate to BTA_GATT_CONN_TERMINATE_LOCAL_HOST in bta_gatt_api.h */
+    ESP_GATT_CONN_FAIL_ESTABLISH = 0x3e,            /*!< Connection fail to establish  */         /* relate to BTA_GATT_CONN_FAIL_ESTABLISH in bta_gatt_api.h */
+    ESP_GATT_CONN_LMP_TIMEOUT = 0x22,               /*!< Connection fail for LMP response tout */ /* relate to BTA_GATT_CONN_LMP_TIMEOUT in bta_gatt_api.h */
+    ESP_GATT_CONN_CONN_CANCEL = 0x0100,             /*!< L2CAP connection cancelled  */           /* relate to BTA_GATT_CONN_CONN_CANCEL in bta_gatt_api.h */
+    ESP_GATT_CONN_NONE = 0x0101                     /*!< No connection to cancel  */              /* relate to BTA_GATT_CONN_NONE in bta_gatt_api.h */
 } esp_gatt_conn_reason_t;
 
 /**
@@ -241,41 +247,44 @@ typedef struct {
     bool            is_primary;             /*!< This service is primary or not */
 } __attribute__((packed)) esp_gatt_srvc_id_t;
 
+/* relate to BTA_GATT_AUTH_REQ_xxx in bta_gatt_api.h */
 /**
  * @brief Gatt authentication request type
  */
 typedef enum {
-    ESP_GATT_AUTH_REQ_NONE                  = 0,
-    ESP_GATT_AUTH_REQ_NO_MITM               = 1,   /* unauthenticated encryption */
-    ESP_GATT_AUTH_REQ_MITM                  = 2,   /* authenticated encryption */
-    ESP_GATT_AUTH_REQ_SIGNED_NO_MITM        = 3,
-    ESP_GATT_AUTH_REQ_SIGNED_MITM           = 4,
+    ESP_GATT_AUTH_REQ_NONE                  = 0,                                       /* relate to BTA_GATT_AUTH_REQ_NONE in bta_gatt_api.h */
+    ESP_GATT_AUTH_REQ_NO_MITM               = 1,   /* unauthenticated encryption */    /* relate to BTA_GATT_AUTH_REQ_NO_MITM in bta_gatt_api.h */
+    ESP_GATT_AUTH_REQ_MITM                  = 2,   /* authenticated encryption */      /* relate to BTA_GATT_AUTH_REQ_MITM in bta_gatt_api.h */
+    ESP_GATT_AUTH_REQ_SIGNED_NO_MITM        = 3,                                       /* relate to BTA_GATT_AUTH_REQ_SIGNED_NO_MITM in bta_gatt_api.h */
+    ESP_GATT_AUTH_REQ_SIGNED_MITM           = 4,                                       /* relate to BTA_GATT_AUTH_REQ_SIGNED_MITM in bta_gatt_api.h */
 } esp_gatt_auth_req_t;
 
+/* relate to BTA_GATT_PERM_xxx in bta_gatt_api.h */
 /**
  * @brief Attribute permissions
  */
 typedef enum {
-    ESP_GATT_PERM_READ                  =   (1 << 0),   /* bit 0 -  0x0001 */
-    ESP_GATT_PERM_READ_ENCRYPTED        =   (1 << 1),   /* bit 1 -  0x0002 */
-    ESP_GATT_PERM_READ_ENC_MITM         =   (1 << 2),   /* bit 2 -  0x0004 */
-    ESP_GATT_PERM_WRITE                 =   (1 << 4),   /* bit 4 -  0x0010 */
-    ESP_GATT_PERM_WRITE_ENCRYPTED       =   (1 << 5),   /* bit 5 -  0x0020 */
-    ESP_GATT_PERM_WRITE_ENC_MITM        =   (1 << 6),   /* bit 6 -  0x0040 */
-    ESP_GATT_PERM_WRITE_SIGNED          =   (1 << 7),   /* bit 7 -  0x0080 */
-    ESP_GATT_PERM_WRITE_SIGNED_MITM     =   (1 << 8),   /* bit 8 -  0x0100 */
+    ESP_GATT_PERM_READ                  =   (1 << 0),   /* bit 0 -  0x0001 */    /* relate to BTA_GATT_PERM_READ in bta_gatt_api.h */
+    ESP_GATT_PERM_READ_ENCRYPTED        =   (1 << 1),   /* bit 1 -  0x0002 */    /* relate to BTA_GATT_PERM_READ_ENCRYPTED in bta_gatt_api.h */
+    ESP_GATT_PERM_READ_ENC_MITM         =   (1 << 2),   /* bit 2 -  0x0004 */    /* relate to BTA_GATT_PERM_READ_ENC_MITM in bta_gatt_api.h */
+    ESP_GATT_PERM_WRITE                 =   (1 << 4),   /* bit 4 -  0x0010 */    /* relate to BTA_GATT_PERM_WRITE in bta_gatt_api.h */
+    ESP_GATT_PERM_WRITE_ENCRYPTED       =   (1 << 5),   /* bit 5 -  0x0020 */    /* relate to BTA_GATT_PERM_WRITE_ENCRYPTED in bta_gatt_api.h */
+    ESP_GATT_PERM_WRITE_ENC_MITM        =   (1 << 6),   /* bit 6 -  0x0040 */    /* relate to BTA_GATT_PERM_WRITE_ENC_MITM in bta_gatt_api.h */
+    ESP_GATT_PERM_WRITE_SIGNED          =   (1 << 7),   /* bit 7 -  0x0080 */    /* relate to BTA_GATT_PERM_WRITE_SIGNED in bta_gatt_api.h */
+    ESP_GATT_PERM_WRITE_SIGNED_MITM     =   (1 << 8),   /* bit 8 -  0x0100 */    /* relate to BTA_GATT_PERM_WRITE_SIGNED_MITM in bta_gatt_api.h */
 } esp_gatt_perm_t;
 
+/* relate to BTA_GATT_CHAR_PROP_BIT_xxx in bta_gatt_api.h */
 /* definition of characteristic properties */
 typedef enum {
-    ESP_GATT_CHAR_PROP_BIT_BROADCAST    =   (1 << 0),       /* 0x01 */
-    ESP_GATT_CHAR_PROP_BIT_READ         =   (1 << 1),       /* 0x02 */
-    ESP_GATT_CHAR_PROP_BIT_WRITE_NR     =   (1 << 2),       /* 0x04 */
-    ESP_GATT_CHAR_PROP_BIT_WRITE        =   (1 << 3),       /* 0x08 */
-    ESP_GATT_CHAR_PROP_BIT_NOTIFY       =   (1 << 4),       /* 0x10 */
-    ESP_GATT_CHAR_PROP_BIT_INDICATE     =   (1 << 5),       /* 0x20 */
-    ESP_GATT_CHAR_PROP_BIT_AUTH         =   (1 << 6),       /* 0x40 */
-    ESP_GATT_CHAR_PROP_BIT_EXT_PROP     =   (1 << 7),       /* 0x80 */
+    ESP_GATT_CHAR_PROP_BIT_BROADCAST    =   (1 << 0),       /* 0x01 */    /* relate to BTA_GATT_CHAR_PROP_BIT_BROADCAST in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_READ         =   (1 << 1),       /* 0x02 */    /* relate to BTA_GATT_CHAR_PROP_BIT_READ in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_WRITE_NR     =   (1 << 2),       /* 0x04 */    /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE_NR in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_WRITE        =   (1 << 3),       /* 0x08 */    /* relate to BTA_GATT_CHAR_PROP_BIT_WRITE in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_NOTIFY       =   (1 << 4),       /* 0x10 */    /* relate to BTA_GATT_CHAR_PROP_BIT_NOTIFY in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_INDICATE     =   (1 << 5),       /* 0x20 */    /* relate to BTA_GATT_CHAR_PROP_BIT_INDICATE in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_AUTH         =   (1 << 6),       /* 0x40 */    /* relate to BTA_GATT_CHAR_PROP_BIT_AUTH in bta_gatt_api.h */
+    ESP_GATT_CHAR_PROP_BIT_EXT_PROP     =   (1 << 7),       /* 0x80 */    /* relate to BTA_GATT_CHAR_PROP_BIT_EXT_PROP in bta_gatt_api.h */
 } esp_gatt_char_prop_t;
 
 /// GATT maximum attribute length
index 501b8a5ad2769ae77907234a06fc96ca9942e73b..0c6baa92d51633771c1566418c576ed856b464e6 100644 (file)
@@ -1067,6 +1067,7 @@ typedef void (tBTA_DM_EXEC_CBACK) (void *p_param);
 /* Encryption callback*/
 typedef void (tBTA_DM_ENCRYPT_CBACK) (BD_ADDR bd_addr, tBTA_TRANSPORT transport, tBTA_STATUS result);
 
+/* relate to ESP_BLE_SEC_xxx in esp_gatt_defs.h */
 #if BLE_INCLUDED == TRUE
 #define BTA_DM_BLE_SEC_NONE         BTM_BLE_SEC_NONE
 #define BTA_DM_BLE_SEC_ENCRYPT      BTM_BLE_SEC_ENCRYPT
index c4e9ace658676733c36895cfdb7a71ff5fdb7359..796a0171c25709d8641781557b25503cc39ccacc 100644 (file)
@@ -55,6 +55,7 @@ typedef struct {
     UINT8       inst_id;        /* instance ID */
 } __attribute__((packed)) tBTA_GATT_ID;
 
+/* relate to ESP_GATT_xxx in esp_gatt_def.h */
 /* Success code and error codes */
 #define  BTA_GATT_OK                        GATT_SUCCESS
 #define  BTA_GATT_INVALID_HANDLE            GATT_INVALID_HANDLE                /* 0x0001 */
@@ -94,14 +95,19 @@ typedef struct {
 #define  BTA_GATT_NOT_ENCRYPTED             GATT_NOT_ENCRYPTED                 /* 0x8e */
 #define  BTA_GATT_CONGESTED                 GATT_CONGESTED                     /* 0x8f */
 
-#define  BTA_GATT_DUP_REG                   0x90                               /* 0x90 */
-#define  BTA_GATT_ALREADY_OPEN              0x91                               /* 0x91 */
-#define  BTA_GATT_CANCEL                    0x92                               /* 0x92 */
+#define  BTA_GATT_DUP_REG                   GATT_DUP_REG                       /* 0x90 */
+#define  BTA_GATT_ALREADY_OPEN              GATT_ALREADY_OPEN                  /* 0x91 */
+#define  BTA_GATT_CANCEL                    GATT_CANCEL                        /* 0x92 */
 
 /* 0xE0 ~ 0xFC reserved for future use */
-#define  BTA_GATT_CCC_CFG_ERR                GATT_CCC_CFG_ERR     /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
-#define  BTA_GATT_PRC_IN_PROGRESS            GATT_PRC_IN_PROGRESS /* 0xFE Procedure Already in progress */
-#define  BTA_GATT_OUT_OF_RANGE               GATT_OUT_OF_RANGE    /* 0xFFAttribute value out of range */
+#define  BTA_GATT_STACK_RSP                 GATT_STACK_RSP                    /* 0xE0 */
+#define  BTA_GATT_APP_RSP                   GATT_APP_RSP                      /* 0xE1 */
+//Error caused by customer application or stack bug
+#define  BTA_GATT_UNKNOWN_ERROR             GATT_UNKNOWN_ERROR                /* 0XEF */
+
+#define  BTA_GATT_CCC_CFG_ERR               GATT_CCC_CFG_ERR     /* 0xFD Client Characteristic Configuration Descriptor Improperly Configured */
+#define  BTA_GATT_PRC_IN_PROGRESS           GATT_PRC_IN_PROGRESS /* 0xFE Procedure Already in progress */
+#define  BTA_GATT_OUT_OF_RANGE              GATT_OUT_OF_RANGE    /* 0xFFAttribute value out of range */
 
 typedef UINT8 tBTA_GATT_STATUS;
 
@@ -188,6 +194,7 @@ typedef struct {
 #define BTA_GATTC_TYPE_WRITE_NO_RSP      GATT_WRITE_NO_RSP
 typedef UINT8 tBTA_GATTC_WRITE_TYPE;
 
+/* relate to ESP_GATT_CONN_xxx in esp_gatt_defs.h */
 #define BTA_GATT_CONN_UNKNOWN                   0
 #define BTA_GATT_CONN_L2C_FAILURE               GATT_CONN_L2C_FAILURE         /* general l2cap resource failure */
 #define BTA_GATT_CONN_TIMEOUT                   GATT_CONN_TIMEOUT             /* 0x08 connection timeout  */
@@ -240,6 +247,7 @@ typedef struct {
 
 } tBTA_GATTC_MULTI;
 
+/* relate to ESP_GATT_xxx in esp_gatt_def.h */
 #define BTA_GATT_AUTH_REQ_NONE           GATT_AUTH_REQ_NONE
 #define BTA_GATT_AUTH_REQ_NO_MITM        GATT_AUTH_REQ_NO_MITM            /* unauthenticated encryption */
 #define BTA_GATT_AUTH_REQ_MITM           GATT_AUTH_REQ_MITM               /* authenticated encryption */
@@ -418,7 +426,7 @@ typedef void (tBTA_GATTC_CBACK)(tBTA_GATTC_EVT event, tBTA_GATTC *p_data);
 #define BTA_GATTS_CLOSE_EVT                             18
 #define BTA_GATTS_LISTEN_EVT                            19
 #define BTA_GATTS_CONGEST_EVT                           20
-#define BTA_GATTS_SET_ATTR_VAL_EVT                      21
+#define BTA_GATTS_SET_ATTR_VAL_EVT                      23
 
 typedef UINT8  tBTA_GATTS_EVT;
 typedef tGATT_IF tBTA_GATTS_IF;
@@ -489,6 +497,7 @@ typedef tGATT_VALUE tBTA_GATT_VALUE;
 /* attribute response data */
 typedef tGATTS_RSP tBTA_GATTS_RSP;
 
+/* relate to ESP_GATT_PREP_WRITE_xxx in esp_gatt_defs.h */
 /* attribute request data from the client */
 #define BTA_GATT_PREP_WRITE_CANCEL   0x00
 #define BTA_GATT_PREP_WRITE_EXEC     0x01
index 3f12d578a1e4bb93787e05b58cd0ad4679809887..6506bf601d22871dcbc865f2339caf52f6f1cb15 100644 (file)
@@ -75,8 +75,9 @@ typedef struct {
 /** Bluetooth Error Status */
 /** We need to build on this */
 
+/* relate to ESP_BT_STATUS_xxx in esp_bt_defs.h */
 typedef enum {
-    BT_STATUS_SUCCESS,
+    BT_STATUS_SUCCESS = 0,
     BT_STATUS_FAIL,
     BT_STATUS_NOT_READY,
     BT_STATUS_NOMEM,
index 1379b43b72937ba9bb55f1855a74ef981462ba3d..ad7a913023b89fc15a8c1f286c16e3b9c31a85ff 100644 (file)
@@ -270,7 +270,7 @@ static tGATT_STATUS read_attr_value (void *p_attr,
     } else { /* characteristic description or characteristic value */
         if (p_attr16->control.auto_rsp == GATT_RSP_BY_STACK) {
             if (p_attr16->p_value == NULL || p_attr16->p_value->attr_val.attr_val == NULL) {
-                status = GATT_ESP_ERROR;
+                status = GATT_UNKNOWN_ERROR;
             }
             else if (offset > p_attr16->p_value->attr_val.attr_len){
                        /*if offset equal to max_len, should respond with zero byte value
@@ -953,7 +953,7 @@ tGATT_STATUS gatts_write_attr_value_by_handle(tGATT_SVC_DB *p_db,
                 } else if ((p_attr->p_value == NULL) || (p_attr->p_value->attr_val.attr_val == NULL)){
                     GATT_TRACE_ERROR("Error in %s, line=%d, %s should not be NULL here\n", __func__, __LINE__, \
                                     (p_attr->p_value == NULL) ? "p_value" : "attr_val.attr_val");
-                    return GATT_ESP_ERROR;
+                    return GATT_UNKNOWN_ERROR;
                 }
             }
 
index c22f6007184d284dae9ee93ab3b75ba9a8a38201..1dd3699f597a8d010f8168bcee82fd4027d6e153 100644 (file)
@@ -1233,7 +1233,7 @@ void gatt_attr_process_prepare_write (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 hand
                         } else if (p_attr->p_value == NULL) {
                             LOG_ERROR("Error in %s, attribute of handle 0x%x not allocate value buffer\n",
                                         __func__, handle);
-                            status = GATT_ESP_ERROR;
+                            status = GATT_UNKNOWN_ERROR;
                         } else {
                              //valid prepare write request, need to send response and queue the data
                              //status: GATT_SUCCESS
@@ -1245,7 +1245,7 @@ void gatt_attr_process_prepare_write (tGATT_TCB *p_tcb, UINT8 i_rcb, UINT16 hand
                 }
             }
         } else{
-            status = GATT_ESP_ERROR;
+            status = GATT_UNKNOWN_ERROR;
             GATT_TRACE_ERROR("Error in %s, Line %d: GATT BUSY\n", __func__, __LINE__);
         }
     }
index 5a0d6fa46bd91504e5a22bb878b6f323075c9709..af0d8df21fff3b29a218bcb42fc097f5958c599d 100644 (file)
@@ -1350,6 +1350,7 @@ enum {
 };
 typedef UINT8 tBTM_SP_EVT;
 
+/* relate to ESP_IO_CAP_xxx in esp_gap_ble_api.h */
 #define BTM_IO_CAP_OUT      0   /* DisplayOnly */
 #define BTM_IO_CAP_IO       1   /* DisplayYesNo */
 #define BTM_IO_CAP_IN       2   /* KeyboardOnly */
@@ -1531,6 +1532,7 @@ typedef void (tBTM_BOND_CANCEL_CMPL_CALLBACK) (tBTM_STATUS result);
 
 /* LE related event and data structure
 */
+/* relate to ESP_LE_KEY_xxx in esp_gap_ble_api.h */
 #if (SMP_INCLUDED == TRUE)
 #define BTM_LE_IO_REQ_EVT       SMP_IO_CAP_REQ_EVT     /* received IO_CAPABILITY_REQUEST event */
 #define BTM_LE_SEC_REQUEST_EVT  SMP_SEC_REQUEST_EVT    /* security request event */
@@ -1562,6 +1564,8 @@ typedef UINT8 tBTM_LE_EVT;
 #define BTM_LE_KEY_LCSRK     (SMP_SEC_KEY_TYPE_CSRK << 4) /* local CSRK has been deliver to peer */
 #endif  ///BLE_INCLUDED == TRUE && SMP_INCLUDED == TRUE
 typedef UINT8 tBTM_LE_KEY_TYPE;
+
+/* relate to ESP_LE_AUTH_xxx in esp_gap_ble_api.h */
 #if (SMP_INCLUDED == TRUE)
 #define BTM_LE_AUTH_REQ_NO_BOND SMP_AUTH_NO_BOND   /* 0 */
 #define BTM_LE_AUTH_REQ_BOND    SMP_AUTH_GEN_BOND  /* 1 << 0 */
index 3a9d23a2a5c6a6cfed1f6d81778bd7aeee15c04d..1b78276cb3cbebd299249a8ee66ec3d8aced7cc5 100644 (file)
@@ -310,6 +310,7 @@ typedef void (tBTM_RAND_ENC_CB) (tBTM_RAND_ENC *p1);
 
 typedef  UINT32  tBTM_BLE_AD_MASK;
 
+/* relate to ESP_BLE_AD_TYPE_xxx in esp_gap_ble_api.h */
 #define BTM_BLE_AD_TYPE_FLAG                HCI_EIR_FLAGS_TYPE                  /* 0x01 */
 #define BTM_BLE_AD_TYPE_16SRV_PART          HCI_EIR_MORE_16BITS_UUID_TYPE       /* 0x02 */
 #define BTM_BLE_AD_TYPE_16SRV_CMPL          HCI_EIR_COMPLETE_16BITS_UUID_TYPE   /* 0x03 */
index 0017d0fa08a7a7e248225b12dd5f697b65128949..76d8c4659a55c79644c3518484568b41c795f25e 100644 (file)
@@ -46,7 +46,6 @@
 #define  GATT_INSUF_RESOURCE                 0x11
 
 
-#define  GATT_ILLEGAL_PARAMETER              0x87
 #define  GATT_NO_RESOURCES                   0x80
 #define  GATT_INTERNAL_ERROR                 0x81
 #define  GATT_WRONG_STATE                    0x82
@@ -54,6 +53,7 @@
 #define  GATT_BUSY                           0x84
 #define  GATT_ERROR                          0x85
 #define  GATT_CMD_STARTED                    0x86
+#define  GATT_ILLEGAL_PARAMETER              0x87
 #define  GATT_PENDING                        0x88
 #define  GATT_AUTH_FAIL                      0x89
 #define  GATT_MORE                           0x8a
 #define  GATT_ENCRYPED_NO_MITM               0x8d
 #define  GATT_NOT_ENCRYPTED                  0x8e
 #define  GATT_CONGESTED                      0x8f
-#define  GATT_STACK_RSP                      0x90
-#define  GATT_APP_RSP                        0x91
-//Error caused by customer application or stack bug
-#define  GATT_ESP_ERROR                      0X9f
+
+#define  GATT_DUP_REG                        0x90 
+#define  GATT_ALREADY_OPEN                   0x91
+#define  GATT_CANCEL                         0x92
 
 /* 0xE0 ~ 0xFC reserved for future use */
+#define  GATT_STACK_RSP                      0xE0
+#define  GATT_APP_RSP                        0xE1
+//Error caused by customer application or stack bug
+#define  GATT_UNKNOWN_ERROR                  0XEF
+
 #define  GATT_CCC_CFG_ERR                    0xFD /* Client Characteristic Configuration Descriptor Improperly Configured */
 #define  GATT_PRC_IN_PROGRESS                0xFE /* Procedure Already in progress */
 #define  GATT_OUT_OF_RANGE                   0xFF /* Attribute value out of range */
+
 typedef UINT8 tGATT_STATUS;