Skip to content

Commit 32fe048

Browse files
committed
fix bug
1 parent cb8b092 commit 32fe048

File tree

7 files changed

+21
-18
lines changed

7 files changed

+21
-18
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ SDK中Demo与API接口采用Kotlin语言编写,希望你对Kotlin有一定的
2525
### gradle自动依赖
2626
在所需的module中的build.gradle文件下添加以下依赖即可:
2727
```groovy
28-
implementation 'cn.entertech:flowtimeble:1.0.2'
28+
implementation 'cn.entertech:biomoduleble:1.0.4'
2929
```
3030
### jar包集成
3131
如果你在自动依赖遇到问题也可以手动添加依赖

app/build.gradle

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ android {
2727
}
2828

2929
dependencies {
30-
implementation fileTree(dir: 'libs', include: ['*.jar'])
3130
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
3231
implementation 'com.android.support:appcompat-v7:28.0.0'
3332
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
@@ -38,5 +37,5 @@ dependencies {
3837
api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
3938
implementation "com.polidea.rxandroidble2:rxandroidble:1.8.0"
4039
implementation 'com.orhanobut:logger:1.15'
41-
// implementation 'cn.entertech:flowtimeble:1.0.3'
40+
implementation 'cn.entertech:biomoduleble:1.0.4'
4241
}
-76.8 KB
Binary file not shown.
77.1 KB
Binary file not shown.

ble/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,19 @@ dependencies {
4242
//添加
4343
apply plugin: 'com.novoda.bintray-release'
4444
publish {
45-
bintrayUser="lloyd95"
46-
bintrayKey="991689a1be9b7db7f30ead5ebea6f109cc1744d4"
45+
bintrayUser="hzentertech"
46+
bintrayKey="a5c7edd58f68d746817dce405483be33f6b0c219"
4747
//bintray.com用户名
48-
userOrg = 'lloyd95'
48+
userOrg = 'hzentertech'
4949
//jcenter上的路径
5050
groupId = 'cn.entertech'
5151
//项目名称
52-
artifactId = 'biomodule-ble'
52+
artifactId = 'biomoduleble'
5353
//版本号
54-
publishVersion = '1.0.1'
54+
publishVersion = '1.0.4'
5555
//描述,不重要
5656
desc = ''
5757
//网站,不重要
58-
website = 'https://github.com/Lloyd0577/MVPDemo'
58+
website = 'https://github.com/Entertech/Enter-Biomodule-BLE-Android-SDK'
5959
dryRun = false
6060
}

ble/src/main/java/cn/entertech/ble/BiomoduleBleManager.kt

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,17 @@ import cn.entertech.ble.util.BatteryUtil
88
import cn.entertech.ble.util.ByteArrayBean
99
import cn.entertech.ble.util.NapBleCharacter
1010
import io.reactivex.disposables.Disposable
11+
import java.util.concurrent.CopyOnWriteArrayList
1112

1213
class BiomoduleBleManager private constructor(context: Context) {
1314
val rxBleManager: RxBleManager
14-
private lateinit var handler: Handler
15-
private lateinit var handlerThread: HandlerThread
16-
val rawDataListeners = mutableListOf<(ByteArray) -> Unit>()
17-
val rawDataListeners4CSharp = mutableListOf<(ByteArrayBean) -> Unit>()
18-
val contactListeners = mutableListOf<(ContactState) -> Unit>()
19-
val batteryListeners = mutableListOf<(NapBattery) -> Unit>()
20-
val heartRateListeners = mutableListOf<(Int) -> Unit>()
15+
private var handler: Handler
16+
private var handlerThread: HandlerThread
17+
val rawDataListeners = CopyOnWriteArrayList<(ByteArray) -> Unit>()
18+
val rawDataListeners4CSharp = CopyOnWriteArrayList<(ByteArrayBean) -> Unit>()
19+
val contactListeners = CopyOnWriteArrayList<(ContactState) -> Unit>()
20+
val batteryListeners = CopyOnWriteArrayList<(NapBattery) -> Unit>()
21+
val heartRateListeners = CopyOnWriteArrayList<(Int) -> Unit>()
2122
var brainWaveDisposable: Disposable? = null
2223
var batteryDisposable: Disposable? = null
2324
var heartRateDisposable: Disposable? = null

ble/src/main/java/cn/entertech/ble/RxBleManager.kt

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ class RxBleManager private constructor(context: Context) {
3939
private lateinit var scanNearSubscription: Disposable
4040
private lateinit var scanSubscription: Disposable
4141
private val SCAN_TIMEOUT: Long = 10000
42-
private val DURATION_OF_SORT: Long = 5000
43-
private val CONNECT_TASK_DELAY: Long = 2000
42+
private val DURATION_OF_SORT: Long = 3000
43+
private val CONNECT_TASK_DELAY: Long = 1000
4444

4545
init {
4646
rxBleClient = RxBleClient.create(context)
@@ -142,6 +142,9 @@ class RxBleManager private constructor(context: Context) {
142142
this.rxBleConnection = rxBleConnection
143143
Logger.d("conn succ")
144144
success?.invoke(scanResult.bleDevice.macAddress)
145+
connectListeners.forEach {
146+
it.invoke(scanResult.bleDevice.macAddress)
147+
}
145148
}, { throwable ->
146149
isConnecting = false
147150
disConnectListeners.forEach {

0 commit comments

Comments
 (0)