门锁基础 API

更新时间:2023-11-27 09:12:52下载pdf

门锁基础能力 API 主要包含:临时密码、成员管理、日志能力等功能。当前这些功能主要针对拍照锁(categoryCodewf_jtmspro)和可视门锁(categoryCodevideolock_1w_1)。

类名 说明
ThingSmartLockApi 门锁基础 API 封装类

临时密码说明

临时密码分为在线临时密码和离线临时密码:

  • 在线临时密码:是指在生成密码时设备必须在线,生成后同步到门锁上。

  • 离线临时密码:在生成密码时设备不需要在线。但是离线密码的删除不同于在线密码。离线密码清除需要获取清空码,在门锁上输入清空码,即可清除掉离线密码。

不同的门锁品类获取在线和离线密码使用不同的接口。拍照锁(categoryCodewf_jtmspro)和可视门锁(categoryCodevideolock_1w_1)拥有不同的实现。

拍照锁临时密码

创建在线临时密码

接口说明

创建一个临时密码。

- (void)addPhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                          name:(NSString *)name
                                         phone:(NSString *)phone
                                 effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                      password:(NSString *)password
                                      schedule:(NSString *)schedule
                                   countryCode:(NSString *)countryCode
                                     availTime:(NSInteger)availTime
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
phone 手机号
effectiveTime 生效时间
invalidTime 失效时间
password 密码
schedule 周期
countryCode 手机的国家码
availTime 可用次数
success 接口成功回调
failure 接口失败回调

示例代码

- (void)addPhotoLockTemporaryPasswordAPITest{
    [self.lockAPI addPhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                    name:@"pwd1111"
                                                   phone:@""
                                           effectiveTime:1659333273374
                                             invalidTime:1659938073374
                                                password:@"1234567"
                                                schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                             countryCode:@"86"
                                               availTime:0
                                                 success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

更新在线密码名称

接口说明

- (void)updatePhotoLockTemporaryPasswordNameWithDevId:(NSString *)devId
                                                pwdId:(NSInteger )pwdId
                                                 name:(NSString *)name
                                              success:(ThingSuccessID)success
                                              failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
name 名称
success 接口成功回调
failure 接口失败回调

示例代码

- (void)updatePhotoLockTemporaryPasswordNameAPITest{
    [self.lockAPI updatePhotoLockTemporaryPasswordNameWithDevId:@"6ce91a406cebe66b1f1gep"
                                                          pwdId:4575053
                                                           name:@"kandi-test-1"
                                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

删除在线临时密码

接口说明

- (void)deletePhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                            pwdId:(NSInteger )pwdId
                                          success:(ThingSuccessID)success
                                          failure:(nullable ThingFailureError)failure;);

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)deletePhotoLockTemporaryPasswordAPITest{
    [self.lockAPI deletePhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                      pwdId:4575053
                                                    success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取在线密码列表

接口说明

- (void)getPhotoLockTemporaryPasswordWithDevId:(NSString *)devId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getPhotoLockTemporaryPasswordAPITest{
    [self.lockAPI getPhotoLockTemporaryPasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                 success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

获取拍照锁离线密码

离线密码只能由云端生成,返回给客户端。

接口说明

- (void)addPhotoLockOfflinePasswordWithDevId:(NSString *)devId
                                     pwdType:(NSString *)pwdType
                                    gmtStart:(NSInteger)gmtStart
                                  gmtExpired:(NSInteger)gmtExpired
                                     pwdName:(NSString *)pwdName
                                 countryCode:(NSString *)countryCode
                                      mobile:(NSString *)mobile
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型
  • 0:多次
  • 1:单次
  • 9:清空密码
gmtStart 开始时间
gmtExpired 结束时间
pwdName 密码名称
countryCode 手机号国家码
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)addPhotoLockOfflinePasswordAPITest{
    [self.lockAPI addPhotoLockOfflinePasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                               pwdType:@"1"
                                              gmtStart:0
                                            gmtExpired:[[NSDate date] timeIntervalSince1970]
                                               pwdName:@"kandi test"
                                           countryCode:@""
                                                mobile:@""
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

设置离线密码名称

接口说明

- (void)setPhotoLockOfflinePasswordNameWithDevId:(NSString *)devId
                                           pwdId:(NSInteger )pwdId
                                         pwdName:(NSString *)pwdName
                                          mobile:(NSString *)mobile
                                         success:(ThingSuccessID)success
                                         failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
pwdName 密码名称
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)setPhotoLockOfflinePasswordNameAPITest{
    [self.lockAPI setPhotoLockOfflinePasswordNameWithDevId:@"6ce91a406cebe66b1f1gep"
                                                     pwdId:3586192
                                                   pwdName:@"CESHIxxx"
                                                    mobile:@""
                                                   success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取离线密码的清空码

接口说明

- (void)getPhotoLockOfflineEmptyCodeWithDevId:(NSString *)devId
                                        pwdId:(NSInteger )pwdId
                                      success:(ThingSuccessID)success
                                      failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdId 密码编号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getPhotoLockOfflineEmptyCodeAPITest{
    [self.lockAPI getPhotoLockOfflineEmptyCodeWithDevId:@"6ce91a406cebe66b1f1gep"
                                                  pwdId:3586192
                                                success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取离线临时密码列表

接口说明

- (void)getOfflinePasswordListWithDevId:(NSString *)devId
                                pwdType:(NSString *)pwdType
                                 status:(NSInteger)status
                                 offset:(NSInteger)offset
                                  limit:(NSInteger)limit
                                success:(ThingSuccessID)success
                                failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型
  • 0:多次
  • 1:单次
  • 9:清除所有清空码
status 密码状态
  • 1:已生成,待使用
  • 2:已使用过一次
  • 3:失效
offset 页码
limit 记录数,默认 50
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getOfflinePasswordListAPITest{
    [self.lockAPI getOfflinePasswordListWithDevId:@"6c05de1dbb2e4fef15z4va"
                                          pwdType:@"0,1,9"
                                           status:-1
                                           offset:0
                                            limit:20
                                          success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取不限次数的离线临时密码列表

接口说明

- (void)getReavailableOfflinePasswordWithDevId:(NSString *)devId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getReavailableOfflinePasswordAPITest{
    [self.lockAPI getReavailableOfflinePasswordWithDevId:@"6ce91a406cebe66b1f1gep"
                                                 success:^(id result) {
                        //TODO
    }
                                                 failure:^(NSError *error) {
                        //TODO
    }];
}

可视门锁临时密码

获取设备硬件编号 SN

接口说明

硬件上报的开门方式的 SN 码,用于创建临时密码等开门方式。

- (void)getVideoLockSnNumberWithDevId:(NSString *)devId
                                 dpId:(NSInteger)dpId
                              success:(ThingSuccessID)success
                              failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
dpId 开门方式 DP Id
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getVideoLockSnNumberAPITest{
    [self.lockAPI getVideoLockSnNumberWithDevId:@"6c05de1dbb2e4fef15z4va"
                                           dpId:69
                                        success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

创建在线临时密码

接口说明

- (void)addVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                          name:(NSString *)name
                                      password:(NSString *)password
                                 effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                     availTime:(NSInteger)availTime
                                            sn:(NSInteger)sn
                                      schedule:(NSString *)schedule
                                      symbolic:(BOOL)symbolic
                                      dpTunnel:(NSInteger)dpTunnel
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
password 密码内容
effectiveTime 生效时间
invalidTime 失效时间
availTime 可用次数
sn 临时密码编号
schedule 周期
symbolic 是否需要下发 DP
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道
  • 1:App 下发
  • 2:云端下发
  • 3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

- (void)addVideoLockTemporaryPasswordAPITest{
    [self.lockAPI addVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                                    name:@"kandi-1"
                                                password:@"5678212"
                                           effectiveTime:1659333273
                                             invalidTime:1659938073
                                               availTime:0
                                                      sn:41
                                                schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                                symbolic:NO
                                                dpTunnel:2
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

更新在线密码

接口说明

更新密码,修改生效日期、生效失效、密码名称。

- (void)updateBLELockTemporaryPasswordWithDevId:(NSString *)devId
                                           name:(NSString *)name
                                       password:(NSString *)password
                                unlockBindingId:(NSInteger )unlockBindingId
                                  effectiveTime:(NSInteger)effectiveTime
                                   invalidTime:(NSInteger)invalidTime
                                          phase:(NSInteger)phase
                                      schedule:(NSString *)schedule
                                      symbolic:(BOOL)symbolic
                                      dpTunnel:(NSInteger)dpTunnel
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 密码名称
password 密码内容
unlockBindingId 密码编号
effectiveTime 生效时间
invalidTime 失效时间
phase 状态
  • 2:正常
  • 4:冻结
schedule 周期
symbolic 是否需要下发 DP
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道
  • 1:App 下发
  • 2:云端下发
  • 3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

- (void)updateBLELockTemporaryPasswordAPITest{
    [self.lockAPI updateBLELockTemporaryPasswordWithDevId:@"6c75c3ahtsybmyx7"
                                                     name:@"test"
                                                 password:@"1234567"
                                          unlockBindingId:6071699
                                            effectiveTime:1665306701584
                                              invalidTime:1665316701584
                                                    phase:2
                                                 schedule:@"[{\"allDay\":true,\"effectiveTime\":360,\"invalidTime\":1080,\"workingDay\":127}]"
                                                 symbolic:YES
                                                 dpTunnel:1
                                                  success:^(id result) {
                        //TODO
    }
                                                  failure:^(NSError *error) {
                        //TODO
    }];
}

更新在线密码名称

接口说明

- (void)updateVideoLockTemporaryPasswordNameWithDevId:(NSString *)devId
                                      unlockBindingId:(NSInteger )unlockBindingId
                                                 name:(NSString *)name
                                              success:(ThingSuccessID)success
                                              failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
name 名称
success 接口成功回调
failure 接口失败回调

示例代码

- (void)updateVideoLockTemporaryPasswordNameAPITest{
    [self.lockAPI updateVideoLockTemporaryPasswordNameWithDevId:@"6c05de1dbb2e4fef15z4va"
                                                unlockBindingId:5664269
                                                           name:@"kandi-test-1"
                                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

删除在线临时密码

接口说明

- (void)deleteVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                  unlockBindingId:(NSInteger )unlockBindingId
                                         symbolic:(BOOL)symbolic
                                         dpTunnel:(NSInteger)dpTunnel
                                          success:(ThingSuccessID)success
                                          failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
symbolic 是否需要下发 DP
dpTunnel 如果需要下发 DP,当前需要走的 DP 下发通道
  • 1:App 下发
  • 2:云端下发
  • 3:混合下发
success 接口成功回调
failure 接口失败回调

示例代码

- (void)deleteVideoLockTemporaryPasswordAPITest{
    [self.lockAPI deleteVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                            unlockBindingId:5664211
                                                   symbolic:YES
                                                   dpTunnel:1
                                                    success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取离线临时密码

接口说明

- (void)addVideoLockOfflinePasswordWithDevId:(NSString *)devId
                                     pwdType:(NSString *)pwdType
                                    gmtStart:(NSInteger)gmtStart
                                  gmtExpired:(NSInteger)gmtExpired
                                     pwdName:(NSString *)pwdName
                                 countryCode:(NSString *)countryCode
                                      mobile:(NSString *)mobile
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
pwdType 密码类型
  • 0:多次
  • 1:单次
  • 9:清除密码
gmtStart 开始时间
gmtExpired 结束时间
pwdName 密码名称
countryCode 手机号国家码
mobile 手机号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)addVideoLockOfflinePasswordAPITest{
    [self.lockAPI addVideoLockOfflinePasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                               pwdType:@"1"
                                              gmtStart:0
                                            gmtExpired:[[NSDate date] timeIntervalSince1970]
                                               pwdName:@"KANDI TEST xxx"
                                           countryCode:@""
                                                mobile:@""
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

设置离线临时密码名称

接口说明

- (void)setVideoLockOfflinePasswordNameWithDevId:(NSString *)devId
                                 unlockBindingId:(NSInteger )unlockBindingId
                                         pwdName:(NSString *)pwdName
                                         success:(ThingSuccessID)success
                                         failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
pwdName 密码名称
success 接口成功回调
failure 接口失败回调

示例代码

- (void)setVideoLockOfflinePasswordNameAPITest{
    [self.lockAPI setVideoLockOfflinePasswordNameWithDevId:@"6c05de1dbb2e4fef15z4va"
                                           unlockBindingId:5684380
                                                   pwdName:@"KANDI TEST"
                                                   success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

获取离线密码的清空码

接口说明

- (void)getVideoLockOfflineEmptyCodeWithDevId:(NSString *)devId
                              unlockBindingId:(NSInteger )unlockBindingId
                                         name:(NSString *)name
                                      success:(ThingSuccessID)success
                                      failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
unlockBindingId 密码编号
name 离线删除密码的名称
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getVideoLockOfflineEmptyCodeAPITest{
    [self.lockAPI getVideoLockOfflineEmptyCodeWithDevId:@"6c05de1dbb2e4fef15z4va"
                                        unlockBindingId:5694232
                                                   name:@"KANDI TEST"
                                                success:^(id result) {
       //TODO
    } failure:^(NSError *error) {
       //TODO
    }];
}

获取临时密码列表

接口说明

同时获取在线密码和离线密码。

- (void)getVideoLockTemporaryPasswordWithDevId:(NSString *)devId
                                     authTypes:(NSArray *)authTypes
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
authTypes 查询的授权类型
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getVideoLockTemporaryPasswordAPITest{
    [self.lockAPI getVideoLockTemporaryPasswordWithDevId:@"6c05de1dbb2e4fef15z4va"
                                               authTypes:@[@"LOCK_OFFLINE_TEMP_PWD",@"LOCK_TEMP_PWD"]
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

成员管理

成员分为 家庭成员非家庭成员(门锁成员)

  • 家庭成员:涂鸦 智能生活 App SDK 中的家庭成员概念。门锁 SDK 将对应的门锁密码编号与该账号关联起来。相关管理操作,请参考 家庭管理

  • 非家庭成员:即为门锁设备单独的成员,仅跟随设备关联。用户可以创建并分配,门锁 SDK 将对应的门锁密码编号与该成员关联起来。

本小节主要介绍门锁成员中 非家庭成员 的管理操作。

添加门锁成员

接口说明

即门锁面板成员。与家庭成员不同,被添加门锁成员不需要注册账户,没有权限管理当前账户下的其他设备。门锁成员的主要目的是关联开门方式和日志记录。

- (void)addPhotoLockPanelMemberWithDevId:(NSString *)devId
                                    name:(NSString *)name
                                  avatar:(NSString *)avatar
                                     sex:(NSString *)sex
                                birthday:(NSInteger)birthday
                                  height:(NSInteger)height
                                  weight:(NSInteger)weight
                         localHeightUnit:(NSString *)localHeightUnit
                                 success:(ThingSuccessID)success
                                 failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
name 用户名称
avatar 头像信息
sex 性别
  • 0:未知
  • 1:男
  • 2:女
birthday 生日(时间戳)
height 身高
weight 体重
localHeightUnit 单位
  • CM:厘米
  • INCH:英寸
success 接口成功回调
failure 接口失败回调

示例代码

- (void)addPhotoLockPanelMemberAPITest{
    [self.lockAPI addPhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                              name:@"kandi.test"
                                            avatar:@""
                                               sex:@""
                                          birthday:1
                                            height:174
                                            weight:120
                                   localHeightUnit:@"cm"
                                           success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

更新成员信息

接口说明

更新成员名称、头像。

- (void)updatePhotoLockPanelMemberWithDevId:(NSString *)devId
                                     userId:(NSString *)userId
                                   userName:(NSString *)userName
                                     avatar:(NSString *)avatar
                                    success:(ThingSuccessID)success
                                    failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户编号
userName 用户名称
avatar 头像信息
success 接口成功回调
failure 接口失败回调

示例代码

- (void)updatePhotoLockPanelMemberAPITest{
    [self.lockAPI updatePhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                               userId:@"000001wt8r"
                                             userName:@"kandi.test.1"
                                               avatar:@""
                                              success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

删除成员

接口说明

- (void)deletePhotoLockPanelMemberWithDevId:(NSString *)devId
                                     userId:(NSString *)userId
                                    success:(ThingSuccessID)success
                                    failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)deletePhotoLockPanelMemberAPITest{
    [self.lockAPI deletePhotoLockPanelMemberWithDevId:@"6ce91a406cebe66b1f1gep"
                                               userId:@"000001wt8r"
                                              success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取成员列表

接口说明

- (void)getPhotoLockMemberPanelListWithDevId:(NSString *)devId
                                     success:(ThingSuccessID)success
                                     failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getPhotoLockMemberPanelListAPITest{
    [self.lockAPI getPhotoLockMemberPanelListWithDevId:@"6ce91a406cebe66b1f1gep"
                                               success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

成员详情

接口说明

获取成员详细信息。

- (void)getPhotoLockPanelMemberDetailWithDevId:(NSString *)devId
                                        userId:(NSString *)userId
                                       success:(ThingSuccessID)success
                                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getPhotoLockPanelMemberDetailAPITest{
    [self.lockAPI getPhotoLockPanelMemberDetailWithDevId:@"6ce91a406cebe66b1f1gep"
                                                  userId:@"000001wt8r"
                                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取成员数量

接口说明

获取家庭成员数量和门锁成员数量。

- (void)getPhotoLockMemberCountWithDevId:(NSString *)devId
                                 success:(ThingSuccessID)success
                                 failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getPhotoLockMemberCountAPITest{
    [self.lockAPI getPhotoLockMemberCountWithDevId:@"6ce91a406cebe66b1f1gep"
                                           success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

日志功能

获取最近的一条记录

接口说明

- (void)getLatestDeviceLogWithDevId:(NSString *)devId
                           userType:(NSInteger)userType
                             userId:(NSString *)userId
                            success:(ThingSuccessID)success
                            failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userType 用户体系类型
  • 0:家庭体系
  • 1:面板用户体系
userId 用户编号
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getLatestDeviceLogAPITest{
    [self.lockAPI getLatestDeviceLogWithDevId:@"6ce91a406cebe66b1f1gep"
                                     userType:1
                                       userId:[ThingSmartUser sharedInstance].uid
                                      success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取日志记录

接口说明

获取日志记录列表。

- (void)getDeviceLogsWithDevId:(NSString *)devId
                 logCategories:(NSString *)logCategories
                       userIds:(NSString *)userIds
           onlyShowMediaRecord:(BOOL)onlyShowMediaRecord
                     startTime:(NSInteger)startTime
                       endTime:(NSInteger)endTime
                    lastRowKey:(NSString *)lastRowKey
                      userType:(NSInteger)userType
                        userId:(NSString *)userId
                         limit:(NSInteger)limit
                       success:(ThingSuccessID)success
                       failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
logCategories 日志大类
userIds 需要筛选的用户列表
onlyShowMediaRecord 是否筛选带图像的记录
startTime 开始时间
endTime 结束时间
lastRowKey 查询分页的参数
userType 用户体系类型,空默认的是家庭用户体系
  • 0:家庭体系
  • 1:面板用户体系
userId 面板用户编号
limit 每页数据个数
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getDeviceLogsAPITest{
    //日志大类。操作日志:operation,开门记录:unlock_record,关门记录:close_record,告警记录:alarm_record
    [self.lockAPI getDeviceLogsWithDevId:@"6ce91a406cebe66b1f1gep"
                           logCategories:@"unlock_record"
                                 userIds:nil
                     onlyShowMediaRecord:NO
                               startTime:0
                                 endTime:[[NSDate date] timeIntervalSince1970]*1000
                              lastRowKey:nil
                                userType:0
                                  userId:nil
                                   limit:10
                                 success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

开门记录绑定到用户

接口说明

默认日志记录中的接口和用户是关联的,此接口可以将开门记录和用户绑定。

- (void)bindHistoryLogToUserWithDevId:(NSString *)devId
                               userId:(NSString *)userId
                            unlockIds:(NSArray *)unlockIds
                              success:(ThingSuccessID)success
                              failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
userId 用户 ID
unlockIds 解锁方式列表
success 接口成功回调
failure 接口失败回调

示例代码

- (void)bindHistoryLogToUserAPITest{
    [self.lockAPI bindHistoryLogToUserWithDevId:@"6ce91a406cebe66b1f1gep"
                                         userId:[ThingSmartUser sharedInstance].uid
                                      unlockIds:@[@"12-01",@"13-02"]
                                        success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

其他

获取图像旋转角度

接口说明

- (void)getDeviceRotateWithDevId:(NSString *)devId
                         success:(ThingSuccessID)success
                         failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getDeviceRotateAPITest{
    [self.lockAPI getDeviceRotateWithDevId:@"6ce91a406cebe66b1f1gep"
                                   success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

获取相册列表

接口说明

- (void)getAlbumListWithDevId:(NSString *)devId
                      success:(ThingSuccessID)success
                      failure:(nullable ThingFailureError)failure;

参数说明

参数 说明
devId 设备 ID
success 接口成功回调
failure 接口失败回调

示例代码

- (void)getAlbumListAPITest{
    [self.lockAPI getAlbumListWithDevId:@"6ce91a406cebe66b1f1gep"
                                success:^(id result) {
                        //TODO
    } failure:^(NSError *error) {
                        //TODO
    }];
}

销毁

接口说明

当不再使用相关功能时,调用销毁方法,避免程序发生异常。拿到 ThingSmartWiFiLockDevice 对象 cameraType 属性,调用属性协议 ThingSmartCameraType 方法 destory 进行销毁。

附录

拍照锁事件定义

事件状态 描述 状态值
状态 1 防撬告警 0x0000
状态 2 远程开门请求 0x0001
状态 3 指纹开门试错 0x0002
状态 4 密码开门试错 0x0003
状态 5 卡片开门试错 0x0004
状态 6 人脸开门试错 0x0005
状态 7 掌纹开门试错 0x0006
状态 8 指静脉开门试错 0x0007
状态 9 指纹开门 0x0008
状态 10 密码开门 0x0009
状态 11 卡片开锁 0x000A
状态 12 人脸开锁 0x000B
状态 13 掌静脉开锁 0x000C
状态 14 指静脉开锁 0x000D
状态 15 临时密码解锁 0x000E
状态 16 动态密码解锁 0x000F
状态 17 远程解锁 0x0010
状态 18 离线密码解锁上报 0x0011
状态 19 门铃解锁上报 0x0012
状态 20 劫持告警 0x0013
状态 21 低电报警 0x0014
状态 22 钥匙插入报警 0x0015
状态 23 高温报警 0x0016
状态 24 门铃+远程开门 0x0017
状态 25 有人停留(逗留) 0x0018
状态 26 门锁被破坏 0x0019
状态 27 特殊指纹开锁 0x001A
状态 28 布防模式下开锁 0x001B
状态 29 遥控开门 0x001C