update design bl

This commit is contained in:
cheykrym 2026-04-01 02:02:58 +03:00
parent a82fcb39e2
commit 5a420b5031
2 changed files with 18 additions and 4 deletions

View File

@ -13,7 +13,7 @@ DEFAULT_SOUND_VOLUME = 100
DEFAULT_PREMUTE_VOLUME = 10
DEFAULT_DUCKING_VOLUME = 35
DEV_MODE_ENABLE = (Path(__file__).resolve().parent / "dev_mode_enable").exists()
BLUETOOTH_MAX_PAIRED_DEVICES = 2
BLUETOOTH_MAX_PAIRED_DEVICES = 5
def get_device_model() -> str:

View File

@ -11,6 +11,8 @@ from PySide6.QtCore import QObject, Signal
import build_info
MOCK_PAIRED_DEVICED = True
@dataclass
class BluetoothDevice:
@ -46,6 +48,18 @@ class BluetoothService(QObject):
mac = parts[1]
name = " ".join(parts[2:]) if len(parts) > 2 else ""
devices.append(BluetoothDevice(mac=mac, name=name))
# DEBUG: мок устройств для тестирования лимита
if MOCK_PAIRED_DEVICED:
real_count = len(devices)
missing = build_info.BLUETOOTH_MAX_PAIRED_DEVICES - real_count
for i in range(missing):
idx = real_count + i + 1
devices.append(BluetoothDevice(
mac=f"00:11:22:33:44:{idx:02X}",
name=f"Test Device {idx}"
))
return devices
def get_device_info(self, mac: str) -> dict[str, str]:
@ -93,10 +107,10 @@ class BluetoothService(QObject):
def make_discoverable(self, timeout_sec: int = 10) -> bool:
"""Сделать устройство видимым для сопряжения.
Args:
timeout_sec: Время видимости в секундах (по умолчанию 10).
Возвращает False, если достигнуто максимальное количество сопряженных устройств.
"""
# Проверка лимита сопряженных устройств
@ -104,7 +118,7 @@ class BluetoothService(QObject):
if len(paired_devices) >= build_info.BLUETOOTH_MAX_PAIRED_DEVICES:
self._last_error = "max_devices"
return False
self._last_error = ""
script_out = self._run_btctl_script(
[