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

      • searchForDevice

         abstract Flowable<PolarDeviceInfo> searchForDevice(String withRequiredDeviceNamePrefix)

        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")
      • getLocalTime

        @Deprecated(message = "Use getLocalTimeWithZone() instead to also get timezone", replaceWith = @ReplaceWith(imports = {}, expression = "getLocalTimeWithZone(identifier)")) abstract Single<LocalDateTime> getLocalTime(String identifier)

        Get current time in device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_TIME_SETUP. Note, the H10 is not supporting time read.

        Parameters:
        identifier - polar device id or bt address
        Returns:

        Single observable which emits device time in LocalDateTime instance when observable is subscribed

      • 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

      • doFactoryReset

        @Deprecated(message = "Use method doFactoryReset(identifier: String) instead.") abstract Completable doFactoryReset(String identifier, Boolean preservePairingInformation)

        Perform factory reset to given device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL

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

        Completable emitting success or error

      • setWareHouseSleep

         abstract Completable setWareHouseSleep(String identifier)

        Set warehouse sleep setting to a given device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL 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

      • doFirstTimeUse

         abstract Completable doFirstTimeUse(String identifier, PolarFirstTimeUseConfig ftuConfig)

        Configure the Polar device with first-time use settings and user identifier. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL

        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"

      • setAutomaticTrainingDetectionSettings

         abstract Completable setAutomaticTrainingDetectionSettings(String identifier, Boolean automaticTrainingDetectionMode, Integer automaticTrainingDetectionSensitivity, Integer minimumTrainingDurationSeconds)

        Set the automatic training detection settings on the device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL

        Parameters:
        identifier - Polar device ID or BT address.
        automaticTrainingDetectionMode - Whether the automatic training detection should be enabled or disabled.
        automaticTrainingDetectionSensitivity - The sensitivity for automatic training detection.
        minimumTrainingDurationSeconds - The minimum duration in seconds required for automatic training detection.
        Returns:

        Completable emitting success or error.

      • setDaylightSavingTime

         abstract Completable setDaylightSavingTime(String identifier)

        Set the next Daylight Saving Time (DST) settings on the device in the current timezone. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL Gets the current timezone from the device and sets DST value based on that.

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

        Completable emitting success or error.

      • deleteDeviceDateFolders

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

        Deletes device day (YYYMMDD) folders from the given date range from a device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL The date range is inclusive. Deletes the day folder (plus all sub-folders with any contents). If date directories are not found for the given date range the operation is still successful and no error is emitted.

        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

      • waitForConnection

         abstract Completable waitForConnection(String identifier)

        Waits for a connection to the specified device. Emits success when the connection is established or an error if the connection fails.

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

        Completable emitting success when connected or error if the connection fails

      • sendInitializationAndStartSyncNotifications

         abstract Single<Boolean> sendInitializationAndStartSyncNotifications(String identifier)

        Notify device of the incoming data transfer operation(s). By using this method the device will handle data transfer operations more efficiently by setting it to faster data transfer mode. It also will cause the device to flush the latest data to files giving you the most up-to-date data. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL handle data transfer operations more efficiently by setting it to faster data transfer mode. It also will cause the device to flush the latest data to files giving you the most up-to-date data.

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

        Single, true if start sync notifications sending was successful, false otherwise.

      • sendTerminateAndStopSyncNotifications

         abstract Completable sendTerminateAndStopSyncNotifications(String identifier)

        Notify device that data transfer operations are completed. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL By calling this API device will set itself back to normal data transfer mode that will use less battery.

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

        Completable, true if stop sync notifications sending was successful, false otherwise.

      • setAutomaticOHRMeasurementEnabled

         abstract Completable setAutomaticOHRMeasurementEnabled(String identifier, Boolean enabled)

        Enable or disable AUTOS file generation on the device. Requires feature PolarBleSdkFeature.FEATURE_POLAR_DEVICE_CONTROL AUTOS files contain 24/7 OHR data. Status of this setting can be read with getUserDeviceSettings().

        Parameters:
        identifier - Polar device ID or BT address
        enabled - true = AUTOS files enabled, false = disabled
        Returns:

        Completable (success or error)

      • getBatteryLevel

         abstract Integer getBatteryLevel(String identifier)

        Request last observed battery level value from device. Requires feature PolarBleSdkFeature.FEATURE_BATTERY_INFO

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

        Level of battery level percentage 0 - 100%. Will return -1 if battery level is not available.

      • getChargerState

         abstract <Error class: unknown class> getChargerState(String identifier)

        Request last observed charging status value from device. Requires feature PolarBleSdkFeature.FEATURE_BATTERY_INFO

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

        ChargeState value indicating the last observed charging status of the device.