mirror of
https://github.com/espressif/esp-idf.git
synced 2025-08-10 04:43:33 +00:00
component/bt : change gatt client callback param
1. change the array to point to decrease the memory occupy 2. change the sendindconfirm position 3. fix union lost
This commit is contained in:
@@ -106,7 +106,7 @@ typedef union {
|
|||||||
esp_gatt_srvc_id_t srvc_id;
|
esp_gatt_srvc_id_t srvc_id;
|
||||||
esp_gatt_id_t char_id;
|
esp_gatt_id_t char_id;
|
||||||
esp_gatt_id_t descr_id;
|
esp_gatt_id_t descr_id;
|
||||||
uint8_t value[ESP_GATT_MAX_ATTR_LEN];
|
uint8_t *value;
|
||||||
uint16_t value_type;
|
uint16_t value_type;
|
||||||
uint16_t value_len;
|
uint16_t value_len;
|
||||||
} read; /* ESP_GATTC_READ_CHAR_EVT */
|
} read; /* ESP_GATTC_READ_CHAR_EVT */
|
||||||
@@ -134,7 +134,7 @@ typedef union {
|
|||||||
esp_gatt_id_t char_id;
|
esp_gatt_id_t char_id;
|
||||||
esp_gatt_id_t descr_id;
|
esp_gatt_id_t descr_id;
|
||||||
uint16_t value_len;
|
uint16_t value_len;
|
||||||
UINT8 value[ESP_GATT_MAX_ATTR_LEN];
|
uint8_t *value;
|
||||||
bool is_notify;
|
bool is_notify;
|
||||||
} notify;
|
} notify;
|
||||||
|
|
||||||
|
@@ -183,8 +183,7 @@ uint16_t set_read_value(esp_ble_gattc_cb_param_t *p_dest, tBTA_GATTC_READ *p_src
|
|||||||
p_dest->read.value_len = p_src->p_value->unformat.len;
|
p_dest->read.value_len = p_src->p_value->unformat.len;
|
||||||
if ( p_src->p_value->unformat.len > 0 && p_src->p_value->unformat.p_value != NULL )
|
if ( p_src->p_value->unformat.len > 0 && p_src->p_value->unformat.p_value != NULL )
|
||||||
{
|
{
|
||||||
memcpy(p_dest->read.value, p_src->p_value->unformat.p_value,
|
p_dest->read.value = p_src->p_value->unformat.p_value;
|
||||||
p_src->p_value->unformat.len);
|
|
||||||
}
|
}
|
||||||
len += p_src->p_value->unformat.len;
|
len += p_src->p_value->unformat.len;
|
||||||
}
|
}
|
||||||
|
@@ -593,12 +593,13 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
|
|||||||
param.notify.is_notify = (notify->is_notify == TRUE) ? true : false;
|
param.notify.is_notify = (notify->is_notify == TRUE) ? true : false;
|
||||||
param.notify.value_len = (notify->len > ESP_GATT_MAX_ATTR_LEN) ? \
|
param.notify.value_len = (notify->len > ESP_GATT_MAX_ATTR_LEN) ? \
|
||||||
ESP_GATT_MAX_ATTR_LEN : notify->len;
|
ESP_GATT_MAX_ATTR_LEN : notify->len;
|
||||||
memcpy(¶m.notify.value, notify->value, param.notify.value_len);
|
param.notify.value = notify->value;
|
||||||
BTC_GATTC_CB_TO_APP(ESP_GATTC_NOTIFY_EVT, ¶m);
|
|
||||||
|
|
||||||
if (notify->is_notify == FALSE) {
|
if (notify->is_notify == FALSE) {
|
||||||
BTA_GATTC_SendIndConfirm(notify->conn_id, ¬ify->char_id);
|
BTA_GATTC_SendIndConfirm(notify->conn_id, ¬ify->char_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BTC_GATTC_CB_TO_APP(ESP_GATTC_NOTIFY_EVT, ¶m);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case BTA_GATTC_OPEN_EVT: {
|
case BTA_GATTC_OPEN_EVT: {
|
||||||
|
@@ -30,7 +30,7 @@ typedef enum {
|
|||||||
} btc_gattc_act_t;
|
} btc_gattc_act_t;
|
||||||
|
|
||||||
/* btc_ble_gattc_args_t */
|
/* btc_ble_gattc_args_t */
|
||||||
typedef struct {
|
typedef union {
|
||||||
//BTC_GATTC_ACT_APP_REGISTER,
|
//BTC_GATTC_ACT_APP_REGISTER,
|
||||||
struct app_reg_arg {
|
struct app_reg_arg {
|
||||||
uint16_t app_id;
|
uint16_t app_id;
|
||||||
|
Reference in New Issue
Block a user