Skip to content

Commit

Permalink
This is a combination of 4 commits.
Browse files Browse the repository at this point in the history
squash again all the commit.

component/bt: Change all the gattc API && bta gattc layer.

component/bt: Debug the code and change the btc_ble_gattc_get_db method.

component/bt: Change the gatt read API interface.

component/bt: Reconstruction the BTA_gattc_cache code.

component/bt: Change back the bluedroid_get_status to marco.

component/bt: Added the serch service res start_handle & end_handle to the result.

component/bt: Change the gattc docs format.

component/bt: Change the docs format.

component/bt: fix the read char value bug.

component/bt: change the gattc_get_attr_count method.

component/bt: Change back the bta_gattc write ccc code.

component/bt: Change the gattc api docs format

component/bt: Change the gattc API docs.

component/bt: Change the prepare write descriptor method to avoid the exection.

Component/bt: modify gatt clinet demo with new API

component/bt: Change the p_src_data->read.p_value to avoid exection.

compoent/bt: Change the bugfix of gattc unreg for the notify.

Modify gattc security demo

component/bt: Change the log error.

Component/bt: modify gattc_multi_connect demo

componnet/bt: Change the bta_gattc_cache sdp include.

component/bt: Change the start_handle & end_handle not from the service.

component/bt: Change the gattc API docs.

component/bt: Change the return issues.

component/bt: Fixed the include service bug.

component/bt: Modify gattc_multi_connect demo , add scan log

component/bt: Fixed the BTA_GATTC_GetIncludeService start handle & end handle error bug.

component/bt: Fix the invalid handle of the get all char issues.

component/bt: Fix the bug with get_db_size_with_type of the start handle & end_handle not correted issue.

component/bt: Fixed the get secondly service num not correct issue.

component/bt: Fixed the last service handle not correted issue.
  • Loading branch information
Yulong-espressif committed Sep 12, 2017
1 parent b6d82ee commit 1759a47
Show file tree
Hide file tree
Showing 20 changed files with 3,535 additions and 2,739 deletions.
349 changes: 219 additions & 130 deletions components/bt/bluedroid/api/esp_gattc_api.c

Large diffs are not rendered by default.

113 changes: 90 additions & 23 deletions components/bt/bluedroid/api/include/esp_gatt_defs.h
Expand Up @@ -27,6 +27,7 @@ extern "C" {
#define ESP_GATT_ILLEGAL_HANDLE 0
/// GATT attribute max handle
#define ESP_GATT_ATTR_HANDLE_MAX 100
#define ESP_GATT_MAX_READ_MULTI_HANDLES 10 /* Max attributes to read in one request */


/**@{
Expand Down Expand Up @@ -294,12 +295,12 @@ typedef uint8_t esp_gatt_char_prop_t;
*/
typedef struct
{
uint16_t uuid_length; /*!< UUID length */
uint8_t *uuid_p; /*!< UUID value */
uint16_t perm; /*!< Attribute permission */
uint16_t max_length; /*!< Maximum length of the element*/
uint16_t length; /*!< Current length of the element*/
uint8_t *value; /*!< Element value array*/
uint16_t uuid_length; /*!< UUID length */
uint8_t *uuid_p; /*!< UUID value */
uint16_t perm; /*!< Attribute permission */
uint16_t max_length; /*!< Maximum length of the element*/
uint16_t length; /*!< Current length of the element*/
uint8_t *value; /*!< Element value array*/
} esp_attr_desc_t;


Expand All @@ -313,8 +314,8 @@ typedef struct
/**
* @brief if auto_rsp set to ESP_GATT_RSP_BY_APP, means the response of Write/Read operation will by replied by application.
if auto_rsp set to ESP_GATT_AUTO_RSP, means the response of Write/Read operation will be replied by GATT stack automatically.
*/
uint8_t auto_rsp;
*/
uint8_t auto_rsp;
} esp_attr_control_t;


Expand All @@ -323,8 +324,8 @@ typedef struct
*/
typedef struct
{
esp_attr_control_t attr_control; /*!< The attribute control type*/
esp_attr_desc_t att_desc; /*!< The attribute type*/
esp_attr_control_t attr_control; /*!< The attribute control type */
esp_attr_desc_t att_desc; /*!< The attribute type */
} esp_gatts_attr_db_t;


Expand All @@ -333,9 +334,9 @@ typedef struct
*/
typedef struct
{
uint16_t attr_max_len; /*!< attribute max value length */
uint16_t attr_len; /*!< attribute current value length */
uint8_t *attr_value; /*!< the pointer to attribute value */
uint16_t attr_max_len; /*!< attribute max value length */
uint16_t attr_len; /*!< attribute current value length */
uint8_t *attr_value; /*!< the pointer to attribute value */
} esp_attr_value_t;


Expand All @@ -344,22 +345,19 @@ typedef struct
*/
typedef struct
{
uint16_t start_hdl; /*!< Gatt start handle value of included service */
uint16_t end_hdl; /*!< Gatt end handle value of included service */
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */
uint16_t start_hdl; /*!< Gatt start handle value of included service */
uint16_t end_hdl; /*!< Gatt end handle value of included service */
uint16_t uuid; /*!< Gatt attribute value UUID of included service */
} esp_gatts_incl_svc_desc_t; /*!< Gatt include service entry element */

/**
* @brief Gatt include 128 bit service entry element
*/
typedef struct
{
uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */



uint16_t start_hdl; /*!< Gatt start handle value of included 128 bit service */
uint16_t end_hdl; /*!< Gatt end handle value of included 128 bit service */
} esp_gatts_incl128_svc_desc_t; /*!< Gatt include 128 bit service entry element */

/// Gatt attribute value
typedef struct {
Expand Down Expand Up @@ -388,6 +386,75 @@ typedef enum {

typedef uint8_t esp_gatt_if_t; /*!< Gatt interface type, different application on GATT client use different gatt_if */

/**
* @brief the type of attribute element
*/
typedef enum {
ESP_GATT_DB_PRIMARY_SERVICE, /*!< Gattc primary service attribute type in the cache */
ESP_GATT_DB_SECONDARY_SERVICE, /*!< Gattc secondary service attribute type in the cache */
ESP_GATT_DB_CHARACTERISTIC, /*!< Gattc characteristic attribute type in the cache */
ESP_GATT_DB_DESCRIPTOR, /*!< Gattc characteristic descriptor attribute type in the cache */
ESP_GATT_DB_INCLUDED_SERVICE, /*!< Gattc include service attribute type in the cache */
ESP_GATT_DB_ALL, /*!< Gattc all the attribute (primary service & secondary service & include service & char & descriptor) type in the cache */
} esp_gatt_db_attr_type_t; /*!< Gattc attribute type element */

/**
* @brief read multiple attribute
*/
typedef struct {
uint8_t num_attr; /*!< The number of the attribute */
uint16_t handles[ESP_GATT_MAX_READ_MULTI_HANDLES]; /*!< The handles list */
} esp_gattc_multi_t; /*!< The gattc multiple read element */

/**
* @brief data base attribute element
*/
typedef struct {
esp_gatt_db_attr_type_t type; /*!< The attribute type */
uint16_t attribute_handle; /*!< The attribute handle, it's valid for all of the type */
uint16_t start_handle; /*!< The service start handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
uint16_t end_handle; /*!< The service end handle, it's valid only when the type = ESP_GATT_DB_PRIMARY_SERVICE or ESP_GATT_DB_SECONDARY_SERVICE */
esp_gatt_char_prop_t properties; /*!< The characteristic properties, it's valid only when the type = ESP_GATT_DB_CHARACTERISTIC */
esp_bt_uuid_t uuid; /*!< The attribute uuid, it's valid for all of the type */
} esp_gattc_db_elem_t; /*!< The gattc service data base element in the cache */

/**
* @brief service element
*/
typedef struct {
bool is_primary; /*!< The service flag, ture if the service is primary service, else is secondly service */
uint16_t start_handle; /*!< The start handle of the service */
uint16_t end_handle; /*!< The end handle of the service */
esp_bt_uuid_t uuid; /*!< The uuid of the service */
} esp_gattc_service_elem_t; /*!< The gattc service element */

/**
* @brief characteristic element
*/
typedef struct {
uint16_t char_handle; /*!< The characteristic handle */
esp_gatt_char_prop_t properties; /*!< The characteristic properties */
esp_bt_uuid_t uuid; /*!< The characteristic uuid */
} esp_gattc_char_elem_t; /*!< The gattc characteristic element */

/**
* @brief descriptor element
*/
typedef struct {
uint16_t handle; /*!< The characteristic descriptor handle */
esp_bt_uuid_t uuid; /*!< The characteristic descriptor uuid */
} esp_gattc_descr_elem_t; /*!< The gattc descriptor type element */

/**
* @brief include service element
*/
typedef struct {
uint16_t handle; /*!< The include service current attribute handle */
uint16_t incl_srvc_s_handle; /*!< The start hanlde of the service which has been included */
esp_bt_uuid_t uuid; /*!< The include service uuid */
} esp_gattc_incl_svc_elem_t; /*!< The gattc inclue service element */


#ifdef __cplusplus
}
#endif
Expand Down

0 comments on commit 1759a47

Please sign in to comment.