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:13 UTC
[21/50] incubator-mynewt-core git commit: nimble/att: Use packed
struct for receiving Find Information Response
nimble/att: Use packed struct for receiving Find Information Response
Use packed structure to map it to received mbuf instead of using
dedicated parsing function. Modern compilers generate effective code
in such case anyway.
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/fe97914d
Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/fe97914d
Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/fe97914d
Branch: refs/heads/master
Commit: fe97914df0e8a0c497a3f737754d8873e8399959
Parents: a31e34b
Author: Szymon Janc <sz...@codecoup.pl>
Authored: Fri Mar 24 15:47:10 2017 +0100
Committer: Szymon Janc <sz...@codecoup.pl>
Committed: Mon Apr 10 11:31:32 2017 +0200
----------------------------------------------------------------------
net/nimble/host/src/ble_att_clt.c | 18 ++++++++++++------
1 file changed, 12 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/fe97914d/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 1d45ef0..4644b35 100644
--- a/net/nimble/host/src/ble_att_clt.c
+++ b/net/nimble/host/src/ble_att_clt.c
@@ -247,23 +247,29 @@ ble_att_clt_rx_find_info(uint16_t conn_handle, struct os_mbuf **om)
#endif
struct ble_att_find_info_idata idata;
- struct ble_att_find_info_rsp rsp;
+ struct ble_att_find_info_rsp *rsp;
int rc;
- rc = ble_hs_mbuf_pullup_base(om, BLE_ATT_FIND_INFO_RSP_BASE_SZ);
+ /* TODO move this to common part
+ * Strip L2CAP ATT header from the front of the mbuf.
+ */
+ os_mbuf_adj(*om, 1);
+
+ rc = ble_hs_mbuf_pullup_base(om, sizeof(*rsp));
if (rc != 0) {
goto done;
}
- ble_att_find_info_rsp_parse((*om)->om_data, (*om)->om_len, &rsp);
+ rsp = (struct ble_att_find_info_rsp *)(*om)->om_data;
+
BLE_ATT_LOG_CMD(0, "find info rsp", conn_handle, ble_att_find_info_rsp_log,
- &rsp);
+ rsp);
/* Strip the response base from the front of the mbuf. */
- os_mbuf_adj((*om), BLE_ATT_FIND_INFO_RSP_BASE_SZ);
+ os_mbuf_adj((*om), sizeof(*rsp));
while (OS_MBUF_PKTLEN(*om) > 0) {
- rc = ble_att_clt_parse_find_info_entry(om, rsp.bafp_format, &idata);
+ rc = ble_att_clt_parse_find_info_entry(om, rsp->bafp_format, &idata);
if (rc != 0) {
goto done;
}