Code Monkey home page Code Monkey logo

android_ttlock_demo's Introduction

"# Android_TTLock_Demo"

IDE

Android Studio

Minimum SDK Version

18

Introduce

TTLockLock

TTLockAPI

Bluetooth Interface

DeviceFirmwareUpdateApi

Device Firmware Upgrade Interface

TTLockLockGateway(you can control the lock by Network)

GatewayAPI

Gatwway Interface

Usage

Manifest Configure

uses-permission

Bluetooth Permission

<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />

Network Permission

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

Register Service

Register Bluetooth Service

<service android:name="com.ttlock.bl.sdk.service.BluetoothLeService" />

Register Device Firmware Upgrade Service

<service android:name="com.ttlock.bl.sdk.service.DfuService" android:exported="true" />

TTLock Usage

  1. Import ttlock-sdk-2.0.aar put ttlock-sdk-2.0.aar into libs directory in your project
  2. Instantiate TTLockCallback Object TTLockCallback mTTLockCallback = new TTLockCallback() { //TODO: Implement abstract methods }
  3. Init TTLockAPI Object mTTLockAPI = new TTLockAPI(mContext, mTTLockCallback);
  4. Turn on Bluetooth mTTLockAPI.requestBleEnable(Activity.this);
  5. Start Bluetooth Service mTTLockAPI.startBleService(mContext);
  6. Start Bluetooth Scan mTTLockAPI.startBTDeviceScan();

DeviceFirmwareUpdateApi Usage

  1. Instantiate DeviceFirmwareUpdateCallback Object DeviceFirmwareUpdateCallback deviceFirmwareUpdateCallback = new DeviceFirmwareUpdateCallback() { //TODO: Implement abstract methods }
  2. Init DeviceFirmwareUpdateApi Object deviceFirmwareUpdateApi = new DeviceFirmwareUpdateApi(mContext, mTTLockAPI, deviceFirmwareUpdateCallback);
  3. Get Lock Firmware Info deviceFirmwareUpdateApi.getLockFirmware( //TODO:params );
  4. Upgrade Firmware deviceFirmwareUpdateApi.upgradeFirmware( //TODO:params );
  5. retry when failed deviceFirmwareUpdateApi.retry();

android_ttlock_demo's People

Contributors

ttlock avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.