WITTE Mobile Library 3.1.0

WITTE Mobile Library 3.1.0

WITTE Digital 维护。



  • acct<blob>=0x50617373776F726473C2A06E6F74C2A07361766564 Passwords0240not0240saved

witte-mobile-mobile-library-for-objc

为 Objective-C 编写的 WITTE Mobile Library 提供了额外的类和方法,以进一步协助在移动应用程序的范围内整合 WITTE 后端和 Tapkey SDK。

功能

  • flinkey Box ID 转换:将 flinkey Box ID 转换为物理锁 ID 格式,反之亦然。
  • flinkey Box 反馈解释:解析和解释 10 字节的数据反馈,以确定箱子是否已打开或关闭。

开始使用

常数

/**
 * The tenant id used with the Tapkey backend.
 */
FOUNDATION_EXPORT NSString* const WD_TENANT_ID;

/**
 * The id token type used to authenticate with the Tapkey backend.
 */
FOUNDATION_EXPORT NSString* const WD_IP_ID;

/**
 * The Bluetooth LE service UUID of a flinkey box.
 */
FOUNDATION_EXPORT NSString* const WD_BLE_SERIVCE_UUID;

/**
 * The Bluetooth LE advertising format for flinkey box 2.4.
 */
FOUNDATION_EXPORT NSString* const WD_BLE_ADVERTISING_FORMAT_V1;

/**
 * The Bluetooth LE advertising format for flinkey box 3.3.
 */
FOUNDATION_EXPORT int const WD_BLE_ADVERTISING_FORMAT_V2;

flinkey Box ID 转换

通过对吻盒ID或物理锁ID进行识别,吻盒ID实际上就是另一个盒ID的代表。盒ID实际上是印在盒子上的,由4组十六进制数字组成(例如:C1-08-F0-94)。物理锁ID是盒ID的编码版本(例如:BADBCPCU),在Tapkey移动库的API中使用。这个库提供了在两种表示之间进行转换的方法。

盒ID到物理锁ID

#import "WDBoxIdConverter.h"
#import "WDByteUtils.h"

NSString* const BoxId = @"C1-08-F0-94";

WDBoxIdConverter* converter = [[WDBoxIdConverter alloc]init];
NSString* physicalLockId = [converter toPhysicalLockIdWithBoxId:BoxId];

物理锁ID到盒ID

#import "WDBoxIdConverter.h"
#import "WDByteUtils.h"

NSString* const PhysicalLockId = @"BADBCPCU";

WDBoxIdConverter* converter = [[WDBoxIdConverter alloc]init];
NSString* boxId = [converter toBoxIdWithPhysicalLockId:PhysicalLockId];

盒子反馈解释

为了确定盒子是否已打开或关闭,需要评估触发锁异步方法调用结果中包含的10字节盒子反馈。这个库提供了10字节盒子反馈的解析器,可以确定盒子的状态。

#import "WDBoxFeedback.h"
#import "WDByteUtils.h"

NSString* const str = @"4C420FFA5008003700D8";
NSData* data = [WDByteUtils toByteArray:str];
WDBoxFeedback* boxFeedback = [[WDBoxFeedback alloc]initWithResponseData:data];

if(boxFeedback.boxState == WDBoxStateLocked) {
    // the box has been locked
}
else if(boxFeedback.boxState == WDBoxStateUnlocked) {
    // the box has been opened
}
else if(boxFeedback.boxState == WDBoxStateDrawerOpen) {
    // the drawer of the box is opened
}