Skip to content

Commit d0c5c42

Browse files
author
ctj
committed
优化dns处理机制
1 parent deb2a76 commit d0c5c42

20 files changed

+1065
-59
lines changed

app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ dependencies {
148148
}
149149
implementation rootProject.ext.dependencies["base_socket"]
150150
//第三方数据操作
151+
implementation rootProject.ext.dependencies["FastBle"]
151152
implementation rootProject.ext.dependencies["greendao"]
152153
//视频播放
153154
implementation rootProject.ext.dependencies["videoplay"]

app/src/main/AndroidManifest.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,13 @@
8080
<protected-broadcast android:name="com.chtj.add.keepalive.info.result" />
8181
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
8282

83+
<!-- 蓝牙相关 -->
84+
<uses-permission android:name="android.permission.BLUETOOTH" />
85+
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
86+
<!-- Android6.0及以上版本 蓝牙扫描才需要-->
87+
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
88+
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
89+
8390
<uses-permission
8491
android:name="android.permission.PACKAGE_USAGE_STATS"
8592
tools:ignore="ProtectedPermissions" />
@@ -182,6 +189,9 @@
182189

183190
<activity android:name=".test.TestAty"
184191
android:theme="@style/AppTheme" />
192+
<!--蓝牙测试-->
193+
<activity android:name=".bluetooth.BlueToothAty"
194+
android:theme="@style/AppTheme" />
185195
<!--在服务里面进行一些application应该执行的初始化操作-->
186196
<service
187197
android:name=".application.InitializeService"

app/src/main/java/com/wave_chtj/example/FeaturesOptionAty.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import com.wave_chtj.example.audio.PlayAudioAty;
4848
import com.wave_chtj.example.base.BaseActivity;
4949
import com.face_chtj.base_iotutils.UriPathUtils;
50+
import com.wave_chtj.example.bluetooth.BlueToothAty;
5051
import com.wave_chtj.example.crash.CrashTools;
5152
import com.wave_chtj.example.crash.MyService;
5253
import com.wave_chtj.example.download.FileDownLoadAty;
@@ -195,6 +196,7 @@ public void initData() {
195196
indexBeanList.add(new IndexBean(FKey.KEY_KEEPALIVE, new String[]{"ATY/SERVICE保活"}, IndexAdapter.LAYOUT_ONE));
196197
indexBeanList.add(new IndexBean(FKey.KEY_OTA, new String[]{"ota升级(RK|FC)"}, IndexAdapter.LAYOUT_ONE));
197198
indexBeanList.add(new IndexBean(FKey.KEY_INSTALL, new String[]{"静默安装"}, IndexAdapter.LAYOUT_ONE));
199+
indexBeanList.add(new IndexBean(FKey.KEY_BLUETOOTH, new String[]{"蓝牙测试"}, IndexAdapter.LAYOUT_ONE));
198200
indexBeanList.add(new IndexBean(FKey.KEY_CRASH, new String[]{"死机验证"}, IndexAdapter.LAYOUT_ONE));
199201
indexBeanList.add(new IndexBean(FKey.KEY_MORE, new String[]{"更多...."}, IndexAdapter.LAYOUT_ONE));
200202
}
@@ -441,6 +443,9 @@ public void run() {
441443
case FKey.KEY_INSTALL:
442444
startAty(InstallAPkAty.class);
443445
break;
446+
case FKey.KEY_BLUETOOTH:
447+
startAty(BlueToothAty.class);
448+
break;
444449
case FKey.KEY_MORE:
445450
ToastUtils.info("敬请期待!");
446451
break;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.wave_chtj.example.bluetooth;
2+
3+
import android.bluetooth.BluetoothDevice;
4+
import android.bluetooth.BluetoothGattCharacteristic;
5+
6+
public interface BlePeripheralCallback {
7+
/**
8+
* 连接状态改变
9+
* @param device 设备信息
10+
* @param status 状态
11+
* @param newState
12+
*/
13+
void onConnectionStateChange(BluetoothDevice device, int status, int newState);
14+
15+
/**
16+
* 写特征回调
17+
* @param device
18+
* @param requestId
19+
* @param characteristic
20+
* @param preparedWrite
21+
* @param responseNeeded
22+
* @param offset
23+
* @param requestBytes
24+
*/
25+
void onCharacteristicWriteRequest(BluetoothDevice device, int requestId, BluetoothGattCharacteristic characteristic, boolean preparedWrite, boolean responseNeeded, int offset, byte[] requestBytes);
26+
}

0 commit comments

Comments
 (0)