ESTSimulatedNearableManager

@interface ESTSimulatedNearableManager
    : ESTNearableManager <ESTNearableManagerDelegate>

ESTSimulatedNearableManager is a class for simulating Nearables (ESTNearable) objects.

  • Array with simulated ESTNearable objects.

    Declaration

    Objective-C

    @property (readonly, strong, nonatomic)
        NSMutableArray<ESTNearable *> *_Nonnull nearables;

    Swift

    var nearables: NSMutableArray { get }
  • Initializer with delegate.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDelegate:
        (id<ESTNearableManagerDelegate> _Nullable)delegate;

    Swift

    init(delegate: ESTNearableManagerDelegate?)

    Parameters

    delegate

    Set delegate for ESTNearableManagerDelegate updates.

    Return Value

    Instance of this object.

  • Use this initializer if you want to specify nearables in JSON. Providing only filename is sufficient, but remember that your file should be *.json type and accessible from MainBundle. By default, order of nearables in the list will be reflected in nearables array, which means, this class do not provide simulation of fluctuating RSSI or proximity. However, you can set those values in JSON file, they will be parsed into ESTNearable object.

    Declaration

    Objective-C

    - (nonnull instancetype)initWithDelegate:
                                (id<ESTNearableManagerDelegate> _Nullable)delegate
                                 pathForJSON:(nonnull NSString *)path;

    Swift

    init(delegate: ESTNearableManagerDelegate?, pathForJSON path: String)

    Parameters

    delegate

    Set delegate for ESTNearableManagerDelegate updates.

    path

    Path for json file with description of nearables you want to simulate.

    Return Value

    Instance of this object.

  • Add single nearable by specifying params. ESTNearable object will be inserted into nearables array.

    Declaration

    Objective-C

    - (void)addNearableToSimulation:(nonnull NSString *)identifier
                           withType:(ESTNearableType)type
                               zone:(ESTNearableZone)zone
                               rssi:(NSInteger)rssi;

    Swift

    func addNearable(toSimulation identifier: String, with type: ESTNearableType, zone: ESTNearableZone, rssi: Int)

    Parameters

    identifier

    Identifier for ESTNearable object.

    type

    Nearable type

    zone

    Nearable zone

    rssi

    Nearable rssi

  • If you used initWithDelegate: initializer to create this class and later you want to range nearables with type, use this method to set array of nearables.

    Declaration

    Objective-C

    - (void)addNearablesToSimulationWithPath:(nonnull NSString *)path;

    Swift

    func addNearablesToSimulation(withPath path: String)

    Parameters

    path

    Path for json file with description of nearables you want to simulate.

  • Set desired zone for your simulated ESTNearableObject.

    Declaration

    Objective-C

    - (void)simulateZone:(ESTNearableZone)zone
             forNearable:(nonnull NSString *)identifier;

    Swift

    func simulateZone(_ zone: ESTNearableZone, forNearable identifier: String)

    Parameters

    zone

    ESTNearableZone to set.

    identifier

    Identifier of ESTNearable you want to change.

  • Simulate enter region event for your nearable. Ranging will automatically start after calling this method. Callback method is nearableManager:didEnterIdentifierRegion from ESTNearableManagerDelegate protocol. If you do not implement didEnterIdentifierRegion code will crash, it’s not checking whether delegate implemented method or not. This is ‘by design’. During testing you probably want to know when your class don’t implement ESTNearableManager delegates.

    Declaration

    Objective-C

    - (void)simulateDidEnterRegionForNearable:(nonnull ESTNearable *)nearable;

    Swift

    func simulateDidEnterRegion(for nearable: ESTNearable)

    Parameters

    nearable

    Nearable object for this event.

  • Simulate exit region event for your nearable. Ranging will automatically stop after calling this method. Callback method is nearableManager:didExitIdentifierRegion from ESTNearableManagerDelegate protocol. If you do not implement didExitIdentifierRegion code will crash, it’s not checking whether delegate implemented method or not. This is ‘by design’. During testing you probably want to know when your class don’t implement ESTNearableManager delegates.

    Declaration

    Objective-C

    - (void)simulateDidExitRegionForNearable:(nonnull ESTNearable *)nearable;

    Swift

    func simulateDidExitRegion(for nearable: ESTNearable)

    Parameters

    nearable

    Nearable object for this event.