Lock Interfaces
1.Judging whether Bluetooth is available
public boolean isBLEEnabled(Context context)2.Request to turn on Bluetooth
public void requestBleEnable(Activity activity)3.Init the Bluetooth configuration
public void prepareBTService(Context context)4.Stop the service to release Bluetooth resource
public void stopBTService()5.Start scan BT lock
public void startScanLock(ScanLockCallback callback)6.Stop the scan
public void stopScanLock()7.Init the lock
public void initLock(ExtendedBluetoothDevice device, InitLockCallback callback)8.Reset the ekey
Reset the ekey, and the lockFlagPos will change.
public void resetEkey(String lockData, ResetKeyCallback callback)9.Reset the lock
The lock will be reset to factory mode and if you want to use it,you should do initLock.
public void resetLock(String lockData, ResetLockCallback callback)10.Lock or unlock (ControlAction.LOCK and ControlAction.UNLOCK)
public void controlLock(
controlAction,
lockData,
lockMac,
ControlLockCallback callback)11.Get Audio Switch State.
public void getMuteModeState(
String lockData,
String lockMac,
GetLockMuteModeStateCallback callback)12.Set lock mute mode
true – on, false – off
public void setMuteMode(
boolean enable,
String lockData,
SetLockMuteModeCallback callback)13.Set remote unlock switch state
true – on, false – off
public void setRemoteUnlockSwitchState(
boolean enable,
String lockData,
SetRemoteUnlockSwitchCallback callback)This setting will change the lock feature value, you need to call Update lock data API to synchronize the cloud data with the new lockdata returned
14.Get remote unlock switch state
true – on, false – off
public void getRemoteUnlockSwitchState(
String lockData,
GetRemoteUnlockStateCallback callback)15.Set the lock time
public void setLockTime(
long timestamp,
String lockData,
SetLockTimeCallback callback)16.Get the lock time
public void getLockTime(
String lockData,
GetLockTimeCallback callback)17.Get the lock log
LogType.NEW - only the new added operation record from last time you get log.
LogType. ALL - all the operation record from lock is initialized.
public void getOperationLog(
int logType,
String lockData,
GetOperationLogCallback callback)18.Get lock battery
public void getBatteryLevel(
String lockData,
GetBatteryLevelCallback callback)19.Set Automatic locking period
public void setAutomaticLockingPeriod(
int seconds,
String lockData,
SetAutoLockingPeriodCallback callback)20.Create custom passcode(Passcode range : 6 - 9 Digits in length)
public void createCustomPasscode(
String passcode,
long startDate,
long endDate,
String lockData,
CreateCustomPasscodeCallback callback)21.Modify passcode
If newPasscode is null or "" means you do not want to change original passcode.
startDate and endDate values are both 0 means you do not want to change expired date,or both values should not be 0.
public void modifyPasscode(
String originalCode,
String newCode,
long startDate,
long endDate,
String lockData,
ModifyPasscodeCallback callback)22.Delete passcode
public void deletePasscode(
String passcode,
String lockData,
String lockMac,
DeletePasscodeCallback callback)23.Reset passcode(all passcodes will be invalid)
public void resetPasscode(
String lockData,
ResetPasscodeCallback callback)24.Get all valid passcodes in lock
public void getAllValidPasscodes(
String lockData,
GetAllValidPasscodeCallback callback)25.Modify admin passcode
public void modifyAdminPasscode(
String newPasscode,
String lockData,
ModifyAdminPasscodeCallback callback)26.Add IC Card
startDate and endDate set 0 means the card will be valid for ever.
onEnterAddMode:the lock is ready to add a card.
public void addICCard(
long startDate,
long endDate,
String lockData,
AddICCardCallback callback)27.Modify IC Card Period
public void modifyICCardValidityPeriod(
long startDate,
long endDate,
String cardNum,
String lockData,
ModifyICCardPeriodCallback callback)28.Get all valid IC Cards
public void getAllValidICCards(
String lockData,
GetAllValidICCardCallback callback)29.Delete IC Card
public void deleteICCard(
String cardNum,
String lockData,
DeleteICCardCallback callback)30.Clear ic cards
public void clearAllICCard(
String lockData,
ClearAllICCardCallback callback)31.Add Fingerprint
startDate and endDate set 0 means the fingerprint will be valid for ever.
onEnterAddMode:the lock is ready to add a fingerprint.
totalCount: lock collect your fingerprint needed.
currentCount : current count the lock is collecting.
public void addFingerprint(
long startDate,
long endDate,
String lockData,
AddFingerprintCallback callback)32.Get all valid fingerprints
public void getAllValidFingerprints(
String lockData,
GetAllValidFingerprintCallback callback)33.Delete fingerprint
public void deleteFingerprint(
String fingerprintNum,
String lockData,
DeleteFingerprintCallback callback)34.Clear all fingerprints
public void clearAllFingerprints(
String lockData,
ClearAllFingerprintCallback callback)35.Modify fingerprint period
public void modifyFingerprintValidityPeriod(
long startDate,
long endDate,
String fingerprintNum,
String lockData,
ModifyFingerprintPeriodCallback callback)36.Get passage mode
public void getPassageMode(
String lockData,
GetPassageModeCallback callback)37.Set passage mode
PassageModeType.Weekly effective value from 1 to 7,1 means Monday 2 means Tuesday ,...,7 means Sunday, 0 means everydays
public void setPassageMode(
PassageModeConfig modeData,
String lockData,
SetPassageModeCallback callback)38.Delete passage mode
public void deletePassageMode(
PassageModeConfig modeData,
String lockData,
DeletePassageModeCallback callback)39.Clear passage mode
public void clearPassageMode(
String lockData,
ClearPassageModeCallback callback)40. Wifi lock scan nearby wifi
Currently, only support 2.4G wifi, 5 G don't support.
public void scanWifi(String lockData, ScanWifiCallback callback)41. Wifi lock config wifi
public void configWifi(String wifiName, String wifiPassword, String lockData, ConfigWifiCallback callback)42. Wifi lock config server
The server and port of the wifi lock
serverAddress = "wifilock.ttlock.com";
portNumber = 4999;
public void configServer(String serverAddress, int portNumber, String lockData,
ConfigServerCallback callback)43. Get the wifi info the wifi lock
WifiLockInfo {
/**
*/
private String wifiMac;
/**
*
* disconnected return -127
*/
private int wifiRssi;
}public void configWifi(String wifiName, String wifiPassword, String lockData, ConfigWifiCallback callback)44. Wifi lock config ip
Need support below feature.
FeatureValueUtil.isSupportFeature(lockData, FeatureValue.WIFI_LOCK_SUPPORT_STATIC_IP);Para info:
IpSetting {
public static final int STATIC_IP = 0;
public static final int DHCP = 1;
/**
* 0 -static ip
* 1 -DHCP
*/
private int type;
/**
* static ip
*/
private String ipAddress;
/**
*
*/
private String subnetMask;
/**
*
*/
private String router;
/**
* dns1
*/
private String preferredDns;
/**
* dns2
*/
private String alternateDns;
}public void configIp(IpSetting ipSetting, String lockData, ConfigIpCallback callback)45. Lock config
Type info:
TTLockConfigType {
/**
* By turning on,if the lock is destroyed by violence, it will sound an alarm.
*/
TAMPER_ALERT(0x01),
/**
* By turning on, you can pair the lock again by long pressing the RESET button.
* By turning off, the RESET button is disabled.
*/
RESET_BUTTON(0x02),
/**
* Privacy lock api and privacy lock button on the lock both turning on,
* will enable the privacy function.
* Only admin key、 admin super code and the privacy card can unlock the lock
*
*/
PRIVACY_LOCK(0x04),
/**
* UnlockDirection.LEFT : true
* UnlockDirection.RIGHT : false
*/
UNLOCK_DIRECTION(0x10),
/**
*
*/
LOCK_SOUND(0x05),
/**
*/
PASSCODE_VISIBLE(0x06),
/**
*/
LOCK_FREEZE(0x07),
/**
*
* false-keep alive mode(can do all remote operations,need more power)
* true-power saving mode(can only upload the records automatically by the wifi lock)
*/
WIFI_LOCK_POWER_SAVING_MODE(0x80);
}public void setLockConfig(TTLockConfigType ttLockConfigType, boolean switchOn, String lockData, SetLockConfigCallback callback)46. Set sound volume
public void setLockSoundWithSoundVolume(SoundVolume soundVolume, String lockData, SetLockSoundWithSoundVolumeCallback callback)para info
SoundVolume {
FIRST_LEVEL(1),
SECOND_LEVEL(2),
THIRD_LEVEL(3),
FOUTH_LEVEL(4),
FIFTH_LEVEL(5),
/**
* mute
*/
OFF(-1),
/**
* open
*/
ON(-2);
}47. Get sound volume
public void getLockSoundWithSoundVolume(String lockData, GetLockSoundWithSoundVolumeCallback callback)48. Add remote control
public void addRemote(String remoteMac, ValidityInfo validityInfo, String lockData, AddRemoteCallback callback)49. Modify remote control
public void modifyRemoteValidityPeriod(String remoteMac, ValidityInfo validityInfo, String lockData, ModifyRemoteValidityPeriodCallback callback)50. Delete remote control
public void deleteRemote(String remoteMac, String lockData, DeleteRemoteCallback callback)51. Clear remote control
public void clearRemote(String lockData, ClearRemoteCallback callback)52. Add door sensor
public void addDoorSensor(String doorSensorMac, String lockData, AddDoorSensorCallback callback)53. Delete door sensor
public void deleteDoorSensor(String lockData, DeleteDoorSensorCallback callback)54. Get Wifi MAC of gateway(Only can use when lock is connected gateway)
public void getNetworkMac(GetNetworkMacCallback callback)55. Configure hotel data
hotelData: hotelData.setHotelInfo(hotelInfo); gain hotelinfo from cloud API hotelData.setBuildingNumber(buildingNumber); BuildingNo hotelData.setFloorNumber(floorNumber); FloorNo
public void setHotelData(HotelData hotelData, String lockData, SetHotelDataCallback callback)56. Set lock sector
sectorStr (start counting from 1, Data format "1,2,3" means write sector 1, 2, 3)
public void setHotelCardSector(String sectorStr, String lockData, SetHotelCardSectorCallback callback)57. Configure lift control wrok mode
ttLiftWorkMode: ActivateAllFloors (Allow control all floors after use card) ActivateSpecificFloor (Allow control floors that same as card data)
public void setLiftWorkMode(TTLiftWorkMode ttLiftWorkMode, String lockData, SetLiftWorkModeCallback callback)58. Set the floors associated with the lift control
controlableFloors (Data format "1,2,3" means the associated floor is 1、2、3)
public void setLiftControlableFloors(String controlableFloors, String lockData, SetLiftControlableFloorsCallback callback)59. Set the floors that lift control can be arrived
activateFloors (List of floors that can be arrived) currentDate (System current time)
public void activateLiftFloors(List<Integer> activateFloors, long currentDate, String lockData, ActivateLiftFloorsCallback callback)60. Obtain accessory battery level
public void getAccessoryBatteryLevel(AccessoryInfo accessoryInfo, String lockData, GetAccessoryBatteryLevelCallback callback)public class AccessoryInfo implements Serializable {
private AccessoryType accessoryType;
private String accessoryMac;
private long batteryDate;
private int accessoryBattery;
}para info:
AccessoryType{
WIRELESS_KEYPAD(1),
REMOTE(2),
DOOR_SENSOR(3);
}61. Add face
public void addFace(String lockData, ValidityInfo validityInfo, AddFaceCallback callback)62. Modify face period
public void modifyFaceValidityPeriod(String lockData, long faceNumber, ValidityInfo validityInfo, ModifyFacePeriodCallback callback)63. Delete face
public void deleteFace(String lockData, long faceNumber, DeleteFaceCallback callback)64. Clear face
public void clearFace(String lockData, ClearFaceCallback callback)65. Add face feature data
featureData; Human face feature data
public void addFaceFeatureData(String lockData, String featureData, ValidityInfo validityInfo, AddFaceCallback callback)66. Gain all valid face in the lock
public void getAllValidFaces(String lockData, GetAllFacesCallback callback)67. Add palm vein
public void addPalmVein(String lockData, ValidityInfo validityInfo, AddPalmVeinCallback callback)68. Modify palm vein period
public void modifyPalmVeinValidityPeriod(String lockData, long palmVeinNumber, ValidityInfo validityInfo, ModifyPalmVeinPeriodCallback callback)69. Delete palm vein
public void deletePalmVein(String lockData, long palmVeinNumber, DeletePalmVeinCallback callback)70. Claer plam vein
public void clearPalmVein(String lockData, ClearPalmVeinCallback callback)71. Gain all valid palm vein in the lock
public void getAllValidPalmVeins(String lockData, GetAllPalmVeinsCallback callback)72. Modify the sensitivity of recognizing face, palm vein and QR code.
/**
* Proximity sensor setting, when 3D face detection or QR code detection is enabled, there is a proximity sensor function. When an object such as a human or a mobile phone approaches the lock, the face detection or QR code detection will be automatically started. This function is used to set whether to turn on or off this sensor function, or to set the sensing distance (far, medium, near).
* @param sensitivity
* 0- off
* 1- low sensitivity(near)
* 2- medium sensitivity(medium)
* 3- high sensiticity(far)
*/
public void setSensitivity(String lockData, int sensitivity, SetSensitivityCallback callback)73. Gain the sensitivity of recognizing face, palm vein and QR code.
public void getSensitivity(String lockData, GetSensitivityCallback callback)74. Door unclosed alarm time setting
time (Door unclosed alarm time, unit of seconds)
public void setDoorSensorAlertTime(int time, String lockData, SetDoorSensorAlertTimeCallback callback)75. Setting power saver work mode
PowerSaveWorkMode: ALL_CARDS (All cards can active the power saver) HOTEL_CARD (Only hotel card can active the power saver) ROOM_CARD (Only room card can active the power saver)
public void setPowerSaverWorkMode(PowerSaverWorkMode powerSaverWorkMode, String lockData, SetPowerSaverWorkModeCallback callback)76.Set unauthorized attempt alert
/**
* Set unauthorized attempt alarm.
*
* When enabled, the lock locks for lockoutDuration seconds after attemptAlertCount failed unlocks
* of the given unlock modes; attemptAlertCount=0 disables the feature.
*
* @param data (attemptAlertCount 0~50,0=关闭;lockoutDuration 0~900 秒)/ alert config
* @param lockData / lock data
* @param callback / callback
*/
public void setUnauthorizedAttemptAlert(UnauthorizedAttemptAlertData data, String lockData,
SetUnauthorizedAttemptAlertCallback callback)/**
* Unauthorized attempt alert config data (used both as the get result and the set input carrier).
* Max failed unlock attempts (range 0~50); 0 means the feature is disabled. Maps to server field unauthorizedAttemptAlertCount.
* Lockout duration after reaching the failed attempt limit (unit: second, range 0~900). Maps to server field unauthorizedAttemptAlertLockTime.
* Unlock modes that trigger lockout (passcode/card/fingerprint).
*/
public class UnauthorizedAttemptAlertData {
/** / Max failed attempts (0~50; 0 means disabled) */
private int attemptAlertCount;
/** Lockout duration in seconds (0~900) */
private int lockoutDuration;
/** Unlock modes that trigger lockout */
private List<UnlockMode> unlockModes;
}77.Get unauthorized attempt alert config.
/**
* Get unauthorized attempt alert config.
*
* @param lockData / lock data
* @param callback / callback
*/
public void getUnauthorizedAttemptAlert(String lockData, GetUnauthorizedAttemptAlertCallback callback)