mirror of
https://github.com/espressif/esp-nimble.git
synced 2026-06-05 21:04:49 +00:00
fix(nimble): Filter benign return codes from ERROR logs
This commit is contained in:
@@ -234,7 +234,6 @@ ble_svc_ans_access(uint16_t conn_handle, uint16_t attr_handle,
|
||||
&ble_svc_ans_alert_not_ctrl_pt,
|
||||
NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,6 @@ ble_svc_cts_access(uint16_t conn_handle, uint16_t attr_handle,
|
||||
}
|
||||
rc = ble_svc_cts_curr_time_validate(curr_time);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if(cts_cfg.set_time_cb == NULL) {
|
||||
@@ -224,7 +223,6 @@ ble_svc_cts_access(uint16_t conn_handle, uint16_t attr_handle,
|
||||
}
|
||||
rc = ble_svc_cts_local_time_info_validate(local_time_info);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -495,7 +495,6 @@ ble_svc_gap_device_appearance_set(uint16_t appearance)
|
||||
if (!ble_hs_gap_svc_ctx) {
|
||||
int rc = ble_svc_gap_appearance_init();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,7 +187,6 @@ ble_svc_hr_notify_measurement(void)
|
||||
rc = ble_gatts_notify_custom(ble_svc_hr_conn_handle[i],
|
||||
ble_svc_hr_measurement_val_handle, txom);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,9 +219,6 @@ ble_svc_htp_notify(uint16_t conn_handle, float temp, bool temp_unit)
|
||||
|
||||
ble_gatts_chr_updated(ble_svc_htp_intr_temp_val_handle);
|
||||
err:
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -252,15 +249,11 @@ ble_svc_htp_indicate(uint16_t conn_handle, float temp, bool temp_unit)
|
||||
rc = os_mbuf_copyinto(txom, sizeof(flags), &temp, sizeof(temp));
|
||||
if (rc != 0) {
|
||||
os_mbuf_free_chain(txom);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_gatts_indicate_custom(conn_handle,
|
||||
ble_svc_htp_temp_measurement_val_handle, txom);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,6 @@ ble_svc_ias_access(uint16_t conn_handle, uint16_t attr_handle,
|
||||
sizeof alert_level,
|
||||
&alert_level, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (alert_level > BLE_SVC_IAS_ALERT_LEVEL_HIGH_ALERT) {
|
||||
|
||||
@@ -321,7 +321,6 @@ static int gatt_svr_chr_access_ras_val(uint16_t conn_handle, uint16_t attr_handl
|
||||
sizeof(ble_svc_ras_cp_val),
|
||||
&ble_svc_ras_cp_val, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
MODLOG_DFLT(INFO, "ble_svc_gap_cp_val = %02x %02x %02x \n",ble_svc_ras_cp_val[0],ble_svc_ras_cp_val[1],ble_svc_ras_cp_val[2]);
|
||||
|
||||
@@ -331,13 +331,11 @@ int ble_aes_ccm_decrypt(const uint8_t key[16], uint8_t nonce[13], const uint8_t
|
||||
|
||||
rc = ble_aes_ccm_crypt(key_reversed, nonce, enc_msg, out_msg, msg_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_aes_ccm_auth(key_reversed, nonce, out_msg, msg_len, aad, aad_len, mic, mic_size);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -372,14 +370,12 @@ int ble_aes_ccm_encrypt(const uint8_t key[16], uint8_t nonce[13], const uint8_t
|
||||
/** Calculating MIC */
|
||||
int rc = ble_aes_ccm_auth(key_reversed, nonce, msg, msg_len, aad, aad_len, mic, mic_size);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/** Encrypting advertisement */
|
||||
rc = ble_aes_ccm_crypt(key_reversed, nonce, msg, out_msg, msg_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -587,7 +587,6 @@ ble_att_rx_extended(uint16_t conn_handle, uint16_t cid, struct os_mbuf **om)
|
||||
|
||||
rc = os_mbuf_copydata(*om, 0, 1, &op);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -600,7 +599,6 @@ ble_att_rx_extended(uint16_t conn_handle, uint16_t cid, struct os_mbuf **om)
|
||||
BLE_HS_LOG(INFO, "ATT handler not found; op=0x%02x conn_handle=0x%04x "
|
||||
"cid=0x%04x; packet dropped\n", op, conn_handle, cid);
|
||||
ble_att_rx_handle_unknown_request(op, conn_handle, cid, om);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -614,9 +612,6 @@ ble_att_rx_extended(uint16_t conn_handle, uint16_t cid, struct os_mbuf **om)
|
||||
if (rc == BLE_HS_ENOTSUP) {
|
||||
ble_att_rx_handle_unknown_request(op, conn_handle, cid, om);
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -790,7 +785,6 @@ ble_att_set_default_bearer_using_cid(uint16_t conn_handle, uint16_t cid) {
|
||||
|
||||
return rc;
|
||||
#endif
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -829,7 +823,6 @@ ble_att_init(void)
|
||||
|
||||
rc = ble_eatt_init(ble_att_rx_extended);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,6 @@ ble_att_clt_rx_error(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(rxom, sizeof(*rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -90,7 +89,6 @@ ble_att_clt_tx_mtu(uint16_t conn_handle, uint16_t mtu)
|
||||
ble_hs_unlock();
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -128,7 +126,6 @@ ble_att_clt_rx_mtu(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
|
||||
#if MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0
|
||||
if (ble_hs_cfg.eatt && cid != BLE_L2CAP_CID_ATT) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
#endif
|
||||
@@ -165,7 +162,6 @@ ble_att_clt_tx_find_info(uint16_t conn_handle, uint16_t cid, uint16_t start_hand
|
||||
uint16_t end_handle)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_FIND_INFO
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -206,13 +202,11 @@ ble_att_clt_parse_find_info_entry(struct os_mbuf **rxom, uint8_t rsp_format,
|
||||
break;
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(rxom, entry_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -222,7 +216,6 @@ ble_att_clt_parse_find_info_entry(struct os_mbuf **rxom, uint8_t rsp_format,
|
||||
case BLE_ATT_FIND_INFO_RSP_FORMAT_16BIT:
|
||||
rc = ble_uuid_init_from_att_mbuf(&idata->uuid, *rxom, 2, 2);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
break;
|
||||
@@ -230,7 +223,6 @@ ble_att_clt_parse_find_info_entry(struct os_mbuf **rxom, uint8_t rsp_format,
|
||||
case BLE_ATT_FIND_INFO_RSP_FORMAT_128BIT:
|
||||
rc = ble_uuid_init_from_att_mbuf(&idata->uuid, *rxom, 2, 16);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
break;
|
||||
@@ -248,7 +240,6 @@ int
|
||||
ble_att_clt_rx_find_info(uint16_t conn_handle, uint16_t cid, struct os_mbuf **om)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_FIND_INFO
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -301,7 +292,6 @@ ble_att_clt_tx_find_type_value(uint16_t conn_handle, uint16_t cid,
|
||||
const void *attribute_value, int value_len)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_FIND_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -344,7 +334,6 @@ ble_att_clt_parse_find_type_value_hinfo(
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, sizeof(*group));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -362,7 +351,6 @@ int
|
||||
ble_att_clt_rx_find_type_value(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_FIND_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -395,7 +383,6 @@ ble_att_clt_tx_read_type(uint16_t conn_handle, uint16_t cid, uint16_t start_hand
|
||||
uint16_t end_handle, const ble_uuid_t *uuid)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -426,7 +413,6 @@ int
|
||||
ble_att_clt_rx_read_type(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -485,7 +471,6 @@ int
|
||||
ble_att_clt_tx_read(uint16_t conn_handle, uint16_t cid, uint16_t handle)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -512,7 +497,6 @@ int
|
||||
ble_att_clt_rx_read(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -529,7 +513,6 @@ int
|
||||
ble_att_clt_tx_read_blob(uint16_t conn_handle, uint16_t cid, uint16_t handle, uint16_t offset)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_BLOB
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -557,7 +540,6 @@ int
|
||||
ble_att_clt_rx_read_blob(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_BLOB
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -574,7 +556,6 @@ ble_att_clt_tx_read_mult(uint16_t conn_handle, uint16_t cid,
|
||||
const uint16_t *handles, int num_handles, bool variable)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_MULT
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -609,7 +590,6 @@ int
|
||||
ble_att_clt_rx_read_mult(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_MULT
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -622,7 +602,6 @@ int
|
||||
ble_att_clt_rx_read_mult_var(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_MULT_VAR
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -641,7 +620,6 @@ ble_att_clt_tx_read_group_type(uint16_t conn_handle, uint16_t cid,
|
||||
const ble_uuid_t *uuid)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_GROUP_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -675,13 +653,11 @@ ble_att_clt_parse_read_group_type_adata(
|
||||
int rc;
|
||||
|
||||
if (data_len < BLE_ATT_READ_GROUP_TYPE_ADATA_BASE_SZ + 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -697,7 +673,6 @@ int
|
||||
ble_att_clt_rx_read_group_type(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_READ_GROUP_TYPE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -744,7 +719,6 @@ ble_att_clt_tx_write_req(uint16_t conn_handle, uint16_t cid, uint16_t handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -769,7 +743,6 @@ ble_att_clt_tx_write_cmd(uint16_t conn_handle, uint16_t cid,
|
||||
uint16_t handle, struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_WRITE_NO_RSP
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -808,7 +781,6 @@ int
|
||||
ble_att_clt_rx_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -950,7 +922,6 @@ ble_att_clt_tx_prep_write(uint16_t conn_handle, uint16_t cid, uint16_t handle,
|
||||
uint16_t offset, struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_PREP_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1002,7 +973,6 @@ int
|
||||
ble_att_clt_rx_prep_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_PREP_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1041,7 +1011,6 @@ int
|
||||
ble_att_clt_tx_exec_write(uint16_t conn_handle, uint16_t cid, uint8_t flags)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_EXEC_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1063,7 +1032,6 @@ int
|
||||
ble_att_clt_rx_exec_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_EXEC_WRITE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1082,7 +1050,6 @@ ble_att_clt_tx_notify(uint16_t conn_handle, uint16_t handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_NOTIFY
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1124,7 +1091,6 @@ ble_att_clt_tx_indicate(uint16_t conn_handle, uint16_t cid,
|
||||
uint16_t handle, struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_INDICATE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1158,7 +1124,6 @@ int
|
||||
ble_att_clt_rx_indicate(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_INDICATE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1175,7 +1140,6 @@ int
|
||||
ble_att_clt_tx_notify_mult(uint16_t conn_handle, struct os_mbuf *txom)
|
||||
{
|
||||
#if !NIMBLE_BLE_ATT_CLT_NOTIFY_MULT
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -107,9 +107,6 @@ ble_att_tx_with_conn(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan, stru
|
||||
if (is_request) {
|
||||
conn->client_att_busy = false;
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
@@ -134,9 +131,6 @@ ble_att_tx(uint16_t conn_handle, uint16_t cid, struct os_mbuf *txom)
|
||||
if (rc != 0) {
|
||||
ble_hs_unlock();
|
||||
os_mbuf_free_chain(txom);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -365,7 +365,6 @@ ble_att_svr_check_perms(uint16_t conn_handle, int is_read,
|
||||
"conn_handle=0x%04x attr_handle=0x%04x\n",
|
||||
conn_handle, entry->ha_handle_id);
|
||||
*out_att_err = BLE_ATT_ERR_READ_NOT_PERMITTED;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
@@ -378,7 +377,6 @@ ble_att_svr_check_perms(uint16_t conn_handle, int is_read,
|
||||
"conn_handle=0x%04x attr_handle=0x%04x\n",
|
||||
conn_handle, entry->ha_handle_id);
|
||||
*out_att_err = BLE_ATT_ERR_WRITE_NOT_PERMITTED;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
@@ -616,13 +614,11 @@ ble_att_svr_read_handle(uint16_t conn_handle, uint16_t attr_handle,
|
||||
if (out_att_err != NULL) {
|
||||
*out_att_err = BLE_ATT_ERR_INVALID_HANDLE;
|
||||
}
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
rc = ble_att_svr_read(conn_handle, entry, offset, om, out_att_err);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -703,13 +699,11 @@ ble_att_svr_write_handle(uint16_t conn_handle, uint16_t attr_handle,
|
||||
if (out_att_err != NULL) {
|
||||
*out_att_err = BLE_ATT_ERR_INVALID_HANDLE;
|
||||
}
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
rc = ble_att_svr_write(conn_handle, entry, offset, om, out_att_err);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -869,7 +863,6 @@ ble_att_svr_rx_mtu(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
mtu = 0;
|
||||
|
||||
if (cid != BLE_L2CAP_CID_ATT) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -987,7 +980,6 @@ ble_att_svr_fill_info(uint16_t start_handle, uint16_t end_handle,
|
||||
|
||||
done:
|
||||
if (rc == 0 && num_entries == 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
} else {
|
||||
return rc;
|
||||
@@ -1044,7 +1036,6 @@ int
|
||||
ble_att_svr_rx_find_info(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_FIND_INFO)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1136,7 +1127,6 @@ ble_att_svr_fill_type_value_entry(struct os_mbuf *om, uint16_t first,
|
||||
goto fail;
|
||||
}
|
||||
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
|
||||
fail:
|
||||
@@ -1304,7 +1294,6 @@ done:
|
||||
BLE_ATT_FIND_TYPE_VALUE_RSP_BASE_SZ;
|
||||
if (rc == 0 && !any_entries) {
|
||||
*out_att_err = BLE_ATT_ERR_ATTR_NOT_FOUND;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
} else {
|
||||
return rc;
|
||||
@@ -1359,7 +1348,6 @@ int
|
||||
ble_att_svr_rx_find_type_value(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_FIND_TYPE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1595,7 +1583,6 @@ int
|
||||
ble_att_svr_rx_read_type(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ_TYPE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1708,7 +1695,6 @@ int
|
||||
ble_att_svr_rx_read(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1772,7 +1758,6 @@ int
|
||||
ble_att_svr_rx_read_blob(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ_BLOB)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -1903,7 +1888,6 @@ int
|
||||
ble_att_svr_rx_read_mult(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ_MULT)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2039,7 +2023,6 @@ int
|
||||
ble_att_svr_rx_read_mult_var(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ_MULT)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2101,7 +2084,6 @@ ble_att_svr_service_uuid(struct ble_att_svr_entry *entry,
|
||||
rc = ble_att_svr_read_flat(BLE_HS_CONN_HANDLE_NONE, entry, 0, sizeof(val), val,
|
||||
&attr_len, out_att_err);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2138,7 +2120,6 @@ ble_att_svr_read_group_type_entry_write(struct os_mbuf *om, uint16_t mtu,
|
||||
len = BLE_ATT_READ_GROUP_TYPE_ADATA_SZ_128;
|
||||
}
|
||||
if (OS_MBUF_PKTLEN(om) + len > mtu) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -2333,7 +2314,6 @@ int
|
||||
ble_att_svr_rx_read_group_type(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_READ_GROUP_TYPE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2450,7 +2430,6 @@ int
|
||||
ble_att_svr_rx_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_WRITE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2518,7 +2497,6 @@ ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, uint16_t cid, struct os_mbuf *
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_WRITE_NO_RSP)
|
||||
os_mbuf_free_chain(*rxom);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2528,7 +2506,6 @@ ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, uint16_t cid, struct os_mbuf *
|
||||
!ble_att_svr_check_conn_aware(conn_handle)) {
|
||||
ble_hs_unlock();
|
||||
os_mbuf_free_chain(*rxom);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
ble_hs_unlock();
|
||||
@@ -2541,7 +2518,6 @@ ble_att_svr_rx_write_no_rsp(uint16_t conn_handle, uint16_t cid, struct os_mbuf *
|
||||
|
||||
rc = ble_att_svr_pullup_req_base(rxom, sizeof(*req), &att_err);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2560,7 +2536,6 @@ int
|
||||
ble_att_svr_rx_signed_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
if (MYNEWT_VAL(BLE_EATT_CHAN_NUM) > 0 && ble_hs_cfg.eatt) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -2597,7 +2572,6 @@ ble_att_svr_rx_signed_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf *
|
||||
|
||||
rc = ble_att_svr_pullup_req_base(rxom, sizeof(*req), &att_err);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2862,7 +2836,6 @@ ble_att_svr_prep_write(uint16_t conn_handle,
|
||||
/* First, validate the contents of the prepare queue. */
|
||||
rc = ble_att_svr_prep_validate(prep_list, err_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2949,7 +2922,6 @@ int
|
||||
ble_att_svr_rx_prep_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_QUEUED_WRITE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3051,7 +3023,6 @@ int
|
||||
ble_att_svr_rx_exec_write(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_QUEUED_WRITE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3143,7 +3114,6 @@ int
|
||||
ble_att_svr_rx_notify(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_NOTIFY)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3191,7 +3161,6 @@ int
|
||||
ble_att_svr_rx_notify_multi(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_NOTIFY_MULTI)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3326,7 +3295,6 @@ int
|
||||
ble_att_svr_rx_indicate(uint16_t conn_handle, uint16_t cid, struct os_mbuf **rxom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_ATT_SVR_INDICATE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3525,7 +3493,6 @@ ble_att_svr_start(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_att_svr_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -3596,7 +3563,6 @@ ble_att_svr_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_att_svr_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -3668,7 +3634,6 @@ int ble_att_get_database_size(int *out_size)
|
||||
uuid->value == BLE_ATT_UUID_SECONDARY_SERVICE) {
|
||||
rc = ble_att_svr_service_uuid(entry, &service_uuid, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
/* handle (2 bytes) + type(2 bytes) + uuid (variable) */
|
||||
@@ -3677,7 +3642,6 @@ int ble_att_get_database_size(int *out_size)
|
||||
else if(uuid->value == BLE_ATT_UUID_INCLUDE) {
|
||||
rc = ble_att_svr_service_uuid(entry, &service_uuid, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3738,7 +3702,6 @@ int ble_att_fill_database_info(uint8_t *out_data)
|
||||
uuid->value == BLE_ATT_UUID_SECONDARY_SERVICE) {
|
||||
rc = ble_att_svr_service_uuid(entry, &service_uuid, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
/* handle (2 bytes) + type(2 bytes) + uuid (variable) */
|
||||
@@ -3753,7 +3716,6 @@ int ble_att_fill_database_info(uint8_t *out_data)
|
||||
entry, 0, sizeof(val), val,
|
||||
&attr_len, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3777,7 +3739,6 @@ int ble_att_fill_database_info(uint8_t *out_data)
|
||||
entry, 0, sizeof(val), val,
|
||||
&attr_len, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
memcpy(data + 4, val, attr_len);
|
||||
@@ -3803,7 +3764,6 @@ int ble_att_fill_database_info(uint8_t *out_data)
|
||||
entry, 0, sizeof(val), val,
|
||||
&attr_len, &att_error);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
memcpy(data + 4, val, attr_len);
|
||||
|
||||
@@ -531,7 +531,6 @@ ble_hs_hci_evt_le_cs_rd_rem_supp_cap_complete(uint8_t subevent, const void *data
|
||||
uint16_t conn_handle = le16toh(ev->conn_handle);
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (desc.role == BLE_GAP_ROLE_MASTER) {
|
||||
@@ -548,9 +547,6 @@ ble_hs_hci_evt_le_cs_rd_rem_supp_cap_complete(uint8_t subevent, const void *data
|
||||
if (rc) {
|
||||
BLE_HS_LOG(INFO, "Failed to set the default CS settings, err %d", rc);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
BLE_HS_LOG(INFO, "Set default CS settings ");
|
||||
@@ -564,9 +560,6 @@ ble_hs_hci_evt_le_cs_rd_rem_supp_cap_complete(uint8_t subevent, const void *data
|
||||
BLE_HS_LOG(INFO, "Failed to read FAE table");
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -613,7 +606,6 @@ ble_hs_hci_evt_le_cs_rd_rem_fae_complete(uint8_t subevent, const void *data,
|
||||
|
||||
rc = ble_gap_conn_find(cmd.conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -648,9 +640,6 @@ ble_hs_hci_evt_le_cs_rd_rem_fae_complete(uint8_t subevent, const void *data,
|
||||
BLE_HS_LOG(INFO, "Failed to create CS config");
|
||||
}
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -709,9 +698,6 @@ ble_hs_hci_evt_le_cs_sec_enable_complete(uint8_t subevent, const void *data,
|
||||
rc = ble_cs_set_proc_params(&cmd, &rsp);
|
||||
if (rc) {
|
||||
BLE_HS_LOG(INFO, "Failed to set CS procedure parameters");
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
BLE_HS_LOG(INFO, "CS procedure parameters set");
|
||||
@@ -724,7 +710,6 @@ ble_hs_hci_evt_le_cs_sec_enable_complete(uint8_t subevent, const void *data,
|
||||
uint16_t conn_handle = le16toh(ev->conn_handle);
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (desc.role == BLE_GAP_ROLE_MASTER) {
|
||||
@@ -735,9 +720,6 @@ ble_hs_hci_evt_le_cs_sec_enable_complete(uint8_t subevent, const void *data,
|
||||
} else {
|
||||
BLE_HS_LOG(INFO, "CS procedure enabled");
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
@@ -764,7 +746,6 @@ ble_hs_hci_evt_le_cs_config_complete(uint8_t subevent, const void *data,
|
||||
uint16_t conn_handle = le16toh(ev->conn_handle);
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -774,9 +755,6 @@ ble_hs_hci_evt_le_cs_config_complete(uint8_t subevent, const void *data,
|
||||
if (rc) {
|
||||
BLE_HS_LOG(DEBUG, "Failed to enable CS security");
|
||||
ble_cs_call_procedure_complete_cb(le16toh(ev->conn_handle), BLE_ERR_UNSPECIFIED);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -925,9 +903,6 @@ ble_cs_initiator_procedure_start(const struct ble_cs_initiator_procedure_start_p
|
||||
"err %d", rc);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@ static int ble_ead_rand(void *buf, int len)
|
||||
int rc;
|
||||
rc = ble_hs_hci_util_rand(buf, len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
|
||||
@@ -195,9 +195,6 @@ ble_eatt_prepare_rx_sdu(struct ble_l2cap_chan *chan)
|
||||
chan->conn_handle, rc);
|
||||
os_mbuf_free_chain(om);
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -307,9 +304,6 @@ ble_eatt_l2cap_event_fn(struct ble_l2cap_event *event, void *arg)
|
||||
rc = ble_eatt_prepare_rx_sdu(event->accept.chan);
|
||||
if (rc) {
|
||||
ble_eatt_free(eatt);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
@@ -325,7 +319,6 @@ ble_eatt_l2cap_event_fn(struct ble_l2cap_event *event, void *arg)
|
||||
if (OS_MBUF_PKTLEN(event->receive.sdu_rx) < 1) {
|
||||
os_mbuf_free_chain(event->receive.sdu_rx);
|
||||
ble_l2cap_disconnect(eatt->chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
opcode = event->receive.sdu_rx->om_data[0];
|
||||
@@ -341,14 +334,12 @@ ble_eatt_l2cap_event_fn(struct ble_l2cap_event *event, void *arg)
|
||||
*/
|
||||
os_mbuf_free_chain(event->receive.sdu_rx);
|
||||
ble_l2cap_disconnect(eatt->chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
if (ble_gap_conn_find(event->receive.conn_handle, &desc)) {
|
||||
os_mbuf_free_chain(event->receive.sdu_rx);
|
||||
ble_l2cap_disconnect(eatt->chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
/* As per BLE 5.4 Standard, Vol. 3, Part G, section 5.3.2
|
||||
@@ -362,7 +353,6 @@ ble_eatt_l2cap_event_fn(struct ble_l2cap_event *event, void *arg)
|
||||
if (!desc.sec_state.encrypted) {
|
||||
os_mbuf_free_chain(event->receive.sdu_rx);
|
||||
ble_l2cap_disconnect(eatt->chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
@@ -452,7 +442,6 @@ ble_gatt_eatt_read_cl_uuid_cb(uint16_t conn_handle,
|
||||
ble_gatt_eatt_write_cl_cb, NULL);
|
||||
BLE_EATT_LOG_DEBUG("eatt: %s , write rc = %d \n", __func__, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -470,20 +459,17 @@ ble_gatt_eatt_read_uuid_cb(uint16_t conn_handle,
|
||||
|
||||
if (error == NULL || (error->status != 0 && error->status != BLE_HS_EDONE)) {
|
||||
BLE_EATT_LOG_DEBUG("eatt: Cannot find Server Supported features on peer device\n");
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (attr == NULL) {
|
||||
BLE_EATT_LOG_ERROR("eatt: Invalid attribute \n");
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
rc = os_mbuf_copydata(attr->om, 0, 1, &supported_features);
|
||||
if (rc) {
|
||||
BLE_EATT_LOG_ERROR("eatt: Cannot read srv supported features \n");
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -494,7 +480,6 @@ ble_gatt_eatt_read_uuid_cb(uint16_t conn_handle,
|
||||
ble_npl_eventq_put(ble_hs_evq_get(), ev);
|
||||
}
|
||||
}
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -642,17 +627,11 @@ ble_eatt_tx(uint16_t conn_handle, uint16_t cid, struct os_mbuf *txom)
|
||||
BLE_EATT_LOG_DEBUG("ble_eatt_tx: Eatt stalled");
|
||||
/* L2CAP owns the mbuf; COC_TX_UNSTALLED event will fire when ready */
|
||||
/* Do NOT re-queue - this would cause use-after-free */
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else if (rc == BLE_HS_EBUSY) {
|
||||
BLE_EATT_LOG_DEBUG("ble_eatt_tx: Message queued");
|
||||
STAILQ_INSERT_HEAD(&eatt->eatt_tx_q, OS_MBUF_PKTHDR(txom), omp_next);
|
||||
ble_npl_eventq_put(ble_hs_evq_get(), &eatt->wakeup_ev);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
BLE_EATT_LOG_ERROR("eatt: %s, ERROR %d ", __func__, rc);
|
||||
|
||||
@@ -117,7 +117,6 @@ ble_eddystone_set_adv_data_gen(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
rc = ble_gap_adv_set_fields(adv_fields);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -160,7 +159,6 @@ ble_eddystone_set_adv_data_uid(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
rc = ble_eddystone_set_adv_data_gen(adv_fields, BLE_EDDYSTONE_UID_SVC_DATA_LEN);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -223,7 +221,6 @@ ble_eddystone_set_adv_data_url(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
rc = ble_eddystone_set_adv_data_gen(adv_fields, url_len + 2);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
+11
-265
File diff suppressed because it is too large
Load Diff
@@ -1721,9 +1721,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1788,7 +1785,6 @@ ble_gattc_disc_all_svcs_tx(struct ble_gattc_proc *proc)
|
||||
proc->disc_all_svcs.prev_handle + 1,
|
||||
0xffff, &uuid.u);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1805,9 +1801,6 @@ ble_gattc_disc_all_svcs_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_disc_all_svcs_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1878,7 +1871,6 @@ ble_gattc_disc_all_svcs_rx_adata(struct ble_gattc_proc *proc,
|
||||
done:
|
||||
cbrc = ble_gattc_disc_all_svcs_cb(proc, rc, 0, &service);
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -1898,21 +1890,18 @@ ble_gattc_disc_all_svcs_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_disc_all_svcs_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->disc_all_svcs.prev_handle == 0xffff) {
|
||||
/* Service discovery complete. */
|
||||
ble_gattc_disc_all_svcs_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_disc_all_svcs_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -1924,7 +1913,6 @@ ble_gattc_disc_all_svcs(uint16_t conn_handle, ble_gatt_disc_svc_fn *cb,
|
||||
void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_DISC_ALL_SVCS)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2044,7 +2032,6 @@ ble_gattc_disc_svc_uuid_tx(struct ble_gattc_proc *proc)
|
||||
val,
|
||||
ble_uuid_length(&proc->disc_svc_uuid.service_uuid.u));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2061,9 +2048,6 @@ ble_gattc_disc_svc_uuid_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_disc_svc_uuid_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2119,7 +2103,6 @@ ble_gattc_disc_svc_uuid_rx_hinfo(struct ble_gattc_proc *proc,
|
||||
done:
|
||||
cbrc = ble_gattc_disc_svc_uuid_cb(proc, rc, 0, &service);
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -2139,21 +2122,18 @@ ble_gattc_disc_svc_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_disc_svc_uuid_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->disc_svc_uuid.prev_handle == 0xffff) {
|
||||
/* Service discovery complete. */
|
||||
ble_gattc_disc_svc_uuid_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_disc_svc_uuid_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -2165,7 +2145,6 @@ ble_gattc_disc_svc_by_uuid(uint16_t conn_handle, const ble_uuid_t *uuid,
|
||||
ble_gatt_disc_svc_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_DISC_SVC_UUID)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2206,9 +2185,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2282,7 +2258,6 @@ ble_gattc_find_inc_svcs_tx(struct ble_gattc_proc *proc)
|
||||
proc->find_inc_svcs.prev_handle + 1,
|
||||
proc->find_inc_svcs.end_handle, &uuid.u);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -2290,7 +2265,6 @@ ble_gattc_find_inc_svcs_tx(struct ble_gattc_proc *proc)
|
||||
rc = ble_att_clt_tx_read(proc->conn_handle, proc->cid,
|
||||
proc->find_inc_svcs.cur_start);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -2308,9 +2282,6 @@ ble_gattc_find_inc_svcs_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_find_inc_svcs_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2385,7 +2356,6 @@ ble_gattc_find_inc_svcs_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
rc = ble_gattc_find_inc_svcs_cb(proc, 0, 0, &service);
|
||||
if (rc != 0) {
|
||||
/* Application has indicated that the procedure should be aborted. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -2401,7 +2371,6 @@ ble_gattc_find_inc_svcs_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
|
||||
err:
|
||||
ble_gattc_find_inc_svcs_cb(proc, rc, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -2478,7 +2447,6 @@ done:
|
||||
}
|
||||
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -2498,21 +2466,18 @@ ble_gattc_find_inc_svcs_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_find_inc_svcs_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->find_inc_svcs.prev_handle == 0xffff) {
|
||||
/* Procedure complete. */
|
||||
ble_gattc_find_inc_svcs_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_find_inc_svcs_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
return 0;
|
||||
@@ -2531,7 +2496,6 @@ ble_gattc_find_inc_svcs(uint16_t conn_handle, uint16_t start_handle,
|
||||
#endif
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_FIND_INC_SVCS)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2572,9 +2536,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2639,7 +2600,6 @@ ble_gattc_disc_all_chrs_tx(struct ble_gattc_proc *proc)
|
||||
proc->disc_all_chrs.prev_handle + 1,
|
||||
proc->disc_all_chrs.end_handle, &uuid.u);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2656,9 +2616,6 @@ ble_gattc_disc_all_chrs_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_disc_all_chrs_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2731,7 +2688,6 @@ ble_gattc_disc_all_chrs_rx_adata(struct ble_gattc_proc *proc,
|
||||
done:
|
||||
cbrc = ble_gattc_disc_all_chrs_cb(proc, rc, 0, &chr);
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -2751,21 +2707,18 @@ ble_gattc_disc_all_chrs_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_disc_all_chrs_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->disc_all_chrs.prev_handle == proc->disc_all_chrs.end_handle) {
|
||||
/* Characteristic discovery complete. */
|
||||
ble_gattc_disc_all_chrs_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_disc_all_chrs_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
return 0;
|
||||
@@ -2777,7 +2730,6 @@ ble_gattc_disc_all_chrs(uint16_t conn_handle, uint16_t start_handle,
|
||||
void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_DISC_ALL_CHRS)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -2892,7 +2844,6 @@ ble_gattc_disc_chr_uuid_tx(struct ble_gattc_proc *proc)
|
||||
proc->disc_chr_uuid.prev_handle + 1,
|
||||
proc->disc_chr_uuid.end_handle, &uuid.u);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2909,9 +2860,6 @@ ble_gattc_disc_chr_uuid_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_disc_chr_uuid_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2995,7 +2943,6 @@ done:
|
||||
}
|
||||
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -3015,21 +2962,18 @@ ble_gattc_disc_chr_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_disc_chr_uuid_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->disc_chr_uuid.prev_handle == proc->disc_chr_uuid.end_handle) {
|
||||
/* Characteristic discovery complete. */
|
||||
ble_gattc_disc_chr_uuid_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_disc_chr_uuid_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
return 0;
|
||||
@@ -3041,7 +2985,6 @@ ble_gattc_disc_chrs_by_uuid(uint16_t conn_handle, uint16_t start_handle,
|
||||
ble_gatt_chr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_DISC_CHR_UUID)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3083,9 +3026,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3149,7 +3089,6 @@ ble_gattc_disc_all_dscs_tx(struct ble_gattc_proc *proc)
|
||||
proc->disc_all_dscs.prev_handle + 1,
|
||||
proc->disc_all_dscs.end_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3166,9 +3105,6 @@ ble_gattc_disc_all_dscs_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_disc_all_dscs_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3222,7 +3158,6 @@ done:
|
||||
|
||||
cbrc = ble_gattc_disc_all_dscs_cb(proc, rc, 0, &dsc);
|
||||
if (rc != 0 || cbrc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
} else {
|
||||
return 0;
|
||||
@@ -3242,21 +3177,18 @@ ble_gattc_disc_all_dscs_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_disc_all_dscs_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (proc->disc_all_dscs.prev_handle == proc->disc_all_dscs.end_handle) {
|
||||
/* All descriptors discovered. */
|
||||
ble_gattc_disc_all_dscs_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
/* Send follow-up request. */
|
||||
rc = ble_gattc_disc_all_dscs_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -3269,7 +3201,6 @@ ble_gattc_disc_all_dscs(uint16_t conn_handle, uint16_t start_handle,
|
||||
ble_gatt_dsc_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_DISC_ALL_DSCS)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3329,9 +3260,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3339,7 +3267,6 @@ done:
|
||||
int ble_gattc_check_valid_param(uint16_t num, uint16_t offset)
|
||||
{
|
||||
if (num == 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ATT_ERR_ATTR_NOT_FOUND);
|
||||
return BLE_ATT_ERR_ATTR_NOT_FOUND;
|
||||
} else if (offset >= num) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ATT_ERR_INVALID_OFFSET);
|
||||
@@ -3508,9 +3435,6 @@ int ble_gattc_get_service(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, svc_num, ESP_BLE_GATT_DB_PRIMARY_SERVICE, offset, (void *)result, db);
|
||||
@@ -3540,9 +3464,6 @@ int ble_gattc_get_all_char(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, char_num, ESP_BLE_GATT_DB_CHARACTERISTIC, offset, (void *)result, db);
|
||||
@@ -3571,9 +3492,6 @@ int ble_gattc_get_all_descr(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, descr_num, ESP_BLE_GATT_DB_DESCRIPTOR, offset, (void *)result, db);
|
||||
@@ -3604,9 +3522,6 @@ int ble_gattc_get_char_by_uuid(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, char_num, ESP_BLE_GATT_DB_CHARACTERISTIC, 0, (void *)result, db);
|
||||
@@ -3639,9 +3554,6 @@ int ble_gattc_get_descr_by_uuid(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, descr_num, ESP_BLE_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
@@ -3671,9 +3583,6 @@ int ble_gattc_get_descr_by_char_handle(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, descr_num, ESP_BLE_GATT_DB_DESCRIPTOR, 0, (void *)result, db);
|
||||
@@ -3706,9 +3615,6 @@ int ble_gattc_get_include_service(uint16_t conn_handle,
|
||||
nimble_platform_mem_free(db);
|
||||
}
|
||||
*count = 0;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
} else {
|
||||
ble_gattc_fill_gatt_db_conversion(count, incl_num, ESP_BLE_GATT_DB_INCLUDED_SERVICE, 0, (void *)result, db);
|
||||
@@ -3745,7 +3651,6 @@ int ble_gattc_get_db(uint16_t conn_handle,
|
||||
ble_gattc_get_cached_gatt_db(conn_handle, start_handle, end_handle, &db, &num, count);
|
||||
|
||||
if (num == 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ATT_ERR_ATTR_NOT_FOUND);
|
||||
return BLE_ATT_ERR_ATTR_NOT_FOUND;
|
||||
}
|
||||
if (db) {
|
||||
@@ -3843,7 +3748,6 @@ ble_gattc_read_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
*om = attr.om;
|
||||
|
||||
/* The read operation only has a single request / response exchange. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -3854,7 +3758,6 @@ ble_gattc_read_tx(struct ble_gattc_proc *proc)
|
||||
|
||||
rc = ble_att_clt_tx_read(proc->conn_handle, proc->cid, proc->read.handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3866,7 +3769,6 @@ ble_gattc_read(uint16_t conn_handle, uint16_t attr_handle,
|
||||
ble_gatt_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_READ)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -3901,9 +3803,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3992,7 +3891,6 @@ ble_gattc_read_uuid_rx_adata(struct ble_gattc_proc *proc,
|
||||
os_mbuf_free_chain(attr.om);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4010,7 +3908,6 @@ ble_gattc_read_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
|
||||
if (status != 0) {
|
||||
ble_gattc_read_uuid_cb(proc, status, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4018,7 +3915,6 @@ ble_gattc_read_uuid_rx_complete(struct ble_gattc_proc *proc, int status)
|
||||
* of multiple characteristics with identical UUIDs.
|
||||
*/
|
||||
ble_gattc_read_uuid_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4037,7 +3933,6 @@ ble_gattc_read_by_uuid(uint16_t conn_handle, uint16_t start_handle,
|
||||
ble_gatt_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_READ_UUID)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4072,9 +3967,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4141,7 +4033,6 @@ ble_gattc_read_long_tx(struct ble_gattc_proc *proc)
|
||||
if (proc->read_long.offset == 0) {
|
||||
rc = ble_att_clt_tx_read(proc->conn_handle, proc->cid, proc->read_long.handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -4149,7 +4040,6 @@ ble_gattc_read_long_tx(struct ble_gattc_proc *proc)
|
||||
proc->read_long.handle,
|
||||
proc->read_long.offset);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -4167,9 +4057,6 @@ ble_gattc_read_long_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_read_long_cb(proc, rc, 0, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4216,7 +4103,6 @@ ble_gattc_read_long_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
*om = attr.om;
|
||||
|
||||
if (rc != 0 || status != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4224,14 +4110,12 @@ ble_gattc_read_long_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
mtu = ble_att_mtu_by_cid(proc->conn_handle, proc->cid);
|
||||
if (mtu == 0) {
|
||||
/* No longer connected. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
if (data_len < mtu - 1) {
|
||||
/* Response shorter than maximum allowed; read complete. */
|
||||
ble_gattc_read_long_cb(proc, BLE_HS_EDONE, 0, NULL);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4239,7 +4123,6 @@ ble_gattc_read_long_rx_read_rsp(struct ble_gattc_proc *proc, int status,
|
||||
proc->read_long.offset += data_len;
|
||||
rc = ble_gattc_read_long_resume(proc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -4251,7 +4134,6 @@ ble_gattc_read_long(uint16_t conn_handle, uint16_t handle, uint16_t offset,
|
||||
ble_gatt_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_READ_LONG)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4286,9 +4168,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4468,7 +4347,6 @@ ble_gattc_read_mult_tx(struct ble_gattc_proc *proc)
|
||||
rc = ble_att_clt_tx_read_mult(proc->conn_handle, proc->cid, proc->read_mult.handles,
|
||||
proc->read_mult.num_handles, proc->read_mult.variable);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4483,7 +4361,6 @@ ble_gattc_read_mult_internal(uint16_t conn_handle, const uint16_t *handles,
|
||||
void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_READ_MULT)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4527,9 +4404,6 @@ done:
|
||||
}
|
||||
|
||||
ble_gattc_process_status(proc, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4551,7 +4425,6 @@ ble_gattc_read_mult_var(uint16_t conn_handle, const uint16_t *handles,
|
||||
return ble_gattc_read_mult_internal(conn_handle, handles, num_handles,
|
||||
true, NULL, cb, cb_arg);
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -4565,7 +4438,6 @@ ble_gattc_write_no_rsp(uint16_t conn_handle, uint16_t attr_handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_WRITE_NO_RSP)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4583,9 +4455,6 @@ ble_gattc_write_no_rsp(uint16_t conn_handle, uint16_t attr_handle,
|
||||
}
|
||||
ble_eatt_release_chan(conn_handle, BLE_GATT_OP_DUMMY);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4604,7 +4473,6 @@ ble_gattc_write_no_rsp_flat(uint16_t conn_handle, uint16_t attr_handle,
|
||||
|
||||
rc = ble_gattc_write_no_rsp(conn_handle, attr_handle, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4621,7 +4489,6 @@ ble_gattc_signed_write(uint16_t conn_handle, uint16_t attr_handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_SIGNED_WRITE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4743,7 +4610,6 @@ ble_gattc_write(uint16_t conn_handle, uint16_t attr_handle,
|
||||
struct os_mbuf *txom, ble_gatt_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_WRITE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -4806,7 +4672,6 @@ ble_gattc_write_flat(uint16_t conn_handle, uint16_t attr_handle,
|
||||
|
||||
rc = ble_gattc_write(conn_handle, attr_handle, om, cb, cb_arg);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4921,9 +4786,6 @@ ble_gattc_write_long_tx(struct ble_gattc_proc *proc)
|
||||
|
||||
done:
|
||||
os_mbuf_free_chain(om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -4937,9 +4799,6 @@ ble_gattc_write_long_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_write_long_cb(proc, rc, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -5046,7 +4905,6 @@ ble_gattc_write_long_rx_prep(struct ble_gattc_proc *proc,
|
||||
err:
|
||||
/* XXX: Might need to cancel pending writes. */
|
||||
ble_gattc_write_long_cb(proc, rc, 0);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -5065,12 +4923,10 @@ ble_gattc_write_long_rx_exec(struct ble_gattc_proc *proc, int status)
|
||||
/* Expecting an execute write response, not a prepare write
|
||||
* response.
|
||||
*/
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
ble_gattc_write_long_cb(proc, status, 0);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -5080,7 +4936,6 @@ ble_gattc_write_long(uint16_t conn_handle, uint16_t attr_handle,
|
||||
ble_gatt_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_WRITE_LONG)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -5240,9 +5095,6 @@ ble_gattc_write_reliable_tx(struct ble_gattc_proc *proc)
|
||||
|
||||
done:
|
||||
os_mbuf_free_chain(om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -5256,9 +5108,6 @@ ble_gattc_write_reliable_resume(struct ble_gattc_proc *proc)
|
||||
rc = ble_gattc_process_resume_status(proc, status);
|
||||
if (rc != 0) {
|
||||
ble_gattc_write_reliable_cb(proc, rc, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -5350,7 +5199,6 @@ ble_gattc_write_reliable_rx_prep(struct ble_gattc_proc *proc,
|
||||
|
||||
err:
|
||||
ble_gattc_write_reliable_err(proc, rc, 0);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -5363,7 +5211,6 @@ ble_gattc_write_reliable_rx_exec(struct ble_gattc_proc *proc, int status)
|
||||
{
|
||||
ble_gattc_dbg_assert_proc_not_inserted(proc);
|
||||
ble_gattc_write_reliable_cb(proc, status, 0);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EDONE);
|
||||
return BLE_HS_EDONE;
|
||||
}
|
||||
|
||||
@@ -5374,7 +5221,6 @@ ble_gattc_write_reliable(uint16_t conn_handle,
|
||||
ble_gatt_reliable_attr_fn *cb, void *cb_arg)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_WRITE_RELIABLE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -5443,7 +5289,6 @@ static int ble_gatts_check_conn_aware(uint16_t conn_handle, bool *aware) {
|
||||
struct ble_hs_conn *conn;
|
||||
conn = ble_hs_conn_find(conn_handle);
|
||||
if(conn == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
*aware = conn->bhc_gatt_svr.aware_state;
|
||||
@@ -5457,7 +5302,6 @@ ble_gatts_notify_custom(uint16_t conn_handle, uint16_t chr_val_handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_NOTIFY)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
#if MYNEWT_VAL(BLE_GATT_CACHING)
|
||||
@@ -5526,7 +5370,6 @@ ble_gatts_notify_multiple_custom(uint16_t conn_handle,
|
||||
struct ble_gatt_notif *tuples)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_NOTIFY_MULTIPLE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -5551,7 +5394,6 @@ ble_gatts_notify_multiple_custom(uint16_t conn_handle,
|
||||
if (conn == NULL) {
|
||||
ble_hs_unlock();
|
||||
os_mbuf_free_chain(txom);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
|
||||
@@ -5756,9 +5598,6 @@ int ble_gattc_register_for_notification(uint16_t conn_handle, uint16_t char_val_
|
||||
nimble_platform_mem_free(cccd_reg_flag);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -5830,9 +5669,6 @@ int ble_gattc_unregister_for_notification(uint16_t conn_handle, uint16_t char_va
|
||||
nimble_platform_mem_free(cccd_unreg_flag);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif //MYNEWT_VAL(BLE_STORE_MAX_CCCDS)
|
||||
@@ -5843,7 +5679,6 @@ int
|
||||
ble_gatts_notify(uint16_t conn_handle, uint16_t chr_val_handle)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_NOTIFY)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -5951,7 +5786,6 @@ ble_gatts_indicate_custom(uint16_t conn_handle, uint16_t chr_val_handle,
|
||||
struct os_mbuf *txom)
|
||||
{
|
||||
#if !MYNEWT_VAL(BLE_GATT_INDICATE)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -6684,7 +6518,6 @@ ble_gattc_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_gattc_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -6730,9 +6563,6 @@ ble_gattc_init(void)
|
||||
rc = ble_gattc_err_dispatch_init();
|
||||
if (rc != 0) {
|
||||
ble_gattc_deinit();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -6741,9 +6571,6 @@ ble_gattc_init(void)
|
||||
rc = ble_gattc_resume_dispatch_init();
|
||||
if (rc != 0) {
|
||||
ble_gattc_deinit();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -6751,16 +6578,12 @@ ble_gattc_init(void)
|
||||
rc = ble_gattc_tmo_dispatch_init();
|
||||
if (rc != 0) {
|
||||
ble_gattc_deinit();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
#else
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -6776,7 +6599,6 @@ ble_gattc_init(void)
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -123,14 +123,12 @@ cacheEraseItem(cache_handle_t handle, const char *key)
|
||||
if (cache_fn.erase_key_item) {
|
||||
rc = cache_fn.erase_key_item(handle,key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (cache_fn.commit) {
|
||||
rc = cache_fn.commit(handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -801,7 +799,6 @@ ble_gattc_cache_assoc_load(ble_addr_t src_addr, uint8_t src_index, ble_addr_t as
|
||||
BLE_HS_LOG(DEBUG, "Successfully associated cache from src_addr to assoc_addr.");
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -954,7 +951,6 @@ ble_gattc_cache_init(void *storage_cb)
|
||||
int no_cached_blob = 0;
|
||||
rc = ble_gattc_cache_static_vars_init();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -38,7 +38,6 @@
|
||||
#define CHECK_CACHE_CONN_STATE(cache_state, cb, cb_arg, opcode, \
|
||||
s_handle, e_handle, p_uuid) \
|
||||
if (ble_hs_cfg.gatt_use_cache == 0) { \
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP); \
|
||||
return BLE_HS_ENOTSUP; \
|
||||
} \
|
||||
op = &conn->pending_op; \
|
||||
@@ -1714,9 +1713,6 @@ ble_gattc_cache_conn_inc_disced(uint16_t conn_handle, const struct ble_gatt_erro
|
||||
ble_gattc_cache_conn_disc_complete(peer, rc);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1754,9 +1750,6 @@ ble_gattc_cache_conn_svc_disced(uint16_t conn_handle, const struct ble_gatt_erro
|
||||
ble_gattc_cache_conn_disc_complete(peer, rc);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1899,9 +1892,6 @@ ble_gattc_cache_conn_dsc_disced(uint16_t conn_handle, const struct ble_gatt_erro
|
||||
ble_gattc_cache_conn_disc_complete(peer, rc);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1984,9 +1974,6 @@ ble_gattc_cache_conn_chr_disced(uint16_t conn_handle, const struct ble_gatt_erro
|
||||
ble_gattc_cache_conn_disc_complete(peer, rc);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2141,9 +2128,6 @@ ble_gattc_cache_conn_assoc_on_read(uint16_t conn_handle,
|
||||
rc = os_mbuf_copydata(attr->om, 0, sizeof(database_hash), database_hash);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(WARN, "Failed to copy database hash from attr->om (rc=%d)", rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
rc = ble_gattc_cache_find_source((struct ble_gattc_cache_conn *)arg, database_hash);
|
||||
@@ -2178,9 +2162,6 @@ int ble_gattc_cache_assoc(ble_addr_t peer_addr)
|
||||
|
||||
if (rc != 0) {
|
||||
cache_conn->cache_state = CACHE_INVALID;
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -2587,7 +2568,6 @@ ble_gattc_cache_conn_search_all_svcs(uint16_t conn_handle,
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2650,7 +2630,6 @@ ble_gattc_cache_conn_search_svc_by_uuid(uint16_t conn_handle, const ble_uuid_t *
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2745,7 +2724,6 @@ ble_gattc_cache_conn_search_inc_svcs(uint16_t conn_handle, uint16_t start_handle
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2816,7 +2794,6 @@ ble_gattc_cache_conn_search_all_chrs(uint16_t conn_handle, uint16_t start_handle
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2887,7 +2864,6 @@ ble_gattc_cache_conn_search_chrs_by_uuid(uint16_t conn_handle, uint16_t start_ha
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2963,7 +2939,6 @@ ble_gattc_cache_conn_search_all_dscs(uint16_t conn_handle, uint16_t start_handle
|
||||
|
||||
rc = ble_gattc_cache_conn_verify(conn);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -733,7 +733,6 @@ ble_gatts_calculate_hash(uint8_t *out_hash_key)
|
||||
/* data with all zeroes */
|
||||
rc = ble_att_get_database_size(&size);
|
||||
if(rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
buf = nimble_platform_mem_calloc(1,sizeof(uint8_t) * size);
|
||||
@@ -773,7 +772,6 @@ ble_gatts_register_inc(struct ble_gatts_svc_entry *entry)
|
||||
rc = ble_att_svr_register(uuid_inc, BLE_ATT_F_READ, 0, &handle,
|
||||
ble_gatts_inc_access, entry);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -869,7 +867,6 @@ ble_gatts_register_dsc(const struct ble_gatt_svc_def *svc,
|
||||
rc = ble_att_svr_register(dsc->uuid, dsc->att_flags, dsc->min_key_size,
|
||||
&dsc_handle, ble_gatts_dsc_access, (void *)dsc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1127,7 +1124,6 @@ ble_gatts_clt_cfg_access(uint16_t conn_handle, uint16_t attr_handle,
|
||||
ble_hs_unlock();
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1159,7 +1155,6 @@ ble_gatts_register_clt_cfg_dsc(uint16_t *att_handle, uint8_t cccd_flags)
|
||||
rc = ble_att_svr_register(uuid_ccc, cccd_flags, 0,
|
||||
att_handle, ble_gatts_clt_cfg_access, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1238,7 +1233,6 @@ ble_gatts_register_cpfds(const struct ble_gatt_cpfd *cpfds)
|
||||
rc = ble_att_svr_register(uuid_cpf, BLE_ATT_F_READ, 0, &first_cpfd_handle,
|
||||
ble_gatts_cpfd_access, (void *)(cpfds + idx));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1253,7 +1247,6 @@ ble_gatts_register_cpfds(const struct ble_gatt_cpfd *cpfds)
|
||||
first_cpfd_handle -= (idx - 1);
|
||||
first_cpfd_entry = ble_att_svr_find_by_handle(first_cpfd_handle);
|
||||
if (first_cpfd_entry == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -1265,7 +1258,6 @@ ble_gatts_register_cpfds(const struct ble_gatt_cpfd *cpfds)
|
||||
rc = ble_att_svr_register(uuid_caf, BLE_ATT_F_READ, 0, NULL,
|
||||
ble_gatts_cafd_access, (void *)(first_cpfd_entry));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1310,7 +1302,6 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
|
||||
rc = ble_att_svr_register(uuid_chr, BLE_ATT_F_READ, 0, &def_handle,
|
||||
ble_gatts_chr_def_access, (void *)chr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1322,7 +1313,6 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
|
||||
&val_handle, ble_gatts_chr_val_access,
|
||||
(void *)chr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
BLE_HS_DBG_ASSERT(val_handle == def_handle + 1);
|
||||
@@ -1344,7 +1334,6 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
|
||||
att_flags = ble_gatts_chr_clt_cfg_flags_from_chr_flags(chr->flags);
|
||||
rc = ble_gatts_register_clt_cfg_dsc(&dsc_handle, att_flags);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
BLE_HS_DBG_ASSERT(dsc_handle == def_handle + 2);
|
||||
@@ -1353,7 +1342,6 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
|
||||
/* Register each Client Presentation Format Descriptor. */
|
||||
rc = ble_gatts_register_cpfds(chr->cpfd);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -1364,7 +1352,6 @@ ble_gatts_register_chr(const struct ble_gatt_svc_def *svc,
|
||||
rc = ble_gatts_register_dsc(svc, chr, dsc, def_handle, register_cb,
|
||||
cb_arg);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1426,7 +1413,6 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
|
||||
int i;
|
||||
|
||||
if (!ble_gatts_svc_incs_satisfied(svc)) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
|
||||
@@ -1447,7 +1433,6 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
|
||||
rc = ble_att_svr_register(uuid, BLE_ATT_F_READ, 0, out_handle,
|
||||
ble_gatts_svc_access, (void *)svc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1473,7 +1458,6 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
|
||||
rc = ble_gatts_register_inc(ble_gatts_svc_entries + idx);
|
||||
#endif
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1484,7 +1468,6 @@ ble_gatts_register_svc(const struct ble_gatt_svc_def *svc,
|
||||
for (chr = svc->characteristics; chr->uuid != NULL; chr++) {
|
||||
rc = ble_gatts_register_chr(svc, chr, register_cb, cb_arg);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1531,9 +1514,6 @@ ble_gatts_register_round(int *out_num_registered, ble_gatt_register_fn *cb,
|
||||
break;
|
||||
|
||||
default:
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1617,7 +1597,6 @@ ble_gatts_register_svcs(const struct ble_gatt_svc_def *svcs,
|
||||
while (total_registered < num_svcs) {
|
||||
rc = ble_gatts_register_round(&cur_registered, cb, cb_arg);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
total_registered += cur_registered;
|
||||
@@ -2062,9 +2041,6 @@ done:
|
||||
}
|
||||
|
||||
ble_hs_unlock();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2233,18 +2209,15 @@ ble_gatts_send_next_indicate(uint16_t conn_handle)
|
||||
ble_hs_unlock();
|
||||
|
||||
if (conn == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
|
||||
if (chr_val_handle == 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
rc = ble_gatts_indicate(conn_handle, chr_val_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2278,7 +2251,6 @@ ble_gatts_rx_indicate_ack(uint16_t conn_handle, uint16_t chr_val_handle)
|
||||
if (clt_cfg_idx == -1) {
|
||||
#endif
|
||||
/* This characteristic does not have a CCCD. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -2287,7 +2259,6 @@ ble_gatts_rx_indicate_ack(uint16_t conn_handle, uint16_t chr_val_handle)
|
||||
#endif
|
||||
if (!(clt_cfg->allowed & BLE_GATTS_CLT_CFG_F_INDICATE)) {
|
||||
/* This characteristic does not allow indications. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -2341,7 +2312,6 @@ ble_gatts_rx_indicate_ack(uint16_t conn_handle, uint16_t chr_val_handle)
|
||||
ble_hs_unlock();
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2979,7 +2949,6 @@ ble_gatts_find_svc_chr_attr(const ble_uuid_t *svc_uuid,
|
||||
svc_entry = ble_gatts_find_svc_entry(svc_uuid);
|
||||
#endif
|
||||
if (svc_entry == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -2993,14 +2962,12 @@ ble_gatts_find_svc_chr_attr(const ble_uuid_t *svc_uuid,
|
||||
while (1) {
|
||||
if (cur == NULL) {
|
||||
/* Reached end of attribute list without a match. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
next = STAILQ_NEXT(cur, ha_next);
|
||||
|
||||
if (cur->ha_handle_id == svc_entry->end_group_handle) {
|
||||
/* Reached end of service without a match. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -3032,7 +2999,6 @@ ble_gatts_find_svc(const ble_uuid_t *uuid, uint16_t *out_handle)
|
||||
entry = ble_gatts_find_svc_entry(uuid);
|
||||
#endif
|
||||
if (entry == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -3051,7 +3017,6 @@ ble_gatts_find_chr(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
|
||||
|
||||
rc = ble_gatts_find_svc_chr_attr(svc_uuid, chr_uuid, NULL, &att_chr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3077,7 +3042,6 @@ ble_gatts_find_dsc(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
|
||||
rc = ble_gatts_find_svc_chr_attr(svc_uuid, chr_uuid, &svc_entry,
|
||||
&att_chr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3085,20 +3049,17 @@ ble_gatts_find_dsc(const ble_uuid_t *svc_uuid, const ble_uuid_t *chr_uuid,
|
||||
while (1) {
|
||||
if (cur == NULL) {
|
||||
/* Reached end of attribute list without a match. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
if (cur->ha_handle_id > svc_entry->end_group_handle) {
|
||||
/* Reached end of service without a match. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
uuid16 = ble_uuid_u16(cur->ha_uuid);
|
||||
if (uuid16 == BLE_ATT_UUID_CHARACTERISTIC) {
|
||||
/* Reached end of characteristic without a match. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -3134,7 +3095,6 @@ static int ble_gatts_remove_clt_cfg(struct ble_gatts_clt_cfg_list *clt_cfgs, uin
|
||||
}
|
||||
|
||||
if (cfg == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -3290,7 +3250,6 @@ ble_gatts_deregister_svc(const ble_uuid_t *uuid) {
|
||||
entry = ble_gatts_find_svc_entry_by_uuid(uuid);
|
||||
if (entry == NULL) {
|
||||
/* no such service */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
rc = 0;
|
||||
@@ -3312,7 +3271,6 @@ ble_gatts_remove_svc_entry(const ble_uuid_t *uuid)
|
||||
}
|
||||
}
|
||||
if (entry == NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
STAILQ_REMOVE(&ble_gatts_svc_entries, entry, ble_gatts_svc_entry, next);
|
||||
@@ -3466,7 +3424,6 @@ ble_gatts_svc_set_visibility(uint16_t handle, int visible)
|
||||
}
|
||||
}
|
||||
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -3619,7 +3576,6 @@ ble_gatts_count_cfg(const struct ble_gatt_svc_def *defs)
|
||||
|
||||
rc = ble_gatts_count_resources(defs, &res);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -286,9 +286,6 @@ ble_hs_lock_nested(void)
|
||||
#endif
|
||||
|
||||
rc = ble_npl_mutex_pend(&ble_hs_mutex, 0xffffffff);
|
||||
if (rc != 0 && rc != OS_NOT_STARTED) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_HS_DEBUG)
|
||||
counter_lock++;
|
||||
@@ -327,9 +324,6 @@ ble_hs_unlock_nested(void)
|
||||
#endif
|
||||
|
||||
rc = ble_npl_mutex_release(&ble_hs_mutex);
|
||||
if (rc != 0 && rc != OS_NOT_STARTED) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
BLE_HS_DBG_ASSERT_EVAL(rc == 0 || rc == OS_NOT_STARTED);
|
||||
|
||||
}
|
||||
@@ -393,7 +387,6 @@ ble_hs_wakeup_tx_conn(struct ble_hs_conn *conn)
|
||||
* get transmitted next time around.
|
||||
*/
|
||||
STAILQ_INSERT_HEAD(&conn->bhc_tx_q, OS_MBUF_PKTHDR(om), omp_next);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
}
|
||||
@@ -803,7 +796,6 @@ ble_hs_start(void)
|
||||
ble_hs_unlock();
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -822,7 +814,6 @@ ble_hs_start(void)
|
||||
#if MYNEWT_VAL(BLE_GATTS)
|
||||
rc = ble_gatts_start();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -66,7 +66,6 @@ ble_hs_adv_set_hdr(uint8_t type, uint8_t data_len, uint8_t max_len,
|
||||
data_len++;
|
||||
rc = os_mbuf_append(om, &data_len, sizeof(data_len));
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -75,7 +74,6 @@ ble_hs_adv_set_hdr(uint8_t type, uint8_t data_len, uint8_t max_len,
|
||||
|
||||
|
||||
if (*dst_len + 2 + data_len > max_len) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -98,7 +96,6 @@ ble_hs_adv_set_flat_mbuf(uint8_t type, int data_len, const void *data,
|
||||
|
||||
rc = ble_hs_adv_set_hdr(type, data_len, max_len, dst, dst_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -117,7 +114,6 @@ ble_hs_adv_set_flat(uint8_t type, int data_len, const void *data,
|
||||
uint8_t *dst, uint8_t *dst_len, uint8_t max_len)
|
||||
{
|
||||
#if !NIMBLE_BLE_ADVERTISE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -142,7 +138,6 @@ ble_hs_adv_set_array_uuid16(uint8_t type, uint8_t num_elems,
|
||||
rc = ble_hs_adv_set_hdr(type, num_elems * 2, max_len, dst,
|
||||
dst_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -150,7 +145,6 @@ ble_hs_adv_set_array_uuid16(uint8_t type, uint8_t num_elems,
|
||||
if (om) {
|
||||
rc = ble_uuid_to_mbuf(&elems[i].u, om);
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -173,14 +167,12 @@ ble_hs_adv_set_array_uuid32(uint8_t type, uint8_t num_elems,
|
||||
int i;
|
||||
|
||||
if ((uint16_t)num_elems * 4 > 255) { // Prevent truncation, actual AD field limited by BLE_HS_ADV_MAX_FIELD_SZ
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
rc = ble_hs_adv_set_hdr(type, num_elems * 4, max_len, dst,
|
||||
dst_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -193,7 +185,6 @@ ble_hs_adv_set_array_uuid32(uint8_t type, uint8_t num_elems,
|
||||
uuid_le = htole32(elems[i].value);
|
||||
rc = os_mbuf_append(om, &uuid_le, sizeof(uuid_le));
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -222,7 +213,6 @@ ble_hs_adv_set_array_uuid128(uint8_t type, uint8_t num_elems,
|
||||
rc = ble_hs_adv_set_hdr(type, num_elems * 16, max_len, dst,
|
||||
dst_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -230,7 +220,6 @@ ble_hs_adv_set_array_uuid128(uint8_t type, uint8_t num_elems,
|
||||
if (om) {
|
||||
rc = ble_uuid_to_mbuf(&elems[i].u, om);
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -259,7 +248,6 @@ ble_hs_adv_set_array16(uint8_t type, uint8_t num_elems, const uint16_t *elems,
|
||||
rc = ble_hs_adv_set_hdr(type, num_elems * sizeof *elems, max_len, dst,
|
||||
dst_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -268,7 +256,6 @@ ble_hs_adv_set_array16(uint8_t type, uint8_t num_elems, const uint16_t *elems,
|
||||
tmp = htole16(elems[i]);
|
||||
rc = os_mbuf_append(om, &tmp, sizeof(tmp));
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else {
|
||||
@@ -286,7 +273,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
struct os_mbuf *om)
|
||||
{
|
||||
#if !NIMBLE_BLE_ADVERTISE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -314,7 +300,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
max_len, om);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -331,7 +316,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->uuids16, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -348,7 +332,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->uuids32, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -365,7 +348,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->uuids128, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -382,7 +364,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->name, dst, &dst_len_local, max_len,
|
||||
om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -396,7 +377,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
if (adv_fields->tx_pwr_lvl == BLE_HS_ADV_TX_PWR_LVL_AUTO) {
|
||||
rc = ble_hs_hci_util_read_adv_tx_pwr(&tx_pwr_lvl);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
} else
|
||||
@@ -408,7 +388,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
rc = ble_hs_adv_set_flat_mbuf(BLE_HS_ADV_TYPE_TX_PWR_LVL, 1,
|
||||
&tx_pwr_lvl, dst, &dst_len_local, max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -421,7 +400,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
max_len, om);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -433,7 +411,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
&adv_fields->sm_oob_flag, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -446,7 +423,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->slave_itvl_range, dst,
|
||||
&dst_len_local, max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -459,7 +435,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->sol_uuids16, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -470,7 +445,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->sol_uuids128, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -484,7 +458,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->svc_data_uuid16, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -499,7 +472,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->public_tgt_addr, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -515,7 +487,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->random_tgt_addr, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -529,7 +500,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
&adv_fields->appearance, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -540,7 +510,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
&adv_fields->adv_itvl, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -558,7 +527,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
dev_addr_ad, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -569,7 +537,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
&adv_fields->le_role, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -581,7 +548,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->sol_uuids32, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -594,7 +560,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->svc_data_uuid32, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -606,7 +571,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->svc_data_uuid128, dst,
|
||||
&dst_len_local, max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -617,7 +581,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->uri, dst, &dst_len_local, max_len,
|
||||
om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -630,7 +593,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->le_supp_feat, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -642,7 +604,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
&adv_fields->adv_itvl_long, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -656,7 +617,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->enc_adv_data, dst, &dst_len_local,
|
||||
max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -670,7 +630,6 @@ adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
adv_fields->mfg_data,
|
||||
dst, &dst_len_local, max_len, om);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -692,7 +651,6 @@ ble_hs_adv_set_fields(const struct ble_hs_adv_fields *adv_fields,
|
||||
uint8_t *dst, uint8_t *dst_len, uint8_t max_len)
|
||||
{
|
||||
#if !NIMBLE_BLE_ADVERTISE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -704,7 +662,6 @@ ble_hs_adv_set_fields_mbuf(const struct ble_hs_adv_fields *adv_fields,
|
||||
struct os_mbuf *om)
|
||||
{
|
||||
#if !NIMBLE_BLE_ADVERTISE
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
return adv_set_fields(adv_fields, NULL, NULL, 0, om);
|
||||
@@ -721,7 +678,6 @@ ble_hs_adv_parse_uuids16(struct ble_hs_adv_fields *adv_fields,
|
||||
#endif
|
||||
|
||||
if (data_len % 2 != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -736,7 +692,6 @@ ble_hs_adv_parse_uuids16(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
if (uuid_cnt > free_slots) {
|
||||
/* not enough space to append */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -770,7 +725,6 @@ ble_hs_adv_parse_uuids32(struct ble_hs_adv_fields *adv_fields,
|
||||
#endif
|
||||
|
||||
if (data_len % 4 != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -786,7 +740,6 @@ ble_hs_adv_parse_uuids32(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
if (uuid_cnt > free_slots) {
|
||||
/* not enough space to append */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
/* Append new UUIDs to existing list */
|
||||
@@ -820,7 +773,6 @@ ble_hs_adv_parse_uuids128(struct ble_hs_adv_fields *adv_fields,
|
||||
#endif
|
||||
|
||||
if (data_len % 16 != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -836,7 +788,6 @@ ble_hs_adv_parse_uuids128(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
if (uuid_cnt > free_slots) {
|
||||
/* not enough space to append */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
/* Append new UUIDs to existing list */
|
||||
@@ -887,18 +838,15 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
int rc;
|
||||
|
||||
if (src_len < 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
*total_len = src[0] + 1;
|
||||
|
||||
if (*total_len < 2) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
if (src_len < *total_len) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -907,14 +855,12 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
data_len = *total_len - 2;
|
||||
|
||||
if (data_len > BLE_HS_ADV_MAX_FIELD_SZ) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
switch (type) {
|
||||
case BLE_HS_ADV_TYPE_FLAGS:
|
||||
if (data_len != BLE_HS_ADV_FLAGS_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->flags = *data;
|
||||
@@ -923,7 +869,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_INCOMP_UUIDS16:
|
||||
rc = ble_hs_adv_parse_uuids16(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids16_is_complete = 0;
|
||||
@@ -932,7 +877,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_COMP_UUIDS16:
|
||||
rc = ble_hs_adv_parse_uuids16(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids16_is_complete = 1;
|
||||
@@ -941,7 +885,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_INCOMP_UUIDS32:
|
||||
rc = ble_hs_adv_parse_uuids32(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids32_is_complete = 0;
|
||||
@@ -950,7 +893,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_COMP_UUIDS32:
|
||||
rc = ble_hs_adv_parse_uuids32(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids32_is_complete = 1;
|
||||
@@ -959,7 +901,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_INCOMP_UUIDS128:
|
||||
rc = ble_hs_adv_parse_uuids128(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids128_is_complete = 0;
|
||||
@@ -968,7 +909,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_COMP_UUIDS128:
|
||||
rc = ble_hs_adv_parse_uuids128(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
adv_fields->uuids128_is_complete = 1;
|
||||
@@ -988,7 +928,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_TX_PWR_LVL:
|
||||
if (data_len != BLE_HS_ADV_TX_PWR_LVL_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->tx_pwr_lvl = *data;
|
||||
@@ -998,7 +937,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
#if MYNEWT_VAL(BLE_EXTRA_ADV_FIELDS)
|
||||
case BLE_HS_ADV_TYPE_SEC_MGR_TK_VALUE:
|
||||
if (data_len != 16) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->sm_tk_value = data;
|
||||
@@ -1007,7 +945,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_SEC_MGR_OOB_FLAG:
|
||||
if (data_len != 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->sm_oob_flag = *data;
|
||||
@@ -1017,7 +954,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_SLAVE_ITVL_RANGE:
|
||||
if (data_len != BLE_HS_ADV_SLAVE_ITVL_RANGE_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->slave_itvl_range = data;
|
||||
@@ -1027,7 +963,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_SOL_UUIDS16:
|
||||
rc = ble_hs_adv_parse_uuids16(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
@@ -1035,7 +970,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_SOL_UUIDS128:
|
||||
rc = ble_hs_adv_parse_uuids128(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
@@ -1043,7 +977,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_SVC_DATA_UUID16:
|
||||
if (data_len < BLE_HS_ADV_SVC_DATA_UUID16_MIN_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->svc_data_uuid16 = data;
|
||||
@@ -1052,7 +985,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_PUBLIC_TGT_ADDR:
|
||||
if (data_len % BLE_HS_ADV_PUBLIC_TGT_ADDR_ENTRY_LEN != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->public_tgt_addr = data;
|
||||
@@ -1063,7 +995,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
#if MYNEWT_VAL(BLE_EXTRA_ADV_FIELDS)
|
||||
case BLE_HS_ADV_TYPE_RANDOM_TGT_ADDR:
|
||||
if (data_len % BLE_HS_ADV_PUBLIC_TGT_ADDR_ENTRY_LEN != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->random_tgt_addr = data;
|
||||
@@ -1074,7 +1005,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_APPEARANCE:
|
||||
if (data_len != BLE_HS_ADV_APPEARANCE_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->appearance = get_le16(data);
|
||||
@@ -1084,7 +1014,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
#if MYNEWT_VAL(BLE_EXTRA_ADV_FIELDS)
|
||||
case BLE_HS_ADV_TYPE_DEVICE_ADDR:
|
||||
if (data_len != 7) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->device_addr = data;
|
||||
@@ -1093,7 +1022,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_LE_ROLE:
|
||||
if (data_len != 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->le_role = *data;
|
||||
@@ -1103,7 +1031,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_ADV_ITVL:
|
||||
if (data_len != BLE_HS_ADV_ADV_ITVL_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->adv_itvl = get_le16(data);
|
||||
@@ -1112,7 +1039,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_SVC_DATA_UUID32:
|
||||
if (data_len < BLE_HS_ADV_SVC_DATA_UUID32_MIN_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->svc_data_uuid32 = data;
|
||||
@@ -1121,7 +1047,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
|
||||
case BLE_HS_ADV_TYPE_SVC_DATA_UUID128:
|
||||
if (data_len < BLE_HS_ADV_SVC_DATA_UUID128_MIN_LEN) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
adv_fields->svc_data_uuid128 = data;
|
||||
@@ -1137,7 +1062,6 @@ ble_hs_adv_parse_one_field(struct ble_hs_adv_fields *adv_fields,
|
||||
case BLE_HS_ADV_TYPE_SOL_UUIDS32:
|
||||
rc = ble_hs_adv_parse_uuids32(adv_fields, data, data_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
@@ -1181,7 +1105,6 @@ ble_hs_adv_parse_fields(struct ble_hs_adv_fields *adv_fields,
|
||||
while (src_len > 0) {
|
||||
rc = ble_hs_adv_parse_one_field(adv_fields, &field_len, src, src_len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1202,7 +1125,6 @@ ble_hs_adv_parse(const uint8_t *data, uint8_t length,
|
||||
field = (const void *) data;
|
||||
|
||||
if (field->length >= length) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -1223,7 +1145,6 @@ find_field_func(const struct ble_hs_adv_field *field, void *user_data)
|
||||
struct find_field_data *ffd = user_data;
|
||||
|
||||
if (field->type != ffd->type) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
|
||||
@@ -1244,12 +1165,10 @@ ble_hs_adv_find_field(uint8_t type, const uint8_t *data, uint8_t length,
|
||||
|
||||
rc = ble_hs_adv_parse(data, length, find_field_func, &ffd);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (!ffd.field) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
|
||||
@@ -157,7 +157,6 @@ int
|
||||
ble_hs_conn_chan_insert(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
|
||||
{
|
||||
#if !NIMBLE_BLE_CONNECT
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
|
||||
@@ -167,7 +166,6 @@ ble_hs_conn_chan_insert(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan)
|
||||
prev = NULL;
|
||||
SLIST_FOREACH(cur, &conn->bhc_channels, next) {
|
||||
if (cur->scid == chan->scid) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
}
|
||||
if (cur->scid > chan->scid) {
|
||||
@@ -660,7 +658,6 @@ ble_hs_conn_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_hs_conn_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,6 @@ ble_hs_flow_tx_num_comp_pkts(void)
|
||||
BLE_HCI_OCF_CB_HOST_NUM_COMP_PKTS),
|
||||
buf, sizeof(buf));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -213,7 +212,6 @@ ble_hs_flow_acl_free(struct os_mempool_ext *mpe, void *data, void *arg)
|
||||
/* Free the mbuf back to its pool. */
|
||||
rc = os_memblock_put_from_cb(&mpe->mpe_mp, data);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -298,7 +296,6 @@ ble_hs_flow_startup(void)
|
||||
BLE_HCI_OCF_CB_SET_CTLR_TO_HOST_FC),
|
||||
&enable_cmd, sizeof(enable_cmd), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -310,9 +307,6 @@ ble_hs_flow_startup(void)
|
||||
ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_CTLR_BASEBAND,
|
||||
BLE_HCI_OCF_CB_SET_CTLR_TO_HOST_FC),
|
||||
&enable_cmd, sizeof(enable_cmd), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -535,9 +535,6 @@ ble_hs_hci_process_ack(uint16_t expected_opcode,
|
||||
STATS_INC(ble_hs_stats, hci_invalid_ack);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -899,7 +896,6 @@ ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om)
|
||||
#endif
|
||||
if (frag == NULL) {
|
||||
*om = txom;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
|
||||
@@ -936,7 +932,6 @@ ble_hs_hci_acl_tx_now(struct ble_hs_conn *conn, struct os_mbuf **om)
|
||||
if (txom != NULL) {
|
||||
/* The controller couldn't accommodate some or all of the packet. */
|
||||
*om = txom;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
|
||||
@@ -973,7 +968,6 @@ ble_hs_hci_acl_tx(struct ble_hs_conn *conn, struct os_mbuf **om)
|
||||
|
||||
/* If this conn is already backed up, don't even try to send. */
|
||||
if (STAILQ_FIRST(&conn->bhc_tx_q) != NULL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EAGAIN);
|
||||
return BLE_HS_EAGAIN;
|
||||
}
|
||||
|
||||
|
||||
@@ -554,7 +554,6 @@ ble_hs_hci_evt_disconn_complete(uint8_t event_code, const void *data,
|
||||
#endif
|
||||
rc = ble_hs_atomic_conn_delete(ev->conn_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -980,7 +979,6 @@ ble_hs_hci_evt_le_adv_rpt(uint8_t subevent, const void *data, unsigned int len)
|
||||
/* Validate the event is formatted correctly */
|
||||
rc = ble_hs_hci_evt_le_adv_rpt_first_pass(data, len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1390,7 +1388,6 @@ ble_hs_hci_evt_le_ext_adv_rpt(uint8_t subevent, const void *data,
|
||||
|
||||
rc = ble_hs_hci_evt_le_ext_adv_rpt_first_pass(data, len);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2071,7 +2068,6 @@ ble_hs_hci_evt_acl_process(struct os_mbuf *om)
|
||||
rc = ble_hs_hci_util_data_hdr_strip(om, &hci_hdr);
|
||||
if (rc != 0) {
|
||||
os_mbuf_free_chain(om);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -54,7 +54,6 @@ ble_hs_hci_util_read_adv_tx_pwr(int8_t *out_tx_pwr)
|
||||
BLE_HCI_OCF_LE_RD_ADV_CHAN_TXPWR),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -86,7 +85,6 @@ ble_hs_hci_util_rand(void *dst, int len)
|
||||
rc = ble_hs_hci_cmd_tx(BLE_HCI_OP(BLE_HCI_OGF_LE, BLE_HCI_OCF_LE_RAND),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -119,7 +117,6 @@ ble_hs_hci_util_read_rssi(uint16_t conn_handle, int8_t *out_rssi)
|
||||
BLE_HCI_OCF_RD_RSSI), &cmd, sizeof(cmd),
|
||||
&rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -178,7 +175,6 @@ ble_hs_hci_util_set_data_len(uint16_t conn_handle, uint16_t tx_octets,
|
||||
BLE_HCI_OCF_LE_SET_DATA_LEN),
|
||||
&cmd, sizeof(cmd), &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -206,7 +202,6 @@ ble_hs_hci_util_read_sugg_def_data_len(uint16_t *out_sugg_max_tx_octets,
|
||||
BLE_HCI_OCF_LE_RD_SUGG_DEF_DATA_LEN),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -293,7 +288,6 @@ ble_hs_hci_read_chan_map(uint16_t conn_handle, uint8_t *out_chan_map)
|
||||
BLE_HCI_OCF_LE_RD_CHAN_MAP),
|
||||
&cmd, sizeof(cmd), &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -448,7 +442,6 @@ ble_hs_hci_rd_all_local_supp_features(uint8_t* status, uint8_t* max_page,
|
||||
&rsp, sizeof(rsp));
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -543,7 +536,6 @@ ble_hs_hci_read_monitor_adv_list_size(uint8_t *out_number)
|
||||
&rsp, sizeof(rsp));
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -109,7 +109,6 @@ ble_hs_id_gen_rnd(int nrpa, ble_addr_t *out_addr)
|
||||
|
||||
rc = ble_hs_hci_util_rand(out_addr->val, 6);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -146,7 +145,6 @@ ble_hs_id_set_nrpa_rnd(void)
|
||||
|
||||
rc = ble_hs_id_gen_rnd(1, &nrpa_addr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -321,7 +319,6 @@ ble_hs_id_addr(uint8_t id_addr_type, const uint8_t **out_id_addr,
|
||||
}
|
||||
|
||||
if (memcmp(id_addr, ble_hs_misc_null_addr, 6) == 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOADDR);
|
||||
return BLE_HS_ENOADDR;
|
||||
}
|
||||
|
||||
@@ -366,7 +363,6 @@ ble_hs_id_addr_type_usable(uint8_t own_addr_type)
|
||||
case BLE_OWN_ADDR_RANDOM:
|
||||
rc = ble_hs_id_addr(own_addr_type, NULL, NULL);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
break;
|
||||
@@ -376,11 +372,9 @@ ble_hs_id_addr_type_usable(uint8_t own_addr_type)
|
||||
id_addr_type = ble_hs_misc_own_addr_type_to_id(own_addr_type);
|
||||
rc = ble_hs_id_addr(id_addr_type, NULL, &nrpa);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (nrpa) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOADDR);
|
||||
return BLE_HS_ENOADDR;
|
||||
}
|
||||
break;
|
||||
@@ -400,7 +394,6 @@ ble_hs_id_use_addr(uint8_t own_addr_type)
|
||||
|
||||
rc = ble_hs_id_addr_type_usable(own_addr_type);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -410,11 +403,9 @@ ble_hs_id_use_addr(uint8_t own_addr_type)
|
||||
#if MYNEWT_VAL(BLE_HS_PVCY)
|
||||
rc = ble_hs_pvcy_ensure_started();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@ ble_hs_misc_conn_chan_find_reqd(uint16_t conn_handle, uint16_t cid,
|
||||
|
||||
rc = ble_hs_misc_conn_chan_find(conn_handle, cid, &conn, &chan);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -229,7 +229,6 @@ ble_hs_periodic_sync_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_hs_periodic_sync_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -80,7 +80,6 @@ ble_hs_pvcy_set_addr_timeout(uint16_t timeout)
|
||||
struct ble_hci_le_set_rpa_tmo_cp cmd;
|
||||
|
||||
if (timeout == 0 || timeout > BLE_MAX_RPA_TIMEOUT_VAL) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -186,7 +185,6 @@ ble_hs_pvcy_add_entry_hci(const uint8_t *addr, uint8_t addr_type,
|
||||
BLE_HS_DBG_ASSERT(irk != NULL);
|
||||
|
||||
if (addr_type > BLE_ADDR_RANDOM) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -200,7 +198,6 @@ ble_hs_pvcy_add_entry_hci(const uint8_t *addr, uint8_t addr_type,
|
||||
rc = ble_hs_resolv_list_add((uint8_t *) &cmd);
|
||||
ble_hs_unlock_nested();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -211,7 +208,6 @@ ble_hs_pvcy_add_entry_hci(const uint8_t *addr, uint8_t addr_type,
|
||||
BLE_HCI_OCF_LE_ADD_RESOLV_LIST),
|
||||
&cmd, sizeof(cmd), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -224,7 +220,6 @@ ble_hs_pvcy_add_entry_hci(const uint8_t *addr, uint8_t addr_type,
|
||||
memcpy(peer_addr.val, addr, sizeof peer_addr.val);
|
||||
rc = ble_hs_pvcy_set_mode(&peer_addr, BLE_GAP_PRIVATE_MODE_DEVICE);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -260,9 +255,6 @@ ble_hs_pvcy_add_entry(const uint8_t *addr, uint8_t addr_type,
|
||||
STATS_INC(ble_hs_stats, pvcy_add_entry_fail);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -299,7 +291,6 @@ ble_hs_pvcy_ensure_started(void)
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -431,19 +422,16 @@ ble_hs_pvcy_set_our_irk(const uint8_t *irk)
|
||||
#else
|
||||
rc = ble_hs_pvcy_set_resolve_enabled(0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_pvcy_clear_entries();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_pvcy_set_resolve_enabled(1);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -461,7 +449,6 @@ ble_hs_pvcy_set_our_irk(const uint8_t *irk)
|
||||
memset(tmp_addr, 0, 6);
|
||||
rc = ble_hs_pvcy_add_entry(tmp_addr, 0, zero_irk);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -533,7 +520,6 @@ ble_hs_pvcy_rpa_config(uint8_t enable)
|
||||
if (enable != NIMBLE_HOST_DISABLE_PRIVACY) {
|
||||
rc = ble_hs_pvcy_ensure_started();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -568,7 +554,6 @@ ble_hs_pvcy_rpa_ah(const uint8_t irk[16], const uint8_t prand[3], uint8_t out[3]
|
||||
|
||||
rc = ble_sm_alg_encrypt(irk, plaintext, ciphertext);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -376,7 +376,6 @@ ble_hs_rand_prand_get(uint8_t *prand)
|
||||
/* Get 24 bits of random data */
|
||||
rc = ble_hs_hci_util_rand(prand, 3);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -843,7 +842,6 @@ ble_hs_resolv_rpa(uint8_t *rpa, uint8_t *irk)
|
||||
/* Send the data to ble_sm_alg_encrypt in little-endian style */
|
||||
rc = ble_sm_alg_encrypt(ecb.key, ecb.plain_text, ecb.cipher_text);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
swap_in_place(ecb.cipher_text, 16);
|
||||
|
||||
@@ -38,7 +38,6 @@ ble_hs_startup_read_sup_f_tx(void)
|
||||
BLE_HCI_OCF_IP_RD_LOC_SUPP_FEAT),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -64,7 +63,6 @@ ble_hs_startup_read_local_ver_tx(void)
|
||||
BLE_HCI_OCF_IP_RD_LOCAL_VER),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -85,7 +83,6 @@ ble_hs_startup_read_sup_cmd_tx(void)
|
||||
BLE_HCI_OCF_IP_RD_LOC_SUPP_CMD),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -105,7 +102,6 @@ ble_hs_startup_le_read_sup_f_tx(void)
|
||||
BLE_HCI_OCF_LE_RD_LOC_SUPP_FEAT),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -127,7 +123,6 @@ ble_hs_startup_le_read_buf_sz_v2_tx(uint16_t *out_acl_pktlen, uint8_t *out_max_a
|
||||
BLE_HCI_OCF_LE_RD_BUF_SIZE_V2), NULL, 0,
|
||||
&rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -153,7 +148,6 @@ ble_hs_startup_le_read_buf_sz_tx(uint16_t *out_pktlen, uint8_t *out_max_pkts)
|
||||
BLE_HCI_OCF_LE_RD_BUF_SIZE), NULL, 0,
|
||||
&rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -174,7 +168,6 @@ ble_hs_startup_read_buf_sz_tx(uint16_t *out_pktlen, uint16_t *out_max_pkts)
|
||||
BLE_HCI_OCF_IP_RD_BUF_SIZE), NULL, 0,
|
||||
&rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -203,7 +196,6 @@ ble_hs_startup_read_buf_sz(void)
|
||||
rc = ble_hs_startup_le_read_buf_sz_tx(&le_pktlen, &le_max_pkts);
|
||||
#endif /* MYNEWT_VAL(BLE_ISO) */
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -213,14 +205,12 @@ ble_hs_startup_read_buf_sz(void)
|
||||
} else {
|
||||
rc = ble_hs_startup_read_buf_sz_tx(&pktlen, &max_pkts);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
rc = ble_hs_hci_set_buf_sz(pktlen, max_pkts);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -229,7 +219,6 @@ ble_hs_startup_read_buf_sz(void)
|
||||
rc = ble_hs_hci_set_iso_buf_sz(iso_pktlen, iso_max_pkts);
|
||||
ble_hs_unlock();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif /* MYNEWT_VAL(BLE_ISO) */
|
||||
@@ -248,13 +237,11 @@ ble_hs_startup_read_bd_addr(void)
|
||||
BLE_HCI_OCF_IP_RD_BD_ADDR),
|
||||
NULL, 0, &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_id_set_pub(rsp.addr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
@@ -448,7 +435,6 @@ ble_hs_startup_le_set_evmask_tx(void)
|
||||
BLE_HCI_OCF_LE_SET_EVENT_MASK),
|
||||
&cmd, sizeof(cmd), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -483,7 +469,6 @@ ble_hs_startup_set_evmask_tx(void)
|
||||
BLE_HCI_OCF_CB_SET_EVENT_MASK),
|
||||
&cmd, sizeof(cmd), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -497,7 +482,6 @@ ble_hs_startup_set_evmask_tx(void)
|
||||
BLE_HCI_OCF_CB_SET_EVENT_MASK2),
|
||||
&cmd2, sizeof(cmd2), NULL, 0);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -522,20 +506,17 @@ ble_hs_startup_go(void)
|
||||
|
||||
rc = ble_hs_startup_reset_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_startup_read_local_ver_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Read local supported commands. */
|
||||
rc = ble_hs_startup_read_sup_cmd_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -548,40 +529,34 @@ ble_hs_startup_go(void)
|
||||
|
||||
rc = ble_hs_startup_read_sup_f_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = ble_hs_startup_set_evmask_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_startup_le_set_evmask_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
#if MYNEWT_VAL(BLE_ROLE_CENTRAL) || MYNEWT_VAL(BLE_ROLE_PERIPHERAL)
|
||||
rc = ble_hs_startup_read_buf_sz();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
rc = ble_hs_startup_le_read_sup_f_tx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_startup_read_bd_addr();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -127,9 +127,6 @@ ble_hs_stop_terminate_all_periodic_sync(void)
|
||||
if (rc != 0 && rc != BLE_HS_ENOTCONN) {
|
||||
BLE_HS_LOG(ERROR, "failed to terminate periodic sync=0x%04x, rc=%d\n",
|
||||
sync_handle, rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -248,7 +245,6 @@ ble_hs_stop_begin(struct ble_hs_stop_listener *listener,
|
||||
|
||||
case BLE_HS_ENABLED_STATE_OFF:
|
||||
/* Host already stopped. */
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
|
||||
default:
|
||||
@@ -276,9 +272,6 @@ ble_hs_stop(struct ble_hs_stop_listener *listener,
|
||||
return 0;
|
||||
|
||||
default:
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -291,9 +284,6 @@ ble_hs_stop(struct ble_hs_stop_listener *listener,
|
||||
rc = ble_hs_stop_terminate_all_periodic_sync();
|
||||
if (rc != 0) {
|
||||
ble_hs_stop_done(rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -302,9 +292,6 @@ ble_hs_stop(struct ble_hs_stop_listener *listener,
|
||||
ble_hs_stop_gap_event, NULL);
|
||||
if (rc != 0) {
|
||||
ble_hs_stop_done(rc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -146,7 +146,6 @@ ble_l2cap_parse_hdr(struct os_mbuf *om, struct ble_l2cap_hdr *hdr)
|
||||
|
||||
rc = os_mbuf_copydata(om, 0, sizeof(*hdr), hdr);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EMSGSIZE);
|
||||
return BLE_HS_EMSGSIZE;
|
||||
}
|
||||
|
||||
@@ -442,7 +441,6 @@ ble_l2cap_rx(uint16_t conn_handle, uint8_t pb, struct os_mbuf *om)
|
||||
if (!chan) {
|
||||
ble_l2cap_sig_reject_invalid_cid_tx(conn_handle, 0, 0, rx_cid);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -450,14 +448,12 @@ ble_l2cap_rx(uint16_t conn_handle, uint8_t pb, struct os_mbuf *om)
|
||||
chan->dcid <= BLE_L2CAP_COC_CID_END && rx_len > chan->my_coc_mps) {
|
||||
ble_l2cap_disconnect(chan);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
if (rx_len > ble_l2cap_get_mtu(chan)) {
|
||||
ble_l2cap_disconnect(chan);
|
||||
os_mbuf_free_chain(rx_frags);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -506,9 +502,6 @@ ble_l2cap_tx(struct ble_hs_conn *conn, struct ble_l2cap_chan *chan,
|
||||
|
||||
default:
|
||||
/* Error. */
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -521,7 +514,6 @@ ble_l2cap_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
rc = ble_l2cap_ensure_ctx();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -115,7 +115,6 @@ ble_l2cap_coc_create_server(uint16_t psm, uint16_t mtu,
|
||||
|
||||
if (ble_l2cap_coc_srv_find(psm) != NULL) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
}
|
||||
|
||||
@@ -255,7 +254,6 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SDU_SIZE);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -271,7 +269,6 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
/* Disconnect peer with invalid behaviour */
|
||||
rx->data_offset = 0;
|
||||
ble_l2cap_disconnect(chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
if (sdu_len > rx->mtu) {
|
||||
@@ -280,7 +277,6 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
|
||||
/* Disconnect peer with invalid behaviour */
|
||||
ble_l2cap_disconnect(chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -294,9 +290,6 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "Could not append data rc=%d\n", rc);
|
||||
ble_l2cap_disconnect(chan);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -314,16 +307,12 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
rx->sdus[chan->coc_rx.current_sdu_idx] = NULL;
|
||||
rx->data_offset = 0;
|
||||
ble_l2cap_disconnect(chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
rc = os_mbuf_appendfrom(rx_sdu, *om, 0, om_total);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "Could not append data rc=%d\n", rc);
|
||||
ble_l2cap_disconnect(chan);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -331,7 +320,6 @@ ble_l2cap_coc_rx_fn(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
if (rx->credits == 0) {
|
||||
BLE_HS_LOG(ERROR, "RX credits underflow, disconnecting\n");
|
||||
ble_l2cap_disconnect(chan);
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
rx->credits--;
|
||||
@@ -457,7 +445,6 @@ ble_l2cap_coc_create_srv_chan(struct ble_hs_conn *conn, uint16_t psm,
|
||||
/* Check if there is server registered on this PSM */
|
||||
srv = ble_l2cap_coc_srv_find(psm);
|
||||
if (!srv) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -627,7 +614,6 @@ ble_l2cap_coc_continue_tx(struct ble_l2cap_chan *chan)
|
||||
/* Not complete SDU sent, wait for credits */
|
||||
tx->flags |= BLE_L2CAP_COC_FLAG_STALLED;
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ESTALLED);
|
||||
return BLE_HS_ESTALLED;
|
||||
}
|
||||
|
||||
@@ -719,7 +705,6 @@ ble_l2cap_coc_recv_ready(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_rx)
|
||||
c = ble_hs_conn_chan_find_by_scid(conn, chan->scid);
|
||||
if (!c) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -767,7 +752,6 @@ ble_l2cap_coc_send(struct ble_l2cap_chan *chan, struct os_mbuf *sdu_tx)
|
||||
tx = &chan->coc_tx;
|
||||
|
||||
if (OS_MBUF_PKTLEN(sdu_tx) > tx->mtu) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
|
||||
@@ -366,7 +366,6 @@ ble_l2cap_sig_rx_noop(uint16_t conn_handle,
|
||||
struct ble_l2cap_sig_hdr *hdr,
|
||||
struct os_mbuf **om)
|
||||
{
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -413,33 +412,28 @@ ble_l2cap_sig_check_conn_params(const struct ble_gap_upd_params *params)
|
||||
/* Check connection interval min */
|
||||
if ((params->itvl_min < BLE_HCI_CONN_ITVL_MIN) ||
|
||||
(params->itvl_min > BLE_HCI_CONN_ITVL_MAX)) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
/* Check connection interval max */
|
||||
if ((params->itvl_max < BLE_HCI_CONN_ITVL_MIN) ||
|
||||
(params->itvl_max > BLE_HCI_CONN_ITVL_MAX) ||
|
||||
(params->itvl_max < params->itvl_min)) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
/* Check connection latency */
|
||||
if (params->latency > BLE_HCI_CONN_LATENCY_MAX) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
/* Check supervision timeout */
|
||||
if ((params->supervision_timeout < BLE_HCI_CONN_SPVN_TIMEOUT_MIN) ||
|
||||
(params->supervision_timeout > BLE_HCI_CONN_SPVN_TIMEOUT_MAX)) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
/* Check connection event length */
|
||||
if (params->min_ce_len > params->max_ce_len) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_ERR_INV_HCI_CMD_PARMS);
|
||||
return BLE_ERR_INV_HCI_CMD_PARMS;
|
||||
}
|
||||
|
||||
@@ -464,7 +458,6 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SIG_UPDATE_REQ_SZ);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -475,14 +468,12 @@ ble_l2cap_sig_update_req_rx(uint16_t conn_handle,
|
||||
|
||||
rc = ble_hs_atomic_conn_flags(conn_handle, &conn_flags);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
/* Only a master can process an update request. */
|
||||
sig_err = !(conn_flags & BLE_HS_CONN_F_MASTER);
|
||||
if (sig_err) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
}
|
||||
|
||||
@@ -665,7 +656,6 @@ ble_l2cap_sig_coc_err2ble_hs_err(uint16_t l2cap_coc_err)
|
||||
case BLE_L2CAP_COC_ERR_CONNECTION_SUCCESS:
|
||||
return 0;
|
||||
case BLE_L2CAP_COC_ERR_UNKNOWN_LE_PSM:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
case BLE_L2CAP_COC_ERR_NO_RESOURCES:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOMEM);
|
||||
@@ -683,10 +673,8 @@ ble_l2cap_sig_coc_err2ble_hs_err(uint16_t l2cap_coc_err)
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EENCRYPT);
|
||||
return BLE_HS_EENCRYPT;
|
||||
case BLE_L2CAP_COC_ERR_INVALID_SOURCE_CID:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EREJECT);
|
||||
return BLE_HS_EREJECT;
|
||||
case BLE_L2CAP_COC_ERR_SOURCE_CID_ALREADY_USED:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
case BLE_L2CAP_COC_ERR_UNACCEPTABLE_PARAMETERS:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EINVAL);
|
||||
@@ -840,7 +828,6 @@ ble_l2cap_sig_credit_base_reconfig_req_rx(uint16_t conn_handle,
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, hdr->length);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1018,7 +1005,6 @@ ble_l2cap_sig_credit_base_con_req_rx(uint16_t conn_handle,
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, hdr->length);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1310,7 +1296,6 @@ ble_l2cap_sig_coc_req_rx(uint16_t conn_handle, struct ble_l2cap_sig_hdr *hdr,
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, sizeof(*req));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1493,7 +1478,6 @@ ble_l2cap_sig_coc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
|
||||
|
||||
if (!conn) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
|
||||
@@ -1575,7 +1559,6 @@ ble_l2cap_sig_ecoc_connect(uint16_t conn_handle, uint16_t psm, uint16_t mtu,
|
||||
|
||||
if (!conn) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
|
||||
@@ -1659,7 +1642,6 @@ ble_l2cap_sig_coc_reconfig(uint16_t conn_handle, struct ble_l2cap_chan *chans[],
|
||||
|
||||
if (!conn) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTCONN);
|
||||
return BLE_HS_ENOTCONN;
|
||||
}
|
||||
|
||||
@@ -1737,7 +1719,6 @@ ble_l2cap_sig_disc_req_rx(uint16_t conn_handle, struct ble_l2cap_sig_hdr *hdr,
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, sizeof(*req));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2017,7 +1998,6 @@ ble_l2cap_sig_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
|
||||
rc = ble_hs_mbuf_pullup_base(om, BLE_L2CAP_SIG_HDR_SZ);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2048,9 +2028,6 @@ ble_l2cap_sig_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
NULL, 0);
|
||||
}
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -340,7 +340,6 @@ ble_sm_gen_pair_rand(uint8_t *pair_rand)
|
||||
|
||||
rc = ble_hs_hci_util_rand(pair_rand, 16);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -362,7 +361,6 @@ ble_sm_gen_ediv(struct ble_sm_master_id *master_id)
|
||||
|
||||
rc = ble_hs_hci_util_rand(&master_id->ediv, sizeof master_id->ediv);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -384,7 +382,6 @@ ble_sm_gen_master_id_rand(struct ble_sm_master_id *master_id)
|
||||
|
||||
rc = ble_hs_hci_util_rand(&master_id->rand_val, sizeof master_id->rand_val);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -407,7 +404,6 @@ ble_sm_gen_ltk(struct ble_sm_proc *proc, uint8_t *ltk)
|
||||
|
||||
rc = ble_hs_hci_util_rand(ltk, proc->key_size);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -433,7 +429,6 @@ ble_sm_gen_csrk(struct ble_sm_proc *proc, uint8_t *csrk)
|
||||
|
||||
rc = ble_hs_hci_util_rand(csrk, 16);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -967,7 +962,6 @@ ble_sm_read_bond(uint16_t conn_handle, struct ble_store_value_sec *out_bond)
|
||||
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1012,9 +1006,6 @@ ble_sm_chk_repeat_pairing(uint16_t conn_handle,
|
||||
case BLE_HS_ENOENT:
|
||||
return 0;
|
||||
default:
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1034,7 +1025,6 @@ ble_sm_chk_repeat_pairing(uint16_t conn_handle,
|
||||
|
||||
BLE_HS_LOG(DEBUG, "silently ignoring pair request from bonded peer");
|
||||
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
}
|
||||
|
||||
@@ -1188,7 +1178,6 @@ ble_sm_chk_store_overflow_by_type(int obj_type, uint16_t conn_handle)
|
||||
|
||||
rc = ble_store_util_count(obj_type, &count);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1207,7 +1196,6 @@ ble_sm_chk_store_overflow_by_type(int obj_type, uint16_t conn_handle)
|
||||
*/
|
||||
rc = ble_store_full_event(obj_type, conn_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1222,14 +1210,12 @@ ble_sm_chk_store_overflow(uint16_t conn_handle)
|
||||
rc = ble_sm_chk_store_overflow_by_type(BLE_STORE_OBJ_TYPE_PEER_SEC,
|
||||
conn_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_sm_chk_store_overflow_by_type(BLE_STORE_OBJ_TYPE_OUR_SEC,
|
||||
conn_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1421,11 +1407,9 @@ ble_sm_retrieve_ltk(uint16_t ediv, uint64_t rand, uint8_t peer_addr_type,
|
||||
|
||||
rc = ble_store_read_our_sec(&key_sec, value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (value_sec->ediv != ediv || value_sec->rand_num != rand) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
return rc;
|
||||
@@ -1445,7 +1429,6 @@ ble_sm_ltk_req_reply_tx(uint16_t conn_handle, const uint8_t *ltk)
|
||||
BLE_HCI_OCF_LE_LT_KEY_REQ_REPLY),
|
||||
&cmd, sizeof(cmd), &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -1469,7 +1452,6 @@ ble_sm_ltk_req_neg_reply_tx(uint16_t conn_handle)
|
||||
BLE_HCI_OCF_LE_LT_KEY_REQ_NEG_REPLY),
|
||||
&cmd, sizeof(cmd), &rsp, sizeof(rsp));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2828,7 +2810,6 @@ ble_sm_incr_our_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2837,11 +2818,9 @@ ble_sm_incr_our_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_store_read_our_sec(&key_sec, &value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (value_sec.csrk_present != 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
if (value_sec.sign_counter == (uint32_t)0xffffffff) {
|
||||
@@ -2851,14 +2830,12 @@ ble_sm_incr_our_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_store_delete_our_sec(&key_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
value_sec.sign_counter += 1;
|
||||
rc = ble_store_write_our_sec(&value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2884,7 +2861,6 @@ ble_sm_incr_peer_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_gap_conn_find(conn_handle, &desc);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2893,11 +2869,9 @@ ble_sm_incr_peer_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_store_read_peer_sec(&key_sec, &value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
if (value_sec.csrk_present != 1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
if (value_sec.sign_counter == (uint32_t)0xffffffff) {
|
||||
@@ -2907,7 +2881,6 @@ ble_sm_incr_peer_sign_counter(uint16_t conn_handle)
|
||||
|
||||
rc = ble_store_delete_peer_sec(&key_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2923,7 +2896,6 @@ ble_sm_incr_peer_sign_counter(uint16_t conn_handle)
|
||||
value_sec.sign_counter += 1;
|
||||
rc = ble_store_write_peer_sec(&value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -2984,7 +2956,6 @@ ble_sm_pair_initiate(uint16_t conn_handle)
|
||||
|
||||
if (proc != NULL) {
|
||||
res.app_status = BLE_HS_EALREADY;
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EALREADY);
|
||||
return BLE_HS_EALREADY;
|
||||
}
|
||||
|
||||
@@ -2993,7 +2964,6 @@ ble_sm_pair_initiate(uint16_t conn_handle)
|
||||
*/
|
||||
rc = ble_sm_chk_store_overflow(conn_handle);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3136,7 +3106,6 @@ ble_sm_rx(struct ble_l2cap_chan *chan, struct os_mbuf **om)
|
||||
|
||||
rc = os_mbuf_copydata(*om, 0, 1, &op);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_EBADDATA);
|
||||
return BLE_HS_EBADDATA;
|
||||
}
|
||||
|
||||
@@ -3279,7 +3248,6 @@ ble_sm_inject_io(uint16_t conn_handle, struct ble_sm_io *pkey)
|
||||
* SMP state.
|
||||
*/
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3381,9 +3349,6 @@ ble_sm_init(void)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
ble_sm_deinit();
|
||||
#endif
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -3392,9 +3357,6 @@ ble_sm_init(void)
|
||||
|
||||
if (rc != 0) {
|
||||
ble_sm_deinit();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -201,7 +201,6 @@ ble_sm_alg_s1(const uint8_t *k, const uint8_t *r1, const uint8_t *r2,
|
||||
/* s1(k, r1 , r2) = e(k, r') */
|
||||
rc = ble_sm_alg_encrypt(k, out, out);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -382,9 +381,6 @@ exit:
|
||||
if (rc != 0) {
|
||||
rc = BLE_HS_EUNKNOWN;
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
#endif // CONFIG_MBEDTLS_VER_4_X_SUPPORT
|
||||
return 0;
|
||||
|
||||
@@ -77,7 +77,6 @@ ble_sm_tx(uint16_t conn_handle, struct os_mbuf *txom)
|
||||
|
||||
return rc;
|
||||
#endif
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
|
||||
@@ -183,7 +183,6 @@ ble_sm_gen_stk(struct ble_sm_proc *proc)
|
||||
|
||||
rc = ble_sm_alg_s1(proc->tk, proc->rands, proc->randm, key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,6 @@ ble_sm_gen_pub_priv(uint8_t *pub, uint8_t *priv)
|
||||
|
||||
rc = ble_sm_alg_gen_key_pair(pub, priv);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -259,7 +258,6 @@ ble_sm_sc_ensure_keys_generated(void)
|
||||
#endif
|
||||
rc = ble_sm_gen_pub_priv(ble_sm_sc_pub_key, ble_sm_sc_priv_key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -463,7 +461,6 @@ ble_sm_sc_random_advance(struct ble_sm_proc *proc)
|
||||
proc->state = BLE_SM_PROC_STATE_CONFIRM;
|
||||
rc = ble_sm_gen_pair_rand(ble_sm_our_pair_rand(proc));
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -1016,20 +1013,17 @@ ble_sm_sc_oob_generate_data(struct ble_sm_sc_oob_data *oob_data)
|
||||
|
||||
rc = ble_sm_sc_ensure_keys_generated();
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_hs_hci_util_rand(oob_data->r, 16);
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_sm_alg_f4(ble_sm_sc_pub_key, ble_sm_sc_pub_key, oob_data->r, 0,
|
||||
oob_data->c);
|
||||
if (rc) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ ble_store_read(int obj_type, const union ble_store_key *key,
|
||||
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -59,7 +58,6 @@ ble_store_write(int obj_type, const union ble_store_value *val)
|
||||
|
||||
if (ble_hs_cfg.store_write_cb == NULL) {
|
||||
ble_hs_unlock();
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
|
||||
@@ -75,7 +73,6 @@ ble_store_write(int obj_type, const union ble_store_value *val)
|
||||
*/
|
||||
rc = ble_store_overflow_event(obj_type, val);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -83,14 +80,10 @@ ble_store_write(int obj_type, const union ble_store_value *val)
|
||||
break;
|
||||
|
||||
default:
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -114,7 +107,6 @@ ble_store_delete(int obj_type, const union ble_store_key *key)
|
||||
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -150,7 +142,6 @@ ble_store_overflow_event(int obj_type, const union ble_store_value *value)
|
||||
|
||||
return ble_store_status(&event);
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -169,7 +160,6 @@ ble_store_full_event(int obj_type, uint16_t conn_handle)
|
||||
return ble_store_status(&event);
|
||||
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -193,7 +183,6 @@ ble_store_read_our_sec(const struct ble_store_key_sec *key_sec,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_OUR_SEC, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -230,7 +219,6 @@ ble_store_write_our_sec(const struct ble_store_value_sec *value_sec)
|
||||
rc = ble_store_persist_sec(BLE_STORE_OBJ_TYPE_OUR_SEC, value_sec);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -247,7 +235,6 @@ ble_store_delete_our_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_OUR_SEC, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -263,7 +250,6 @@ ble_store_delete_peer_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_PEER_SEC, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -287,7 +273,6 @@ ble_store_read_peer_sec(const struct ble_store_key_sec *key_sec,
|
||||
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -301,7 +286,6 @@ ble_store_write_peer_sec(const struct ble_store_value_sec *value_sec)
|
||||
|
||||
rc = ble_store_persist_sec(BLE_STORE_OBJ_TYPE_PEER_SEC, value_sec);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -314,7 +298,6 @@ ble_store_write_peer_sec(const struct ble_store_value_sec *value_sec)
|
||||
value_sec->peer_addr.type,
|
||||
value_sec->irk);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -322,7 +305,6 @@ ble_store_write_peer_sec(const struct ble_store_value_sec *value_sec)
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -342,7 +324,6 @@ ble_store_read_cccd(const struct ble_store_key_cccd *key,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_CCCD, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -359,7 +340,6 @@ ble_store_write_cccd(const struct ble_store_value_cccd *value)
|
||||
rc = ble_store_write(BLE_STORE_OBJ_TYPE_CCCD, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -376,7 +356,6 @@ ble_store_delete_cccd(const struct ble_store_key_cccd *key)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_CCCD, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -396,7 +375,6 @@ ble_store_read_csfc(const struct ble_store_key_csfc *key,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_CSFC, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -413,7 +391,6 @@ ble_store_write_csfc(const struct ble_store_value_csfc *value)
|
||||
rc = ble_store_write(BLE_STORE_OBJ_TYPE_CSFC, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -430,7 +407,6 @@ ble_store_delete_csfc(const struct ble_store_key_csfc *key)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_CSFC, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -476,7 +452,6 @@ ble_store_read_ead(const struct ble_store_key_ead *key,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_ENC_ADV_DATA, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -493,7 +468,6 @@ ble_store_write_ead(const struct ble_store_value_ead *value)
|
||||
rc = ble_store_write(BLE_STORE_OBJ_TYPE_ENC_ADV_DATA, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -510,7 +484,6 @@ ble_store_delete_ead(const struct ble_store_key_ead *key)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_ENC_ADV_DATA, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -542,7 +515,6 @@ ble_store_read_local_irk(const struct ble_store_key_local_irk *key,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_LOCAL_IRK, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -561,7 +533,6 @@ ble_store_write_local_irk(const struct ble_store_value_local_irk *value)
|
||||
rc = ble_store_write(BLE_STORE_OBJ_TYPE_LOCAL_IRK, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -579,7 +550,6 @@ ble_store_delete_local_irk(const struct ble_store_key_local_irk *key)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_LOCAL_IRK, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -610,7 +580,6 @@ ble_store_read_rpa_rec(const struct ble_store_key_rpa_rec *key,
|
||||
rc = ble_store_read(BLE_STORE_OBJ_TYPE_PEER_ADDR, store_key, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -627,7 +596,6 @@ ble_store_write_rpa_rec(const struct ble_store_value_rpa_rec *value)
|
||||
rc = ble_store_write(BLE_STORE_OBJ_TYPE_PEER_ADDR, store_value);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -644,7 +612,6 @@ ble_store_delete_rpa_rec(const struct ble_store_key_rpa_rec *key)
|
||||
rc = ble_store_delete(BLE_STORE_OBJ_TYPE_PEER_ADDR, store_key);
|
||||
return rc;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -784,16 +751,12 @@ ble_store_iterate(int obj_type,
|
||||
|
||||
default:
|
||||
/* Read error. */
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
idx++;
|
||||
}
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -836,16 +799,12 @@ ble_store_clear(void)
|
||||
|
||||
/* BLE_HS_ENOENT means we deleted everything. */
|
||||
if (rc != BLE_HS_ENOENT) {
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -131,7 +131,6 @@ ble_store_util_bonded_peers(ble_addr_t *out_peer_id_addrs, int *out_num_peers,
|
||||
ble_store_util_iter_unique_peer,
|
||||
&set);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -144,7 +143,6 @@ ble_store_util_bonded_peers(ble_addr_t *out_peer_id_addrs, int *out_num_peers,
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -171,13 +169,11 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_OUR_SEC, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_PEER_SEC, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -186,7 +182,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_CCCD, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -196,7 +191,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_ENC_ADV_DATA, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -206,7 +200,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_PEER_ADDR, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -215,7 +208,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_CSFC, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -242,7 +234,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
if (needs_unlock) {
|
||||
ble_hs_unlock();
|
||||
}
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
@@ -253,7 +244,6 @@ ble_store_util_delete_peer(const ble_addr_t *peer_id_addr)
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -279,15 +269,11 @@ ble_store_util_delete_all(int type, const union ble_store_key *key)
|
||||
} while (rc == 0);
|
||||
|
||||
if (rc != BLE_HS_ENOENT) {
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -321,13 +307,11 @@ ble_store_util_count(int type, int *out_count)
|
||||
ble_store_util_iter_count,
|
||||
out_count);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -345,7 +329,6 @@ ble_store_util_delete_oldest_peer(void)
|
||||
peer_id_addrs, &num_peers,
|
||||
sizeof peer_id_addrs / sizeof peer_id_addrs[0]);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -355,13 +338,11 @@ ble_store_util_delete_oldest_peer(void)
|
||||
|
||||
rc = ble_store_util_delete_peer(&peer_id_addrs[0]);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -401,7 +382,6 @@ ble_store_util_ead_peers(ble_addr_t *out_peer_id_addrs, int *out_num_peers,
|
||||
ble_store_util_iter_unique_peer,
|
||||
&set);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -412,7 +392,6 @@ ble_store_util_ead_peers(ble_addr_t *out_peer_id_addrs, int *out_num_peers,
|
||||
*out_num_peers = set.num_peers;
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -433,7 +412,6 @@ ble_store_util_delete_ead_oldest_peer(void)
|
||||
peer_id_addrs, &num_peers,
|
||||
sizeof peer_id_addrs / sizeof peer_id_addrs[0]);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -444,13 +422,11 @@ ble_store_util_delete_ead_oldest_peer(void)
|
||||
key.ead.peer_addr = peer_id_addrs[0];
|
||||
rc = ble_store_util_delete_all(BLE_STORE_OBJ_TYPE_ENC_ADV_DATA, &key);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -240,7 +240,6 @@ ble_uuid_from_str(ble_uuid_any_t *uuid, const char *str)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
int rc = ble_uuid_base_init();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
@@ -366,15 +365,11 @@ ble_uuid_init_from_att_mbuf(ble_uuid_any_t *uuid, struct os_mbuf *om, int off,
|
||||
|
||||
rc = os_mbuf_copydata(om, off, len, val);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_uuid_init_from_att_buf(uuid, val, len);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -457,7 +452,6 @@ ble_uuid_flat(const ble_uuid_t *uuid, void *dst)
|
||||
#if MYNEWT_VAL(BLE_STATIC_TO_DYNAMIC)
|
||||
int rc = ble_uuid_base_init();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -267,14 +267,12 @@ ble_store_config_read_our_sec(const struct ble_store_key_sec *key_sec,
|
||||
idx = ble_store_config_find_sec(key_sec, ble_store_config_our_secs,
|
||||
ble_store_config_num_our_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_sec = ble_store_config_our_secs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -312,21 +310,18 @@ ble_store_config_write_our_sec(const struct ble_store_value_sec *value_sec)
|
||||
|
||||
rc = ble_store_config_persist_our_secs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ble_store_config_our_bond_count > (UINT16_MAX - 5)) {
|
||||
rc = ble_restore_our_sec_nvs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -366,14 +361,12 @@ ble_store_config_delete_sec(const struct ble_store_key_sec *key_sec,
|
||||
|
||||
idx = ble_store_config_find_sec(key_sec, value_secs, *num_value_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
rc = ble_store_config_delete_obj(value_secs, sizeof *value_secs, idx,
|
||||
num_value_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -390,13 +383,11 @@ ble_store_config_delete_our_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_config_delete_sec(key_sec, ble_store_config_our_secs,
|
||||
&ble_store_config_num_our_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_our_secs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -411,13 +402,11 @@ ble_store_config_delete_peer_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_config_delete_sec(key_sec, ble_store_config_peer_secs,
|
||||
&ble_store_config_num_peer_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_peer_secs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
@@ -434,14 +423,12 @@ ble_store_config_read_peer_sec(const struct ble_store_key_sec *key_sec,
|
||||
idx = ble_store_config_find_sec(key_sec, ble_store_config_peer_secs,
|
||||
ble_store_config_num_peer_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_sec = ble_store_config_peer_secs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -479,21 +466,18 @@ ble_store_config_write_peer_sec(const struct ble_store_value_sec *value_sec)
|
||||
|
||||
rc = ble_store_config_persist_peer_secs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
if (ble_store_config_peer_bond_count > (UINT16_MAX - 5)) {
|
||||
rc = ble_restore_peer_sec_nvs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -546,7 +530,6 @@ ble_store_config_delete_cccd(const struct ble_store_key_cccd *key_cccd)
|
||||
|
||||
idx = ble_store_config_find_cccd(key_cccd);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -555,18 +538,15 @@ ble_store_config_delete_cccd(const struct ble_store_key_cccd *key_cccd)
|
||||
idx,
|
||||
&ble_store_config_num_cccds);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_cccds();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -580,14 +560,12 @@ ble_store_config_read_cccd(const struct ble_store_key_cccd *key_cccd,
|
||||
|
||||
idx = ble_store_config_find_cccd(key_cccd);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_cccd = ble_store_config_cccds[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -618,13 +596,11 @@ ble_store_config_write_cccd(const struct ble_store_value_cccd *value_cccd)
|
||||
|
||||
rc = ble_store_config_persist_cccds();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -669,7 +645,6 @@ ble_store_config_delete_ead(const struct ble_store_key_ead *key_ead)
|
||||
|
||||
idx = ble_store_config_find_ead(key_ead);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -678,13 +653,11 @@ ble_store_config_delete_ead(const struct ble_store_key_ead *key_ead)
|
||||
idx,
|
||||
&ble_store_config_num_eads);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_eads();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -699,7 +672,6 @@ ble_store_config_read_ead(const struct ble_store_key_ead *key_ead,
|
||||
|
||||
idx = ble_store_config_find_ead(key_ead);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -733,7 +705,6 @@ ble_store_config_write_ead(const struct ble_store_value_ead *value_ead)
|
||||
|
||||
rc = ble_store_config_persist_eads();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -781,7 +752,6 @@ ble_store_config_delete_local_irk(const struct ble_store_key_local_irk *key_irk)
|
||||
|
||||
idx = ble_store_config_find_local_irk(key_irk);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -790,18 +760,15 @@ ble_store_config_delete_local_irk(const struct ble_store_key_local_irk *key_irk)
|
||||
idx,
|
||||
&ble_store_config_num_local_irks);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_local_irk();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -815,14 +782,12 @@ ble_store_config_read_local_irk(const struct ble_store_key_local_irk *key_irk,
|
||||
|
||||
idx = ble_store_config_find_local_irk(key_irk);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_irk = ble_store_config_local_irks[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -862,15 +827,11 @@ ble_store_config_write_local_irk(const struct ble_store_value_local_irk *value_i
|
||||
if (appended) {
|
||||
ble_store_config_num_local_irks--;
|
||||
}
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
#endif
|
||||
}
|
||||
@@ -913,13 +874,11 @@ ble_store_config_read_rpa_rec(const struct ble_store_key_rpa_rec *key_rpa_rec,st
|
||||
|
||||
idx = ble_store_config_find_rpa_rec(key_rpa_rec);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
*value_rpa_rec = ble_store_config_rpa_recs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -948,12 +907,10 @@ ble_store_config_write_rpa_rec(const struct ble_store_value_rpa_rec *value_rpa_r
|
||||
|
||||
rc = ble_store_config_persist_rpa_recs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -967,7 +924,6 @@ ble_store_config_delete_rpa_rec(const struct ble_store_key_rpa_rec *key_rpa_rec)
|
||||
|
||||
idx = ble_store_config_find_rpa_rec(key_rpa_rec);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -976,19 +932,16 @@ ble_store_config_delete_rpa_rec(const struct ble_store_key_rpa_rec *key_rpa_rec)
|
||||
idx,
|
||||
&ble_store_config_num_rpa_recs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_rpa_recs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -1034,7 +987,6 @@ ble_store_config_delete_csfc(const struct ble_store_key_csfc *key_csfc)
|
||||
idx = ble_store_config_find_csfc(key_csfc, ble_store_config_csfcs,
|
||||
ble_store_config_num_csfcs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -1043,19 +995,16 @@ ble_store_config_delete_csfc(const struct ble_store_key_csfc *key_csfc)
|
||||
idx, &ble_store_config_num_csfcs);
|
||||
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
rc = ble_store_config_persist_csfcs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -1070,14 +1019,12 @@ ble_store_config_read_csfc(const struct ble_store_key_csfc *key_csfc,
|
||||
idx = ble_store_config_find_csfc(key_csfc, ble_store_config_csfcs,
|
||||
ble_store_config_num_csfcs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_csfc = ble_store_config_csfcs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -1109,13 +1056,11 @@ ble_store_config_write_csfc(const struct ble_store_value_csfc *value_csfc)
|
||||
|
||||
rc = ble_store_config_persist_csfcs();
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -1179,7 +1124,6 @@ ble_store_config_read(int obj_type, const union ble_store_key *key,
|
||||
rc = ble_store_config_read_local_irk(&key->local_irk, &value->local_irk);
|
||||
return rc;
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
@@ -1226,7 +1170,6 @@ ble_store_config_write(int obj_type, const union ble_store_value *val)
|
||||
return rc;
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
@@ -1269,7 +1212,6 @@ ble_store_config_delete(int obj_type, const union ble_store_key *key)
|
||||
return rc;
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -148,14 +148,12 @@ ble_store_ram_read_our_sec(const struct ble_store_key_sec *key_sec,
|
||||
idx = ble_store_ram_find_sec(key_sec, ble_store_ram_our_secs,
|
||||
ble_store_ram_num_our_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_sec = ble_store_ram_our_secs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -190,7 +188,6 @@ ble_store_ram_write_our_sec(const struct ble_store_value_sec *value_sec)
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -231,14 +228,12 @@ ble_store_ram_delete_sec(const struct ble_store_key_sec *key_sec,
|
||||
|
||||
idx = ble_store_ram_find_sec(key_sec, value_secs, *num_value_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
rc = ble_store_ram_delete_obj(value_secs, sizeof *value_secs, idx,
|
||||
num_value_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -255,12 +250,10 @@ ble_store_ram_delete_our_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_ram_delete_sec(key_sec, ble_store_ram_our_secs,
|
||||
&ble_store_ram_num_our_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -275,12 +268,10 @@ ble_store_ram_delete_peer_sec(const struct ble_store_key_sec *key_sec)
|
||||
rc = ble_store_ram_delete_sec(key_sec, ble_store_ram_peer_secs,
|
||||
&ble_store_ram_num_peer_secs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -296,14 +287,12 @@ ble_store_ram_read_peer_sec(const struct ble_store_key_sec *key_sec,
|
||||
idx = ble_store_ram_find_sec(key_sec, ble_store_ram_peer_secs,
|
||||
ble_store_ram_num_peer_secs);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
*value_sec = ble_store_ram_peer_secs[idx];
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -337,7 +326,6 @@ ble_store_ram_write_peer_sec(const struct ble_store_value_sec *value_sec)
|
||||
ble_store_ram_peer_secs[idx] = *value_sec;
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -392,7 +380,6 @@ ble_store_ram_delete_cccd(const struct ble_store_key_cccd *key_cccd)
|
||||
|
||||
idx = ble_store_ram_find_cccd(key_cccd);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -401,12 +388,10 @@ ble_store_ram_delete_cccd(const struct ble_store_key_cccd *key_cccd)
|
||||
idx,
|
||||
&ble_store_ram_num_cccds);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -421,7 +406,6 @@ ble_store_ram_read_cccd(const struct ble_store_key_cccd *key_cccd,
|
||||
|
||||
idx = ble_store_ram_find_cccd(key_cccd);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -429,7 +413,6 @@ ble_store_ram_read_cccd(const struct ble_store_key_cccd *key_cccd,
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -458,7 +441,6 @@ ble_store_ram_write_cccd(const struct ble_store_value_cccd *value_cccd)
|
||||
ble_store_ram_cccds[idx] = *value_cccd;
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
|
||||
@@ -507,7 +489,6 @@ ble_store_ram_delete_csfc(const struct ble_store_key_csfc *key_csfc)
|
||||
|
||||
idx = ble_store_ram_find_csfc(key_csfc);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -516,12 +497,10 @@ ble_store_ram_delete_csfc(const struct ble_store_key_csfc *key_csfc)
|
||||
idx,
|
||||
&ble_store_ram_num_csfcs);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -535,7 +514,6 @@ ble_store_ram_read_csfc(const struct ble_store_key_csfc *key_csfc,
|
||||
|
||||
idx = ble_store_ram_find_csfc(key_csfc);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -543,7 +521,6 @@ ble_store_ram_read_csfc(const struct ble_store_key_csfc *key_csfc,
|
||||
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -572,7 +549,6 @@ ble_store_ram_write_csfc(const struct ble_store_value_csfc *value_csfc)
|
||||
ble_store_ram_csfcs[idx] = *value_csfc;
|
||||
return 0;
|
||||
#else
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
#endif
|
||||
}
|
||||
@@ -617,7 +593,6 @@ ble_store_ram_delete_ead(const struct ble_store_key_ead *key_ead)
|
||||
|
||||
idx = ble_store_ram_find_ead(key_ead);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
rc = ble_store_ram_delete_obj(ble_store_ram_eads,
|
||||
@@ -625,7 +600,6 @@ ble_store_ram_delete_ead(const struct ble_store_key_ead *key_ead)
|
||||
idx,
|
||||
&ble_store_ram_num_eads);
|
||||
if (rc != 0) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, rc);
|
||||
return rc;
|
||||
}
|
||||
|
||||
@@ -640,7 +614,6 @@ ble_store_ram_read_ead(const struct ble_store_key_ead *key_ead,
|
||||
|
||||
idx = ble_store_ram_find_ead(key_ead);
|
||||
if (idx == -1) {
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOENT);
|
||||
return BLE_HS_ENOENT;
|
||||
}
|
||||
|
||||
@@ -726,7 +699,6 @@ ble_store_ram_read(int obj_type, const union ble_store_key *key,
|
||||
#endif
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
@@ -766,7 +738,6 @@ ble_store_ram_write(int obj_type, const union ble_store_value *val)
|
||||
#endif
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
@@ -800,7 +771,6 @@ ble_store_ram_delete(int obj_type, const union ble_store_key *key)
|
||||
#endif
|
||||
|
||||
default:
|
||||
BLE_HS_LOG(ERROR, "%s rc=%d\n", __func__, BLE_HS_ENOTSUP);
|
||||
return BLE_HS_ENOTSUP;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user