Last Updated on : 2023-11-27 05:41:01download
Wi-Fi lock basic API encapsulates common methods regarding temporary passwords, member management, logging capabilities, and more features. These methods apply to camera locks (categoryCode
: wf_jtmspro) and smart video locks (categoryCode
: videolock_1w_1).
Temporary passwords are classified into online passwords and offline passwords.
Online temporary password: This type of password is generated when the respective lock runs online and then synced to the lock.
Offline temporary password: This type of password is generated even when the respective lock stays offline. Offline passwords are deleted differently from online passwords. Enter a clearing code on the lock, so all offline passwords are cleared from the lock.
The API methods to get online and offline passwords can vary, depending on different lock categories. These capabilities are implemented respectively for camera locks (categoryCode
: wf_jtmspro) and smart video locks (categoryCode
: videolock_1w_1). For more information, see Demo.
IPhotoLock getPhotoLockManager();
Example
val iTuyaLockManager = TuyaOptimusSdk.getManager(ITuyaLockManager::class.java)
val iVideoLockManager = iTuyaLockManager?.newVideoLockManagerInstance(mDevId)
val iPhotoLock = iVideoLockManager?.photoLockManager
API description
Creates an online temporary password.
void createOnlineTempPassword(String password, String countryCode, String phone, long effectiveTime,long invalidTime, int availableTimes, String name, List<ScheduleBean> scheduleBean, ITuyaResultCallback<OnlineTempPassword> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
password | No | It is a 7-digit password by default. |
countryCode | Yes | The country code. |
phone | Yes | The mobile phone number. |
effectiveTime | No | The time when the password takes effect. Unit: milliseconds. |
invalidTime | No | The time when the password expires. Unit: milliseconds. |
availableTimes | No | The number of times the password can be used. Valid values:
|
name | Yes | The name of the password. |
scheduleBean | No | The days on which the password is valid within a week. |
scheduleBean.allDay | No | Specifies whether the password is valid all day long. |
scheduleBean.effectiveTime | Yes | The time when a password becomes valid on that day. Unit: minutes. |
scheduleBean.invalidTime | Yes | The time when a password expires on that day. Unit: minutes. For example, to make the password valid from 10:30 to 12:00, apply these settings: effectiveTime=10\*60+30 and invalidTime = 12\*60 . However, this parameter does not apply when allDay=true is used. |
scheduleBean.workingDay | No | The number of valid days within a week. The bit for a valid day is set to 1 and that for an invalid day is set to 0 . The bits represent [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday] sequentially from left to right. For example, to make the password valid only on Monday and Tuesday, set this parameter to 1001111 , convert the binary value to a decimal value, and then pass in the conversion result. |
Example
val scheduleBean = ScheduleBean()
scheduleBean.allDay = true
scheduleBean.workingDay = 127
val list:MutableList<ScheduleBean> = ArrayList()
list.add(scheduleBean)
iPhotoLock?.createOnlineTempPassword("1231231",
"86",
"",
System.currentTimeMillis(),
System.currentTimeMillis() + 7 * 24 * 60 * 60 * 1000,
0,
"pwd ",
list,
object : ITuyaResultCallback<OnlineTempPassword> {
override fun onSuccess(result: OnlineTempPassword?) {
ToastUtil.shortToast(mContext, "Create Success")
result?.let {
pwdList.add(it.pwdId)
}
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
void updateTempPasswordName(String pwdId, String name, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
pwdId | No | The password ID. |
name | Yes | The name of the password. |
Example
iPhotoLock?.updateTempPasswordName(
pwdId,
"testt",
object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "Update Success")
}
})
API description
void deleteTempPassword(String pwdId, IResultCallback callback);
Example
iPhotoLock?.deleteTempPassword("pwdId", object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "Delete Success")
}
})
API description
void getOnlineTempPasswordList(ITuyaResultCallback<ArrayList<OnlineTempPasswordListBean>> callback);
Parameters of callback for OnlineTempPasswordListBean
Parameter | Description |
---|---|
id | The password ID, equivalent to pwdId . |
phone | The mobile phone number. |
effective | Indicates whether the password is valid. Valid values:
|
effectiveTime | The time when the password takes effect. Unit: milliseconds. |
invalidTime | The time when the password expires. Unit: milliseconds. |
availTime | The number of times the password can be used. Valid values:
|
sn | The hardware serial number (SN) of the temporary password. |
name | The name of the password. |
phase | The status of the password. Valid values:
|
gmtCreate | The time when the password was created. |
timeZoneId | The time zone. |
scheduleDetails | The days on which the password is valid within a week. |
Example
iPhotoLock?.getOnlineTempPasswordList(object :
ITuyaResultCallback<ArrayList<OnlineTempPasswordListBean>> {
override fun onSuccess(result: ArrayList<OnlineTempPasswordListBean>?) {
ToastUtil.shortToast(mContext, "Get List Success")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
An offline password is generated only in the cloud and returned to the app.
API description
void getOfflinePassword(long gmtStart, long gmtExpired, OfflineTypeEnum offlineTypeEnum,
String countryCode, String pwdName, String mobile, ITuyaResultCallback<OfflineTempPasswordBean> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
gmtStart | No | The time when the password takes effect. |
gmtExpired | No | The time when the password expires. |
offlineTypeEnum | No | The type of password. Valid values:
|
countryCode | Yes | The country code. |
pwdName | Yes | The name of the password. |
mobile | Yes | The mobile phone number. |
Example
iPhotoLock?.getOfflinePassword(System.currentTimeMillis()/1000,
System.currentTimeMillis()/1000 + 24 * 60 * 60 ,
OfflineTypeEnum.MULTIPLE,
"",
"offline pwd",
"",
object : ITuyaResultCallback<OfflineTempPasswordBean> {
override fun onSuccess(result: OfflineTempPasswordBean?) {
ToastUtil.shortToast(mContext, "Get Pwd Success")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
void setOfflinePasswordName(String pwdId, String pwdName, String mobile, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
pwdId | No | The password ID. |
pwdName | Yes | The name of the password. |
mobile | Yes | The mobile phone number. |
Example
iPhotoLock?.setOfflinePasswordName("pwdId",
"offline update",
"",
object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "Update Pwd Success")
}
})
API description
void getClearCode(String pwdId, ITuyaResultCallback<OfflineTempPasswordBean> callback);
Example
iPhotoLock?.getClearCode("pwdId",
object : ITuyaResultCallback<OfflineTempPasswordBean> {
override fun onSuccess(result: OfflineTempPasswordBean?) {
ToastUtil.shortToast(mContext, " get clear code:${result?.pwd}")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
void getOfflinePasswordList(OfflineTypeEnum offlineTypeEnum, int offset, int limit, OfflinePasswordStatusEnum offlinePasswordStatusEnum,
ITuyaResultCallback<ArrayList<OfflinePasswordListBean>> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
offlineTypeEnum | No | The type of password. Valid values:
|
offset | No | The page number. |
limit | No | The maximum number of entries to be returned per page. |
offlinePasswordStatusEnum | No | The status of the password. Valid values:
|
Parameters of callback for OfflinePasswordListBean
Parameter | Description |
---|---|
opModeSubType | The subtype of opModeType . |
pwdTypeEnum | The type of password. Valid values:
|
hasClearPwd | Indicates whether a clearing code is generated. |
timeZoneId | The time zone. |
mobile | The mobile phone number. |
opModeType | The unlocking method. Valid values:
|
gmtCreate | The time when the password was created. Unit: milliseconds. |
gmtStart | The time when the password takes effect. Unit: milliseconds. |
gmtExpired | The time when the password expires. Unit: milliseconds. |
pwdTypeCode | The type of password. Valid values:
|
optUid | The user ID (UID). |
revokedPwdName | The name of the clearing code. |
pwdName | The name of the password. |
pwdId | The password ID. |
pwd | The password. |
deliveryStatus | Indicates whether the password is confirmed to be sent. |
The email address. | |
statusEnum | The status of the password. Valid values:
|
API description
void getNoLimitOfflinePassword(ITuyaResultCallback<ArrayList<OfflineTempPasswordBean>> callback);
Example
iPhotoLock?.getNoLimitOfflinePassword(object :
ITuyaResultCallback<ArrayList<OfflineTempPasswordBean>> {
override fun onSuccess(result: ArrayList<OfflineTempPasswordBean>?) {
ToastUtil.shortToast(mContext, "password:${result?.toString()}")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
Returns the hardware SN in an unlocking method reported by a smart video lock. This hardware SN applies to an unlocking method, such as a temporary password.
void getDeviceSN(String dpId,ITuyaResultCallback<Integer> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
dpId | No | The value of dpId for an unlocking method, such as an online temporary password. |
callback | Yes | The hardware SN returned. |
Example
iVideoLock?.getDeviceSN( "69", object : ITuyaResultCallback<Int> {
override fun onSuccess(result: Int?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
void createOnlineTempPassword(int sn, String password, long effectiveTime, long invalidTime,
int availableTimes, String name, List<ScheduleBean> scheduleBean, ITuyaResultCallback<String> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
sn | No | The hardware SN of the temporary password. |
password | No | The password that is 4 to 15 characters in length. |
effectiveTime | No | The time when the password takes effect. Unit: milliseconds or seconds. |
invalidTime | No | The time when the password expires. Unit: milliseconds or seconds. |
availableTimes | No | The number of times the password can be used. Valid values:
|
name | Yes | The name of the password. |
scheduleBean | No | The days on which the password is valid within a week. |
scheduleBean.allDay | No | Specifies whether the password is valid all day long. |
scheduleBean.effectiveTime | Yes | The time when a password becomes valid on that day. Unit: minutes. |
scheduleBean.invalidTime | Yes | The time when a password expires on that day. Unit: minutes. For example, to make the password valid from 10:30 to 12:00, apply these settings: effectiveTime=10\*60+30 and invalidTime = 12\*60 . However, this parameter does not apply when allDay=true is used. |
scheduleBean.workingDay | No | The number of valid days within a week. The bit for a valid day is set to 1 and that for an invalid day is set to 0 . The bits represent [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday] sequentially from left to right. For example, to make the password valid only on Monday and Tuesday, set this parameter to 1001111 , convert the binary value to a decimal value, and then pass in the conversion result. |
Return data
Parameter | Description |
---|---|
unlockBindingId | The ID of the temporary password. |
Example
val scheduleBean = ScheduleBean()
scheduleBean.allDay = true
scheduleBean.workingDay = 127
val list: MutableList<ScheduleBean> = ArrayList()
list.add(scheduleBean)
iVideoLock?.createOnlineTempPassword(sn,
"123124",
System.currentTimeMillis() / 1000,
System.currentTimeMillis() + 24 * 60 * 60,
0,
"online pwd ",
list,
object : ITuyaResultCallback<String> {
override fun onSuccess(result: String?) {
ToastUtil.shortToast(mContext, "pwd :${result}")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
Updates an online password, and modifies the date when the password takes effect, as well as its name and validity period.
void updateOnlineTempPassword(String unlockBindingId, String password, long effectiveTime,
long invalidTime, String name, int phase,
List<ScheduleBean> scheduleBean, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
unlockBindingId | No | The ID of the temporary password. |
password | No | The password. |
effectiveTime | No | The time when the password takes effect. Unit: milliseconds or seconds. |
invalidTime | No | The time when the password expires. Unit: milliseconds or seconds. |
name | Yes | The name of the password. |
phase | No | The status of the password. Valid values:
|
scheduleBean | No | The days on which the password is valid within a week. |
scheduleBean.allDay | No | Specifies whether the password is valid all day long. |
scheduleBean.effectiveTime | Yes | The time when a password becomes valid on that day. Unit: minutes. |
scheduleBean.invalidTime | Yes | The time when a password expires on that day. Unit: minutes. For example, to make the password valid from 10:30 to 12:00, apply these settings: effectiveTime=10\*60+30 and invalidTime = 12\*60 . However, this parameter does not apply when allDay=true is used. |
scheduleBean.workingDay | No | The number of valid days within a week. The bit for a valid day is set to 1 and that for an invalid day is set to 0 . The bits represent [Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, and Saturday] sequentially from left to right. For example, to make the password valid only on Monday and Tuesday, set this parameter to 1001111 , convert the binary value to a decimal value, and then pass in the conversion result. |
Example
val scheduleBean = ScheduleBean()
scheduleBean.allDay = true
scheduleBean.workingDay = 127
val list: MutableList<ScheduleBean> = ArrayList()
list.add(scheduleBean) iVideoLock?.updateOnlineTempPassword("unlockBindingId","2223334",System.currentTimeMillis()/1000,
System.currentTimeMillis()/1000+24*60*60,"online pwd update${num}",2,list,object :IResultCallback{
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "update success ")
}
})
API description
void updateOnlineTempPasswordName(String unlockBindingId, String name, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
unlockBindingId | No | The ID of the temporary password. |
name | Yes | The name of the password. |
Example
iVideoLock?.updateOnlineTempPasswordName(
"unlockBindingId",
"online update",
object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "update success ")
}
})
API description
void deleteOnlineTempPassword(String unlockBindingId, IResultCallback callback);
Example
iVideoLock?.deleteOnlineTempPassword("unlockBindingId", object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "success ")
}
})
API description
void getOfflineTempPassword(long gmtStart, long gmtExpired, OfflineTypeEnum offlineTypeEnum,
String countryCode, String pwdName, String mobile, ITuyaResultCallback<OfflineTempPasswordBean> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
gmtStart | No | The time when the password takes effect. Unit: seconds. |
gmtExpired | No | The time when the password expires. Unit: seconds. |
offlineTypeEnum | No | The type of password. Valid values:
|
countryCode | Yes | The country code. |
pwdName | Yes | The name of the password. |
mobile | Yes | The mobile phone number. |
Example
iVideoLock?.getOfflineTempPassword(System.currentTimeMillis() / 1000,
System.currentTimeMillis() / 1000 + 48 * 60 * 60,
OfflineTypeEnum.MULTIPLE,
"86",
"offline pwd test",
"",
object : ITuyaResultCallback<OfflineTempPasswordBean> {
override fun onSuccess(result: OfflineTempPasswordBean?) {
ToastUtil.shortToast(mContext, result?.toString())
result?.let {
offlinePwdList.add(it.unlockBindingId)
}
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
void setOfflineTempPasswordName(String pwdName, String unlockBindingId, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
unlockBindingId | No | The ID of the temporary password. |
pwdName | Yes | The name of the password. |
Example
iVideoLock?.setOfflineTempPasswordName(
"Offline pwd tt ",
"unlockBindingId",
object : IResultCallback {
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext, error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext, "update success")
}
})
API description
void getClearCode(String pwdName, String unlockBindingId, ITuyaResultCallback<OfflineTempPasswordBean> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
unlockBindingId | No | The ID of the temporary password. |
pwdName | Yes | The name of the password. |
Example
iVideoLock?.getClearCode(
"clear code",
"unlockBindingId",
object : ITuyaResultCallback<OfflineTempPasswordBean> {
override fun onSuccess(result: OfflineTempPasswordBean?) {
ToastUtil.shortToast(mContext, result?.toString())
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
API description
Returns a list of online and offline passwords.
void getTempPasswordList(ITuyaResultCallback<ArrayList<VideoLockTempPasswordBean>> callback);
Parameters of ClearCodeInfo
in callback for VideoLockTempPasswordBean
Parameter | Description |
---|---|
unlockBindingId | The ID of the temporary password. |
effectiveTime | The time when the password takes effect. |
invalidTime | The time when the password expires. |
name | The name of the password. |
phase | The status of the password. Valid values:
|
effective | The validity status. Valid values:
|
opModeType | The unlocking method. Valid values:
|
opModeSubType | The subtype of opModeType . |
sn | The hardware SN reported by the device. |
opModeInfo | The information about the clearing code. |
hasClearPwd | Indicates whether a clearing code is set. |
revokedPwdName | The name of the clearing code. |
revokedPwdEffectiveTime | The validity period of the clearing code. |
revokedPwdInvalidTime | The time when the clearing code expires. |
Example
iVideoLock?.getTempPasswordList(object :
ITuyaResultCallback<ArrayList<VideoLockTempPasswordBean>> {
override fun onSuccess(result: ArrayList<VideoLockTempPasswordBean>?) {
ToastUtil.shortToast(mContext, result?.toString())
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext, errorMessage)
}
})
Lock members are classified into home members and non-home members.
Home member: the same as that defined in the Smart Life App SDK. The Smart Lock SDK can be used to bind a lock password ID with a home member account. For more information, see Home Management.
Non-home members: an individual member of a smart lock, only bound with the device. This member can be created and assigned. The Smart Lock SDK can be used to bind a lock password ID with this member.
This section describes the operations regarding non-home members.
ILockBaseAbilityManager getBaseAbilityManager();
Example
val iTuyaLockManager = TuyaOptimusSdk.getManager(ITuyaLockManager::class.java)
val iVideoLockManager = iTuyaLockManager?.newVideoLockManagerInstance(mDevId)
val iLockBaseAbilityManager = iVideoLockManager?.baseAbilityManager
API description
Adds a lock panel member. Different from a home member, a lock member does not need to be registered and not have permissions to manage other devices that are bound with the current account. A lock member is created to bind an unlocking method with a log entry.
void addUser(String name, File avatar, String sex, Long birthday, Integer height,
Integer weight, String heightUnit, ITuyaResultCallback<String> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
name | No | The username of a member. |
avatar | Yes | The file of a user avatar. |
sex | Yes | The gender of the member. |
birthday | Yes | The birthday of the member. |
height | Yes | The height of the member. |
weight | Yes | The weight of the member. |
heightUnit | Yes | The unit of the height. Valid values:
|
Callback | Yes | The callback. |
Example
iLockBaseAbilityManager?.addUser("User",null,"0",System.currentTimeMillis(),
180,80,"CM",object :ITuyaResultCallback<String>{
override fun onSuccess(result: String?) {
ToastUtil.shortToast(mContext,"Add Success")
}
override fun onError(errorCode: String?, errorMessage: String?) {
ToastUtil.shortToast(mContext,errorMessage)
}
})
API description
Updates the name and avatar of a member.
void updateUser(String userId, String userName, File avatar, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
userId | No | The user ID. |
userName | Yes | The username of a member. |
avatar | Yes | The file of a user avatar. |
Callback | Yes | The callback. |
Example
iLockBaseAbilityManager?.updateUser("userId","User",null,
object :IResultCallback{
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext,error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext,"Modify Success")
}
})
API description
void deleteUser(String userId, IResultCallback callback);
Example
iLockBaseAbilityManager?.deleteUser("userid",object :IResultCallback{
override fun onError(code: String?, error: String?) {
ToastUtil.shortToast(mContext,error)
}
override fun onSuccess() {
ToastUtil.shortToast(mContext,"Delete Success")
}
})
API description
void getUsersList(ITuyaResultCallback<ArrayList<WifiLockUserBean>> callback);
Parameters of callback for WifiLockUserBean
Parameter | Description |
---|---|
userId | The member ID. |
avatarUrl | The avatar of the member. |
userContact | The contact information of the member. |
nickName | The nickname of the member. |
userType | The user type of the member. Valid values:
|
lockUserId | The user ID on the lock. |
unlockCountMap | The array of the unlocking method quantities. Each key is set to a value of dpId . |
unlockList | The list of unlocking method names. |
Example
iLockBaseAbilityManager?.getUsersList(object :ITuyaResultCallback<ArrayList<WifiLockUserBean>>{
override fun onSuccess(result: ArrayList<WifiLockUserBean>?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
Returns details of a member.
void getUserDetail(String userId, ITuyaResultCallback<WifiLockUserDetail> callback);
Parameters of callback for WifiLockUserDetail
Parameter | Description |
---|---|
userId | The member ID. |
avatarUrl | The avatar of the member. |
userContact | The contact information of the member. |
nickName | The nickname of the member. |
userType | The user type of the member. Valid values:
|
unlockDetail | The list of unlocking methods. |
unlockDetail.dpId | The value of dpId for an unlocking method. |
unlockDetail.unlockList | The details of an unlocking method. |
unlockList.opModeId | The ID of an unlocking method in the cloud. |
unlockList.unlockId | The ID of an unlocking method. |
unlockList.admin | Indicates whether an unlocking method is used by an administrator. |
unlockList.unlockName | The name of an unlocking method. |
unlockList.unlockAttr | The attribute of an unlocking method. 1 : indicates a duress alarm. |
unlockList.photoUnlock | Indicates whether capture when unlocking is enabled. |
unlockList.allocateFlag | Indicates whether a locking method can be unbound from a member. Valid values:
|
Example
iLockBaseAbilityManager?.getUserDetail(userId,object :ITuyaResultCallback<WifiLockUserDetail>{
override fun onSuccess(result: WifiLockUserDetail?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
Returns the number of home members and non-home members.
void getUserCount(ITuyaResultCallback<Pair<Integer, Integer>> callback);
Parameters
Parameter | Description |
---|---|
Pair.first | The number of home members. |
Pair.second | The number of non-home members. |
ILockBaseAbilityManager getBaseAbilityManager();
Example
val iTuyaLockManager = TuyaOptimusSdk.getManager(ITuyaLockManager::class.java)
val iVideoLockManager = iTuyaLockManager?.newVideoLockManagerInstance(mDevId)
val iLockBaseAbilityManager = iVideoLockManager?.baseAbilityManager
API description
void getLatestLog(int userType, String userId, ITuyaResultCallback<LatestLogBean> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
userType | No | The type of member. Valid values:
|
userId | No | The user ID.
|
Callback | Yes | The callback. |
Parameters of callback for LatestLogBean
Parameter | Description |
---|---|
logCategory | The log category. Valid values:
|
logType | The type of log. |
recordType | The type of unlocking log entry without a respective locking log entry. Valid values:
|
unlockNameRosettaKey | The multilingual setting of a locking log entry. |
currentUser | Indicates whether the recorded action is taken by the current user. |
userId | The user ID. |
userName | The username. |
unlockName | The name of the unlocking method. |
time | The time when an event occurs. |
relateDevName | The name of the associated device. |
relateOpMode | The details of the associated unlocking method. |
unReadCount | The number of unchecked log entries. |
data | The details of an alarm or operation log entry. |
channelId | The channel ID dedicated for an access control device. |
unionUnlockInfo | The information about a combination unlocking method. |
unionUnlockInfo.currentUser | Indicates whether the combination unlocking method is used by the current user. |
unionUnlockInfo.sn | The hardware SN of the device that is bound with the combination unlocking method. |
Example
iLockBaseAbilityManager?.getLatestLog(
0,
"userId",
object : ITuyaResultCallback<LatestLogBean> {
override fun onSuccess(result: LatestLogBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
Returns a list of log entries.
void getLogList(String logCategories, String userIds, boolean onlyShowMediaRecord, Long startTime, Long endTime,
String lastRowKey, int limit, int userType, String userId, ITuyaResultCallback<LogsListBean> callback);
Parameters
Parameter | Optional | Description |
---|---|---|
logCategories | Yes | The log category. Valid values:
|
userIds | Yes | The list of user IDs to be returned, separated with commas (,). Example: 12,13 . |
onlyShowMediaRecord | No | Indicates whether only log entries with images or video files are returned. Default value: false , used to return all log entries. |
startTime | Yes | The start time of the period to be queried. Unit: milliseconds. |
endTime | Yes | The end time of the period to be queried. Unit: milliseconds. |
lastRowKey | Yes | The row key of the last entry on each page. |
limit | No | The maximum number of entries to be returned per page. |
userType | Yes | The type of member. Valid values:
|
userId | Yes | The user ID.
|
Callback | Yes | The callback. |
Parameters of MediaInfo
in callback for LogsListBean
and LogsInfoBean
Parameter | Description |
---|---|
hasMore | Indicates whether additional data is available. |
lastRowKey | The row key of the last entry on each page. |
records | The information about the log entries. |
records.logType | The type of log. |
records.data | The data of a data point (DP). |
records.recordType | The type of unlocking log entry without a respective locking log entry. Valid values:
|
records.dpId | The ID of a DP. |
records.unlockName | The name of an unlocking method. The value can be empty. |
records.userName | The username. |
records.userId | The user ID. |
records.currentUser | Indicates whether the recorded action was taken by the current user. |
records.memberBindableFlag | Indicates whether an unlocking method can be bound with a member. |
records.logId | The log ID. |
records.time | The time when an event occurred. |
records.logCategory | The log category. Valid values:
|
records.mediaInfoList | The information about video files and images. This parameter applies to smart video locks, Wi-Fi low-power locks, and keepalive locks when these locks can generate video files and images. |
mediaInfoList.fileUrl | The URL of a cover image. |
mediaInfoList.fileKey | The secret key that is used to decrypt a cover image. |
mediaInfoList.mediaPath | The relative address of a video file. |
mediaInfoList.mediaBucket | The bucket where a video file is located. |
mediaInfoList.mediaKey | The secret key that is used to decrypt a video file. |
Example
iLockBaseAbilityManager?.getLogList("",
null,
false,
null,
System.currentTimeMillis(),
"",
20,
0,
"userid",
object : ITuyaResultCallback<LogsListBean> {
override fun onSuccess(result: LogsListBean?) {
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
API description
By default, the API methods respecting API management are bound with users. This API method can be called to bind recorded unlocking methods with a user.
void bindUnlockWaysToUser(String userId, String[] unlockIds, IResultCallback callback);
Parameters
Parameter | Optional | Description |
---|---|---|
unlockIds | No | The list of unlocking methods. Each element in the list consists of the type of locking method and the unlocking method ID, concatenated with a hyphen (-) in between. Example: [12-01,13-02]. |
userId | No | The user ID.
|
Callback | Yes | The callback. |
Example
val array = arrayOf("${logsInfoBean.dpId}-${logsInfoBean.data}")
iLockBaseAbilityManager?.bindUnlockWaysToUser("the userid will be bound",
array, object : IResultCallback {
override fun onError(code: String?, error: String?) {
}
override fun onSuccess() {
}
})
API description
void getDevicePhotoRotateAngel(ITuyaResultCallback<JSONObject> callback);
Example
val iTuyaLockManager = TuyaOptimusSdk.getManager(ITuyaLockManager::class.java)
iTuyaVideoLockManager = iTuyaLockManager.newVideoLockManagerInstance(mDevId)
iTuyaVideoLockManager?.getDevicePhotoRotateAngel(object :ITuyaResultCallback<JSONObject>{
override fun onSuccess(result: JSONObject?) {
TODO("Not yet implemented")
}
override fun onError(errorCode: String?, errorMessage: String?) {
TODO("Not yet implemented")
}
})
API description
void getAlbumList(ITuyaResultCallback<AlbumBean> callback);
Parameters of AlbumInfo
in callback for AlbumBean
Parameter | Description |
---|---|
eventTypes | The types of cover images and video files returned in an album. |
albumList | The list of albums. |
albumList.eventType | The type of file. For more information, see Definitions of camera lock events. |
albumList.fileUrl | The URL of a cover image. |
albumList.fileKey | The secret key that is used to decrypt a cover image. |
albumList.mediaPath | The URL of a video file. |
albumList.mediaKey | The secret key that is used to decrypt a video file. |
albumList.mediaBucket | The bucket where a video file is located. |
albumList.uploadTime | The time when a file was uploaded. |
Destroys an API method if respective features are no longer required. This helps to avoid possible errors. This API method applies to the classes IVideoLock
, IPhotoLock
, and ILockBaseAbilityManager
. This API method is called in the following example:
void onDestroy();
Event status | Description | Status value |
---|---|---|
Status 1 | Anti-pry alert | 0x0000 |
Status 2 | Remote unlocking request | 0x0001 |
Status 3 | Fingerprint attempt failed | 0x0002 |
Status 4 | Password attempt failed | 0x0003 |
Status 5 | Card attempt failed | 0x0004 |
Status 6 | Face recognition failed | 0x0005 |
Status 7 | Palm print recognition failed | 0x0006 |
Status 8 | Finger vein recognition failed | 0x0007 |
Status 9 | Unlock with fingerprint | 0x0008 |
Status 10 | Unlock with password | 0x0009 |
Status 11 | Unlock with card | 0x000A |
Status 12 | Unlock with face recognition | 0x000B |
Status 13 | Unlock with palm vein | 0x000C |
Status 14 | Unlock with finger vein | 0x000D |
Status 15 | Unlock with temporary password | 0x000E |
Status 16 | Unlock with dynamic password | 0x000F |
Status 17 | Remote unlocking | 0x0010 |
Status 18 | Report offline password unlocking | 0x0011 |
Status 19 | Report doorbell request | 0x0012 |
Status 20 | Duress alarm | 0x0013 |
Status 21 | Low battery alert | 0x0014 |
Status 22 | Mechanical key attempt | 0x0015 |
Status 23 | High temperature alert | 0x0016 |
Status 24 | Doorbell ringing and remote unlocking | 0x0017 |
Status 25 | Loitering alert | 0x0018 |
Status 26 | Lock tampering | 0x0019 |
Status 27 | Unlock with special fingerprint | 0x001A |
Status 28 | Unlocking in arm mode | 0x001B |
Status 29 | Unlock with remote control | 0x001C |
Is this page helpful?
YesFeedbackIs this page helpful?
YesFeedback