Skip to content

Commit

Permalink
Changed default protocol to Sport
Browse files Browse the repository at this point in the history
  • Loading branch information
CrazyDude1994 committed Aug 5, 2019
1 parent e0c6c4a commit 39c0a46
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
Expand Up @@ -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

Expand All @@ -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)
Expand Down
Expand Up @@ -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?
Expand All @@ -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(
Expand Down Expand Up @@ -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] =
Expand All @@ -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()
Expand Down
Expand Up @@ -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>>() {
Expand All @@ -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)
}
Expand Down

0 comments on commit 39c0a46

Please sign in to comment.