ARMmbed / ble-nrf51822

Nordic stack and drivers for the mbed BLE_API
Other
46 stars 51 forks source link

Characteristics discovery does not work as expected when a service does not include any characteristics #118

Open pan- opened 8 years ago

pan- commented 8 years ago

This bug has two symptoms, depending on the UUID of the empty service.

If the UUID of the empty service is a 16 bit UUID, the service might be discovered several times.

18:38:58.549|D2 --> DutThread: gattClient discoverAllServicesAndCharacteristics 0
18:38:59.979|D2 <-- DutThread: {"name":"discoverAllServicesAndCharacteristics","arguments":["0"],"result":[{"UUID":6144,"start_handle":1,"end_handle":7,"characteristics":[{"UUID":10752,"properties":["read","write"],"start_handle":2,"value_handle":3,"end_handle":3},{"UUID":10753,"properties":["read"],"start_handle":4,"value_handle":5,"end_handle":5},{"UUID":10756,"properties":["read"],"start_handle":6,"value_handle":7,"end_handle":7}]},{"UUID":6145,"start_handle":8,"end_handle":11,"characteristics":[{"UUID":10757,"properties":["indicate"],"start_handle":9,"value_handle":10,"end_handle":11}]},{"UUID":65518,"start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":65518,"start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":65519,"start_handle":13,"end_handle":13,"characteristics":[]},{"UUID":65520,"start_handle":14,"end_handle":14,"characteristics":[]},{"UUID":65520,"start_handle":14,"end_handle":14,"characteristics":[]},{"UUID":65521,"start_handle":15,"end_handle":15,"characteristics":[]},{"UUID":65522,"start_handle":16,"end_handle":65535,"characteristics":[]}],"status":0}

In this little snippet, the services starting at handle 12 and at handle 14 are discovered twice.

If the UUID of the empty service is a 128bit UUID, the discovery process never end and the service is discovered again and again:

18:35:48.921|D2 <-- DutThread: {"name":"discoverAllServicesAndCharacteristics","arguments":["0"],"result":[{"UUID":6144,"start_handle":1,"end_handle":7,"characteristics":[{"UUID":10752,"properties":["read","write"],"start_handle":2,"value_handle":3,"end_handle":3},{"UUID":10753,"properties":["read"],"start_handle":4,"value_handle":5,"end_handle":5},{"UUID":10756,"properties":["read"],"start_handle":6,"value_handle":7,"end_handle":7}]},{"UUID":6145,"start_handle":8,"end_handle":11,"characteristics":[{"UUID":10757,"properties":["indicate"],"start_handle":9,"value_handle":10,"end_handle":11}]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"ch
18:35:50.494|D2 <-- DutThread: aracteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879
18:35:52.075|D2 <-- DutThread: 623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"charact
18:35:53.651|D2 <-- DutThread: eristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_ha
18:35:55.224|D2 <-- DutThread: ndle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_h
18:35:56.793|D2 <-- DutThread: andle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595
18:35:57.816|D2 <-- DutThread: C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},{"UUID":"D111B458-E3BE-480B-8592-CE595C879623","start_handle":12,"end_handle":12,"characteristics":[]},"discovery timeout","status":-1}
ciarmcom commented 8 years ago

ARM Internal Ref: IOTSFW-2275