Android Studio
18
Bluetooth Interface
Device Firmware Upgrade Interface
Gatwway Interface
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<service android:name="com.ttlock.bl.sdk.service.BluetoothLeService" />
<service android:name="com.ttlock.bl.sdk.service.DfuService" android:exported="true" />
- Import ttlock-sdk-2.0.aar put ttlock-sdk-2.0.aar into libs directory in your project
- Instantiate TTLockCallback Object TTLockCallback mTTLockCallback = new TTLockCallback() { //TODO: Implement abstract methods }
- Init TTLockAPI Object mTTLockAPI = new TTLockAPI(mContext, mTTLockCallback);
- Turn on Bluetooth mTTLockAPI.requestBleEnable(Activity.this);
- Start Bluetooth Service mTTLockAPI.startBleService(mContext);
- Start Bluetooth Scan mTTLockAPI.startBTDeviceScan();
- Instantiate DeviceFirmwareUpdateCallback Object DeviceFirmwareUpdateCallback deviceFirmwareUpdateCallback = new DeviceFirmwareUpdateCallback() { //TODO: Implement abstract methods }
- Init DeviceFirmwareUpdateApi Object deviceFirmwareUpdateApi = new DeviceFirmwareUpdateApi(mContext, mTTLockAPI, deviceFirmwareUpdateCallback);
- Get Lock Firmware Info deviceFirmwareUpdateApi.getLockFirmware( //TODO:params );
- Upgrade Firmware deviceFirmwareUpdateApi.upgradeFirmware( //TODO:params );
- retry when failed deviceFirmwareUpdateApi.retry();