manolofdez / AsyncBluetooth

A small library that adds concurrency to CoreBluetooth APIs.
MIT License
168 stars 31 forks source link

QUESTION: Why .eventPublisher starts scanning for peripherals. #26

Closed theedov closed 1 year ago

theedov commented 1 year ago

Hello, I have a question, why eventPublisher starts scanning for peripherals?

    override init() {
        super.init()

        manager.eventPublisher
            .sink { event in
                print(event)
            }
            .store(in: &cancellables)
    }

LOG:

[CoreBluetooth] API MISUSE: <CBCentralManager: 0x281c10000> has no restore identifier but the delegate implements the centralManager:willRestoreState: method. Restoring will not be supported
[centralManager] Waiting for bluetooth to be ready...
[centralManager] Scanning for peripherals...
[centralManager] Found peripheral 4F380BEB-6D9D-2551-5B23-CB72156C1537
[centralManager] Found peripheral 4F380BEB-6D9D-2551-5B23-CB72156C1537
[centralManager] Found peripheral E3B1A66E-E029-B311-B9CB-90827BD936CD
[centralManager] Found peripheral AC741473-26F7-5C3C-4D86-399F4DB0CDD9
[centralManager] Found peripheral AF1683EB-29A7-2477-0A0C-9CD73A5A9175
.....
[centralManager] Stopping scan...
[centralManager] Stopped scanning peripherals

IGNORE THAT - FORGOT TO REMOVE SOME TESTING CODE 🙄