react-native-van-lock
v0.1.0
Published
React Native for TTLock
Downloads
4
Readme
react-native-van-lock
React Native for TTLock
Installation
npm install react-native-van-lock
Config your project
ios
Android
config android/build.gradle:
buildscript {
ext {
// Change min sdk to 18
minSdkVersion = 18
}
}
allprojects {
repositories {
...
// Add below lines
flatDir{
dirs "$rootDir/../node_modules/react-native-van-lock/android/libs"
}
}
}
do this step if you get android merger error:
<manifest
...
xmlns:tools="http://schemas.android.com/tools"
>
...
<application
...
tools:replace="android:allowBackup"
>
Usage
Import
import VanLock from 'react-native-van-lock';
Init
VanLock.init()
init TipiLock SDK, this must be call before using other methods
Scan nearby locks
VanLock.addReceiveScanDeviceListener(callback)
add listener to receive bluetooth lock before do start device scan
VanLock.removeReceiveScanDeviceListener()
remove listener
VanLock.startDeviceScan()
start scan bluetooth locks
VanLock.stopDeviceScan()
start scan bluetooth locks
Init lock
VanLock.lockInitialize(lockMac, callback)
start lock initialization
Unlock
VanLock.unlockByAdministrator(lock, callback)
unlock lock by using admin key
VanLock.unlockByUser(lock, callback)
unlock lock by using e-key
Adjust time
VanLock.setLockTime(timestamp, lock, callback)
change lock's time
VanLock.getLockTime(lock, callback)
get lock's current time
Change admin pin
VanLock.setAdminKeyboardPassword(pin, lock, callback)
Manage temporary pins
VanLock.addPeriodKeyboardPassword(pin, startTimestamp, endTimestamp, lock, callback)
add new temporary pin
VanLock.modifyKeyboardPassword(oldPin, newPin, startTimestamp, endTimestamp, lock, callback)
modify an existing pin
VanLock.deleteOneKeyboardPassword(pin, lock, callback)
delete one pin
VanLock.resetKeyboardPassword(lock, callback)
delete all pins
Change audio state
VanLock.getAudioState(lock, callback)
VanLock.setAudioState(state, lock, callback)
Reset lock
VanLock.resetLock(lock, callback)
reset lock, when this operation return success, the lock can be init again.
Log
VanLock.getOperateLog(lock, callback)
get log from lock
Contributing
See the contributing guide to learn how to contribute to the repository and the development workflow.
License
MIT