Latest 3.0.0
Homepage https://github.com/ttlock/iOS_SDK_Demo
License MIT
Platforms ios 9.0, requires ARC
Frameworks CoreBluetooth
Authors

Minimum iOS Target:

iOS 9.0

Minimum Xcode Version:

Xcode 10.2

Installation

By Cocoapods

First, add the following line to your Podfile:

use_frameworks!

target ‘YourAppTargetName’ do

pod ‘TTLock’

pod ‘TTLockDFU’( If you need to upgrade devices into your application )

pod ‘TTLockGateway’( If you need to support first generation gateway )

end

Second, pod install

Introduction

TTLock

TTLock has been designed to communicate with devices by mobile phone bluetooth.

TTGateway supports second generation gateway.

TTUtil provides methods to use specialValue and get type of lock.

TTLockDFU (Device Firmware Upgrade)

TTLockDFU has been designed to make it easy to upgrade devices into your application by mobile phone bluetooth.

TTLockGateway

TTLockGateway supports first generation gateway.

Usage

TTLock Usage

Initialize TTLock in the method{ didFinishLaunchingWithOptions} in AppDelegate (please do not call it in an asynchronous thread)

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {

     [TTLock setupBluetooth:^(TTBluetoothState state) {
        NSLog(@"##############  TTLock is working, bluetooth state: %ld  ##############",(long)state);
    }];
    return YES;
}

Scene: Unlock

 [TTLock controlLockWithControlAction:TTControlActionUnlock lockData:lockData success:^(long long lockTime, NSInteger electricQuantity, long long uniqueId) {
        NSLog(@"##############  Unlock successed power: %ld  ##############",(long)electricQuantity);
    } failure:^(TTError errorCode, NSString *errorMsg) {
        NSLog(@"##############  Unlock failed errorMsg: %@  ##############",errorMsg);
    }];

If you want to get log and set time immediately after unlocking, you can do the following:

- (void)unlockAndGetLogAndSetTime{

     //unlock
    [TTLock controlLockWithControlAction:TTControlActionUnlock lockData:lockData success:^(long long lockTime, NSInteger electricQuantity, long long uniqueId) {
        NSLog(@"##############  Unlock successed power: %ld  ##############",(long)electricQuantity);
    } failure:^(TTError errorCode, NSString *errorMsg) {
        NSLog(@"##############  Unlock failed errorMsg: %@  ##############",errorMsg);
    }];

     //get log
    [TTLock getOperationLogWithType:TTOperateLogTypeLatest lockData:lockData success:^(NSString *operateRecord) {
        NSLog(@"##############  Log: %@  ##############",operateRecord);
    } failure:^(TTError errorCode, NSString *errorMsg) {
        NSLog(@"##############  Get log failed errorMsg: %@  ##############",errorMsg);
    }];

     //set time
    long long timestamp = [[NSDate date] timeIntervalSince1970] * 1000;
    [TTLock setLockTimeWithTimestamp:timestamp lockData:lockData success:^{
        NSLog(@"##############  Set time successed  ##############");
    } failure:^(TTError errorCode, NSString *errorMsg) {
        NSLog(@"##############  Set time failed errorMsg: %@  ##############",errorMsg);
    }];
}

How to use SpecialValue

 BOOL isSuportPasscode = [TTUtil lockSpecialValue:_lockModel.specialValue suportFunction:TTLockSpecialFunctionPasscode];
 BOOL isSuportICCard = [TTUtil lockSpecialValue:_lockModel.specialValue suportFunction:TTLockSpecialFunctionICCard];
 BOOL isSuportFingerprint = [TTUtil lockSpecialValue:_lockModel.specialValue suportFunction:TTLockSpecialFunctionFingerprint];

Latest podspec

{
    "name": "TTLock",
    "version": "3.0.0",
    "summary": "TTLock SDK for iOS.",
    "homepage": "https://github.com/ttlock/iOS_SDK_Demo",
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": {
        "ttlock": "[email protected]"
    },
    "platforms": {
        "ios": "9.0"
    },
    "source": {
        "git": "https://github.com/ttlock/iOS_SDK_Demo.git",
        "tag": "3.0.0"
    },
    "vendored_frameworks": "TTLockFrameworks/TTLock.framework",
    "preserve_paths": "TTLockFrameworks/TTLock.framework",
    "frameworks": "CoreBluetooth",
    "libraries": "z",
    "requires_arc": true
}

Pin It on Pinterest

Share This