File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -219,6 +219,28 @@ def test_parse_advertisement_short_local_name():
219219 assert adv .tx_power is None
220220
221221
222+ def test_parse_advertisement_complete_overrides_short_local_name ():
223+ # SHORT (0x08) appears first then COMPLETE (0x09) follows; COMPLETE must
224+ # overwrite the short form so callers always see the longer name when
225+ # both are present.
226+ data = [b"\x04 \x08 Bar\x04 \x09 Foo" ]
227+
228+ adv = parse_advertisement_data (data )
229+
230+ assert adv .local_name == "Foo"
231+
232+
233+ def test_parse_advertisement_short_local_name_ignored_after_complete ():
234+ # COMPLETE (0x09) appears first then SHORT (0x08) follows; the SHORT
235+ # branch is gated on ``local_name is None``, so the previously-set
236+ # complete name must survive.
237+ data = [b"\x04 \x09 Foo\x04 \x08 Bar" ]
238+
239+ adv = parse_advertisement_data (data )
240+
241+ assert adv .local_name == "Foo"
242+
243+
222244def test_parse_advertisement_data_32bit_service_data ():
223245 data = [
224246 b"\x07 \x20 \x1a \x02 \n \x05 \n \xff " ,
You can’t perform that action at this time.
0 commit comments