Class PolarBleApiCallback
-
- All Implemented Interfaces:
-
com.polar.sdk.api.PolarBleApiCallbackProvider
public abstract class PolarBleApiCallback implements PolarBleApiCallbackProvider
Contains the callbacks of the API.
-
-
Constructor Summary
Constructors Constructor Description PolarBleApiCallback()
-
Method Summary
Modifier and Type Method Description UnitblePowerStateChanged(Boolean powered)Bluetooth power state of the device where this SDK is running UnitdeviceConnected(PolarDeviceInfo polarDeviceInfo)Device is now connected UnitdeviceConnecting(PolarDeviceInfo polarDeviceInfo)Connecting to device UnitdeviceDisconnected(PolarDeviceInfo polarDeviceInfo)Device is now disconnected. UnitdeviceDisconnected(PolarDeviceInfo polarDeviceInfo, PolarBleDisconnectInfo info)Device is disconnected with a reason and recovery recommendation. UnitbleSdkFeatureReady(String identifier, PolarBleApi.PolarBleSdkFeature feature)Called when the feature in connected device is available and it is ready. UnitdisInformationReceived(String identifier, UUID uuid, String value)DIS information received. UnitbatteryLevelReceived(String identifier, Integer level)Battery level received. Unit)>batteryChargingStatusReceived(String identifier, <Error class: unknown class> chargingStatus)Battery charging status received. Unit)>powerSourcesStateReceived(String identifier, <Error class: unknown class> powerSourcesState)Battery power sources state received. UnithrNotificationReceived(String identifier, PolarHrData.PolarHrSample data)HR notification data received from device. UnitbleSdkFeaturesReadiness(String identifier, List<PolarBleApi.PolarBleSdkFeature> ready, List<PolarBleApi.PolarBleSdkFeature> unavailable)Called once all requested features have been evaluated after a device connection. -
-
Method Detail
-
blePowerStateChanged
Unit blePowerStateChanged(Boolean powered)
Bluetooth power state of the device where this SDK is running
- Parameters:
powered- true = Bluetooth power on, false = Bluetooth power off
-
deviceConnected
Unit deviceConnected(PolarDeviceInfo polarDeviceInfo)
Device is now connected
- Parameters:
polarDeviceInfo- Polar device information
-
deviceConnecting
Unit deviceConnecting(PolarDeviceInfo polarDeviceInfo)
Connecting to device
- Parameters:
polarDeviceInfo- Polar device information
-
deviceDisconnected
@Deprecated(message = "Use deviceDisconnected(polarDeviceInfo, info) for typed disconnect diagnostics") Unit deviceDisconnected(PolarDeviceInfo polarDeviceInfo)
Device is now disconnected.
- Parameters:
polarDeviceInfo- Polar device information
-
deviceDisconnected
Unit deviceDisconnected(PolarDeviceInfo polarDeviceInfo, PolarBleDisconnectInfo info)
Device is disconnected with a reason and recovery recommendation.
For PolarBleRecoveryAction.RETRY_OPERATION, wait for the next deviceConnected callback before retrying the failed idempotent SDK operation. The SDK does not replay arbitrary application operations; do not blindly repeat a non-idempotent write.
For PolarBleRecoveryAction.RETRY_CONNECTION, keep the device nearby and powered on while the SDK reconnects and rebuilds the GATT session. Retry the interrupted operation only after deviceConnected. A timeout alone does not prove that pairing information was removed.
For PolarBleRecoveryAction.REMOVE_PAIRING_AND_PAIR_AGAIN, stop automatic retries, remove/forget the pairing in Android Bluetooth settings and from the device when required, put the device into pairing mode, and connect again.
For PolarBleRecoveryAction.RETRY_PAIRING, Android started or retried security negotiation but the peripheral did not complete it. Put the device into its explicit pairing mode, keep it disconnected from other phones, and connect again. This does not prove that an existing Android bond was removed.
For PolarBleRecoveryAction.NONE, use normal disconnected-device handling. An explicit PolarBleApi.disconnectFromDevice call is intentional and is reported with PolarBleDisconnectReason.CONNECTION_LOST and PolarBleRecoveryAction.NONE; applications should not present pairing recovery instructions for that case.
- Parameters:
polarDeviceInfo- Polar device informationinfo- typed disconnect reason and recovery recommendation
-
bleSdkFeatureReady
Unit bleSdkFeatureReady(String identifier, PolarBleApi.PolarBleSdkFeature feature)
Called when the feature in connected device is available and it is ready. Called only for the features which are specified by PolarBleApi instantiation.
- Parameters:
identifier- Polar device idfeature- feature is ready
-
disInformationReceived
Unit disInformationReceived(String identifier, UUID uuid, String value)
DIS information received. Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_DEVICE_INFO
- Parameters:
identifier- Polar device id or bt addressuuid- uuid of dis valuevalue- dis value for uuid
-
batteryLevelReceived
Unit batteryLevelReceived(String identifier, Integer level)
Battery level received. Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_BATTERY_INFO
- Parameters:
identifier- Polar device id or bt addresslevel- battery level (value between 0-100%)
-
batteryChargingStatusReceived
Unit )>batteryChargingStatusReceived(String identifier, <Error class: unknown class> chargingStatus)
Battery charging status received. Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_BATTERY_INFO
- Parameters:
identifier- Polar device id or bt addresschargingStatus- Charging status ChargeState
-
powerSourcesStateReceived
Unit )>powerSourcesStateReceived(String identifier, <Error class: unknown class> powerSourcesState)
Battery power sources state received. Requires feature PolarBleApi.PolarBleSdkFeature.FEATURE_BATTERY_INFO
- Parameters:
identifier- Polar device id or bt addresspowerSourcesState- PowerSourcesState
-
hrNotificationReceived
Unit hrNotificationReceived(String identifier, PolarHrData.PolarHrSample data)
HR notification data received from device. Notice when using OH1 and PPI measurement is started hr received from this callback is 0.
- Parameters:
identifier- Polar device id or bt addressdata- @see polar.com.sdk.api.model.PolarHrData.
-
bleSdkFeaturesReadiness
Unit bleSdkFeaturesReadiness(String identifier, List<PolarBleApi.PolarBleSdkFeature> ready, List<PolarBleApi.PolarBleSdkFeature> unavailable)
Called once all requested features have been evaluated after a device connection.
The ready list contains features confirmed ready for use. The unavailable list contains features not supported by this device.
- Parameters:
identifier- Polar device idready- features confirmed ready for use on this deviceunavailable- features not supported by this device
-
-
-
-