卡片管理

更新时间:2024-06-11 08:23:01下载pdf

获取门锁已录入的卡片列表

接口说明

- (void)getCardListWithSiteId:(long long)siteId
                     deviceId:(NSString *)deviceId
                       pageNo:(NSInteger)pageNumber
                     pageSize:(NSInteger)pageSize
                      success:(ThingLockCardSuccessList)success
                      failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
pageNo 页码
pageSize 每页数量
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared getCardListWithSiteId:siteId
                                          deviceId:self.devId
                                            pageNo:self.pageNo
                                          pageSize:20
                                           success:^(NSArray<ThingLockCardModel *> * _Nullable list, NSInteger totalPage) {

} failure:^(NSError *error) {

}];

获取卡片详情

接口说明

- (void)getCardDetailWithSiteId:(long long)siteId
                       deviceId:(NSString *)deviceId
                         cardId:(NSString *)cardId
                        success:(ThingLockCardSuccess)success
                        failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
cardId 卡片 ID
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared getCardDetailWithSiteId:siteId
                                deviceId:self.devId
                                  cardId:self.cardId
                               success:^(ThingLockCardModel * _Nullable model) {


} failure:^(NSError *error) {

}];

新增限时卡片

接口说明

- (void)createLimitCardWithSiteId:(long long)siteId
                         deviceId:(NSString *)deviceId
                         cardName:(NSString *)cardName
            effectiveTimeInterval:(NSTimeInterval)effectiveTimeInterval
              invalidTimeInterval:(NSTimeInterval)invalidTimeInterval
                          success:(ThingSuccessHandler)success
                          failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
lockDevId 门锁设备 ID
cardName 卡片名称
effectiveTimeInterval 生效时间的整点时间戳,单位秒。例如 15:32,则传入 15:00 的时间戳
invalidTimeInterval 失效时间的整点时间戳,单位秒。例如 18:24,则传入 18:00 的时间戳
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared createLimitCardWithSiteId:SiteManager.shared.siteId
                                         deviceId:self.devId
                                         cardName:self.nameLabel.text
                            effectiveTimeInterval:effectiveTime
                              invalidTimeInterval:invalidTime
                                          success:^{

} failure:^(NSError *error) {

}];

新增永久卡片

接口说明

- (void)createPermanentCardWithSiteId:(long long)siteId
                             deviceId:(NSString *)deviceId
                             cardName:(NSString *)cardName
                              success:(ThingSuccessHandler)success
                              failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
cardName 卡片名称
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared createPermanentCardWithSiteId:SiteManager.shared.siteId
                                         deviceId:self.devId
                                         cardName:self.nameLabel.text
                                          success:^{

} failure:^(NSError *error) {

}];

修改卡片名称

接口说明

- (void)updateNameWithSiteId:(long long)siteId
                    deviceId:(NSString *)deviceId
                      cardId:(NSString *)cardId
                    cardName:(NSString *)cardName
                     success:(ThingSuccessHandler)success
                     failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
cardId 卡片 ID
cardName 卡片名称
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared updateNameWithSiteId:siteId
                                             deviceId:self.devId
                                               cardId:self.cardId
                                             cardName:name
                                              success:^{

} failure:^(NSError *error) {

}];

删除卡片

接口说明

- (void)removeCardWithSiteId:(long long)siteId
                    deviceId:(NSString *)deviceId
                      cardId:(NSString *)cardId
                      lockId:(NSString *)lockId
                     success:(ThingSuccessHandler)success
                     failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
cardId 卡片 ID
lockId 当前卡片对应的 lockId,从卡片详情中获取,对应 lockId 字段
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared removeCardWithSiteId:siteId
                                         deviceId:self.devId
                                           cardId:self.cardId
                                           lockId:self.cardModel.lockId
                                          success:^{

} failure:^(NSError *error) {

}];

清空卡片

接口说明

- (void)clearAllCardWithSiteId:(long long)siteId
                       deviceId:(NSString *)deviceId
                        success:(ThingSuccessHandler)success
                        failure:(ThingFailureError)failure;

参数说明

参数 说明
siteId 站点 ID
deviceId 门锁设备 ID
success 成功回调
failure 失败回调

示例代码

[ThingLockCardManager.shared clearAllCardWithSiteId:siteId
                                           deviceId:self.devId
                                            success:^{

} failure:^(NSError *error) {
}];

清空卡片是指清除当前门锁所录入的全部卡片。