Scan & connect with BLE peripherals (Bluetooth Smart)

Other topics

Scan all available peripherals

Swift:

centralManager.scanForPeripherals(withServices: nil, options: nil)

Objective C:

[centralManager scanForPeripheralsWithServices:nil options:nil];

Scan available peripherals only with interested services

Swift:

let services = [CBUUID(string: SERVICE1_UUID), CBUUID(string: SERVICE2_UUID)]
centralManager.scanForPeripherals(withServices: services, options: nil)

Objective C:

NSArray *services = @[[CBUUID UUIDWithString:SERVICE1_UUID], [CBUUID UUIDWithString:SERVICE2_UUID]];
[centralManager scanForPeripheralsWithServices:services options:nil];

Contributors

Topic Id: 9759

Example Ids: 30074,30075

This site is not affiliated with any of the contributors.