component/bt : fix rsp convert

This commit is contained in:
Tian Hao 2016-11-21 12:11:47 +08:00
parent 0245a2028c
commit bf20b958a9
3 changed files with 10 additions and 6 deletions

View File

@ -114,7 +114,7 @@ typedef enum {
ESP_GATT_CHAR_PROP_BIT_EXT_PROP = (1 << 7), /* 0x80 */
} esp_gatt_char_prop_t;
#define ESP_GATT_MAX_ATTR_LEN 600
#define ESP_GATT_MAX_ATTR_LEN 600 //as same as GATT_MAX_ATTR_LEN
typedef struct {
uint8_t value[ESP_GATT_MAX_ATTR_LEN];
uint16_t handle;

View File

@ -100,9 +100,13 @@ void bta_to_btc_srvc_id(esp_gatt_srvc_id_t *p_dest, tBTA_GATT_SRVC_ID *p_src)
bta_to_btc_gatt_id(&p_dest->id, &p_src->id);
}
void btc_to_bta_response(tBTA_GATTS_RSP *rsp_struct, esp_gatt_rsp_t *p_rsp)
void btc_to_bta_response(tBTA_GATTS_RSP *p_dest, esp_gatt_rsp_t *p_src)
{
memcpy(rsp_struct, p_rsp, sizeof(esp_gatt_rsp_t));
p_dest->attr_value.auth_req = p_src->attr_value.auth_req;
p_dest->attr_value.handle = p_src->attr_value.handle;
p_dest->attr_value.len = p_src->attr_value.len;
p_dest->attr_value.offset = p_src->attr_value.offset;
memcpy(p_dest->attr_value.value, p_src->attr_value.value, ESP_GATT_MAX_ATTR_LEN);
}
uint16_t get_uuid16(tBT_UUID *p_uuid)

View File

@ -285,7 +285,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
param.create.service_handle = p_data->create.service_id;
param.create.service_id.is_primary = p_data->create.is_primary;
param.create.service_id.id.inst_id = p_data->create.svc_instance;
memcpy(&param.create.service_id.id.uuid, &p_data->create.uuid, sizeof(esp_bt_uuid_t));
bta_to_btc_uuid(&param.create.service_id.id.uuid, &p_data->create.uuid);
BTC_GATTS_CB_TO_APP(ESP_GATTS_CREATE_EVT, &param);
break;
case BTA_GATTS_ADD_INCL_SRVC_EVT:
@ -301,7 +301,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
param.add_char.gatt_if = p_data->add_result.server_if;
param.add_char.attr_handle = p_data->add_result.attr_id;
param.add_char.service_handle = p_data->add_result.service_id;
memcpy(&param.add_char.char_uuid, &p_data->add_result.char_uuid, sizeof(esp_bt_uuid_t));
bta_to_btc_uuid(&param.add_char.char_uuid, &p_data->add_result.char_uuid);
BTC_GATTS_CB_TO_APP(ESP_GATTS_ADD_CHAR_EVT, &param);
break;
@ -310,7 +310,7 @@ void btc_gatts_cb_handler(btc_msg_t *msg)
param.add_char_descr.gatt_if = p_data->add_result.server_if;
param.add_char_descr.attr_handle = p_data->add_result.attr_id;
param.add_char_descr.service_handle = p_data->add_result.service_id;
memcpy(&param.add_char_descr.char_uuid, &p_data->add_result.char_uuid, sizeof(esp_bt_uuid_t));
bta_to_btc_uuid(&param.add_char_descr.char_uuid, &p_data->add_result.char_uuid);
BTC_GATTS_CB_TO_APP(ESP_GATTS_ADD_CHAR_DESCR_EVT, &param);
break;