Skip to content

Polar Ble SDK v.4.0.0-beta0

Pre-release
Pre-release
Compare
Choose a tag to compare
@JOikarinen JOikarinen released this 13 Dec 06:22

What's Changed

  • SDK now provides timestamp for each sample streamed from Polar device. Earlier the timestamp were provided only for the last sample in the received data packet, but now all the samples has the timestamp provided. Data types having the timestamps are Accelerometer, ECG, Gyro, Magnetometer and PPG. The details about the time system and timestamps are provided in TimeSystemExplained
  • the new API to read the current time (Android , iOS) in the device has been also added

Android SDK updates

  • API classes has changed from Java to Kotlin. The conversion shall be made in backward compatible manner, so that user of the new SDK don't need to change already existing Java code, except the API changes explained in Migration chapter below. Please report the issue, if your existing Java is code is not working.

Migration from 3.3.6 to 4.0.0

  • each data class, which has the timestamps, has still the deprecated "packet" timestamp. To replace the packet timestamp each sample class now introduces the time stamp property. The old "packet" timestamps continues working still in this release, but please consider change to timestamp found in sample class.

For example the accelerometer data on Android is now:

/**
 * Polar accelerometer data.
 * @property samples from acceleration sensor. Each sample contains signed x,y,z axis value in millig
 */
class PolarAccelerometerData(
    val samples: List<PolarAccelerometerDataSample>,
    @Deprecated("Use the timestamp found in each sample")
    val timeStamp: Long
) {

    /**
     * Polar accelerometer data sample
     *  @property timeStamp moment sample is taken in nanoseconds. The epoch of timestamp is 1.1.2000
     *  @property x axis value in millig (including gravity)
     *  @property y axis value in millig (including gravity)
     *  @property z axis value in millig (including gravity)
     */
    data class PolarAccelerometerDataSample(
        val timeStamp: Long,
        val x: Int,
        val y: Int,
        val z: Int
    )
}

For example the accelerometer data on iOS is now:

/// Polar acc data
///
///     - Deprecated: Timestamp: Last sample timestamp in nanoseconds. The epoch of timestamp is 1.1.2000
///     - samples: Acceleration samples
///         - timeStamp: moment sample is taken in nanoseconds. The epoch of timestamp is 1.1.2000
///         - x axis value in millig (including gravity)
///         - y axis value in millig (including gravity)
///         - z axis value in millig (including gravity)
public typealias PolarAccData = (timeStamp: UInt64, samples: [(timeStamp: UInt64, x: Int32, y: Int32, z: Int32)])