Class DiscoverySettings

java.lang.Object
com.blukii.sdk.discovery.DiscoverySettings
All Implemented Interfaces:
android.os.Parcelable

public final class DiscoverySettings extends Object implements android.os.Parcelable
Property set of settings to configure the discovering process.

The DiscoverySettings properties are affecting the discovery process that is started by BlukiiClient.startDiscovery() and the DiscoveryData contents of the result callbacks.

You can access the DiscoverySettings by calling BlukiiClient.getDiscoverySettings().

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

See Also:
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static class 
    Helper for Default Filter Lists

    Nested classes/interfaces inherited from interface android.os.Parcelable

    android.os.Parcelable.ClassLoaderCreator<T extends Object>, android.os.Parcelable.Creator<T extends Object>
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final android.os.Parcelable.Creator<DiscoverySettings>
     
    static final int
    Default value for rssi threshold: -85.
    static final int
    Maximum value for rssi threshold: -20.
    static final int
    Minimum value for rssi threshold: -120.
    static final int
    Scan duration of one discovery phase: 5000 milliseconds.
    static final int
    Scan mode with balanced power consumption and scan frequency: ScanSettings.SCAN_MODE_BALANCED.
    static final int
    Scan mode with high power consumption and scan frequency: ScanSettings.SCAN_MODE_LOW_LATENCY.
    static final int
    Scan mode with low power consumption and scan frequency: ScanSettings.SCAN_MODE_LOW_POWER.
    static final int
    Scan wait duration wait duration between two discovery phases.

    Fields inherited from interface android.os.Parcelable

    CONTENTS_FILE_DESCRIPTOR, PARCELABLE_WRITE_RETURN_VALUE
  • Method Summary

    Modifier and Type
    Method
    Description
    int
     
    int
    Gets the discovery profile.
    int
    Gets the rssi threshold for the discovery.
    int
    Gets the duration of one discovery phase.
    int
    Gets the scan mode concerning power consumption and scan frequency.
    int
    Gets the wait duration between two discovery phases.
    boolean
    Gets the state if discovery should calculate the average RSSI of all scanned frames.
    boolean
    Gets the state if discovery should list every frame in the result list.
    boolean
    Gets the state if blukii monitoring is enabled.
    boolean
    Gets the state if discovery should be continued after reboot of Android.
    boolean
    Gets the state if discovery should scan for sensor data of blukii beacons.
    boolean
    Gets the state if discovery should scan for basic blukii data like firmware, advertising interval etc.
    boolean
    Gets the state if discovery should scan for device tracing packets.
    boolean
    Gets the state if discovery should scan for Eddystone data.
    boolean
    Gets the state if discovery should scan for iBeacon data.
    boolean
    Gets the state if discovery should scan for non blukii BLE modules.
    void
    setCalculatingRssiAverage(boolean calculatingRssiAverage)
    Sets the state if discovery should calculate the average RSSI of all scanned frames.
    void
    setListEveryFrame(boolean listEveryFrame)
    Sets the state if discovery should list every frame in the result list or not.
    void
    setMonitoringEnabled(boolean enabled)
    Gets the state if blukii monitoring is enabled.
    void
    setPersisted(boolean persisted)
    Gets the state if discovery should be continued after reboot of Android.
    void
    setProfile(int profile)
    Sets the discovery profile.
    void
    setRssiThreshold(int rssiThreshold)
    Sets the rssi threshold for the discovery.
    void
    setScanBeaconSensorData(boolean scanBeaconSensorData)
    Sets the state if discovery should scan for sensor data of blukii beacons.
    void
    setScanBlukiiData(boolean scanBlukiiData)
    Sets the state if discovery should scan for sensor data of blukii beacons.
    void
    setScanDeviceTracingData(boolean scanDeviceTracingData)
    Sets the state if discovery should scan for device tracing packets.
    void
    setScanDuration(int scanDuration)
    Gets the duration of one discovery phase.
    void
    setScanEddystoneData(boolean scanEddystoneData)
    Sets the state if discovery should scan for Eddystone data.
    void
    setScanFilters(List<android.bluetooth.le.ScanFilter> filters)
    Sets a list of Bluetooth LE ScanFilters
    void
    setScanIBeaconData(boolean scanIBeaconData)
    Sets the state if discovery should scan for iBeacon data.
    void
    setScanMode(int scanMode)
    Sets the scan mode concerning power consumption and scan frequency.
    void
    setScanNonBlukiis(boolean scanNonBlukiis)
    Sets the state if discovery should also scan for non blukii BLE modules.
    void
    setScanWaitDuration(int scanWaitTime)
    Sets the wait duration between two discovery phases.
    void
    writeToParcel(android.os.Parcel parcel, int i)
     

    Methods inherited from class java.lang.Object

    equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Method Details

    • getRssiThreshold

      public int getRssiThreshold()
      Gets the rssi threshold for the discovery.

      BLE modules with a higher rssi value will be discovered only.

      Returns:
      rssi threshold value, default is RSSI_DEFAULT
      See Also:
    • setRssiThreshold

      public void setRssiThreshold(int rssiThreshold)
      Sets the rssi threshold for the discovery.

      BLE modules with a higher rssi value will be discovered only.

      The valid range for the rssi threshold is limited by RSSI_MIN and RSSI_MAX.

      Parameters:
      rssiThreshold - rssi threshold value, default is RSSI_DEFAULT
      See Also:
    • getScanMode

      public int getScanMode()
      Gets the scan mode concerning power consumption and scan frequency.

      The values are integer values derived from the ScanSettings class of the android.bluetooth.le library:

      Returns:
      scan mode, default is SCANMODE_BALANCED
      See Also:
    • setScanMode

      public void setScanMode(int scanMode)
      Sets the scan mode concerning power consumption and scan frequency.

      The values are integer values derived from the ScanSettings class of the android.bluetooth.le library:

      Parameters:
      scanMode - scan mode, default is SCANMODE_BALANCED
      See Also:
    • getScanDuration

      public int getScanDuration()
      Gets the duration of one discovery phase.

      After the scan duration has finished all scanned BLE data is saved into a List of DiscoveryData and returned by callback BlukiiClient.OnDiscoveryListener.onDiscoveryResult(List).

      See also getScanWaitDuration() to optimize the discovery concerning power consumption.

      Returns:
      scan duration in milliseconds, default is SCANDURATION_DEFAULT.
      See Also:
    • setScanDuration

      public void setScanDuration(int scanDuration)
      Gets the duration of one discovery phase.

      After the scan duration has finished all scanned BLE data is saved into a List of DiscoveryData and returned by callback BlukiiClient.OnDiscoveryListener.onDiscoveryResult(List).

      See also getScanWaitDuration() to optimize the discovery concerning power consumption.

      Parameters:
      scanDuration - scan duration in milliseconds, default is SCANDURATION_DEFAULT.
      See Also:
    • getScanWaitDuration

      public int getScanWaitDuration()
      Gets the wait duration between two discovery phases.

      You can use this feature to minimize power consumption if you do not need an continuous scan.

      This setting only takes affect for DiscoveryProfile.ALTERNATE. Therefore see setProfile(int).

      Returns:
      scan wait duration in milliseconds, default is SCANWAITDURATION_DEFAULT.
      See Also:
    • setScanWaitDuration

      public void setScanWaitDuration(int scanWaitTime)
      Sets the wait duration between two discovery phases.

      You can use this feature to minimize power consumption if you do not need an continuous scan.

      This setting only takes affect for DiscoveryProfile.ALTERNATE. Therefore see setProfile(int).

      Parameters:
      scanWaitTime - scan wait duration in milliseconds, default is SCANWAITDURATION_DEFAULT.
      See Also:
    • getProfile

      public int getProfile()
      Gets the discovery profile.

      It defines whether BLE scan is running depending on the apps state (foreground, background, screen off).

      Please see class DiscoveryProfile for more information.

      Returns:
      discovery profile, default is DiscoveryProfile.FOREGROUND
      See Also:
    • setProfile

      public void setProfile(int profile)
      Sets the discovery profile.

      It defines whether BLE scan is running depending on the apps state (foreground, background, screen off).

      Please see class DiscoveryProfile for more information.

      Parameters:
      profile - discovery profile, default is DiscoveryProfile.FOREGROUND
      See Also:
    • isPersisted

      public boolean isPersisted()
      Gets the state if discovery should be continued after reboot of Android.

      Note: Activating this setting needs the RECEIVE_BOOT_COMPLETED permission in your app's manifest

      Returns:
      state if if discovery should be continued after reboot, default is false
    • setPersisted

      @RequiresPermission("android.permission.RECEIVE_BOOT_COMPLETED") public void setPersisted(boolean persisted)
      Gets the state if discovery should be continued after reboot of Android.

      Note: Activating this setting needs the RECEIVE_BOOT_COMPLETED permission in your app's manifest

      Parameters:
      persisted - state if if discovery should be continued after reboot, default is false
    • isScanNonBlukiis

      public boolean isScanNonBlukiis()
      Gets the state if discovery should scan for non blukii BLE modules.

      Note: the majority of DiscoveryData data is only supported for blukii modules: BeaconSensorData, InfoData and some value of DiscoveryData. EddystoneData and IBeaconData is also supported for non blukii modules.

      Returns:
      state if non blukii BLE modules are scanned, default is false
      See Also:
    • setScanNonBlukiis

      public void setScanNonBlukiis(boolean scanNonBlukiis)
      Sets the state if discovery should also scan for non blukii BLE modules.

      Note: the majority of DiscoveryData data is only supported for blukii modules: BeaconSensorData, InfoData and some value of DiscoveryData. EddystoneData and IBeaconData is also supported for non blukii modules.

      Parameters:
      scanNonBlukiis - state if non blukii BLE modules are scanned, default is false
    • isScanBlukiiData

      public boolean isScanBlukiiData()
      Gets the state if discovery should scan for basic blukii data like firmware, advertising interval etc.
      Returns:
      state if basic blukii data is scanned, default is true
      See Also:
    • setScanBlukiiData

      public void setScanBlukiiData(boolean scanBlukiiData)
      Sets the state if discovery should scan for sensor data of blukii beacons.

      If this flag is set DiscoveryData may contain a valid BeaconSensorData object.

      Note: This flag is only relevant for blukii beacons

      Parameters:
      scanBlukiiData - state if basic blukii data is scanned, default is true
      See Also:
    • isScanBeaconSensorData

      public boolean isScanBeaconSensorData()
      Gets the state if discovery should scan for sensor data of blukii beacons.

      If this flag is set DiscoveryData may contain a valid BeaconSensorData object.

      Note: This flag is only relevant for blukii beacons

      Returns:
      state if blukii beacon sensor data is scanned, default is false
      See Also:
    • setScanBeaconSensorData

      public void setScanBeaconSensorData(boolean scanBeaconSensorData)
      Sets the state if discovery should scan for sensor data of blukii beacons.

      If this flag is set DiscoveryData may contain a valid BeaconSensorData object.

      Note: This flag is only relevant for blukii beacons

      Parameters:
      scanBeaconSensorData - state if blukii beacon sensor data is scanned, default is false
      See Also:
    • isScanEddystoneData

      public boolean isScanEddystoneData()
      Gets the state if discovery should scan for Eddystone data.

      If this flag is set DiscoveryData may contain a valid EddystoneData object.

      Returns:
      state if Eddystone data is scanned, default is false
      See Also:
    • setScanEddystoneData

      public void setScanEddystoneData(boolean scanEddystoneData)
      Sets the state if discovery should scan for Eddystone data.

      If this flag is set DiscoveryData may contain a valid EddystoneData object.

      Parameters:
      scanEddystoneData - state if Eddystone data is scanned, default is false
      See Also:
    • isScanIBeaconData

      public boolean isScanIBeaconData()
      Gets the state if discovery should scan for iBeacon data.

      If this flag is set DiscoveryData may contain a valid IBeaconData object.

      Returns:
      state if iBeacon data is scanned, default is false
      See Also:
    • setScanIBeaconData

      public void setScanIBeaconData(boolean scanIBeaconData)
      Sets the state if discovery should scan for iBeacon data.

      If this flag is set DiscoveryData may contain a valid IBeaconData object.

      Parameters:
      scanIBeaconData - state if iBeacon data is scanned, default is false
      See Also:
    • isScanDeviceTracingData

      public boolean isScanDeviceTracingData()
      Gets the state if discovery should scan for device tracing packets.

      If this flag is set DiscoveryData may contain a valid DeviceTracing object.

      Returns:
      state if DeviceTracing data is scanned, default is false
      See Also:
    • setScanDeviceTracingData

      public void setScanDeviceTracingData(boolean scanDeviceTracingData)
      Sets the state if discovery should scan for device tracing packets.

      If this flag is set DiscoveryData may contain a valid TracedDevice object.

      Parameters:
      scanDeviceTracingData - state if DeviceTracing data is scanned, default is false
      See Also:
    • isCalculatingRssiAverage

      public boolean isCalculatingRssiAverage()
      Gets the state if discovery should calculate the average RSSI of all scanned frames.

      Otherwise the last found RSSI value is returned on DiscoveryData.getRssi()

      Returns:
      true if RSSI average is calculated
      See Also:
    • setCalculatingRssiAverage

      public void setCalculatingRssiAverage(boolean calculatingRssiAverage)
      Sets the state if discovery should calculate the average RSSI of all scanned frames.

      Otherwise the last found RSSI value is returned on DiscoveryData.getRssi()

      Parameters:
      calculatingRssiAverage - state if RSSI average is calculated, default is false
      See Also:
    • isEveryFrameListed

      public boolean isEveryFrameListed()
      Gets the state if discovery should list every frame in the result list.
      Returns:
      true if every frame is listed
    • setListEveryFrame

      public void setListEveryFrame(boolean listEveryFrame)
      Sets the state if discovery should list every frame in the result list or not.

      Values:

      • true every received frame is listed as separate DiscoveryData data object.
      • false all received frames of one scan duration are summarized (default), so there is only one DiscoveryData data object of each device.
      Parameters:
      listEveryFrame - true if every frame should be listed, otherwise false
    • isMonitoringEnabled

      public boolean isMonitoringEnabled()
      Gets the state if blukii monitoring is enabled. If enabled, data like Battery State of the blukii device is transferred to blukii Cloud.
      Returns:
      true if Monitoring enabled
    • setMonitoringEnabled

      @RequiresApi(api=23) public void setMonitoringEnabled(boolean enabled)
      Gets the state if blukii monitoring is enabled. If enabled, data like Battery State of the blukii device is transferred to blukii Cloud.
      Parameters:
      enabled - true if blukii devices should be monitored, otherwise false
    • setScanFilters

      @RequiresApi(21) public void setScanFilters(List<android.bluetooth.le.ScanFilter> filters)

      Sets a list of Bluetooth LE ScanFilters

      You can use a default filter list from DiscoverySettings.ScanFilters

      Parameters:
      filters - List of Bluetooth LE ScanFilters
    • describeContents

      public int describeContents()
      Specified by:
      describeContents in interface android.os.Parcelable
    • writeToParcel

      public void writeToParcel(android.os.Parcel parcel, int i)
      Specified by:
      writeToParcel in interface android.os.Parcelable