fix numeric entries and phy request

This commit is contained in:
Gilles Boccon-Gibod
2025-04-22 16:15:58 -07:00
parent 1bd83273e8
commit febed8179b
3 changed files with 10 additions and 7 deletions

View File

@@ -1291,8 +1291,10 @@ class Central(Connection.Listener):
logging.info(color('### Connected', 'cyan'))
self.connection.listener = self
print_connection(self.connection)
phy = await self.connection.get_phy()
print_connection_phy(phy)
if not self.classic:
phy = await self.connection.get_phy()
print_connection_phy(phy)
# Switch roles if needed.
if self.role_switch:

View File

@@ -381,7 +381,7 @@ fun MainView(
label = {
Text(text = "Packet Interval (ms)")
},
value = appViewModel.senderPacketInterval.toString(),
value = (if (appViewModel.senderPacketInterval != 0) appViewModel.senderPacketInterval else "").toString(),
modifier = Modifier
.fillMaxWidth()
.focusRequester(focusRequester),
@@ -389,7 +389,9 @@ fun MainView(
keyboardType = KeyboardType.Number, imeAction = ImeAction.Done
),
onValueChange = {
if (it.isNotEmpty()) {
if (it.isEmpty()) {
appViewModel.updateSenderPacketInterval(0)
} else {
val interval = it.toIntOrNull()
if (interval != null) {
appViewModel.updateSenderPacketInterval(interval)

View File

@@ -27,8 +27,8 @@ val DEFAULT_RFCOMM_UUID: UUID = UUID.fromString("E6D55659-C8B4-4B85-96BB-B1143AF
const val DEFAULT_PEER_BLUETOOTH_ADDRESS = "AA:BB:CC:DD:EE:FF"
const val DEFAULT_STARTUP_DELAY = 3000
const val DEFAULT_SENDER_PACKET_COUNT = 100
const val DEFAULT_SENDER_PACKET_SIZE = 1024
const val DEFAULT_SENDER_PACKET_INTERVAL = 100
const val DEFAULT_SENDER_PACKET_SIZE = 970 // 970 is a value that works well on Android.
const val DEFAULT_SENDER_PACKET_INTERVAL = 0
const val DEFAULT_PSM = 128
const val L2CAP_CLIENT_MODE = "L2CAP Client"
@@ -192,7 +192,6 @@ class AppViewModel : ViewModel() {
} else if (senderPacketSizeSlider < 0.5F) {
512
} else if (senderPacketSizeSlider < 0.7F) {
// 970 is a value that works well on Android.
970
} else if (senderPacketSizeSlider < 0.9F) {
2048