[Possible Bug] [Swift] ESTDeviceManager didDiscoverDevices returning null array

Problem: didDiscoverDevices() function of ESTDeviceManager returns null “devices” array

Background: I’m trying to gather temperature and ambient light sensor info from multiple beacons (using Swift)

Info: I’m pretty sure I’m using the beaconManager class correctly, and am using the startDeviceDiscoveryWithFilter() to search for a particular beacon. However, when the didDiscoverDevices function fires, it returns a null “devices” array. I think there are two possible scenarios:
Scenario 1: startDeviceDiscoveryWithFilter() did not find any beacons (or I inputted the beacon identifier incorrectly for the filter, but these would have the same outcome). Shouldn’t this fire the deviceManagerDidFailDiscovery() function if it doesn’t find any beacons matching the filter?

Scenario 2: startDeviceDiscoveryWithFilter() found the beacon, but is not passing their info to the “devices” array in the didDiscoverDevices() function, resulting in “devices” being a null array

Here is my code for AppDelegate.swift:

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, ESTDeviceManagerDelegate, UIApplicationDelegate {

    var window: UIWindow?

    var deviceManager: ESTDeviceManager!

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

        /*(My setupAppID function is correct in my actual code, but the values are replaced with "[redacted]" here for privacy) */
        ESTConfig.setupAppID("[redacted]", andAppToken: "[redacted]")
    
        self.deviceManager = ESTDeviceManager()
        print("created device manager")
    
        self.deviceManager.delegate = self
        print ("set device manager delegate to self")
    
    //the filter identifier is correct in my actual code, replaced with [redacted] here for privacy. I used the "identifier" value from the beacon on the Estimote Cloud site.
        print("creating filter for identifier")
        let filter = ESTDeviceFilterLocationBeacon(identifier: “[redacted]”)
    
        print("starting device discovery with filter")
        self.deviceManager.startDeviceDiscoveryWithFilter(filter)
    
        return true
    }

    //no devices found
    func deviceManagerDidFailDiscovery(manager: ESTDeviceManager) {
        print("discovery failed!")
    }

    //device discovery
    func deviceManager(manager: ESTDeviceManager, didDiscoverDevices devices: [ESTDevice]) {
        print("Discovered devices!")
        print(devices)
    }
}

The app builds and runs fine on my iPhone from XCode, and all the outputs are correct up until the didDiscoverDevices. The Estimotes are also verified to work, as they work fine with the other apps I’ve tested today.

The output from the didDiscoverDevices() function looks like this:

Discovered devices!
[ ]
Discovered devices!
[ ]
Discovered devices!
[ ]

etc. etc., repeating for the set interval.

Is there something wrong with my code? Or is this a bug with the ESTDeviceManager class or its didDiscoverDevices() and startDeviceDiscoveryWithFilter() functions?

Thanks in advance!

I don’t think that’s a bug. Just like you said, most likely the device manager simply hasn’t found any devices matching the criteria. We don’t call deviceManagerDidFailDiscovery when this happens, because “failures” are reserved for things like, Bluetooth is off, or Bluetooth crashed, etc. Not detecting a device is a valid result of scanning, not a failure, at least in our opinion.

Are you sure you provided the correct identifier, and that it’s an identifier for a Location Beacon?

I’m using the “identifier” string next to the beacon on the “Beacons” tab on the Estimote Cloud web app. Is this the correct identifier or should I be using something else?

Yes, that’s it. Please keep in mind though the ESTDeviceManager works only with beacons with firmware 4.x—which for now means, only our brand new Location Beacons. For older generation “Proximity Beacons”, you need to use the older ESTUtilityManager.

Hi

Can you try coverting ESTDevice Manager to a property like
@property (nonatomic) ESTDeviceManager *manager;
ESTDeviceFilterLocationBeacon *be = [[ESTDeviceFilterLocationBeacon alloc] initWithIdentifier:@"<<< Identifier you can get from estimote app >>>"];
[self.manager startDeviceDiscoveryWithFilter: be];

self.manager.delegate = self;

-(void)deviceManager:(ESTDeviceManager *)manager didDiscoverDevices:(NSArray<ESTDevice *> *)devices{
NSLog(@“Device desc %@”,devices );
NSLog(@“manager desc %@”,manager);
int cval = [devices count];

}
-(void)deviceManagerDidFailDiscovery:(ESTDeviceManager *)manager1{
NSLog(@“manager %@”,manager1);
}

one more thing I am also trying to read sensors data from beacon - so far no sucess from Location beacon.
I am trying to read EST Telemetry data. to read temperature , GPIO sensor data.

So far my understanding is you need not connect to beacon device to read EST Telemetry Packet data as this just broadcast data and your app has to capture it.

Let me know if my understanding is wrong in this case.

Let me know if you are able to read temperature or GPIO data.

Thanks
Krishna