0
votes

i want to detect an altBeacon (transmitted by an Android Smartphone with the QuickBeacon App) with CoreBluetooth and Swift.

But when I search for a specific UUID the delegate method is not being called.

   func centralManagerDidUpdateState(central: CBCentralManager!){

    if (central.state == .PoweredOff) {
        println("CoreBluetooth BLE hardware is powered off")
    }
    else if (central.state == .PoweredOn) { 
        var UUIDObj:NSArray! = [CBUUID(string: "2f234454-cf6d-4a0f-adf2-f4911ba9ffa6")]
        self.centralManager.scanForPeripheralsWithServices(UUIDObj as [AnyObject], options: nil)
        NSLog("Scanning started"); }}

Normally this method should be called

func centralManager(central: CBCentralManager!, didDiscoverPeripheral peripheral: CBPeripheral!, advertisementData: [NSObject : AnyObject]!, RSSI: NSNumber!) {

When i change the Beacon Format to "iBeacon" it also don't work. Does anybody know how i can get the advertising values of the AltBeacon and iBeacon standard with coreBluetooth?

Update:

When i search for all peripheral devices i get this information from my AltBeacon:

in DidDiscoverPeripheral AdvertisementData: [kCBAdvDataIsConnectable: 0] RSSI: -47 Peripheral Name: nil , State: (Enum Value) , Services:nil, RSSI:nil,ID: <__NSConcreteUUID 0x17002edc0> A91CBF8C-DA69-B2FB-1A9A-CDDB60A48209 , Description:

But the UUID does not match with the given ID :(

1
If you scan for peripheral without giving specific Service UUID, do you fid it? - Larme
It seems that AltBeacon doesn't advertise its services UUID. So, you can't scanForPeripheral filtering on a specific service UUID if it does broadcast one. - Larme
I broadcast the beacon signal with the QuickBeacon App of Radius Networks with my Nexus 6. Is it possible that the app or the Nexus 6 does not broadcast the right package? - user3143691
It seems so. Since we can read in your logs: "Services:nil", it doesn't broadcast services. It may have the service, but doesn't broadcast it. - Larme
Do you think that a real AltBeacon (for example a RadBeacon) would broadcast the "right" advertisement data so that i could define the region by UUID? - user3143691

1 Answers

0
votes

I can answer a part of your question: The CBCentralManager's delegate methods (e.g. func centralManagerDidUpdateState(central: CBCentralManager!)) are only called if you instantiate the manager with a queue, i.e. using init(delegate:queue:) or init(delegate:queue:options:) instead of just init()...