Hi Jacob,

On Tue, Dec 27, 2016 at 10:37 PM, Jacob Rosenthal <[email protected]>
wrote:

> Hey all, been working with mynewt for a week or so now, trying to
> understand the code and slim the nimble stack down for nrf51822qfaa
> targets. Playing with central role now (modified blecent), and Im having
> some trouble searching for a single svc by uuid (to save peer struct
> memory, rather than indexing them all)
>
> Either I dont understand ble_gattc_disc_svc_by_uuid or it has problems.
>
> Its returning successfully but with a different uuid than I would expect
> and weird handles
>
> 2357:[ts=18414036ssb, mod=4 level=1] GATT procedure initiated: discover
> service by uuid; uuid=0000180d-0000-1000-800000805f9b34fb
> 2360:[ts=18437472ssb, mod=4 level=0] host tx hci data; handle=1 length=27
> 2361:[ts=18445284ssb, mod=4 level=0] ble_hs_hci_acl_tx(): 0x01 0x00 0x1b
> 0x00 0x17 0x00 0x04 0x00 0x06 0x01 0x00 0xff 0xff 0x00 0x28 0xfb 0x34 0x9b
> 0x5f 0x80 0x00 0x00 0x80 0x00 0x10 0x00 0x00 0x0d 0x18 0x00 0x00
>

So here's the problem: UUID you're searching for is a 16-bit UUID (0x180d)
and it shall be transmitted this way in a request, i.e. it cannot be sent
as 128-bit UUID which is what Nimble does. This problem should be already
fixed on develop branch by this pull request: https://github.com/apache/
incubator-mynewt-core/pull/140 (commit a9968542).


> 2364:[ts=18468720ssb, mod=4 level=0] txed att command: find type value req;
> conn=1 start_handle=0x0001 end_handle=0xffff attr_type=10240
> 2372:[ts=18531216ssb, mod=4 level=0] Number of Completed Packets:
> num_handles=1
> 2374:[ts=18546840ssb, mod=4 level=0] handle:1 pkts:1
> 2379:[ts=18585900ssb, mod=4 level=0] ble_hs_hci_evt_acl_process(): handle=1
> pb=2 len=9 data=0x05 0x00 0x04 0x00 0x01 0x06 0x01 0x00 0x0a
> 2382:[ts=18609336ssb, mod=4 level=0] rxed att command: error rsp; conn=1
> req_op=6 handle=0x0001 error_code=10
>

Here you receive response with 0x0a code which means that attribute was not
found due to the above issue, which means your request did not return any
valid service. Invalid data you see below are most likely from invalid
NULL-pointer dereference.


> 2384:[ts=18624960ssb, mod=64 level=3] Service discovery complete; status=0
> conn_handle=1
>
>
> (gdb)  p (peer->svcs)->slh_first->svc
> $4 = {
>   start_handle = 16384,
>   end_handle = 8192,
>   uuid128 = "\365\r\000\000U\016\000\000U\016\000\000\000\000\000"
> }
> (gdb)
> b blecent_on_svc_disc_complete
> b blecent_on_chr_disc_complete
>
<snip>

BR,
Andrzej

Reply via email to