component/bt : cleanup id/uuid define

1. which named uuid is esp_bt_uuid_t type
2. which named id is xxx_id_t type, such as service_id_t char_id_t, include inst & uuid
3. share include directory
This commit is contained in:
Tian Hao 2016-11-16 00:34:48 +08:00
parent 521ef3f579
commit 229df65cfc
21 changed files with 77 additions and 80 deletions

View File

@ -234,9 +234,9 @@ esp_err_t esp_ble_gattc_get_characteristic(uint16_t conn_id,
msg.sig = BTC_SIG_API_CALL; msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
if (start_char_id) { if (start_char_id) {
memcpy(&arg.char_uuid, start_char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, start_char_id, sizeof(esp_gatt_id_t));
msg.act = BTC_GATTC_ACT_GET_NEXT_CHAR; msg.act = BTC_GATTC_ACT_GET_NEXT_CHAR;
} else { } else {
msg.act = BTC_GATTC_ACT_GET_FIRST_CHAR; msg.act = BTC_GATTC_ACT_GET_FIRST_CHAR;
@ -273,10 +273,10 @@ esp_err_t esp_ble_gattc_get_descriptor(uint16_t conn_id,
msg.sig = BTC_SIG_API_CALL; msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
if (start_descr_id) { if (start_descr_id) {
memcpy(&arg.descr_uuid, start_descr_id, sizeof(esp_gatt_id_t)); memcpy(&arg.descr_id, start_descr_id, sizeof(esp_gatt_id_t));
msg.act = BTC_GATTC_ACT_GET_NEXT_DESCR; msg.act = BTC_GATTC_ACT_GET_NEXT_DESCR;
} else { } else {
msg.act = BTC_GATTC_ACT_GET_FIRST_DESCR; msg.act = BTC_GATTC_ACT_GET_FIRST_DESCR;
@ -312,9 +312,9 @@ esp_err_t esp_ble_gattc_get_included_service(uint16_t conn_id,
msg.sig = BTC_SIG_API_CALL; msg.sig = BTC_SIG_API_CALL;
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
if (start_incl_srvc_id) { if (start_incl_srvc_id) {
memcpy(&arg.start_service_uuid, start_incl_srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.start_service_id, start_incl_srvc_id, sizeof(esp_gatt_srvc_id_t));
msg.act = BTC_GATTC_ACT_GET_NEXT_INCL_SERVICE; msg.act = BTC_GATTC_ACT_GET_NEXT_INCL_SERVICE;
} else { } else {
msg.act = BTC_GATTC_ACT_GET_FIRST_INCL_SERVICE; msg.act = BTC_GATTC_ACT_GET_FIRST_INCL_SERVICE;
@ -348,8 +348,8 @@ esp_err_t esp_ble_gattc_read_char (uint16_t conn_id, esp_gatt_srvc_id_t *srvc_id
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_CHAR; msg.act = BTC_GATTC_ACT_READ_CHAR;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
arg.auth_req = auth_req; arg.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }
@ -381,9 +381,9 @@ esp_err_t esp_ble_gattc_read_char_descr (uint16_t conn_id,
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_READ_CHAR_DESCR; msg.act = BTC_GATTC_ACT_READ_CHAR_DESCR;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
memcpy(&arg.descr_uuid, descr_id, sizeof(esp_gatt_id_t)); memcpy(&arg.descr_id, descr_id, sizeof(esp_gatt_id_t));
arg.auth_req = auth_req; arg.auth_req = auth_req;
return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }
@ -417,8 +417,8 @@ esp_err_t esp_ble_gattc_write_char( uint16_t conn_id,
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_WRITE_CHAR; msg.act = BTC_GATTC_ACT_WRITE_CHAR;
arg.conn_id = (uint16_t) conn_id; arg.conn_id = (uint16_t) conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len; arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len;
memcpy(arg.value, value, arg.len); memcpy(arg.value, value, arg.len);
arg.auth_req = auth_req; arg.auth_req = auth_req;
@ -455,9 +455,9 @@ esp_err_t esp_ble_gattc_write_char_descr (uint16_t conn_id,
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_WRITE_CHAR_DESCR; msg.act = BTC_GATTC_ACT_WRITE_CHAR_DESCR;
arg.conn_id = (uint16_t) conn_id; arg.conn_id = (uint16_t) conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
memcpy(&arg.descr_uuid, descr_id, sizeof(esp_gatt_id_t)); memcpy(&arg.descr_id, descr_id, sizeof(esp_gatt_id_t));
arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len; arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len;
memcpy(arg.value, value, arg.len); memcpy(arg.value, value, arg.len);
arg.auth_req = auth_req; arg.auth_req = auth_req;
@ -495,8 +495,8 @@ esp_err_t esp_ble_gattc_prepare_write(uint16_t conn_id,
msg.pid = BTC_PID_GATTC; msg.pid = BTC_PID_GATTC;
msg.act = BTC_GATTC_ACT_PREPARE_WRITE; msg.act = BTC_GATTC_ACT_PREPARE_WRITE;
arg.conn_id = conn_id; arg.conn_id = conn_id;
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
arg.offset = offset; arg.offset = offset;
arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len; // length check ? arg.len = len > ESP_GATT_MAX_ATTR_LEN ? ESP_GATT_MAX_ATTR_LEN : len; // length check ?
memcpy(arg.value, data, arg.len); memcpy(arg.value, data, arg.len);
@ -560,8 +560,8 @@ esp_gatt_status_t esp_ble_gattc_register_for_notify (esp_gatt_if_t gatt_if,
msg.act = BTC_GATTC_ACT_REG_FOR_NOTIFY; msg.act = BTC_GATTC_ACT_REG_FOR_NOTIFY;
arg.gatt_if = gatt_if; arg.gatt_if = gatt_if;
memcpy(&arg.remote_bda, &server_bda, sizeof(esp_bd_addr_t)); memcpy(&arg.remote_bda, &server_bda, sizeof(esp_bd_addr_t));
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }
@ -594,8 +594,8 @@ esp_gatt_status_t esp_ble_gattc_unregister_for_notify (esp_gatt_if_t gatt_if,
msg.act = BTC_GATTC_ACT_UNREG_FOR_NOTIFY; msg.act = BTC_GATTC_ACT_UNREG_FOR_NOTIFY;
arg.gatt_if = gatt_if; arg.gatt_if = gatt_if;
memcpy(&arg.remote_bda, &server_bda, sizeof(esp_bd_addr_t)); memcpy(&arg.remote_bda, &server_bda, sizeof(esp_bd_addr_t));
memcpy(&arg.service_uuid, srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, srvc_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&arg.char_uuid, char_id, sizeof(esp_gatt_id_t)); memcpy(&arg.char_id, char_id, sizeof(esp_gatt_id_t));
return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gattc_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }

View File

@ -57,7 +57,7 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatt_if)
} }
esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if, esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
esp_gatt_srvc_id_t *service_uuid, uint16_t num_handle) esp_gatt_srvc_id_t *service_id, uint16_t num_handle)
{ {
btc_msg_t msg; btc_msg_t msg;
esp_ble_gatts_args_t arg; esp_ble_gatts_args_t arg;
@ -67,7 +67,7 @@ esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
msg.act = BTC_GATTS_ACT_CREATE_SERVICE; msg.act = BTC_GATTS_ACT_CREATE_SERVICE;
arg.gatt_if = gatt_if; arg.gatt_if = gatt_if;
arg.num_handle = num_handle; arg.num_handle = num_handle;
memcpy(&arg.service_uuid, service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&arg.service_id, service_id, sizeof(esp_gatt_srvc_id_t));
return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL); return (btc_transfer_context(&msg, &arg, sizeof(esp_ble_gatts_args_t), NULL) == BT_STATUS_SUCCESS ? ESP_OK : ESP_FAIL);
} }

View File

@ -60,10 +60,10 @@ typedef struct {
uint16_t len; uint16_t len;
uint16_t offset; uint16_t offset;
esp_gatt_if_t gatt_if; /* internal is server_if or client_if */ esp_gatt_if_t gatt_if; /* internal is server_if or client_if */
esp_gatt_srvc_id_t service_uuid; esp_gatt_srvc_id_t service_id;
esp_gatt_srvc_id_t start_service_uuid; esp_gatt_srvc_id_t start_service_id;
esp_gatt_id_t char_uuid; esp_gatt_id_t char_id;
esp_gatt_id_t descr_uuid; esp_gatt_id_t descr_id;
esp_gatt_auth_req_t auth_req; esp_gatt_auth_req_t auth_req;
esp_bd_addr_t remote_bda; esp_bd_addr_t remote_bda;
esp_bt_uuid_t uuid; esp_bt_uuid_t uuid;
@ -116,7 +116,7 @@ typedef union {
/* ESP_GATTC_SEARCH_RES_EVT */ /* ESP_GATTC_SEARCH_RES_EVT */
struct gattc_search_res_evt_param { struct gattc_search_res_evt_param {
uint16_t conn_id; uint16_t conn_id;
esp_gatt_srvc_id_t service_uuid; esp_gatt_srvc_id_t service_id;
} search_res; } search_res;
/* ESP_GATTC_READ_CHAR_EVT, ESP_GATTC_READ_DESCR_EVT */ /* ESP_GATTC_READ_CHAR_EVT, ESP_GATTC_READ_DESCR_EVT */

View File

@ -36,8 +36,8 @@
/* esp_ble_gatts_args_t */ /* esp_ble_gatts_args_t */
typedef struct { typedef struct {
esp_gatt_if_t gatt_if; /* internal is server_if or client_if */ esp_gatt_if_t gatt_if; /* internal is server_if or client_if */
esp_gatt_srvc_id_t service_uuid; esp_gatt_srvc_id_t service_id;
esp_gatt_id_t char_uuid; esp_gatt_id_t char_id;
esp_gatt_id_t descr_uuid; esp_gatt_id_t descr_uuid;
esp_bt_uuid_t uuid; esp_bt_uuid_t uuid;
esp_gatt_rsp_t rsp; esp_gatt_rsp_t rsp;
@ -113,7 +113,7 @@ typedef union {
int status; int status;
uint16_t gatt_if; uint16_t gatt_if;
uint16_t service_handle; //handle uint16_t service_handle; //handle
esp_gatt_srvc_id_t service_id; //uuid esp_gatt_srvc_id_t service_id; //id
} create; } create;
// param for ESP_GATTS_ADD_INCL_SRVC_EVT // param for ESP_GATTS_ADD_INCL_SRVC_EVT
struct gatts_add_incl_srvc_evt_param { struct gatts_add_incl_srvc_evt_param {
@ -240,14 +240,14 @@ esp_err_t esp_ble_gatts_app_unregister(esp_gatt_if_t gatt_if);
** service and characteristics/descriptors into the service. ** service and characteristics/descriptors into the service.
** **
** @param[in] gatt_if: gatt interface ID ** @param[in] gatt_if: gatt interface ID
** @param[in] service_uuid: service UUID. ** @param[in] service_id: service ID.
** @param[in] num_handle: numble of handle requessted for this service. ** @param[in] num_handle: numble of handle requessted for this service.
** **
** @return ESP_OK - success, other - failed ** @return ESP_OK - success, other - failed
** **
*******************************************************************************/ *******************************************************************************/
esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if, esp_err_t esp_ble_gatts_create_service(esp_gatt_if_t gatt_if,
esp_gatt_srvc_id_t *service_uuid, uint16_t num_handle); esp_gatt_srvc_id_t *service_id, uint16_t num_handle);

View File

@ -107,7 +107,7 @@ static void btc_gattc_get_first_char(esp_ble_gattc_args_t *arg)
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&srvc_id, &arg->service_id);
status = BTA_GATTC_GetFirstChar(arg->conn_id, &srvc_id, NULL, status = BTA_GATTC_GetFirstChar(arg->conn_id, &srvc_id, NULL,
&out_char_id, &out_char_prop); &out_char_id, &out_char_prop);
if (status == 0) { if (status == 0) {
@ -117,7 +117,7 @@ static void btc_gattc_get_first_char(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_char.conn_id = arg->conn_id; param.get_char.conn_id = arg->conn_id;
param.get_char.status = status; param.get_char.status = status;
memcpy(&param.get_char.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_char.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_char.char_id, &char_id, sizeof(esp_gatt_id_t)); memcpy(&param.get_char.char_id, &char_id, sizeof(esp_gatt_id_t));
param.get_char.char_prop = out_char_prop; param.get_char.char_prop = out_char_prop;
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_CHAR_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_CHAR_EVT, &param);
@ -131,8 +131,8 @@ static void btc_gattc_get_next_char(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_ID out_char_id; tBTA_GATTC_CHAR_ID out_char_id;
tBTA_GATT_CHAR_PROP out_char_prop; tBTA_GATT_CHAR_PROP out_char_prop;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
status = BTA_GATTC_GetNextChar(arg->conn_id, &in_char_id, NULL, status = BTA_GATTC_GetNextChar(arg->conn_id, &in_char_id, NULL,
&out_char_id, &out_char_prop); &out_char_id, &out_char_prop);
@ -144,7 +144,7 @@ static void btc_gattc_get_next_char(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_char.conn_id = arg->conn_id; param.get_char.conn_id = arg->conn_id;
param.get_char.status = status; param.get_char.status = status;
memcpy(&param.get_char.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_char.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_char.char_id, &char_id, sizeof(esp_gatt_id_t)); memcpy(&param.get_char.char_id, &char_id, sizeof(esp_gatt_id_t));
param.get_char.char_prop = out_char_prop; param.get_char.char_prop = out_char_prop;
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_CHAR_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_CHAR_EVT, &param);
@ -158,8 +158,8 @@ static void btc_gattc_get_first_descr(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_DESCR_ID out_char_descr_id; tBTA_GATTC_CHAR_DESCR_ID out_char_descr_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
status = BTA_GATTC_GetFirstCharDescr(arg->conn_id, &in_char_id, NULL, status = BTA_GATTC_GetFirstCharDescr(arg->conn_id, &in_char_id, NULL,
&out_char_descr_id); &out_char_descr_id);
@ -171,8 +171,8 @@ static void btc_gattc_get_first_descr(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_descr.conn_id = arg->conn_id; param.get_descr.conn_id = arg->conn_id;
param.get_descr.status = status; param.get_descr.status = status;
memcpy(&param.get_descr.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_descr.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_descr.char_id, &arg->char_uuid, sizeof(esp_gatt_id_t)); memcpy(&param.get_descr.char_id, &arg->char_id, sizeof(esp_gatt_id_t));
memcpy(&param.get_descr.descr_id, &descr_id, sizeof(esp_gatt_id_t)); memcpy(&param.get_descr.descr_id, &descr_id, sizeof(esp_gatt_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_DESCR_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_DESCR_EVT, &param);
} }
@ -185,9 +185,9 @@ static void btc_gattc_get_next_descr(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_DESCR_ID out_char_descr_id; tBTA_GATTC_CHAR_DESCR_ID out_char_descr_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_id);
btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_uuid); btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_id);
status = BTA_GATTC_GetNextCharDescr(arg->conn_id, &in_char_descr_id status = BTA_GATTC_GetNextCharDescr(arg->conn_id, &in_char_descr_id
, NULL, &out_char_descr_id); , NULL, &out_char_descr_id);
@ -198,8 +198,8 @@ static void btc_gattc_get_next_descr(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_descr.conn_id = arg->conn_id; param.get_descr.conn_id = arg->conn_id;
param.get_descr.status = status; param.get_descr.status = status;
memcpy(&param.get_descr.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_descr.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_descr.char_id, &arg->char_uuid, sizeof(esp_gatt_id_t)); memcpy(&param.get_descr.char_id, &arg->char_id, sizeof(esp_gatt_id_t));
memcpy(&param.get_descr.descr_id, &descr_id, sizeof(esp_gatt_id_t)); memcpy(&param.get_descr.descr_id, &descr_id, sizeof(esp_gatt_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_DESCR_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_DESCR_EVT, &param);
} }
@ -212,7 +212,7 @@ static void btc_gattc_get_first_incl_service(esp_ble_gattc_args_t *arg)
tBTA_GATTC_INCL_SVC_ID out_incl_svc_id; tBTA_GATTC_INCL_SVC_ID out_incl_svc_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&srvc_id, &arg->service_id);
status = BTA_GATTC_GetFirstIncludedService(arg->conn_id, &srvc_id, status = BTA_GATTC_GetFirstIncludedService(arg->conn_id, &srvc_id,
NULL, &out_incl_svc_id); NULL, &out_incl_svc_id);
@ -222,7 +222,7 @@ static void btc_gattc_get_first_incl_service(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_incl_srvc.conn_id = arg->conn_id; param.get_incl_srvc.conn_id = arg->conn_id;
param.get_incl_srvc.status = status; param.get_incl_srvc.status = status;
memcpy(&param.get_incl_srvc.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_incl_srvc.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_incl_srvc.incl_srvc_id, &incl_srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_incl_srvc.incl_srvc_id, &incl_srvc_id, sizeof(esp_gatt_srvc_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_INCL_SRVC_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_INCL_SRVC_EVT, &param);
} }
@ -235,8 +235,8 @@ static void btc_gattc_get_next_incl_service(esp_ble_gattc_args_t *arg)
tBTA_GATTC_INCL_SVC_ID out_incl_svc_id; tBTA_GATTC_INCL_SVC_ID out_incl_svc_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_incl_svc_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_incl_svc_id.srvc_id, &arg->service_id);
btc_to_bta_srvc_id(&in_incl_svc_id.incl_svc_id, &arg->start_service_uuid); btc_to_bta_srvc_id(&in_incl_svc_id.incl_svc_id, &arg->start_service_id);
status = BTA_GATTC_GetNextIncludedService(arg->conn_id, &in_incl_svc_id, status = BTA_GATTC_GetNextIncludedService(arg->conn_id, &in_incl_svc_id,
NULL, &out_incl_svc_id); NULL, &out_incl_svc_id);
@ -246,7 +246,7 @@ static void btc_gattc_get_next_incl_service(esp_ble_gattc_args_t *arg)
memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t)); memset(&param, 0, sizeof(esp_ble_gattc_cb_param_t));
param.get_incl_srvc.conn_id = arg->conn_id; param.get_incl_srvc.conn_id = arg->conn_id;
param.get_incl_srvc.status = status; param.get_incl_srvc.status = status;
memcpy(&param.get_incl_srvc.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_incl_srvc.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.get_incl_srvc.incl_srvc_id, &incl_srvc_id, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.get_incl_srvc.incl_srvc_id, &incl_srvc_id, sizeof(esp_gatt_srvc_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_INCL_SRVC_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_GET_INCL_SRVC_EVT, &param);
} }
@ -254,17 +254,17 @@ static void btc_gattc_get_next_incl_service(esp_ble_gattc_args_t *arg)
static void btc_gattc_read_char(esp_ble_gattc_args_t *arg) static void btc_gattc_read_char(esp_ble_gattc_args_t *arg)
{ {
tBTA_GATTC_CHAR_ID in_char_id; tBTA_GATTC_CHAR_ID in_char_id;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
BTA_GATTC_ReadCharacteristic(arg->conn_id, &in_char_id, arg->auth_req); BTA_GATTC_ReadCharacteristic(arg->conn_id, &in_char_id, arg->auth_req);
} }
static void btc_gattc_read_char_descr(esp_ble_gattc_args_t *arg) static void btc_gattc_read_char_descr(esp_ble_gattc_args_t *arg)
{ {
tBTA_GATTC_CHAR_DESCR_ID in_char_descr_id; tBTA_GATTC_CHAR_DESCR_ID in_char_descr_id;
btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_id);
btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_uuid); btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_id);
BTA_GATTC_ReadCharDescr(arg->conn_id, &in_char_descr_id, arg->auth_req); BTA_GATTC_ReadCharDescr(arg->conn_id, &in_char_descr_id, arg->auth_req);
} }
@ -275,8 +275,8 @@ static void btc_gattc_write_char(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_ID in_char_id; tBTA_GATTC_CHAR_ID in_char_id;
tBTA_GATTC_WRITE_TYPE write_type = BTA_GATTC_TYPE_WRITE; tBTA_GATTC_WRITE_TYPE write_type = BTA_GATTC_TYPE_WRITE;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
BTA_GATTC_WriteCharValue(arg->conn_id, &in_char_id, BTA_GATTC_WriteCharValue(arg->conn_id, &in_char_id,
write_type, write_type,
@ -291,9 +291,9 @@ static void btc_gattc_write_char_descr(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_DESCR_ID in_char_descr_id; tBTA_GATTC_CHAR_DESCR_ID in_char_descr_id;
tBTA_GATT_UNFMT descr_val; tBTA_GATT_UNFMT descr_val;
tBTA_GATTC_WRITE_TYPE write_type = BTA_GATTC_TYPE_WRITE; tBTA_GATTC_WRITE_TYPE write_type = BTA_GATTC_TYPE_WRITE;
btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_descr_id.char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_descr_id.char_id.char_id, &arg->char_id);
btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_uuid); btc_to_bta_gatt_id(&in_char_descr_id.descr_id, &arg->descr_id);
descr_val.len = arg->len; descr_val.len = arg->len;
descr_val.p_value = arg->value; descr_val.p_value = arg->value;
@ -306,8 +306,8 @@ static void btc_gattc_write_char_descr(esp_ble_gattc_args_t *arg)
static void btc_gattc_prepare_write(esp_ble_gattc_args_t *arg) static void btc_gattc_prepare_write(esp_ble_gattc_args_t *arg)
{ {
tBTA_GATTC_CHAR_ID in_char_id; tBTA_GATTC_CHAR_ID in_char_id;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
BTA_GATTC_PrepareWrite(arg->conn_id, &in_char_id, arg->offset, arg->len, BTA_GATTC_PrepareWrite(arg->conn_id, &in_char_id, arg->offset, arg->len,
arg->value, arg->auth_req); arg->value, arg->auth_req);
@ -324,8 +324,8 @@ static void btc_gattc_reg_for_notify(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_ID in_char_id; tBTA_GATTC_CHAR_ID in_char_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
status = BTA_GATTC_RegisterForNotifications(arg->gatt_if, status = BTA_GATTC_RegisterForNotifications(arg->gatt_if,
arg->remote_bda, &in_char_id); arg->remote_bda, &in_char_id);
@ -334,8 +334,8 @@ static void btc_gattc_reg_for_notify(esp_ble_gattc_args_t *arg)
param.reg_for_notif.conn_id = arg->conn_id; param.reg_for_notif.conn_id = arg->conn_id;
param.reg_for_notif.status = status; param.reg_for_notif.status = status;
param.reg_for_notif.registered = true; param.reg_for_notif.registered = true;
memcpy(&param.reg_for_notif.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.reg_for_notif.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.reg_for_notif.char_id, &arg->service_uuid, sizeof(esp_gatt_id_t)); memcpy(&param.reg_for_notif.char_id, &arg->service_id, sizeof(esp_gatt_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_REG_FOR_NOTIF_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_REG_FOR_NOTIF_EVT, &param);
} }
@ -345,8 +345,8 @@ static void btc_gattc_unreg_for_notify(esp_ble_gattc_args_t *arg)
tBTA_GATTC_CHAR_ID in_char_id; tBTA_GATTC_CHAR_ID in_char_id;
esp_ble_gattc_cb_param_t param; esp_ble_gattc_cb_param_t param;
btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&in_char_id.srvc_id, &arg->service_id);
btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_uuid); btc_to_bta_gatt_id(&in_char_id.char_id, &arg->char_id);
status = BTA_GATTC_DeregisterForNotifications(arg->gatt_if, status = BTA_GATTC_DeregisterForNotifications(arg->gatt_if,
arg->remote_bda, &in_char_id); arg->remote_bda, &in_char_id);
@ -355,8 +355,8 @@ static void btc_gattc_unreg_for_notify(esp_ble_gattc_args_t *arg)
param.reg_for_notif.conn_id = arg->conn_id; param.reg_for_notif.conn_id = arg->conn_id;
param.reg_for_notif.status = status; param.reg_for_notif.status = status;
param.reg_for_notif.registered = false; param.reg_for_notif.registered = false;
memcpy(&param.reg_for_notif.srvc_id, &arg->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.reg_for_notif.srvc_id, &arg->service_id, sizeof(esp_gatt_srvc_id_t));
memcpy(&param.reg_for_notif.char_id, &arg->service_uuid, sizeof(esp_gatt_id_t)); memcpy(&param.reg_for_notif.char_id, &arg->service_id, sizeof(esp_gatt_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_REG_FOR_NOTIF_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_REG_FOR_NOTIF_EVT, &param);
} }
@ -488,7 +488,7 @@ void btc_gattc_cb_handler(btc_msg_t *msg)
case BTA_GATTC_SEARCH_RES_EVT: { case BTA_GATTC_SEARCH_RES_EVT: {
tBTA_GATTC_SRVC_RES *srvc_res = &arg->srvc_res; tBTA_GATTC_SRVC_RES *srvc_res = &arg->srvc_res;
param.search_res.conn_id = srvc_res->conn_id; param.search_res.conn_id = srvc_res->conn_id;
memcpy(&param.search_res.service_uuid, &srvc_res->service_uuid, sizeof(esp_gatt_srvc_id_t)); memcpy(&param.search_res.service_id, &srvc_res->service_uuid, sizeof(esp_gatt_srvc_id_t));
BTC_GATTC_CB_TO_APP(ESP_GATTC_SEARCH_RES_EVT, &param); BTC_GATTC_CB_TO_APP(ESP_GATTC_SEARCH_RES_EVT, &param);
break; break;
} }

View File

@ -118,7 +118,7 @@ void btc_gatts_call_handler(btc_msg_t *msg)
break; break;
case BTC_GATTS_ACT_CREATE_SERVICE: { case BTC_GATTS_ACT_CREATE_SERVICE: {
tBTA_GATT_SRVC_ID srvc_id; tBTA_GATT_SRVC_ID srvc_id;
btc_to_bta_srvc_id(&srvc_id, &arg->service_uuid); btc_to_bta_srvc_id(&srvc_id, &arg->service_id);
BTA_GATTS_CreateService(arg->gatt_if, &srvc_id.id.uuid, BTA_GATTS_CreateService(arg->gatt_if, &srvc_id.id.uuid,
srvc_id.id.inst_id, arg->num_handle, srvc_id.id.inst_id, arg->num_handle,
srvc_id.is_primary); srvc_id.is_primary);

View File

@ -15,9 +15,7 @@ COMPONENT_ADD_INCLUDEDIRS := bluedroid/bta/include \
bluedroid/btc/profile/std/gatt/include \ bluedroid/btc/profile/std/gatt/include \
bluedroid/btc/profile/std/gap/include \ bluedroid/btc/profile/std/gap/include \
bluedroid/btc/profile/std/sdp/include \ bluedroid/btc/profile/std/sdp/include \
bluedroid/btc/profile/std/include/gatt \ bluedroid/btc/profile/std/include \
bluedroid/btc/profile/std/include/gap \
bluedroid/btc/profile/std/include/sdp \
bluedroid/btc/include \ bluedroid/btc/include \
bluedroid/stack/btm/include \ bluedroid/stack/btm/include \
bluedroid/stack/btu/include \ bluedroid/stack/btu/include \
@ -56,7 +54,6 @@ COMPONENT_SRCDIRS := bluedroid/bta/dm \
bluedroid/btc/core \ bluedroid/btc/core \
bluedroid/btc/profile/esp/blufi \ bluedroid/btc/profile/esp/blufi \
bluedroid/btc/profile/std/gap \ bluedroid/btc/profile/std/gap \
bluedroid/btc/profile/std/gap \
bluedroid/btc/profile/std/gatt \ bluedroid/btc/profile/std/gatt \
bluedroid/btc/profile \ bluedroid/btc/profile \
bluedroid/stack/btm \ bluedroid/stack/btm \