nimble/sm: Use endian.h API for protocol data Don't use TOFROMLE16 API for protocol data. This API hide direction of convertion making code hard to follow.
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/7674f263 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7674f263 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7674f263 Branch: refs/heads/master Commit: 7674f26323d8dfce61fcfd6e2175894a7eb89f10 Parents: 32db778 Author: Szymon Janc <[email protected]> Authored: Fri Mar 24 15:50:08 2017 +0100 Committer: Szymon Janc <[email protected]> Committed: Mon Apr 10 11:31:33 2017 +0200 ---------------------------------------------------------------------- net/nimble/host/src/ble_sm.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7674f263/net/nimble/host/src/ble_sm.c ---------------------------------------------------------------------- diff --git a/net/nimble/host/src/ble_sm.c b/net/nimble/host/src/ble_sm.c index b58e7ae..9c925fd 100644 --- a/net/nimble/host/src/ble_sm.c +++ b/net/nimble/host/src/ble_sm.c @@ -1103,8 +1103,7 @@ ble_sm_ltk_req_reply_tx(uint16_t conn_handle, uint8_t *ltk) return BLE_HS_ECONTROLLER; } - ack_conn_handle = TOFROMLE16(ack_conn_handle); - if (ack_conn_handle != conn_handle) { + if (le16toh(ack_conn_handle) != conn_handle) { return BLE_HS_ECONTROLLER; } @@ -1129,8 +1128,7 @@ ble_sm_ltk_req_neg_reply_tx(uint16_t conn_handle) return BLE_HS_ECONTROLLER; } - ack_conn_handle = TOFROMLE16(ack_conn_handle); - if (ack_conn_handle != conn_handle) { + if (le16toh(ack_conn_handle) != conn_handle) { return BLE_HS_ECONTROLLER; }
