Class BleDeviceSession
-
- All Implemented Interfaces:
public abstract class BleDeviceSessionBluetooth le device class, contains all essential api's for sufficient usage of bluetooth le device
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public enumBleDeviceSession.DeviceSessionStateConnection state
-
Field Summary
Fields Modifier and Type Field Description private BleDeviceSession.DeviceSessionStatesessionStateprivate final BleDeviceSession.DeviceSessionStatepreviousStateprivate BleAdvertisementContentadvertisementContentprivate final BleAdvertisementContentgetAdvertisementContentprivate List<String>connectionUuidsprivate final BooleanisNonConnectableAdvertisementprivate final BooleanisConnectableAdvertisementprivate final Stringaddressprivate final BooleanisAuthenticatedprivate final BluetoothDevicebluetoothDeviceprivate final Stringnameprivate final StringpolarDeviceIdprivate final StringpolarDeviceTypeprivate final LongpolarDeviceIdIntprivate final IntegermedianRssiprivate final Integerrssiprivate final BlePolarHrAdvertisementblePolarHrAdvertisement
-
Method Summary
-
-
Method Detail
-
getSessionState
final BleDeviceSession.DeviceSessionState getSessionState()
Members
-
setSessionState
final Unit setSessionState(BleDeviceSession.DeviceSessionState sessionState)
Members
-
getPreviousState
final BleDeviceSession.DeviceSessionState getPreviousState()
- Returns:
state before current one
-
getAdvertisementContent
final BleAdvertisementContent getAdvertisementContent()
-
setAdvertisementContent
final Unit setAdvertisementContent(BleAdvertisementContent advertisementContent)
-
getGetAdvertisementContent
final BleAdvertisementContent getGetAdvertisementContent()
-
getConnectionUuids
final List<String> getConnectionUuids()
- Returns:
current connection uuid's needed for connection attempt
-
setConnectionUuids
final Unit setConnectionUuids(List<String> connectionUuids)
- Parameters:
connectionUuids- set connection uuid's
-
isNonConnectableAdvertisement
abstract Boolean isNonConnectableAdvertisement()
- Returns:
true if device is in non-connectable advertisement<BR></BR> Notes: Depending on Android API version,it's impossible to know this.<BR></BR> So this would work only for Polar Devices that follows Polar SAGRFC31
-
isConnectableAdvertisement
final Boolean isConnectableAdvertisement()
- Returns:
true if device is connectable advertisement<BR></BR> Notes: Depending on Android API version,it's impossible to know this.<BR></BR> So this would work only for Polar Devices that follows Polar SAGRFC31
-
getAddress
abstract String getAddress()
- Returns:
bluetooth device address in string format
-
isAuthenticated
abstract Boolean isAuthenticated()
- Returns:
true if session is bonded device
-
getBluetoothDevice
abstract BluetoothDevice getBluetoothDevice()
- Returns:
android bluetooth device instance
-
getPolarDeviceId
final String getPolarDeviceId()
- Returns:
polar device id
-
getPolarDeviceType
final String getPolarDeviceType()
- Returns:
polar device type
-
getPolarDeviceIdInt
final Long getPolarDeviceIdInt()
- Returns:
polar device id in int
-
getMedianRssi
final Integer getMedianRssi()
- Returns:
current median rssi value
-
getBlePolarHrAdvertisement
final BlePolarHrAdvertisement getBlePolarHrAdvertisement()
- Returns:
polar hr advertisement content @see BlePolarHrAdvertisement
-
isDeviceAlive
final Boolean isDeviceAlive(Long time, TimeUnit timeUnit)
- Parameters:
time- max time for the last advertisement eventtimeUnit- desired timeunit- Returns:
true, device is still somewhat considered "alive"
-
isAdvertising
final Boolean isAdvertising(Long time, TimeUnit timeUnit)
- Parameters:
time- max time for the last advertisement eventtimeUnit- desired timeunit- Returns:
true if device is advertising in the required timespan
-
authenticate
abstract Unit authenticate()
start pairing and optionally bonding procedure with the device
- Returns:
Either produces complete for already bonded device or starts pairing/bonding procedure or onError on failure case
-
monitorServicesDiscovered
abstract Deferred<List<UUID>> monitorServicesDiscovered(Boolean checkConnection)
Monitor services discovered
- Returns:
Deferred result
-
clearGattCache
abstract Boolean clearGattCache()
- Returns:
true if current gatt cache clear was ok
-
readRssiValue
abstract Deferred<Integer> readRssiValue()
- Returns:
Deferred result for rssi values
-
getIndicatesPairingProblem
abstract Pair<Boolean, Integer> getIndicatesPairingProblem()
Checks if session indicates pairing problem. This is a helper method to check if the session is in a state where pairing problems are likely, for example due to failed authentication attempts or other issues that may arise during the pairing process.
- Returns:
Boolean indicating if the session indicates a pairing problem. True if there are indications of a pairing problem, false otherwise. Int value contains Bluetooth error code if there is a pairing problem, otherwise it is -1 (not set).
-
fetchClient
final BleGattBase fetchClient(UUID uuid)
- Parameters:
uuid- service uuid- Returns:
get a specific client from the list
-
clientsReady
final Unit clientsReady(Boolean checkConnection)
Helper to combine all available/desired clients ready.
- Parameters:
checkConnection- check initial connection
-
-
-
-