Open Platform
Skip to content

On Premise JAR User Manual ​

Contents ​

1 Instruction ​

This manual describes the methods provided by the On Premise JAR (TTLockUtil). The utility classes are in the com.sciener.util package:

  • TTLockUtil: lock-related utilities, including creating PIN codes, creating eKeys, getting lock info, updating lock data, generating unlock QR codes, etc.
  • HotelUtil: hotel-related utilities, including creating a hotel, getting hotel info and getting the IC Key.

General notes:

  • The lockData parameter of all methods must be generated by the APP SDK on premise after adding a lock, otherwise an IllegalArgumentException is thrown.
  • All time parameters (startTime, endTime, etc.) are timestamps in milliseconds.

1.1 Create PIN code ​

1.1.1 TTLockUtil.createPIN ​

java
public static String createPIN(String lockData, Integer type, Long startTime, Long endTime, boolean isExclusive)

Create a keyboard PIN code. The time is calibrated according to the lock's timezone: if the start time and end time are on the same day, they are floored to half an hour; otherwise they are floored to the hour.

1.1.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
KeyboardPwdTypeIntValues listed in the table below
startTimeLongStart time
endTimeLongEnd time
isExclusiveBooleanClear former used pin after used

KeyboardPwdType values:

ValueCodeDescription
One Time1This code only valid for once within 6 hours from the Start Time
Permanent2This code must be used at least once within 24 Hours after the Start Time, Or it will be invalidated.
Timed3This code must be used at least once within 24 Hours after the Start Time, Or it will be invalidated.
Delete all4This code will delete all other codes
Weekend recurring5This code is valid during the time period at the weekend
Daily recurring6This code is valid during the time period everyday
Workday recurring7This code is valid during the time period on workdays
Mon recurring8This code is valid during the time period on Mondays
Tue recurring9This code is valid during the time period on Tuesdays
Wed recurring10This code is valid during the time period on Wednesdays
Thu recurring11This code is valid during the time period on Thursdays
Fri recurring12This code is valid during the time period on Fridays
Sat recurring13This code is valid during the time period on Saturdays
Sun recurring14This code is valid during the time period on Sundays

1.1.3 Return ​

ParameterTypeDescription
KeyboardPwdStringPIN code

1.2 Create ekey ​

1.2.1 TTLockUtil.createEkey ​

java
public static String createEkey(String lockData, Long startTime, Long endTime, Integer userID, boolean isAdmin)

Create an eKey. The returned eKey data can be passed to the APP SDK for Bluetooth unlocking.

Note: the old 4-parameter method createEkey(String lockData, Long startTime, Long endTime, Integer userID) is deprecated (@Deprecated). The eKey it creates has management rights by default. Use the new method with the isAdmin parameter instead.

1.2.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
startTimeLongStart time
endTimeLongEnd time
userIDIntUser ID, identify users
isAdminBooleanWhether the eKey is for an administrator. true: the eKey has management rights for the lock; false: a normal user eKey, which does not contain the admin code, PIN data or other management information

1.2.3 Return ​

ParameterTypeDescription
eKeyStringEkey data

1.3 Get admin code ​

1.3.1 TTLockUtil.getAdminCode ​

java
public static String getAdminCode(String lockData)

1.3.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data

1.3.3 Return ​

ParameterTypeDescription
noKeyPwdStringAdmin PIN code

1.4 Create PIN code With Index ​

1.4.1 TTLockUtil.createPINWithIndex ​

java
public static String createPINWithIndex(String lockData, Integer type, Long startTime, Long endTime, boolean isExclusive, int index)

Same as createPIN, with an extra index parameter to create different One Time / Permanent PIN codes for the same hour.

1.4.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
keyboardPwdTypeIntValues listed in the table below
startTimeLongStart time
endTimeLongEnd time
isExclusiveBooleanClear former used pin after used
indexIntIndex, begin at 0, available to One Time and Permanent pin type,create different pin code for the same hour.

keyboardPwdType values:

ValueCodeDescription
One Time1This code only valid for once within 6 hours from the Start Time
Permanent2This code must be used at least once within 24 Hours after the Start Time, Or it will be invalidated.
Timed3This code must be used at least once within 24 Hours after the Start Time, Or it will be invalidated.
Delete all4This code will delete all other codes
Weekend recurring5This code is valid during the time period at the weekend
Daily recurring6This code is valid during the time period everyday
Workday recurring7This code is valid during the time period on workdays
Mon recurring8This code is valid during the time period on Mondays
Tue recurring9This code is valid during the time period on Tuesdays
Wed recurring10This code is valid during the time period on Wednesdays
Thu recurring11This code is valid during the time period on Thursdays
Fri recurring12This code is valid during the time period on Fridays
Sat recurring13This code is valid during the time period on Saturdays
Sun recurring14This code is valid during the time period on Sundays

1.4.3 Return ​

ParameterTypeDescription
keyboardPwdStringPIN code

1.5 Update lock timezone ​

When the lock is moved to a place with a new timezone, or enter light saving time, you can call this method to update the lock timezone.

1.5.1 TTLockUtil.updateTimezone ​

java
public static String updateTimezone(String lockData, int timezoneRawOffset)

After updating, calibrate the lock clock with the returned new lockData via the APP SDK.

1.5.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
timezoneRawOffsetIntTimezone raw offset,in milliseconds,for example:3600000 for UTC+1

1.5.3 Return ​

ParameterTypeDescription
lockDataStringlockData with new timezone

1.6 Update lock data ​

After modifying lock settings (such as enabling remote unlocking, upgrading lock firmware, resetting ekeys, or resetting passwords) via the APP SDK, the SDK will return updated lock data containing the modified parameters. This method is used to update the new parameters into the lock data, and the developer’s system can saves the updated lock data for subsequent operations.

1.6.1 TTLockUtil.updateLockData ​

java
public static String updateLockData(String lockData, String newLockData)

The following properties are renewed from newLockData (only when present):

  • lockFlagPos: new flag position after resetting eKeys
  • pwdInfo, timestamp: new PIN data after resetting passcodes
  • featureValue: lock feature value
  • modelNum, hardwareRevision, firmwareRevision: model number, hardware version and firmware version after a firmware upgrade

1.6.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
newLockDataStringThe lock data returned by the APP SDK containing the modified parameters

1.6.3 Return ​

ParameterTypeDescription
lockDataStringNew lockData

1.7 Create hotel ​

1.7.1 HotelUtil.createHotel ​

java
public static String createHotel()

Create a hotel with a randomly generated hotel number, IC Key and AES key, and return the hotel data. The developer's system should save the hotel data for subsequent operations.

1.7.2 Parameter Description ​

NameTypeDescription
None-No parameters

1.7.3 Return parameters ​

ParameterTypeDescription
hotelDataStringHotel Data

1.8 Get hotel info ​

1.8.1 HotelUtil.getHotelInfo ​

java
public static String getHotelInfo(String hotelData)

Get the hotel info, which is used to add hotel locks in the APP SDK. Throws IllegalArgumentException if the hotelData is invalid.

1.8.2 Parameter Description ​

NameTypeDescription
hotelDataStringHotel Data

1.8.3 Return parameters ​

ParameterTypeDescription
hotelInfoStringHotel info

1.9 Get IC Key ​

1.9.1 HotelUtil.getIcKey ​

java
public static String getIcKey(String hotelData)

Get the IC Key of the hotel, used for hotel IC card operations. Throws IllegalArgumentException if the hotelData is invalid.

1.9.2 Parameter Description ​

NameTypeDescription
hotelDataStringHotel Data

1.9.3 Return parameters ​

ParameterTypeDescription
icKeyStringIC Key

1.10 Get Lock info ​

1.10.1 TTLockUtil.getLockInfo ​

java
public static LockInfo getLockInfo(String lockData) throws Exception

Parse the lock information from lockData, returns a com.sciener.api.entity.LockInfo object.

1.10.2 Parameter Description ​

NameTypeDescription
lockDataStringLock Data

1.10.3 Return parameters ​

ParameterTypeDescription
lockInfoLockInfoLock info object

Fields in LockInfo Object:

Field NameTypeDescription
lockMacStringMAC address of lock
lockNameStringBluetooth device name of lock
electricQuantityintBattery level, range [0-100]; -1 means unknown
noKeyPwdStringAdministrator keyboard PIN code
featureValueStringLock feature value, represents supported lock functions
wirelessKeypadFeatureValueStringWireless keypad feature value, default "0"
timezoneRawOffSetLongTime zone offset relative to UTC, unit: milliseconds
modelNumStringLock product model number
hardwareRevisionStringHardware version number
firmwareRevisionStringFirmware version number
passageModeIntegerPassage mode: 1-enabled, 2-disabled
passageModeAutoUnlockIntegerPassage-mode auto unlock:1-enabled,2-disabled
autoLockTimeIntegerAuto-lock delay in seconds; -1 means auto-lock disabled
factoryDateStringLock factory production date
isFrozenIntegerLock frozen status:1-frozen,2-not frozen
lightingTimeIntegerAuto-lighting duration(seconds);0-disabled;-1-unknown
hotelModeIntegerHotel mode:1-enabled,2-disabled
privacyLockIntegerPrivacy lock switch:0-unknown,1-on,2-off
resetButtonIntegerReset button switch:0-unknown,1-enabled,2-disabled
tamperAlertIntegerTamper alert switch:0-unknown,1-enabled,2-disabled
displayPasscodeIntegerScreen passcode display switch:0-unknown,1-on,2-off
lockSoundIntegerLock prompt sound switch:0-unknown,1-on,2-off
soundVolumeIntegerSpeaker volume level:1-5;0-unknown
openDirectionIntegerDoor opening direction:0-unknown,1-left-opening,2-right-opening
sensitivityIntegerLock sensor sensitivity:-1-unknown,0-disabled,1-low,2-medium,3-high
doorNotClosedWarningTimeIntegerDoor-not-closed alarm delay(seconds);0-disable alarm
passcodeKeyNumberIntegerNumber of numeric keys for incomplete-digit password lock; null for ordinary locks
doubleVerificationIntegerDual-verification mode:1-enabled,2-disabled
latchBoltIntegerLatch-bolt control:0-unknown,1-support control,2-no control
faceImageSizeintMaximum face photo size, unit: KB
faceImageHeightintFace photo height, unit: pixel
faceImageWidthintFace photo width, unit: pixel
faceImageTypeintFace photo image type, 1 represents JPG format

1.11 Get lock MAC ​

1.11.1 TTLockUtil.getMac ​

java
public static String getMac(String lockData)

Get the Bluetooth MAC address of the lock from lockData.

1.11.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data

1.11.3 Return parameters ​

ParameterTypeDescription
lockMacStringBluetooth MAC address of the lock, e.g. B4:99:4C:67:96:79

1.12 Update admin code ​

1.12.1 TTLockUtil.updateAdminCode ​

java
public static String updateAdminCode(String lockData, String adminCode)

When the admin code of the lock has been changed in the lock, call this method to renew the lockData with the new admin code. The developer's system should save the new lockData for subsequent operations.

1.12.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
adminCodeStringThe new admin code

1.12.3 Return parameters ​

ParameterTypeDescription
lockDataStringNew lockData with the new admin code

1.13 Get QR code data ​

1.13.1 TTLockUtil.getQrCodeData ​

java
public static String getQrCodeData(String lockData, short qrCodeNumber, Long startTime, Long endTime)

Generate the unlock QR code content. Render the returned string into a QR code image, which can be scanned by the lock to unlock.

Restrictions:

  • The lock must support the QR code function, otherwise an IllegalArgumentException is thrown.
  • endTime must be later than startTime.
  • The valid period (endTime - startTime) can't be more than 1 hour.

1.13.2 Parameter Description ​

NameTypeDescription
lockDataStringLock data
qrCodeNumberShortQR code number, numbered from 1, maintained by the developer's system
startTimeLongStart time, timestamp in milliseconds
endTimeLongEnd time, timestamp in milliseconds

1.13.3 Return parameters ​

ParameterTypeDescription
qrCodeDataStringUnlock QR code content, in the format SCIE:hexadecimal string, ending with a line break
CopyRight © 2012-2026 Sciener.All Rights Reserved