-
Notifications
You must be signed in to change notification settings - Fork 759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bluetooth-assisted Push to Talk (PTT) via Element Call #6464
base: develop
Are you sure you want to change the base?
Conversation
Ktlint Results👎 |
SonarCloud Quality Gate failed. |
@@ -128,14 +146,6 @@ class WidgetFragment @Inject constructor( | |||
} | |||
} | |||
|
|||
override fun onPause() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we possibly want to keep this for non-Element-Call widgets?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly, it is in my to-do list. Nice catch though, thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
|
||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { | ||
val notification = notificationUtils.buildBluetoothLowEnergyNotification() | ||
startForeground(Random.nextInt(), notification) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to kill the service when the WidgetFragment is destroyed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should also disconnect from the bluetooth device which it looks like we might not be doing currently
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
by setting the appropriate descriptor, which apparently is not a thing that setCharacteristicNotification does
Enable notifications for characteristic changes
|
||
override fun onScanResult(device: BluetoothDevice) { | ||
Timber.d("### WidgetFragment. New BLE device found: " + device.name + " - " + device.address) | ||
if (device.name == null || bluetoothDevices.map { it.address }.contains(device.address)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This kind of logic and even this method should not be in the fragment if we want to merge this into the develop at one point.
bluetoothManager | ||
?.adapter | ||
?.bondedDevices | ||
?.firstOrNull { it.name == "PTT-Z" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should improve the UX with extra screens to get rid of the hardcoded device name.
override fun onServicesDiscovered(gatt: BluetoothGatt, status: Int) { | ||
gatt.services.forEach { service -> | ||
service.characteristics.forEach { characteristic -> | ||
if (characteristic.uuid.equals(UUID.fromString("0000ffe1-0000-1000-8000-00805f9b34fb"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should improve the UX with extra screens to get rid of the hardcoded uuid.
service.characteristics.forEach { characteristic -> | ||
if (characteristic.uuid.equals(UUID.fromString("0000ffe1-0000-1000-8000-00805f9b34fb"))) { | ||
gatt.setCharacteristicNotification(characteristic, true) | ||
val descriptor = characteristic.getDescriptor(UUID.fromString("00002902-0000-1000-8000-00805f9b34fb")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should improve the UX with extra screens to get rid of the hardcoded uuid.
Signed-off-by: Johannes Marbach <[email protected]>
Suppress webview / checkbox permission dialog
SonarCloud Quality Gate failed. |
@onurays what is the status of the PR? |
The old one has disappeared from Netlify. This replaces it with a ROSA deployment like our live EC which shouldn't randomly go away.
Update to new Element Call URL
…feature/ons/ptt_bluetooth
…eature/ons/ptt_bluetooth
Allow events to be collected in the background
Start Element Call widget in its own task So that closing the app does not end a PTT call
@@ -17,8 +17,13 @@ | |||
package im.vector.app.features.widgets | |||
|
|||
import android.app.Activity | |||
import android.bluetooth.BluetoothDevice |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🚫 Unused import
import im.vector.app.databinding.FragmentRoomWidgetBinding | ||
import im.vector.app.features.settings.VectorPreferences | ||
import im.vector.app.features.webview.WebEventListener | ||
import im.vector.app.features.widgets.ptt.BluetoothLowEnergyDevice | ||
import im.vector.app.features.widgets.ptt.BluetoothLowEnergyDeviceScanner |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🚫 Unused import
@@ -46,17 +50,21 @@ import org.matrix.android.sdk.flow.flow | |||
import org.matrix.android.sdk.flow.mapOptional | |||
import org.matrix.android.sdk.flow.unwrap | |||
import timber.log.Timber | |||
import javax.inject.Inject |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- 🚫 Unused import
SonarCloud Quality Gate failed. |
Onuray Sahin seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
This is a proof-of-concept implementation of hardware-supported Push-to-Talk (PTT) using Element Call in a widget.
ptt_bottomsheet.mp4