SBKBeaconManager Class Reference
Inherits from | NSObject |
Declared in | SBKBeaconManager.h |
Overview
The SBKBeaconManager class defines the interface for configuring the delivery of beacon-related events to your application. You use an instance of this class to get SBKBeacon objects, and establish the parameters that determine which beacon’s events should be delivered.
You should always use the shared instance. Creating own instance is not allowed.
Tasks
Getting the Instance
Setting and Getting the Delegate
-
delegate
property
Initiating Beacon Ranging
-
– requestAlwaysAuthorization
-
– requestWhenInUseAuthorization
-
– startRangingBeaconsWithID:wakeUpApplication:
-
– stopRangingBeaconsWithID:
-
– stopRangingAllBeacons
-
– addBroadcastKey:
-
– registerBeaconAppearWatcher:type:watcher:
-
– rangedBeaconIDs
Getting the Instance of Beacons
Configuration
-
outOfRangeDelay
property -
version
property -
duplicateKeyBLE
property
Properties
delegate
The delegate of the app object.
@property (nonatomic, weak) id<SBKBeaconManagerDelegate> delegate
Discussion
The delegate of the app object.
Declared In
SBKBeaconManager.h
duplicateKeyBLE
- Set whether enable duplicate key for scanning device in background mode.
- default is NO,To set this property before call startRangingBeaconsWithID. *
- @discussion if set this property to YES, the SDK will continuously receive packet from device, but this increase the power consumption, NO, SDK will receive one packet from device unless this packet was changed.
@property (readwrite, nonatomic) BOOL duplicateKeyBLE
Discussion
- Set whether enable duplicate key for scanning device in background mode.
- default is NO,To set this property before call startRangingBeaconsWithID. *
- @discussion if set this property to YES, the SDK will continuously receive packet from device, but this increase the power consumption, NO, SDK will receive one packet from device unless this packet was changed.
Declared In
SBKBeaconManager.h
outOfRangeDelay
Delay out of range notifications delivering.
@property (readwrite, nonatomic) NSTimeInterval outOfRangeDelay
Discussion
Delay out of range notifications delivering.
In order to prevent notifications delivering too frequently, beacon will not be marked out of range immediately. Default value is 8 seconds, means a beacon will be marked out of range if it can not be ranged in last 8 seconds.
Declared In
SBKBeaconManager.h
Class Methods
sharedInstance
Returns the shared instance of the SBKBeaconManager class. Users are not allowed to create own instance.
+ (SBKBeaconManager *)sharedInstance
Discussion
Returns the shared instance of the SBKBeaconManager class. Users are not allowed to create own instance.
Declared In
SBKBeaconManager.h
Instance Methods
addBroadcastKey:
Set the secret info to decrypt the broadcast info.
- (BOOL)addBroadcastKey:(NSString *)secretInfo
Parameters
- secretInfo
the secret info.
Discussion
Set the secret info to decrypt the broadcast info.
Declared In
SBKBeaconManager.h
allBeacons
Get all the beacon instances.
- (NSArray *)allBeacons
Return Value
Beacon instances in array.
Discussion
Get all the beacon instances.
Declared In
SBKBeaconManager.h
beaconWithCLBeacon:
Get the beacon instance with CLBeacon object.
- (SBKBeacon *)beaconWithCLBeacon:(CLBeacon *)beacon
Parameters
- beacon
Using CLBeacon object to identify the sensoro beacon you want.
Return Value
SBKBeacon instance.
Discussion
Get the beacon instance with CLBeacon object.
This mehtod will return a sensoso beacon corresponding CLBeacon object. if this beacon is not a sensoro beacon, it will return nil.
Declared In
SBKBeaconManager.h
beaconWithID:
Get the beacon instance with SBKBeaconID object.
- (SBKBeacon *)beaconWithID:(SBKBeaconID *)beaconID
Parameters
- beaconID
Using SBKBeaconID object to identify the beacon you want.
Return Value
Beacon instance.
Discussion
Get the beacon instance with SBKBeaconID object.
This mehtod will return nil if the beacon has not been ranged. The beacon with same ID will only have one instance.
Warning: The SBKBeaconID object must have major and minor properties.
Declared In
SBKBeaconManager.h
beaconsInRange
Get the beacon instances in range now.
- (NSArray *)beaconsInRange
Return Value
Beacon instances in array, sorted by accuracy.
Discussion
Get the beacon instances in range now.
Declared In
SBKBeaconManager.h
disableBLEPowerAlert
Disable the alert that was showed when BLE was power off. Defualt was show the alert dialog. You can call this method to disable this alert, before call other method.
- (void)disableBLEPowerAlert
Discussion
Disable the alert that was showed when BLE was power off. Defualt was show the alert dialog. You can call this method to disable this alert, before call other method.
Declared In
SBKBeaconManager.h
rangedBeaconIDs
The set of SBKBeaconID currently being ranged.
- (NSSet *)rangedBeaconIDs
Return Value
The objects in the set are instances of the SBKBeaconID class
Discussion
The set of SBKBeaconID currently being ranged.
Declared In
SBKBeaconManager.h
registerBeaconAppearWatcher:type:watcher:
Regiser a watcher to do something for new beacon.
- (void)registerBeaconAppearWatcher:(NSString *)identifier type:(u_int8_t)type watcher:(SBKBeaconWatcher)watcher
Parameters
- identifier
serial number or uuid, major, minor (UUID|MAJOR|MINOR).
- type
identifier’s type, 0: serial number, 1: uuid, major, minor.
- watcher
call this method when beacon will appear.
Discussion
Regiser a watcher to do something for new beacon.
Regiser a watcher to do something for new beacon that need setting before call didRangeNewBeacon, for example set beacon’s inRangeMinimumRssiWhileEntering. for every indentifier in lifetime just call once. To call didRangeNewBeacon for a beacon may be many times, because you can enter a beacon many times;
Declared In
SBKBeaconManager.h
requestAlwaysAuthorization
Requests permission to use location services whenever the app is running.
- (void)requestAlwaysAuthorization
Discussion
Requests permission to use location services whenever the app is running.
When the current authorization status is kCLAuthorizationStatusNotDetermined, calling this method prompts the user to grant permission to the app to use location services.The user prompt contains the text from the NSLocationAlwaysUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method. You must call this method or the requestWhenInUseAuthorization method prior to using location services. If the current authorization status is anything other than kCLAuthorizationStatusNotDetermined, this method does nothing. for detail Apple’s requestAlwaysAuthorization
Declared In
SBKBeaconManager.h
requestWhenInUseAuthorization
Requests permission to use location services while the app is in the foreground.
- (void)requestWhenInUseAuthorization
Discussion
Requests permission to use location services while the app is in the foreground.
When the current authorization status is kCLAuthorizationStatusNotDetermined, calling this method prompts the user to grant permission to the app to use location services. The user prompt contains the text from the NSLocationWhenInUseUsageDescription key in your app’s Info.plist file, and the presence of that key is required when calling this method. You must call this method or the requestAlwaysAuthorization method prior to using location services. If the current authorization status is anything other than kCLAuthorizationStatusNotDetermined, this method does nothing. for detail Apple’s requestWhenInUseAuthorization
Declared In
SBKBeaconManager.h
startRangingBeaconsWithID:wakeUpApplication:
Starts the delivery of notifications for beacons with specified id.
- (void)startRangingBeaconsWithID:(SBKBeaconID *)beaconID wakeUpApplication:(BOOL)wakeUpApplication
Parameters
- beaconID
Using SBKBeaconID object to identify the beacons.
- wakeUpApplication
Wake up your application in background when those beacons being ranged.
Discussion
Starts the delivery of notifications for beacons with specified id.
Declared In
SBKBeaconManager.h
stopRangingAllBeacons
Stops the delivery of notifications for all beacons.
- (void)stopRangingAllBeacons
Discussion
Stops the delivery of notifications for all beacons.
Declared In
SBKBeaconManager.h
stopRangingBeaconsWithID:
Stops the delivery of notifications for beacons with specified id.
- (void)stopRangingBeaconsWithID:(SBKBeaconID *)beaconID
Parameters
- beaconID
Using SBKBeaconID object to identify the beacons.
Discussion
Stops the delivery of notifications for beacons with specified id.
Declared In
SBKBeaconManager.h