nimble: fix sending uuid16 when possible in disc_svc_uuid With this patch it is possible to pass TC_GAD_CL_BV_02_C.
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/7dee316d Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/tree/7dee316d Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/diff/7dee316d Branch: refs/heads/develop Commit: 7dee316d9a3aae1897baa2f417e3958f3d4fe428 Parents: 7bd5ec5 Author: MichaÅ Narajowski <[email protected]> Authored: Wed Dec 14 15:46:18 2016 +0100 Committer: MichaÅ Narajowski <[email protected]> Committed: Tue Dec 20 09:40:10 2016 +0100 ---------------------------------------------------------------------- net/nimble/host/src/ble_gattc.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-core/blob/7dee316d/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 d962208..6eb0606 100644 --- a/net/nimble/host/src/ble_gattc.c +++ b/net/nimble/host/src/ble_gattc.c @@ -1636,6 +1636,7 @@ static int ble_gattc_disc_svc_uuid_tx(struct ble_gattc_proc *proc) { struct ble_att_find_type_value_req req; + uint16_t uuid16; int rc; ble_gattc_dbg_assert_proc_not_inserted(proc); @@ -1644,8 +1645,17 @@ ble_gattc_disc_svc_uuid_tx(struct ble_gattc_proc *proc) req.bavq_end_handle = 0xffff; req.bavq_attr_type = BLE_ATT_UUID_PRIMARY_SERVICE; - rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req, - proc->disc_svc_uuid.service_uuid, 16); + + uuid16 = ble_uuid_128_to_16(proc->disc_svc_uuid.service_uuid); + if (uuid16 != 0){ + rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req, + &uuid16, 2); + } else { + rc = ble_att_clt_tx_find_type_value(proc->conn_handle, &req, + proc->disc_svc_uuid.service_uuid, + 16); + } + if (rc != 0) { return rc; }
