DonkeyLockKit

object DonkeyLockKit : Sdk, DonkeyLockKitLibrary

Main entry for interacting with BLE-enabled Donkey vehicles

Functions

Link copied to clipboard
open override fun finalizeLock(deviceName: String, onResult: (Result<FinalizeLockSuccess>) -> Unit)

Finalizing lock should be done after prepareEndRental to clear all the outstanding cache and disconnecting of the bluetooth lock. Note that once the lock is finalized, it is not possible to do any more of lock actions.

Link copied to clipboard
open override fun initializeLock(deviceName: String, key: String, passkey: String, onResult: (Result<InitLockSuccess>) -> Unit)

Initializing of lock has to be done before any unlock, lock, prepareEndRental or finalizeLock This function needs to be called only once per rental. In case, initializeLock is called again later after some unlocking and locking, the lock might not be able to open due to the eKey getting reset.

Link copied to clipboard
open override fun initializeSdk(context: Context, sdkToken: String, onResult: (Result<InitSdkSuccess>) -> Unit)

In order to interact with Donkey bike locks, SDK must be initialized with the sdkToken provided by Donkey Republic.

Link copied to clipboard
open override fun lock(deviceName: String, onUpdate: (ConnectionUpdate) -> Unit, onResult: (Result<LockingSuccess>) -> Unit)

For locking a Donkey bike, use this function

Link copied to clipboard
open override fun prepareEndRental(deviceName: String, onUpdate: (ConnectionUpdate) -> Unit, onResult: (Result<PrepareEndRentalSuccess>) -> Unit)

For preparing Donkey bike for end rental, use this function. prepareEndRental invokes checking of the lock state including the bike.donkey.lockkit.updates.ConnectionUpdate.ExtraLockCheck - necessary operation before ending rental to make sure the vehicle is safe from any misuse. In the case of lock being unlocked, this function will try to lock it as well. Note however that this does not end the rental. Remember to call the required endpoint on TOMP.

Link copied to clipboard
open override fun unlock(deviceName: String, onUpdate: (ConnectionUpdate) -> Unit, onResult: (Result<UnlockingSuccess>) -> Unit)

For unlocking a Donkey bike, use this function

Properties

Link copied to clipboard
val config: DonkeyConfig

To change bike.donkey.lockkit.DonkeyConfig.ServerEnvironment or bike.donkey.lockkit.DonkeyConfig.LogLevel Updating of the config values can be done only before calling initializeSdk