Classes

The following classes are available globally.

  • 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 first BLE frame that is scanned by the mobile device.

    BKDiscoveryData is a part of BKOutputElement It will be set if the BKOutputElement is returned by the delegate function BKClientDiscoveryDelegate.onDiscoveryResult(discoveryResultList: [BKOutputElement]) after calling BKClient.initDiscovery(). For Other BKClient delegates BKDiscoveryData is nil.

    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 set for 3D axis data

    See more

    Declaration

    Swift

    open class BKAxisData: NSObject, NSSecureCoding
  • Main Controller class for discovering BLE modules and resolving blukii concerned data from the blukii Info Manager.

    BlukiiClient is a single point of contact for all data retieving actions as follows: - Discovering BLE modules, extracting BLE data and resolving data from blukii Info Manager (https://manager.blukiiinfo.com) - Resolving data for a single blukii module or tag from blukii Info Manager - Resolving news from blukii Info Manager

    A. Discover BLE modules, extract their BLE data and resolve their data from blukii Info Manager

    Use this feature to discover BLE modules in your environment and optionally retrieve corresponding data from blukii Info Manager.

    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 (delegate onDiscoveryInitialized()) you can start the discovery.

    var mBlukiiClient: BKClient!
    
    override func viewDidLoad() {
        ...
        mBlukiiClient = BKClient()
        mBlukiiClient.discoveryDelegate = self
        mBlukiiClient.initDiscovery()
        ...
    }
    
    func onInitialized() {
        if mBlukiiClient.startDiscovery() {
            // Discovery successfully started
        }
    }
    
    func onDiscoveryResult(discoveryResultList: [BlukiiInfo.BKOutputElement]) { }
    func onDiscoveryError(errorCode: BlukiiInfo.BKClient.ErrorCode) { }
    func onDiscoveryInfo(infoCode: BlukiiInfo.BKClient.InfoCode) { }
    

    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:

    • The scanner is searching for BLE modules inside the defined rssi range (BKDiscoverySettings.getRssiThreshold()).
    • After one scan duration (BKDiscoverySettings.scanDuration) the results are called back to (BKClientDiscoveryDelegate.onDiscoveryResult(_: ))
    • This is repeated until BLE Scanning is stopped by BKClient.stopDiscovery() or the app did enter the background.
    • if the scanner is paused according to the BKDiscoverySettings the info BKClient.InfoCode.INFO_DISCOVERY_PAUSED is called.
    • For background scanning it is necessary to be in the iBeacon Region 123456789AB-CDEF-01234-00000000002 or 123456789AB-CDEF-01234-00000000003. In background it is possible to scan for iBeacon, EddystoneBeacon and InfoBeacon.

    3. Configure resolver settings

    Use the BKResolveSettingsobject for configuring the resolving of the blukii Info Manager data.

    Call BKClient.resolveSettingsto retrieve the settings property set.

    Note: BKResolveSettings.resolveEnabled has to be set true to enable the resolver!

    func onInitialized() {
          // Discovery successfully initialized
    
          let discoverySettings: BKDiscoverySettings = mBlukiiClient.discoverySettings
          discoverySettings.setRssiThreshold(-100)
          discoverySettings.scanDuration = 10000
          ...
    
          // change resolver settings
          let resolveSettings: BKResolveSettings = mBlukiiClient.resolveSettings
          resolveSettings.resolveEnabled = true
          resolveSettings.setLanguagePriority([BKResolveSettings.OutputLanguage.English, BKResolveSettings.OutputLanguage.German])
          ...
    
          if mBlukiiClient.startDiscovery() {
              // Discovery successfully started
          }
     }
    

    4. Retrieve results

    The callback BKClientDiscoveryDelegate.onDiscoveryResult(discoveryResultList: [BKOutputElement]) 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: [BKOutputElement]) {
      // Discovery phase has finished: list of OutputElements are retrieved
    
      for outputElement in discoveryResultList {
         let id = outputElement.id
         let rssi = outputElement.discoveryData?.rssi
         ...
      }
    }
    

    5. Retrieve errors and infos

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

    func onDiscoveryError(errorCode: BKClient.ErrorCode) {
        // An error has been sent from discover
    }
    
    func onDiscoveryInfo(infoCode: BKClient.InfoCode) {
        // An info has been sent from discovery
    }
    

    B. Resolve data for a single blukii module or tag from blukii Info Manager

    Retrieve data for a module or tag from blukii Info Manager by calling resolveInputElement(InputElement)

    You have to prepare an BKInputElement that stands for a blukii number, NFC tag or scan result. Please see BKInputElement for more Information.

    If the resolving proccess is successfull the delegate BKClientResolveDelegate.onResolveInputElementResult(outputElement: BKOutputElement) is called. Otherwise the delegate BKClientResolveDelegate.onResolveInputElementError(inputElement: BKInputElement, errorCode: BKClient.ErrorCode) lets you know the error of the resolving proccess.

    mBlukiiClient.resolveDelegate = self
    
    func resolveSingleElement() {
        // call resolver
        let inputElement = BKInputElement(tagID: "", inputType: BKInputSourceType.NFC)
        mBlukiiClient.resolveInputElement(inputElement)
    }
    
    func onResolveInputElementResult(outputElement: BKOutputElement) {
        let id = outputElement.id
        let url = outputElement.resolveData?.url
    }
    
    func onResolveInputElementError(inputElement: BKInputElement, errorCode: BKClient.ErrorCode) {
        // An error has been sent from resolver
    }
    

    C. Resolving news from blukii Info Manager

    Retrieve a translated news text from the blukii Info Manager.

    If the resolving process is successfull the delegate BKClientNewsDelegate.onNewsResult(news: String) is called. Otherwise the delegate BKClientNewsDelegate.onNewsError(errorCode: BKClient.ErrorCode) lets you know the error of the resolving process.

    mBlukiiClient.newsDelegate = self
    
    func resolveNews() {
        mBlukiiClient.resolveServerNews("en-gb")
    }
    
    func onNewsResult(news: String) {
        // news retrieved
    }
    
    func onNewsError(errorCode: BlukiiInfo.BKClient.ErrorCode) {
        // An error has been sent from resolver
    }
    
    See more

    Declaration

    Swift

    open class BKClient: NSObject, BKDeviceDiscoveryServiceDelegate, BKBackendResolverDelegate
  • Read only data set for blukii SmartKey

    See more

    Declaration

    Swift

    open class BKKeyData: NSObject, NSSecureCoding
  • Property set of settings to configure the resolving process of data from blukii Info Manager (https://manager.blukiiinfo.com)

    You can access the BKResolveSettings by calling BKClient.resolveSettings

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

    With the exception of getLanguagePriority() the ResolveSettings properties are only affecting the discovery process that is started by BKClient.initDiscovery()

    For the single resolving process that is started by BKClient.resolveInputElement(input: BKInputElement) only getLanguagePriority() is relevant.

    See more

    Declaration

    Swift

    open class BKResolveSettings: NSObject
  • Data Object that defines the input data for resolving requests to blukii Info Manager (https://manager.blukiiinfo.com).

    It is used in two cases:

    • Delegate BKClientDiscoveryDelegate.onDiscoveryResult(discoveryResultList: [BKOutputElement]):

    BKInputElement is part of every BKOutputElement. It contains input type BKInputSourceTpye.BLUKII and the device name of the discovered BLE module.

    • Function BKClient.resolveInputElement(BKInputElement):

    BKInputElement is used as input property for a single recolving action. It has to be created by initializer BKInputElement(String, BKInputSourceType). If resolving is successful it will be unmodified part of BKOutputElement that is returned by delegate BKClientResolveDelegate.onResolveInputElementResult(outputElement: BKOutputElement)

    See more

    Declaration

    Swift

    open class BKInputElement: NSObject, NSSecureCoding
  • Helper class to validate application and mobile device features

    See more

    Declaration

    Swift

    open class BKFeatureValidator: NSObject
  • Read only data object for resolved output data of the blukii info manager

    BKResolveData can be valid for blukii modules only.

    It contains the result of a data request to the blukii Info Manager (https://manager.blukiiinfo.com). The BKResolveData fields contain the values of on corresponding blukii number.

    BKResolveData is part of BKOutputElement

    It will be set for the following cases:

    • OutputElement ID (see BKOutputElement.id) must be configured as a blukii number on the blukii Info Manager by an Info Manger user. This is an requierement for all BKClient delegates!
    • BKResolveData will be requested during the discovery (see BKClient.initDiscovery()) for all discovered Elelements if the setting BKResolveSettings.resolveEnabled is set true. If some data is responded it will be returned as part of an BKOutputElement by delegate BKClientDiscoveryDelegate.onDiscoveryResult(discoveryResultList: [BKOutputElement]) The result state of resolving can additionally be read by calling BKOuputElement.resolveState:
      • UNRESOLVED: Resolve is off (BKResolveSettings.resolveEnabled is false) or blukii Info Manager is not connectable
      • RESOLVED: blukii Info Manager has responded data for the OutputElement ID
      • NODATA: blukii Info Manager is connectable but has responded no data for the OutputElement ID
      • CACHED: ResolveData contains cached data that has been responded earlier (see cache settings on BKResolveSettings)
    • BKResolveData will be requested for a single Element by calling (see BKClient.resolveInputElement(BKInputElement)). If some data is responded it will be returned as part of an BKOutputElement by delegate BKClientResolveDelegate.onResolveInputElementResult(outputElement: BKOutputElement). The result state of resolving can additionally be read by calling BKOutputElement.resolveState. For single element requests there is no cache available.
      • RESOLVED: blukii Info Manager has responded data for the OutputElement ID
      • NODATA: blukii Info Manager has not responded data for the OutputElement ID
    See more

    Declaration

    Swift

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

    BKOutputElement is returned by delegates of the BKClient functions for discovery and resolve of BLE modules.

    It is an combination of data that is encapsulated in specific data objects:

    • BKInputElement: input data that is created by discovery process (blukii number) or external inputs (NFC tag id, scan of barcodes). A cnversion of the BKInputelement.tagID is saved in id
    • BKDiscoveryData: emitted data of the BLE module
    • BKResolveData: resolved data requested from blukii Info Manager (https://manager.blukiiinfo.com) The state of resolve process is saved by resolveState
    See more

    Declaration

    Swift

    open class BKOutputElement: NSObject, NSSecureCoding