Skip to content
Permalink
Browse files

Changed default protocol to Sport

  • Loading branch information...
CrazyDude1994 committed Aug 5, 2019
1 parent e0c6c4a commit 39c0a4676e76f5c4b20289318d4c2bdbe5bf60f3
@@ -15,7 +15,7 @@ class BluetoothDataPoller(
csvOutputStream: FileOutputStream?
) : DataPoller {

private lateinit var protocol: CrsfProtocol
private lateinit var protocol: Protocol
private lateinit var thread: Thread
private var outputStreamWriter: OutputStreamWriter? = null

@@ -29,7 +29,7 @@ class BluetoothDataPoller(
listener.onConnected()
})
}
protocol = CrsfProtocol(listener)
protocol = FrSkySportProtocol(listener)
val buffer = ByteArray(1024)
while (!thread.isInterrupted && bluetoothSocket.isConnected) {
val size = bluetoothSocket.inputStream.read(buffer)
@@ -23,7 +23,7 @@ class BluetoothLeDataPoller(
csvOutputStream: FileOutputStream?
) : DataPoller {

private lateinit var protocol: CrsfProtocol
private lateinit var protocol: Protocol
private var outputStreamWriter: OutputStreamWriter? = null
private var connected = false
private var bluetoothGatt: BluetoothGatt?
@@ -34,7 +34,7 @@ class BluetoothLeDataPoller(
object : BluetoothGattCallback() {

private var serviceSelected = false
private val tempProtocols: HashMap<UUID, CrsfProtocol> = HashMap()
private val tempProtocols: HashMap<UUID, Protocol> = HashMap()
private val validPacketCount: HashMap<UUID, Int> = HashMap()

override fun onCharacteristicChanged(
@@ -93,7 +93,7 @@ class BluetoothLeDataPoller(
if (notifyCharacteristicList != null && notifyCharacteristicList.isNotEmpty()) {
notifyCharacteristicList.forEach { characteristic ->
val sportProtocol =
CrsfProtocol(object : DataDecoder.Companion.DefaultDecodeListener() {
FrSkySportProtocol(object : DataDecoder.Companion.DefaultDecodeListener() {

override fun onSuccessDecode() {
validPacketCount[characteristic.uuid] =
@@ -105,7 +105,7 @@ class BluetoothLeDataPoller(
notifyCharacteristicList.filter { it.uuid != entry.key }.forEach {
gatt.setCharacteristicNotification(it, false)
}
protocol = CrsfProtocol(listener)
protocol = FrSkySportProtocol(listener)
serviceSelected = true
runOnMainThread(Runnable {
listener.onConnected()
@@ -16,7 +16,7 @@ class LogPlayer(val originalListener: DataDecoder.Listener) : DataDecoder.Listen
private var dataReadyListener: DataReadyListener? = null
private var currentPosition: Int = 0
private var uniqueData = HashMap<Int, Int>()
private var protocol: Protocol = CrsfProtocol(this)
private var protocol: Protocol = FrSkySportProtocol(this)

private val task = @SuppressLint("StaticFieldLeak") object :
AsyncTask<File, Long, ArrayList<Protocol.Companion.TelemetryData>>() {
@@ -25,7 +25,7 @@ class LogPlayer(val originalListener: DataDecoder.Listener) : DataDecoder.Listen
val logFile = FileInputStream(file[0])
val arrayList = ArrayList<Protocol.Companion.TelemetryData>()

val tempProtocol = CrsfProtocol(this@LogPlayer, object : DataDecoder(this@LogPlayer) {
val tempProtocol = FrSkySportProtocol(this@LogPlayer, object : DataDecoder(this@LogPlayer) {
override fun decodeData(data: Protocol.Companion.TelemetryData) {
arrayList.add(data)
}

0 comments on commit 39c0a46

Please sign in to comment.
You can’t perform that action at this time.