Classes

The following classes are available globally.

  • Read only data set for 3D axis data

    See more

    Declaration

    Swift

    open class BKAxisData : NSObject, NSSecureCoding
  • Read only data object for sensor data that is emitted by blukii beacons

    BeaconSensor values are part of BKDiscoveryData

    Seealso

    BKDiscoveryData
    See more

    Declaration

    Swift

    open class BKBeaconSensorData : NSObject, NSSecureCoding
  • Main Controller class for discovering BLE modules

    BlukiiClient is a single point of contact for all data retieving actions as follows:

    • Discovering BLE modules, extracting BLE advertised data
    • Decryption of blukii SecureBeacon advertising

    A. Discover BLE modules and extract their BLE data

    To do this you have to do the following steps:

    1. Initialize and start discovery

    Call initDiscovery() and implement the BKClientDiscoveryDelegate delegates. After initialization is ready (BKClientDiscoveryDelegate.onDiscoveryInitialized()) you can start the discovery.

     var mBlukiiClient: BKClient!
    
     override func viewDidLoad() {
         ...
         mBlukiiClient = BKController.instance.getDiscoveryClient()
         mBlukiiClient.discoveryDelegate = self
         mBlukiiClient.initDiscovery()
         ...
     }
    
     func stopDiscovery() {
         mBlukiiClient.stopDiscovery()
     }
    
     // Discovery Delegate
     func onDiscoveryInitialized() {
         if mBlukiiClient.startDiscovery() {
             // Discovery successfully started
         }
     }
    
     func onDiscoveryResult(discoveryResultList: [BKDiscoveryData]) {
         // retrieve BLE results
     }
    
     func onDiscoveryError(errorCode: BKDiscoveryError) {
         // retrieve errors
     }
    
     func onDiscoveryInfo(infoCode: BKDiscoveryInfo) {
         // retrieve infos and changed states
     }
    

    2. Configure discovery settings

    Use the BKDiscoverySettings object for configuring discovery. Get BKClient.discoverySettings to retrieve the settings property set.

     func onInitialized() {
           // Discovery successfully initialized
    
           let discoverySettings: BKDiscoverySettings = mBlukiiClient.discoverySettings
           discoverySettings.setRssiThreshold(-100)
           discoverySettings.scanDuration = 10000
           ...
    
           if mBlukiiClient.startDiscovery() {
               // Discovery successfully started
           }
      }
    

    When BLE scanner is started the BLE discovery is acting according to the BKDiscoverySettings:

    3. Retrieve results

    The callback BKClientDiscoveryDelegate.onDiscoveryResult(_:) will be called after finishing every discovery phase. It retrieves the discovered list of BKOutputElements.

    Note: If no BLE modules have been found discoveryResultList is empty (not nil).

     func onDiscoveryResult(discoveryResultList: [BKDiscoveryData]) {
       // Discovery phase has finished: list of OutputElements are retrieved
    
       for discoveryData in discoveryResultList {
          let id = discoveryData.blukiiId
          let rssi = discoveryData.getRssi()
          ...
       }
     }
    

    4. Retrieve errors and infos

    The callbacks BKClientDiscoveryDelegate.onDiscoveryError(_:) and BKClientDiscoveryDelegate.onDiscoveryInfo(_:) will be called if there is important information about the discover process.

     func onDiscoveryError(errorCode: BKDiscoveryError) {
         // An error has been sent from discover
     }
    
     func onDiscoveryInfo(infoCode: BKDiscoveryInfo) {
         // An info has been sent from discovery
     }
    

    5. Permission

    In Info.plist set the following keys for Beacon Detection:

    • NSLocationAlwaysUsageDescription
    • NSBluetoothAlwaysUsageDescription

    Add the Follow Capapilities to your Project, for scanning Beacons in Background:

    • Background Mode: Location Updates
    • Background Mode: Uses Bluetooth LE accessoires

    B. Decryption of SecureBeacon advertising

    blukii SecureBeacons are encrypted to prevent third parties from misusing the Beacon identification.

    The encryption is affecting the mac address and the iBeacon Major and Minor value.

    You can decrypt DiscoveryData by calling decryptSecureBeacons(discoveryDataList:). To detect a SecureBeacon, you have to set your secureBeacon UUID to BKDiscoverySettings.securebeaconUUID

    The delegate BKDecryptSecureBeaconsDelegate.onDecryptSecureBeacons(_:decryptedCount:) is retrieving a copy of the input parameter list containing decrypted values. Each BKDiscoveryData object, that has been decrypted is marked with BKDiscoveryData.secureBeaconState as BKSecureBeaconState.decrypted.

    func onDecryptSecureBeacons(_ decryptedDiscoveryDataList: [BKDiscoveryData], decryptedCount: Int) {
       print("BlukiiClient.onDiscoveryResult: DecryptSecureBeacons Successful: Count=" +  decryptedCount)
    }
    
    func onDecryptError(_ error: Error) {
       print("BlukiiClient.onDiscoveryResult: DecryptSecureBeacons failed: error=" + error.localizedDescription)
    }
    

    Note: SecureBeacons can only be decrypted by its owner, so the corresponding user needs to be logged in (@see BKBlukiiCloud)

    See more

    Declaration

    Swift

    open class BKClient : NSObject, BKDeviceDiscoveryServiceDelegate, BKDiscoveryBackendResolverDelegate
  • Read only data object for emitted data of on BLE module.

    BKDiscoveryData is a collection of BLE data that is scanned during one scan duration for one BLE module.

    It contains the following values if it is provided by the module’s hardware and firmware

    • Device found date
    • RSSI value
    • blukii Hardware specific advertising data like firmware, blukii type, advertising interval, battery and txPower
    • Sensor data results of blukii sensor beacons. See BKBeaconSensorData
    • Key data of blukii SmartKeys. See BKKeyData
    • Eddystone protocol data values. See BKEddystoneData
    • iBeacon protocol data values. See BKiBeaconData

    Note: If the scan scan duration (see BKDiscoverySettings.scanDuration) is longer than the advertising interval of the module than each value is read only once. The following data frames of the same type are ignored if the corresponding fields are already set in the BKDiscoveryData object. The discovery date (deviceFoundDate) is the timestamp of the last BLE frame that is scanned by the mobile device.

    BKDiscoveryData is returned by teh delegate function BKClientDiscoveryDelegate.onDiscoveryResult(_:)

    See more

    Declaration

    Swift

    open class BKDiscoveryData : NSObject, NSSecureCoding
  • Property set of settings to configure the discovering process.

    The DiscoverySettings properties are affecting the discovery process that is started by BKClient.initDiscovery() and the BKDiscoveryData contents of the result delegate.

    You can access the DiscoverySettings by BKClient.discoverySettings

    Every setting value is writeable and has a default value that is used if not changed by the developer.

    See more

    Declaration

    Swift

    open class BKDiscoverySettings : NSObject
  • Read only data object for Eddystone data that is emitted by beacons

    See Eddystone specification at https://github.com/google/eddystone/blob/master/protocol-specification.md

    BKEddystoneData can contain data of unencrypted EddyStone UID, URL and TLM.

    BKEddystoneData values are part of BKDiscoveryData.

    See more

    Declaration

    Swift

    open class BKEddystoneData : NSObject, NSSecureCoding
  • Read only data set for blukii SmartKey

    See more

    Declaration

    Swift

    open class BKKeyData : NSObject, NSSecureCoding
  • Read only data object for iBeacon data that is emitted by beacons

    See iBeacon specification at https://developer.apple.com/ibeacon

    iBeaconData values are part of BKDiscoveryData

    See more

    Declaration

    Swift

    open class BKiBeaconData : NSObject, NSSecureCoding
  • This class is the main controller for blukii cloud based actions.

    You can get a BKBlukiiCloud object via BKController.instance.

    With a blukii cloud object you have access to the cloud state. You can set credentials and a API key, get the user role, check if the user is authenticated and you can do the login and logout.

    Note: The API key has be purchased from blukii. Please contact support@blukii.com for more information.

    See more

    Declaration

    Swift

    open class BKBlukiiCloud
  • Main controller of blukii SDK

    BlukiiController controls the instantiation of all controllers that can only be loaded by BlukiiController.

    Please note: There must be only one BlukiiController instance to prevent multiple instantiations of package controllers and data structures.

    Example Snippet

    override func viewDidLoad() {
       ...
       mBlukiiCloud = BKController.instance.getCloud()
       ...
    }
    
    See more

    Declaration

    Swift

    open class BKController
  • Helper class to validate application and mobile device features

    See more

    Declaration

    Swift

    open class BKFeatureValidator : NSObject
  • Main controller class of package info, for interacting with blukii Manager Info CMS (@see https://manager.blukii.com)

    BlukiiClient class contains discovery functions as follows:

    • Request for getting blukii Info output data.
    • Reporting of blukii Info clicks.
    • Reporting of blukii Info violations.

    Note: These functions needs to set an developers API key by BKBlukiiCloud.setApiKey(apiKey:). Settings of credentials and user login is not needed for BlukiiInfo functions.

    See more

    Declaration

    Swift

    open class BKBlukiiInfo : NSObject
  • Read only data object for Info Bundle data retrieved from blukii Manager Info CMS.

    It contains the results of the BKBlukiiInfo.getInfoBundles(bundleIds:completionHandler:) request to the blukii Manager Info CMS (https://manager.blukii.com).

    See more

    Declaration

    Swift

    open class BKInfoBundleData : NSObject, NSCoding
  • Read only data object for output language based info bundle data retrieved from blukii Manager Info CMS.

    It is a child object of BKInfoBundleData and contains all data that is language specific

    See more

    Declaration

    Swift

    open class BKInfoBundleOutputData : NSObject, NSCoding
  • Read only data object for data of BLE discover and resolving process.

    It contains the results of the BKBlukiiInfo.getInfoData(blukiiIds:completionHandler:) request to the blukii Manager Info CMS(https://manager.blukii.com).

    The BKInfoData fields contain the values of one corresponding blukii number.

    See more

    Declaration

    Swift

    open class BKInfoData : NSObject, NSSecureCoding
  • Read only data object for output language based blukii data retrieved from blukii Manager Info CMS.

    It is a child object of BKInfoData and contains all data that is language specific

    See more

    Declaration

    Swift

    open class BKInfoOutputData : NSObject, NSCoding