You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by an...@apache.org on 2017/04/10 11:47:06 UTC

[14/50] incubator-mynewt-core git commit: nimble/att: Don't pass Error Responce as packed structure

nimble/att: Don't pass Error Responce as packed structure

Use packed structure only for mapping it onto received mbuf. Data is
passed to upper layers in native form. This allows compiler to generate
more effective code with regards to unaligned access.


Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/commit/4e0f1b91
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/4e0f1b91
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/4e0f1b91

Branch: refs/heads/master
Commit: 4e0f1b9183a44d896d1a58be6d4bf42ab9fbb620
Parents: 8dbabc6
Author: Szymon Janc <sz...@codecoup.pl>
Authored: Fri Mar 24 15:35:59 2017 +0100
Committer: Szymon Janc <sz...@codecoup.pl>
Committed: Mon Apr 10 11:31:31 2017 +0200

----------------------------------------------------------------------
 net/nimble/host/src/ble_att_clt.c   | 2 +-
 net/nimble/host/src/ble_gatt_priv.h | 2 +-
 net/nimble/host/src/ble_gattc.c     | 5 ++---
 3 files changed, 4 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e0f1b91/net/nimble/host/src/ble_att_clt.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_att_clt.c b/net/nimble/host/src/ble_att_clt.c
index 76d61eb..d34c096 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -44,7 +44,7 @@ ble_att_clt_rx_error(uint16_t conn_handle, struct os_mbuf **rxom)
     ble_att_error_rsp_parse((*rxom)->om_data, (*rxom)->om_len, &rsp);
     BLE_ATT_LOG_CMD(0, "error rsp", conn_handle, ble_att_error_rsp_log, &rsp);
 
-    ble_gattc_rx_err(conn_handle, &rsp);
+    ble_gattc_rx_err(conn_handle, rsp.baep_handle, rsp.baep_error_code);
 
     return 0;
 }

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e0f1b91/net/nimble/host/src/ble_gatt_priv.h
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gatt_priv.h b/net/nimble/host/src/ble_gatt_priv.h
index 2325120..ea06b33 100644
--- a/net/nimble/host/src/ble_gatt_priv.h
+++ b/net/nimble/host/src/ble_gatt_priv.h
@@ -107,7 +107,7 @@ struct ble_gatts_conn {
 int ble_gattc_locked_by_cur_task(void);
 void ble_gatts_indicate_fail_notconn(uint16_t conn_handle);
 
-void ble_gattc_rx_err(uint16_t conn_handle, struct ble_att_error_rsp *rsp);
+void ble_gattc_rx_err(uint16_t conn_handle, uint16_t handle, uint16_t status);
 void ble_gattc_rx_mtu(uint16_t conn_handle, int status, uint16_t chan_mtu);
 void ble_gattc_rx_read_type_adata(uint16_t conn_handle,
                                   struct ble_att_read_type_adata *adata);

http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/4e0f1b91/net/nimble/host/src/ble_gattc.c
----------------------------------------------------------------------
diff --git a/net/nimble/host/src/ble_gattc.c b/net/nimble/host/src/ble_gattc.c
index 6594182..ca5d541 100644
--- a/net/nimble/host/src/ble_gattc.c
+++ b/net/nimble/host/src/ble_gattc.c
@@ -4647,7 +4647,7 @@ done:
  * procedure.
  */
 void
-ble_gattc_rx_err(uint16_t conn_handle, struct ble_att_error_rsp *rsp)
+ble_gattc_rx_err(uint16_t conn_handle, uint16_t handle, uint16_t status)
 {
     struct ble_gattc_proc *proc;
     ble_gattc_err_fn *err_cb;
@@ -4656,8 +4656,7 @@ ble_gattc_rx_err(uint16_t conn_handle, struct ble_att_error_rsp *rsp)
     if (proc != NULL) {
         err_cb = ble_gattc_err_dispatch_get(proc->op);
         if (err_cb != NULL) {
-            err_cb(proc, BLE_HS_ERR_ATT_BASE + rsp->baep_error_code,
-                   rsp->baep_handle);
+            err_cb(proc, BLE_HS_ERR_ATT_BASE + status, handle);
         }
         ble_gattc_proc_free(proc);
     }