feat: add safe BLE discovery and network baseline tools
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
from bleak.backends.device import BLEDevice
|
||||
from bleak.backends.scanner import AdvertisementData
|
||||
|
||||
from k1link.ble.scanner import advertisement_record
|
||||
|
||||
|
||||
def test_advertisement_record_marks_k1_candidate() -> None:
|
||||
device = BLEDevice("TEST-UUID", "Unknown", details=None)
|
||||
advertisement = AdvertisementData(
|
||||
local_name="Lixel-K1-1234",
|
||||
manufacturer_data={123: b"\x01\x02"},
|
||||
service_data={"service": b"\xaa"},
|
||||
service_uuids=["B", "a"],
|
||||
tx_power=-4,
|
||||
rssi=-52,
|
||||
platform_data=(),
|
||||
)
|
||||
record = advertisement_record(device, advertisement)
|
||||
assert record["k1_name_candidate"] is True
|
||||
assert record["id_kind"] == "corebluetooth_uuid"
|
||||
assert record["manufacturer_data_hex"] == {"123": "0102"}
|
||||
assert record["service_data_hex"] == {"service": "aa"}
|
||||
assert record["service_uuids"] == ["B", "a"]
|
||||
Reference in New Issue
Block a user