Skip to content

Commit

Permalink
Merge pull request #56 from tw-mosip/remove-phy
Browse files Browse the repository at this point in the history
fix(INJI-39): skip request for PHY upgrade to PHY2 [ hotfix ]
  • Loading branch information
krishnakumar4a4 authored May 18, 2023
2 parents 66665fc + e29f09e commit f5f50e4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,6 @@ class GattClient(var context: Context) {
}
}

override fun onPhyRead(gatt: BluetoothGatt?, txPhy: Int, rxPhy: Int, status: Int) {
Log.d(logTag, "Central onPhyRead: txPhy: $txPhy, rxPhy: $rxPhy, status: $status")
}

override fun onPhyUpdate(gatt: BluetoothGatt?, txPhy: Int, rxPhy: Int, status: Int) {
Log.d(logTag, "Central onPhyUpdate: txPhy: $txPhy, rxPhy: $rxPhy, status: $status")
}

override fun onCharacteristicRead(
gatt: BluetoothGatt?,
characteristic: BluetoothGattCharacteristic?,
Expand Down Expand Up @@ -177,9 +169,6 @@ class GattClient(var context: Context) {
// TODO: In case device is never connected, how do we know?

gatt.requestConnectionPriority(CONNECTION_PRIORITY_HIGH)
gatt.readPhy()
gatt.setPreferredPhy(2, 2, 0)
gatt.readPhy()
this.bluetoothGatt = gatt
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class GattServer(private val context: Context) : BluetoothGattServerCallback() {
Log.i(logTag, "Connection initiated to central: $connect with device address: ${device?.address}")

onDeviceConnectedCallback(status, newState)
device?.let { setPhy(it) }
device
} else {
Log.i(logTag,"Received disconnect from central with device address: ${device?.address}")
Expand All @@ -90,14 +89,6 @@ class GattServer(private val context: Context) : BluetoothGattServerCallback() {
onMTUChangedCallback(allowedMTU)
}

private fun setPhy(bluetoothDevice: BluetoothDevice) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
gattServer.readPhy(bluetoothDevice)
gattServer.setPreferredPhy(bluetoothDevice, 2, 2, 0)
gattServer.readPhy(bluetoothDevice)
}
}

override fun onCharacteristicWriteRequest(
device: BluetoothDevice?,
requestId: Int,
Expand Down Expand Up @@ -144,14 +135,6 @@ class GattServer(private val context: Context) : BluetoothGattServerCallback() {
}
}

override fun onPhyRead(device: BluetoothDevice?, txPhy: Int, rxPhy: Int, status: Int) {
Log.d(logTag, "Peripheral onPhyRead: txPhy: $txPhy, rxPhy: $rxPhy, status: $status")
}

override fun onPhyUpdate(device: BluetoothDevice?, txPhy: Int, rxPhy: Int, status: Int) {
Log.d(logTag, "Peripheral onPhyUpdate: txPhy: $txPhy, rxPhy: $rxPhy, status: $status")
}

fun disconnect(): Boolean {
return if(bluetoothDevice != null) {
Log.d(logTag, "Disconnecting from central with device address: ${bluetoothDevice?.address}")
Expand Down

0 comments on commit f5f50e4

Please sign in to comment.