Show per-device BLE receive counts in desktop rows

This commit is contained in:
evgeny committed 2026-10-30 12:46:27 +01:00
1 parent 49cbb7e148
commit 184b02b342
3 files changed
+11 -3

No files matched your search

+3 -1
View File
@@ -342,7 +342,9 @@ int main(void) {
ble_backend_broadcast(backends[0]->owner, &ep, bytes, len, -30); bytes[2] = BLE_IDENTITY_VERSION;
assert(ble_etcp_neighbors(endpoints[0].driver, neighbors, 2) == 1 && neighbors[0].broadcast_received == 3);
/* Отдельный сосед имеет свой счётчик; его объявление не меняет счёт первого. */
int other_len = ble_identity_encode(self, endpoints[0].inst.node_id ^ 1, "other");
uint64_t other_node = 1;
while (other_node == endpoints[0].inst.node_id || other_node == endpoints[1].inst.node_id) other_node++;
int other_len = ble_identity_encode(self, other_node, "other");
ble_backend_broadcast(backends[0]->owner, &ep, self, other_len, -55);
assert(ble_etcp_neighbors(endpoints[0].driver, neighbors, 2) == 2);
assert(neighbors[0].broadcast_received == 3 && neighbors[1].broadcast_received == 1);
+6
View File
@@ -46,8 +46,14 @@ private slots:
ble_backend_broadcast(backend.owner, &endpoint, bytes, length, -42);
const auto peers = radio.snapshot().peers;
QCOMPARE(peers.size(), 1); QVERIFY(peers.first().contains("Android")); QVERIFY(peers.first().contains("-42"));
QVERIFY(peers.first().endsWith("RX 1"));
ble_backend_broadcast(backend.owner, &endpoint, bytes, length, -40);
QCOMPARE(radio.snapshot().peers.size(), 1);
QVERIFY(radio.snapshot().peers.first().endsWith("RX 2"));
length = ble_identity_encode(bytes, 2, "Renamed peer"); strcpy(endpoint.id, "new-address");
ble_backend_broadcast(backend.owner, &endpoint, bytes, length, -38);
const auto renamed = radio.snapshot().peers.first();
QVERIFY(renamed.contains("Renamed peer") && renamed.contains("NEW-ADDRESS") && renamed.endsWith("RX 3"));
radio.apply(1, "Renamed"); QVERIFY(advertised.isEmpty());
QCOMPARE(ble_backend_incoming(backend.owner, &endpoint), ble_link_id(0));
radio.apply(0, "Renamed"); QVERIFY(!radio.transport()); QCOMPARE(destructions, 1);
+2 -2
View File
@@ -100,9 +100,9 @@ DesktopBleSnapshot DesktopBle::snapshot() {
address = address.left(12);
for (int offset = 10; offset >= 2; offset -= 2) address.insert(offset, ':');
}
m_snapshot.peers.append(QStringLiteral("%1 · %2 · %3 · %4 dBm").arg(QString::fromUtf8(peer.identity.name),
m_snapshot.peers.append(QStringLiteral("%1 · %2 · %3 · %4 dBm · RX %5").arg(QString::fromUtf8(peer.identity.name),
QString::number(peer.identity.node_id, 16).rightJustified(16, '0'), address.toUpper(),
peer.rssi == 127 ? QStringLiteral("?") : QString::number(peer.rssi)));
peer.rssi == 127 ? QStringLiteral("?") : QString::number(peer.rssi)).arg(qulonglong(peer.broadcast_received)));
}
m_snapshot.connections = m_connections.size();
return m_snapshot;