Request maximum BLE advertising power and display radio power status
This commit is contained in:
1 parent
c8b6fb2736
commit
a819fe0f11
16 files changed
+262
-13
No files matched your search
@@ -50,6 +50,8 @@ BluetoothSettingsPage::BluetoothSettingsPage(const QString& path, UtunNode* node
|
||||
m_status = new QLabel(this); m_status->setWordWrap(true); m_status->setTextFormat(Qt::PlainText);
|
||||
m_advertisingStatus = new QLabel(this); m_advertisingStatus->setWordWrap(true); m_advertisingStatus->setTextFormat(Qt::PlainText);
|
||||
layout->addWidget(m_status); layout->addWidget(m_advertisingStatus);
|
||||
m_power = new QLabel(this); m_power->setObjectName("bluetoothPower");
|
||||
m_power->setWordWrap(true); m_power->setTextFormat(Qt::PlainText); layout->addWidget(m_power);
|
||||
layout->addWidget(new QLabel(QCoreApplication::translate("ChatGui", "Nearby VibeChat devices:"), this));
|
||||
m_peers = new QListWidget(this); layout->addWidget(m_peers, 1);
|
||||
auto* timer = new QTimer(this);
|
||||
@@ -70,6 +72,22 @@ void BluetoothSettingsPage::refresh() {
|
||||
m_advertisingStatus->setVisible((state.flags & 3) == 3);
|
||||
m_advertisingStatus->setText(state.advertising == BLE_READY ? QCoreApplication::translate("ChatGui", "Advertising is active") :
|
||||
QCoreApplication::translate("ChatGui", "Advertising: %1").arg(state.advertisingReason));
|
||||
m_power->setVisible(m_node && m_node->isRunning() && state.state == BLE_READY && (state.flags & 1));
|
||||
QStringList power;
|
||||
#ifdef Q_OS_LINUX
|
||||
power << QCoreApplication::translate("ChatGui", "Advertising power: maximum requested");
|
||||
if (state.advertisingPower.can_set == 0)
|
||||
power << QCoreApplication::translate("ChatGui", "Power selection is not supported by this adapter");
|
||||
else if (state.advertisingPower.can_set < 0)
|
||||
power << QCoreApplication::translate("ChatGui", "Power selection support: unavailable");
|
||||
#else
|
||||
power << QCoreApplication::translate("ChatGui", "Advertising power: managed by the system");
|
||||
#endif
|
||||
power << (state.advertisingPower.max_dbm == 127 ? QCoreApplication::translate("ChatGui", "Adapter advertising power limit: unavailable") :
|
||||
QCoreApplication::translate("ChatGui", "Adapter advertising power limit: %1 dBm").arg(state.advertisingPower.max_dbm));
|
||||
power << QCoreApplication::translate("ChatGui", "Actual advertising power: unavailable");
|
||||
power << QCoreApplication::translate("ChatGui", "Connection transmit power: unavailable to the application");
|
||||
m_power->setText(power.join('\n'));
|
||||
m_peers->clear(); m_peers->addItems(state.peers);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user