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:
Tian Hao 2016-11-24 10:50:16 +08:00
parent 225e31b6de
commit e5ceddabac
4 changed files with 7 additions and 7 deletions

View file

@ -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;

View file

@ -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;
} }

View file

@ -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(&param.notify.value, notify->value, param.notify.value_len); param.notify.value = notify->value;
BTC_GATTC_CB_TO_APP(ESP_GATTC_NOTIFY_EVT, &param);
if (notify->is_notify == FALSE) { if (notify->is_notify == FALSE) {
BTA_GATTC_SendIndConfirm(notify->conn_id, &notify->char_id); BTA_GATTC_SendIndConfirm(notify->conn_id, &notify->char_id);
} }
BTC_GATTC_CB_TO_APP(ESP_GATTC_NOTIFY_EVT, &param);
break; break;
} }
case BTA_GATTC_OPEN_EVT: { case BTA_GATTC_OPEN_EVT: {

View file

@ -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;