File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed
src/main/java/com/bhm/ble/device Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -11,8 +11,8 @@ android {
1111 applicationId " com.bhm.ble"
1212 minSdk 24
1313 targetSdk 34
14- versionCode 230
15- versionName " 2.3.0 "
14+ versionCode 231
15+ versionName " 2.3.1 "
1616
1717 testInstrumentationRunner " androidx.test.runner.AndroidJUnitRunner"
1818 }
Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ plugins {
66
77// ext.GROUP = "com.lute.ble"
88// ext.POM_ARTIFACT_ID = "BleCore"
9- // ext.VERSION_NAME = "2.3.0 "
9+ // ext.VERSION_NAME = "2.3.1 "
1010// //引用gradle_upload.gradle
1111// apply from: "${project.rootDir}/maven_upload.gradle"
1212
@@ -19,7 +19,7 @@ afterEvaluate {
1919 // 这里头是artifacts的配置信息,不填会采用默认的
2020 groupId = ' com.github.buhuiming'
2121 artifactId = ' BleCore'
22- version = ' 2.3.0 '
22+ version = ' 2.3.1 '
2323
2424 from components. release
2525 artifact androidSourcesJar // 打包源码,去除这行打的包将看不到源码
Original file line number Diff line number Diff line change @@ -60,6 +60,8 @@ internal class BleConnectedDevice(val bleDevice: BleDevice) : BluetoothGattCallb
6060
6161 private var bleEventCallback: BleEventCallback ? = null
6262
63+ private val characters = (' a' .. ' z' ) + (' A' .. ' Z' ) + (' 0' .. ' 9' )
64+
6365 private fun initBleConnectRequest () {
6466 if (bleConnectRequest == null ) {
6567 bleConnectRequest = BleConnectRequest (bleDevice, this )
@@ -409,7 +411,7 @@ internal class BleConnectedDevice(val bleDevice: BleDevice) : BluetoothGattCallb
409411 bleWriteRequest?.writeData(
410412 serviceUUID,
411413 writeUUID,
412- System .currentTimeMillis().toString(),
414+ System .currentTimeMillis().toString() + generateRandomString() ,
413415 dataArray,
414416 writeType,
415417 bleWriteCallback
@@ -434,7 +436,7 @@ internal class BleConnectedDevice(val bleDevice: BleDevice) : BluetoothGattCallb
434436 bleWriteRequest?.writeQueueData(
435437 serviceUUID,
436438 writeUUID,
437- System .currentTimeMillis().toString(),
439+ System .currentTimeMillis().toString() + generateRandomString() ,
438440 dataArray,
439441 skipErrorPacketData,
440442 retryWriteCount,
@@ -529,4 +531,13 @@ internal class BleConnectedDevice(val bleDevice: BleDevice) : BluetoothGattCallb
529531 bleConnectRequest = null
530532 bleEventCallback = null
531533 }
534+
535+ /* *
536+ * 从[characters]中随机生成5个字符组成的字符串
537+ */
538+ private fun generateRandomString (): String {
539+ return (1 .. 5 )
540+ .map { characters.random() }
541+ .joinToString(" " )
542+ }
532543}
You can’t perform that action at this time.
0 commit comments