Skip to content

Commit

Permalink
add new sdk demo
Browse files Browse the repository at this point in the history
  • Loading branch information
lxk123 committed May 7, 2019
0 parents commit 818ac18
Show file tree
Hide file tree
Showing 131 changed files with 7,762 additions and 0 deletions.
11 changes: 11 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
*.iml
.gradle
/local.properties
/.idea/caches/build_file_checksums.ser
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
.DS_Store
/build
/captures
.externalNativeBuild
18 changes: 18 additions & 0 deletions .idea/gradle.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

36 changes: 36 additions & 0 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

38 changes: 38 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 12 additions & 0 deletions .idea/runConfigurations.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

39 changes: 39 additions & 0 deletions README.en.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# NewSDKAndroidDemo

#### Description
New SDK Android Demo

#### Software Architecture
Software architecture description
1.Lock Operate Api:TTLockClient
2.Lock firmware update Api:LockDfuClient
3.Gateway Api:GatewayClient

#### IDE
Android Studio

#### Minimum SDK Version
18

#### Installation
1. \ implementation 'com.tongtonglock:ttlock:3.0.0'
2. add permission in manifest
\<uses-permission android:name="android.permission.BLUETOOTH" /><br />
\<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /><br />
\<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
\<uses-permission android:name="android.permission.INTERNET" /> <br />
\<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

3. before use sdk,make sure bluetooth is enabled.

#### Instructions

1. init sdk : \GatewayClient.getDefault().prepareBTService(getApplicationContext());
2. use api:\TTLockClient.getDefault().startScanLock(new ScanLockCallback() {
@Override
public void onScanLockSuccess(ExtendedBluetoothDevice device) {

}
});
3. when Activity finished,you should close SDK service:\TTLockClient.getDefault().stopBTService();

41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# NewSDKAndroidDemo

#### 介绍
新版SDK Android端Demo
1.锁操作相关: TTLockClient
2.锁固件升级相关:LockDfuClient
3.网关操作相关:GatewayClient

#### IDE
Android Studio

#### Minimum SDK Version
18

## 使用说明
### 引入SDK
\ implementation 'com.tongtonglock:ttlock:3.0.0'

### manifest配置
#### 添加Permission
\<uses-permission android:name="android.permission.BLUETOOTH" /><br />
\<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" /><br />
\<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
\<uses-permission android:name="android.permission.INTERNET" /> <br />
\<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

### SDK初始化
#### 1)确保蓝牙开启
#### 2)SDK初始化 \GatewayClient.getDefault().prepareBTService(getApplicationContext());

#### 3)开始调用接口 比如扫描周围蓝牙智能锁:
\TTLockClient.getDefault().startScanLock(new ScanLockCallback() {
@Override
public void onScanLockSuccess(ExtendedBluetoothDevice device) {

}
});
### 重置SDK服务
#### 3)退出页面之后记得关闭SDK服务 \TTLockClient.getDefault().stopBTService();


2 changes: 2 additions & 0 deletions app/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/build

44 changes: 44 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 27
defaultConfig {
applicationId "ttlock.demo"
minSdkVersion 23
targetSdkVersion 27
versionCode 1
versionName "1.0"
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
buildConfigField "String", "API_URL", '"http://120.26.119.23:8085"'
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}

dataBinding {
enabled true
}

compileOptions {
targetCompatibility JavaVersion.VERSION_1_8
sourceCompatibility JavaVersion.VERSION_1_8
}
}

dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation "com.android.support:appcompat-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:recyclerview-v7:$rootProject.supportLibraryVersion"
implementation "com.android.support:design:$rootProject.supportLibraryVersion"
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
testImplementation 'junit:junit:4.12'
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
implementation 'com.google.code.gson:gson:2.6.2'
implementation 'com.tongtonglock:ttlock:3.0.0'
implementation 'com.squareup.retrofit2:retrofit:2.4.0'
implementation 'com.squareup.retrofit2:converter-gson:2.4.0'
}
21 changes: 21 additions & 0 deletions app/proguard-rules.pro
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html

# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}

# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable

# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package tool.pubhouse.com.ttlocksdkdemo;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;

import org.junit.Test;
import org.junit.runner.RunWith;

import static org.junit.Assert.*;

/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getTargetContext();

assertEquals("tool.pubhouse.com.ttlocksdkdemo", appContext.getPackageName());
}
}
61 changes: 61 additions & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="ttlock.demo">

<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.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
android:name=".MyApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/AppTheme">
<activity android:name=".AuthActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity android:name=".MainActivity">

<!-- <intent-filter> -->
<!-- <action android:name="android.intent.action.MAIN" /> -->


<!-- <category android:name="android.intent.category.LAUNCHER" /> -->
<!-- </intent-filter> -->
</activity>
<activity android:name=".lock.LockApiActivity" />
<activity android:name=".lock.ScanLockActivity" />
<activity android:name=".firmwareupdate.FirmwareUpdateActivity" />
<activity android:name=".lock.UnlockActivity" />
<activity android:name=".lock.EnableDisableSomeLockFuncionActivity" />
<activity android:name=".lock.PassageModeActivity" />
<activity android:name=".lock.LockTimeActivity" />
<activity android:name=".passcode.PasscodeActivity" />
<activity android:name=".passcode.CreateCustomPasscodeActivity" />
<activity android:name=".passcode.ModifyPasscodeActivity" />
<activity android:name=".passcode.AdminPasscodeActivity" />
<activity android:name=".fingerprint.FingerprintActivity" />
<activity android:name=".iccard.ICCardActivity" />
<activity android:name=".gateway.GatewayActivity" />
<activity android:name=".lock.UserLockActivity" />
<activity android:name=".fingerprint.MyFingerprintListActivity" />
<activity android:name=".fingerprint.FingerprintModifyActivity" />
<activity android:name=".iccard.MyICCardListActivity" />
<activity android:name=".iccard.ICCardModifyActivity" />
<activity android:name=".gateway.InitGatewayActivity" />
<activity android:name=".gateway.GatewayDfuActivity" />
<activity android:name=".gateway.UserGatewayActivity" />
<activity android:name=".IndexActivity"></activity>
</application>

</manifest>
Loading

0 comments on commit 818ac18

Please sign in to comment.