@@ -311,12 +311,54 @@ def test_parse_adv_data():
311311 adv = parse_advertisement_data (data )
312312
313313 assert adv .local_name == "M2_B1A8S10P"
314- assert adv .service_uuids == ["0000fee7ffe0-0000-1000-8000-00805f9b34fb" ]
314+ assert adv .service_uuids == [
315+ "0000ffe0-0000-1000-8000-00805f9b34fb" ,
316+ "0000fee7-0000-1000-8000-00805f9b34fb" ,
317+ ]
315318 assert adv .service_data == {}
316319 assert adv .manufacturer_data == {2917 : b"\x88 \xa0 \xc8 G\x8c \xea \xd1 \xc1 " }
317320 assert adv .tx_power is None
318321
319322
323+ def test_parse_multiple_16bit_uuids ():
324+ """Test parsing advertisement data with 3 16-bit service UUIDs."""
325+ # Build advertisement data with 3 16-bit UUIDs
326+ # Length: 7 (1 byte type + 6 bytes for 3 UUIDs)
327+ # Type: 0x02 (16-bit service UUID more available)
328+ # UUIDs in little-endian: 0x1234 -> 3412, 0x5678 -> 7856, 0x9ABC -> BC9A
329+ data = [bytes .fromhex ("070234127856BC9A" )]
330+ adv = parse_advertisement_data (data )
331+
332+ assert adv .service_uuids == [
333+ "00001234-0000-1000-8000-00805f9b34fb" ,
334+ "00005678-0000-1000-8000-00805f9b34fb" ,
335+ "00009abc-0000-1000-8000-00805f9b34fb" ,
336+ ]
337+ assert adv .local_name is None
338+ assert adv .service_data == {}
339+ assert adv .manufacturer_data == {}
340+ assert adv .tx_power is None
341+
342+
343+ def test_parse_multiple_32bit_uuids ():
344+ """Test parsing advertisement data with 2 32-bit service UUIDs."""
345+ # Build advertisement data with 2 32-bit UUIDs
346+ # Length: 9 (1 byte type + 8 bytes for 2 UUIDs)
347+ # Type: 0x04 (32-bit service UUID more available)
348+ # UUIDs in little-endian: 0x12345678 -> 78563412, 0x9ABCDEF0 -> F0DEBC9A
349+ data = [bytes .fromhex ("090478563412F0DEBC9A" )]
350+ adv = parse_advertisement_data (data )
351+
352+ assert adv .service_uuids == [
353+ "12345678-0000-1000-8000-00805f9b34fb" ,
354+ "9abcdef0-0000-1000-8000-00805f9b34fb" ,
355+ ]
356+ assert adv .local_name is None
357+ assert adv .service_data == {}
358+ assert adv .manufacturer_data == {}
359+ assert adv .tx_power is None
360+
361+
320362def test_parse_advertisement_data_zero_padded_scan_included ():
321363 data = [
322364 b"\x02 \x01 \x06 \t \xff Y\x00 \xfe \x02 4\x9e \xa6 \xba \x00 \x00 \x00 \x00 \x00 \x00 \x00 \x00 "
0 commit comments