kopia lustrzana https://github.com/meshtastic/Meshtastic-Android
refactor: remove legacy BLE characteristic
rodzic
ffb402acde
commit
c0692b80ec
|
@ -37,7 +37,6 @@ import com.geeksville.mesh.model.UIViewModel
|
|||
import com.geeksville.mesh.model.primaryChannel
|
||||
import com.geeksville.mesh.model.shouldAddChannels
|
||||
import com.geeksville.mesh.model.toChannelSet
|
||||
import com.geeksville.mesh.repository.radio.BluetoothInterface
|
||||
import com.geeksville.mesh.service.*
|
||||
import com.geeksville.mesh.ui.*
|
||||
import com.geeksville.mesh.ui.map.MapFragment
|
||||
|
@ -355,8 +354,6 @@ class MainActivity : AppCompatActivity(), Logging {
|
|||
}
|
||||
}
|
||||
}
|
||||
} else if (BluetoothInterface.invalidVersion) {
|
||||
showAlert(R.string.firmware_too_old, R.string.firmware_old)
|
||||
}
|
||||
} catch (ex: RemoteException) {
|
||||
warn("Abandoning connect $ex, because we probably just lost device connection")
|
||||
|
|
|
@ -88,10 +88,6 @@ class BluetoothInterface @AssistedInject constructor(
|
|||
/// this service UUID is publicly visible for scanning
|
||||
val BTM_SERVICE_UUID: UUID = UUID.fromString("6ba1b218-15a8-461f-9fa8-5dcae273eafd")
|
||||
|
||||
var invalidVersion = false
|
||||
val EOL_FROMRADIO_CHARACTER: UUID =
|
||||
UUID.fromString("8ba2bcc2-ee02-4a55-a531-c525c5e454d5")
|
||||
|
||||
val BTM_FROMRADIO_CHARACTER: UUID =
|
||||
UUID.fromString("2c55e69e-4993-11ed-b878-0242ac120002")
|
||||
val BTM_TORADIO_CHARACTER: UUID =
|
||||
|
@ -119,7 +115,6 @@ class BluetoothInterface @AssistedInject constructor(
|
|||
?: throw RadioNotConnectedException("BLE service not found")
|
||||
|
||||
private lateinit var fromNum: BluetoothGattCharacteristic
|
||||
private lateinit var fromRadio: BluetoothGattCharacteristic
|
||||
|
||||
/**
|
||||
* With the new rev2 api, our first send is to start the configure readbacks. In that case,
|
||||
|
@ -199,6 +194,7 @@ class BluetoothInterface @AssistedInject constructor(
|
|||
/// Attempt to read from the fromRadio mailbox, if data is found broadcast it to android apps
|
||||
private fun doReadFromRadio(firstRead: Boolean) {
|
||||
safe?.let { s ->
|
||||
val fromRadio = getCharacteristic(BTM_FROMRADIO_CHARACTER)
|
||||
s.asyncReadCharacteristic(fromRadio) {
|
||||
try {
|
||||
val b = it.getOrThrow()
|
||||
|
@ -326,16 +322,6 @@ class BluetoothInterface @AssistedInject constructor(
|
|||
|
||||
fromNum = getCharacteristic(BTM_FROMNUM_CHARACTER)
|
||||
|
||||
// We changed UUIDs to be able to identify old firmware (<1.3.43)
|
||||
fromRadio = if (bservice.characteristics.map { it.uuid }
|
||||
.contains(EOL_FROMRADIO_CHARACTER)) {
|
||||
invalidVersion = true
|
||||
getCharacteristic(EOL_FROMRADIO_CHARACTER)
|
||||
} else {
|
||||
invalidVersion = false
|
||||
getCharacteristic(BTM_FROMRADIO_CHARACTER)
|
||||
}
|
||||
|
||||
// We treat the first send by a client as special
|
||||
isFirstSend = true
|
||||
|
||||
|
|
|
@ -30,7 +30,6 @@ import com.geeksville.mesh.model.DeviceVersion
|
|||
import com.geeksville.mesh.repository.datastore.RadioConfigRepository
|
||||
import com.geeksville.mesh.repository.location.LocationRepository
|
||||
import com.geeksville.mesh.repository.network.MQTTRepository
|
||||
import com.geeksville.mesh.repository.radio.BluetoothInterface
|
||||
import com.geeksville.mesh.repository.radio.RadioInterfaceService
|
||||
import com.geeksville.mesh.repository.radio.RadioServiceConnectionState
|
||||
import com.geeksville.mesh.util.*
|
||||
|
@ -1624,8 +1623,6 @@ class MeshService : Service(), Logging {
|
|||
newNodes.clear()
|
||||
newMyNodeInfo = null
|
||||
|
||||
if (BluetoothInterface.invalidVersion) onHasSettings() // Device firmware is too old
|
||||
|
||||
debug("Starting config nonce=$configNonce")
|
||||
|
||||
sendToRadio(ToRadio.newBuilder().apply {
|
||||
|
|
Ładowanie…
Reference in New Issue