Class PolarBleApi

    • Method Detail

      • setMtu

         abstract Unit setMtu(@IntRange(from = 70, to = 512) Integer mtu)

        set mtu to lower than default (232 is the default for polar devices, minimum for H10 is 70 and for OH1 is 140) to minimize latency

        Parameters:
        mtu - value between 70-512 to be set
      • shutDown

         abstract Unit shutDown()

        Releases the SDK resources. When the SDK is used on scope of the android component (e.g. Activity or Service) then the shutDown may be called on component destroy function. After shutDown the new instance of the SDK is needed:

      • cleanup

         abstract Unit cleanup()

        removes all known devices which are not in use currently

      • setPolarFilter

         abstract Unit setPolarFilter(Boolean enable)

        When enabled only Polar devices are found by the searchForDevice, if set to false any BLE devices with HR services are returned by the searchForDevice. The default setting for Polar filter is true.

        Parameters:
        enable - false disables polar filter
      • foregroundEntered

         abstract Unit foregroundEntered()

        Optionally call when application enters to the foreground. By calling foregroundEntered() you make sure BLE scan is restarted. BLE scan start is not working when Android device display is off (related to Android power save). By calling foregroundEntered() helps in some rare situations e.g. if connection is lost to the device and .setAutomaticReconnection is enabled, reconnection is created when application is back in foreground.

      • searchForDevice

         abstract Flowable<PolarDeviceInfo> searchForDevice()

        Starts searching for BLE devices when subscribed. Search continues as long as observable is subscribed or error. Each found device is emitted only once. By default searches only for Polar devices, but can be controlled by .setPolarFilter. If .setPolarFilter is false then searches for any BLE heart rate capable devices

        Returns:

        Flowable stream of PolarDeviceInfo Produces: <BR></BR> - onNext for any new Polar (or BLE) device detected <BR></BR> - onError if scan start fails <BR></BR> - onComplete non produced unless stream is further configured

      • setAutomaticReconnection

         abstract Unit setAutomaticReconnection(Boolean enable)

        When enabled the reconnection is attempted if device connection is lost. By default automatic reconnection is enabled. Note that firmware update (FWU) turns on automatic reconnection automatically, and restores the setting automatically when operation completes. One should not change this setting during FWU.

        Parameters:
        enable - true = automatic reconnection is enabled, false = automatic reconnection is disabled
      • autoConnectToDevice

         abstract Completable autoConnectToDevice(Integer rssiLimit, String service, Integer timeout, TimeUnit unit, String polarDeviceType)

        Start connecting to a nearby Polar device. PolarBleApiCallback.deviceConnected callback is invoked when connection to a nearby device is established.

        Parameters:
        rssiLimit - RSSI (Received Signal Strength Indication) value is typically from -40 to -60 (dBm), depends on the used Bluetooth chipset and/or antenna tuning
        service - in hex string format like "180D" PolarInvalidArgument invoked if not in correct format
        timeout - min time to search nearby device default = 2s
        unit - time unit to be used
        polarDeviceType - like H10, OH1 etc...
        Returns:

        rx Completable, complete invoked when nearby device found, and connection attempt started. deviceConnecting callback invoked to inform connection attempt

      • connectToDevice

         abstract Unit connectToDevice(String identifier)

        Request a connection to a BLE device. Invokes PolarBleApiCallback.deviceConnected callback.

        Parameters:
        identifier - Polar device id found printed on the sensor/device (in format "12345678") or bt address (in format "00:11:22:33:44:55")
      • startListenForPolarHrBroadcasts

         abstract Flowable<PolarHrBroadcastData> startListenForPolarHrBroadcasts(Set<String> deviceIds)

        Start listening the heart rate from Polar devices when subscribed. This observable listens BLE broadcast and parses heart rate from BLE broadcast. The BLE device don't need to be connected when using this function, the heart rate is parsed from the BLE advertisement

        Parameters:
        deviceIds - set of Polar device ids to filter or null for a any Polar device
        Returns:

        Flowable stream of PolarHrBroadcastData Produces: <BR></BR> - onNext when new advertisement is detected based on deviceId list as filter <BR></BR> - onError if scan start fails <BR></BR> - onComplete non produced unless stream is further configured

      • getFile

         abstract Single<ByteArray> getFile(String identifier, String path)

        Get file as ByteArray from device.

        Parameters:
        identifier - polar device id or bt address
        path - filesystem file path
        Returns:

        Single observable which emits file bytes or error

      • setLedConfig

         abstract Completable setLedConfig(String identifier, LedConfig ledConfig)

        Set LedConfig for device (Verity Sense 2.2.1+).

        Parameters:
        identifier - Polar device ID or BT address
        ledConfig - new LedConfig
        • @return Completable emitting success or error

      • doFactoryReset

         abstract Completable doFactoryReset(String identifier, Boolean preservePairingInformation)

        Perform factory reset to given device.

        Parameters:
        identifier - Polar device ID or BT address
        preservePairingInformation - preserve pairing information during factory reset
        Returns:

        Completable emitting success or error

      • doRestart

         abstract Completable doRestart(String identifier)

        Perform restart device.

        Parameters:
        identifier - Polar device ID or BT address
        Returns:

        Completable emitting success or error

      • setLogConfig

         abstract Completable setLogConfig(String identifier, LogConfig logConfig)

        Set LogConfig for device.

        Parameters:
        identifier - Polar device ID or BT address
        logConfig - new LogConfig
        • @return Completable emitting success or error

      • setWareHouseSleep

         abstract Completable setWareHouseSleep(String identifier)

        Set warehouse sleep setting to a given device. Warehouse sleep does factory reset to the device and makes it sleep.

        Parameters:
        identifier - Polar device ID or BT address
        Returns:

        Completable emitting success or error

      • turnDeviceOff

         abstract Completable turnDeviceOff(String identifier)

        Turn of device by setting the device to sleep state.

        Parameters:
        identifier - Polar device ID or BT address
        Returns:

        Completable emitting success or error

      • doFirstTimeUse

         abstract Completable doFirstTimeUse(String identifier, PolarFirstTimeUseConfig ftuConfig)

        Configure the Polar device with first-time use settings and user identifier.

        Parameters:
        identifier - Polar device ID or Bluetooth address.
        ftuConfig - Configuration data for the first-time use, encapsulated in PolarFirstTimeUseConfig.
        Returns:

        Completable emitting success or error.

        PolarFirstTimeUseConfig class requires valid values for each parameter within specific ranges:

        • Gender: "Male" or "Female"

        • Height: 90 to 240 cm

        • Weight: 15 to 300 kg

        • Max heart rate: 100 to 240 bpm

        • Resting heart rate: 20 to 120 bpm

        • VO2 max: 10 to 95

        • Training background: One of the predefined levels (10, 20, 30, 40, 50, 60)

        • Sleep goal: In minutes between 300 to 660

        • Typical day: "MOSTLY_SITTING", "MOSTLY_STANDING", or "MOSTLY_MOVING"

      • isFtuDone

         abstract Single<Boolean> isFtuDone(String identifier)

        Check if the First Time Use has been done for the given device.

        Parameters:
        identifier - Polar device ID or Bluetooth address.
        Returns:

        Single emitting success with "true" or "false" response, or error.

      • deleteDeviceDateFolders

         abstract Completable deleteDeviceDateFolders(String identifier, LocalDate fromDate, LocalDate toDate)

        Delete device date folders from a device.

        Parameters:
        identifier - , Polar device ID or BT address
        fromDate - The starting date to delete date folders from
        toDate - The ending date of last date to delete folders from
        Returns:

        Completable emitting success or error