Skip to content

//MLBluetoothSDK/com.masterlock.mlbluetoothsdk/MLProduct

MLProduct

[androidJvm]\ open class MLProduct : MLProductBase, LockStateInterface

Object for interacting with a single physical Master Lock BLE Connected Product. Connect to a lock by returning an instance of MLProduct to productForDevice Send commands to a lock by calling MLProduct instance methods, e.g. unlock Receive updates from a lock by observing IMLProductDelegate methods, e.g. onLockStateChange

Constructors

MLProduct [androidJvm]
constructor(deviceId: String, accessProfile: String, expectedFirmwareVersion: Int, delegate: IMLProductDelegate)
Creates an instance of MLProduct, suitable for most use cases
constructor(deviceId: String, accessProfile: String, expectedFirmwareVersion: Int, region: String, delegate: IMLProductDelegate, autoDisconnect: Boolean, timeManagementStrategy: TimeManagementStrategy)
Creates an instance of an MLProduct with specified autodisconnect behavior
constructor(deviceId: String, delegate: IMLProductDelegate)
Creates an instance of an MLProduct that is useful for monitoring getVisibility This MLProduct will NOT be connectable until it is upgraded by calling setAccessProfile Only use this constructor if you do not yet have an Access Profile or Expected Firmware Version for this device ID
constructor(deviceId: String, accessProfile: String, expectedFirmwareVersion: Int)
Create an instance of an MLProduct with the default region
constructor(deviceId: String, accessProfile: String, expectedFirmwareVersion: Int, region: String, delegate: IMLProductDelegate)
Create an instance of an MLProduct with a specific region - do not use if you were not provided specific region(s) for your SDK License

Types

Name Summary
MLProductBuilder [androidJvm]
open class MLProductBuilder
Helper class for Building an MLProduct

Properties

Name Summary
auditTrailIndex [androidJvm]
open var auditTrailIndex: Integer
An optional fallback value for starting point for reading audit trail when the app is offline
autoDisconnect [androidJvm]
open var autoDisconnect: Boolean
Determines behavior of an MLProduct session when public and private command queues are empty: If true, an MLProduct’s session will disconnect as soon as the command queues are empty; If false - The MLBluetoothSDK will continue to call the keepAlive callback for value of keepAliveIntervalSeconds
connectionPriority [androidJvm]
open var connectionPriority: Int
Since most connections are short-lived, the Master Lock SDK will request high connection priority for faster transfers between the lock and the device.
delegate [androidJvm]
open var delegate: IMLProductDelegate
deviceId [androidJvm]
val deviceId: String
The ID advertised by a lock
expectedFirmwareVersion [androidJvm]
@Nullable
open var expectedFirmwareVersion: Integer
Used by the SDK to maintain data integrity in case of firmware updates
inBootLoaderMode [androidJvm]
open var inBootLoaderMode: Boolean
Indicates the Lock is in bootloader mode (should not be set externally)
isConnected [androidJvm]
open var isConnected: Boolean
if true, MLProduct has an active Bluetooth session with a Lock (should not be set externally)
keepAliveCallback [androidJvm]
open var keepAliveCallback: MLCommandCallback<String>
Command block that will be executed if autoDisconnect is false and the commands queues are empty Because lock commands are executed in response to bluetooth gatt callbacks, commands executed in the callback may occur on a background thread
keepAliveIntervalSeconds [androidJvm]
open var keepAliveIntervalSeconds: Int
Minimum length of connections if autoDisconnect is false
lockState [androidJvm]
open var lockState: LockStateManager
region [androidJvm]
open var region: MLRegion
The region identifies the instance of the service where the lock’s data is stored: NorthAmerica or EuropeanUnion
timeManagementStrategy [androidJvm]
open var timeManagementStrategy: TimeManagementStrategy
Supplemental business rules for updating time on a lock in addition to WriteTime permissions defined in the device access profile

Functions

Name Summary
cancelLockReset [androidJvm]
open fun cancelLockReset(callback: MLCommandCallback<String>)
Attempt to cancel a queued Lock Reset, if present Returns a result of "Canceled" if a request is canceled
clearAllSecondaryPasscodes [androidJvm]
open fun clearAllSecondaryPasscodes(callback: MLCommandCallback<String>)
Clear all the secondary passcodes
clearSecondaryPasscode [androidJvm]
open fun clearSecondaryPasscode(index: Short, callback: MLCommandCallback<String>)
Clear the specified Secondary Passcode
disableAutoRelock [androidJvm]
open fun disableAutoRelock(callback: MLCommandCallback<String>)
For D1000 Deadbolt only with minimum FW version 1772468928: Disables auto-relock functionality.
disconnect [androidJvm]
open fun disconnect(type: MLDisconnectType, callback: MLCommandCallback<String>)
This will command the lock to end the BLE session with the phone
enableAutoRelock [androidJvm]
open fun enableAutoRelock(seconds: Int, callback: MLCommandCallback<String>)
For D1000 Deadbolt only with minimum FW version 1772468928: Enables auto-relock functionality.
getFirmwareVersion [androidJvm]
@Nullable
open fun getFirmwareVersion(): Integer
hasKey [androidJvm]
fun hasKey(): Boolean
if true an accessProfile has been assigned to this MLProduct, connection is possible if false, no connections will be possible until setAccessProfile is called
isUpdatingFirmware [androidJvm]
fun isUpdatingFirmware(): Boolean
if device is in the process of a firmware update
keepAlive [androidJvm]
open fun keepAlive(callback: MLCommandCallback<String>)
Sends an additional command
lockReset [androidJvm]
open fun lockReset(callback: MLCommandCallback<String>)
For supported locks/customers, completing a Lock Reset will reset the device’s Primary Code and invalid all previously requested temporary access codes.
mechanismOptions [androidJvm]
open fun mechanismOptions(): Array<MechanismOptions>
returns an array with the values of valid Mechanisms for this device Will be empty if a user session has not yet been established
onChanged [androidJvm]
@CallSuper
open fun onChanged(@NonNullnewState: LockState)
Called when a new LockState has been calculated for this product
readBatteryLevel [androidJvm]
open fun readBatteryLevel(callback: MLCommandCallback<MLBatteryLevelModel>)
Reads the cached battery level of the lock and returns a MLBatteryLevelModel object that will indicate the battery’s level as a % of full.
readFirmwareCounter [androidJvm]
open fun readFirmwareCounter(callback: MLCommandCallback<Integer>)
Reads devices firmware update counter indicating the number of times a device has been updated
readIsAutoRelockEnabled [androidJvm]
open fun readIsAutoRelockEnabled(callback: MLCommandCallback<Boolean>)
For D1000 Deadbolt only with minimum FW version 1772468928: Reads the current auto-relock state.
readIsDeadboltLeftHanded [androidJvm]
open fun readIsDeadboltLeftHanded(callback: MLCommandCallback<Boolean>)
For Deadbolt only Reads whether the bolt extends to left or right of the lock.
readIsDoorPositionSensorEnabled [androidJvm]
open fun readIsDoorPositionSensorEnabled(callback: MLCommandCallback<Boolean>)
For Deadbolt only with minimum FW version of 1679338484: Reads flag if door position sensor is enabled
readIsForcedRelockEnabled [androidJvm]
open fun readIsForcedRelockEnabled(callback: MLCommandCallback<Boolean>)
For Door Controller only with minimum FW version of 1723562164: Reads flag if forced relock is enabled
readPrimaryLockState [androidJvm]
open fun readPrimaryLockState(callback: MLCommandCallback<MLState>)
Read the current state of the lock.
readPrimaryPasscode [androidJvm]
open fun readPrimaryPasscode(callback: MLCommandCallback<Array<String>>)
Reads the current primary passcode from the lock.
readPrimaryPasscodeCounter [androidJvm]
open fun readPrimaryPasscodeCounter(callback: MLCommandCallback<Integer>)
Reads the number of times the Primary Passcode has been changed
readPublicConfigurationCounter [androidJvm]
open fun readPublicConfigurationCounter(callback: MLCommandCallback<Integer>)
Reads the number of times the Public Configuration has changed
readRssi [androidJvm]
open fun readRssi(callback: MLCommandCallback<Integer>)
Reads the current RSSI strength the phone is getting from the lock it is connected to
readSecondaryLockState [androidJvm]
open fun readSecondaryLockState(callback: MLCommandCallback<MLState>)
Read the current state of a LockBox’s Shackle.
readSecondaryPasscode [androidJvm]
open fun readSecondaryPasscode(index: Int, callback: MLCommandCallback<Array<String>>)
Reads the specified secondary passcode
readSecondaryPasscodeCounter [androidJvm]
open fun readSecondaryPasscodeCounter(callback: MLCommandCallback<Integer>)
Reads the number of times the Secondary Passcodes have been changed
readTime [androidJvm]
open fun readTime(callback: MLCommandCallback<Date>)
Reads the Lock’s internal clock in UTC time
readUnlockTimeout [androidJvm]
open fun readUnlockTimeout(callback: MLCommandCallback<Integer>)
Read the current setting for the UnlockPrimaryLock Timeout.
relock [androidJvm]
open fun relock(callback: MLCommandCallback<String>)
For Deadbolt only: Extends the deadbolt to a Locked position
setAccessProfile [androidJvm]
fun setAccessProfile(accessProfile: String)
Assign a new Access Profile to this MLProduct.
[androidJvm]
fun setAccessProfile(accessProfile: String, expectedFirmwareVersion: Int)
Assign a new Access Profile and expected firmware version to this MLProduct.
setAutoDisconnect [androidJvm]
open fun setAutoDisconnect(autoDisconnect: Boolean)
Determines behavior of an MLProduct session when public and private command queues are empty: If true, an MLProduct’s session will disconnect as soon as the command queues are empty; If false - The MLBluetoothSDK will continue to call the keepAlive callback for * If false - The MLBluetoothSDK will continue to call the keepAlive callback for value of keepAliveIntervalSeconds, or longer if additional commands are enqueued
setDeadboltLeftHanded [androidJvm]
open fun setDeadboltLeftHanded(isLeftHanded: Boolean, callback: MLCommandCallback<Boolean>)
For Deadbolt only Reads whether the bolt extends to left or right of the lock.
setIsDoorPositionSensorEnabled [androidJvm]
open fun setIsDoorPositionSensorEnabled(isInstalled: Boolean, callback: MLCommandCallback<Boolean>)
For Deadbolt only with minimum FW version of 1679338484: sets flag to indicate if a door position sensor is enabled
setIsForcedRelockEnabled [androidJvm]
open fun setIsForcedRelockEnabled(isEnabled: Boolean, callback: MLCommandCallback<Boolean>)
For Door Controller only with minimum FW version of 1723562164: sets flag to indicate if forced relock is enabled
state [androidJvm]
open fun state(): LockState
a snapshot of the current state of the Lock associated with this MLProduct.
unlock [androidJvm]
open fun unlock(mechanism: MechanismOptions, callback: MLCommandCallback<String>)
open fun unlock(mechanism: MechanismOptions, seconds: Int, userCallback: MLCommandCallback<String>)
Queues an unlock command to this MLProducts associated physical lock
[androidJvm]
open fun unlock(seconds: Int, callback: MLCommandCallback<String>)
Unlocks the Primary Lock mechanism
updateFirmware [androidJvm]
open fun updateFirmware(firmwareVersion: Int)
If the version is valid, the SDK will download the new firmware, put the lock into bootloader mode, disconnect, reconnect and begin updating firmware; progress will be sent to the IMLProductDelegate.
updateFirmwareCommand [androidJvm]
open fun updateFirmwareCommand(updateData: String, callback: MLCommandCallback<String>)
For internal use
writeAuthenticatedCommand [androidJvm]
open fun writeAuthenticatedCommand(updateData: String, callback: MLCommandCallback<String>)
Writes to authenticated memory using commands prepared by CP API
writePrimaryPasscode [androidJvm]
open fun writePrimaryPasscode(newCode: String, callback: MLCommandCallback<String>)
Write a new Primary Passcode.
writeSecondaryPasscode [androidJvm]
open fun writeSecondaryPasscode(index: Int, newCode: String, callback: MLCommandCallback<String>)
Write a new Secondary Passcode.
writeUnlockTimeout [androidJvm]
open fun writeUnlockTimeout(newTimeout: Int, callback: MLCommandCallback<Integer>)
Update the unlock timeout the lock uses