Preserve incoming disconnect handling and exercise resolved-service notification

This commit is contained in:
evgeny committed 2026-10-29 19:50:44 +01:00
1 parent 51621e6240
commit 7dab663b93
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -373,9 +373,9 @@ static int properties(struct ble_backend* b, const char* path, const char* inter
}
if (!strcmp(interface, DEVICE_IF)) {
struct bluez_link* l = find_device(b, path);
if (l && ((connected == 0 && l->connected) || (resolved == 0 && l->resolved)))
if (l && ((connected == 0 && (!l->outgoing || l->connected)) || (resolved == 0 && l->resolved)))
link_error(l, connected == 0 ? "device disconnected" : "GATT services invalidated");
else if (l && l->outgoing) {
else if (l && l->outgoing && (connected >= 0 || resolved >= 0)) {
if (connected >= 0) l->connected = connected;
if (resolved >= 0) l->resolved = resolved;
DEBUG_DEBUG(CAT, "BLE BlueZ readiness link=%llu connected=%d resolved=%d opened=%d",
+2 -1
View File
@@ -87,7 +87,8 @@ static int remote_state(sd_bus* b, const char* path, const char* i, const char*
}
static const sd_bus_vtable device_vtable[] = {
SD_BUS_VTABLE_START(0), SD_BUS_METHOD("Connect", "", "", simple, SD_BUS_VTABLE_UNPRIVILEGED),
SD_BUS_PROPERTY("Connected", "b", remote_state, 0, 0), SD_BUS_PROPERTY("ServicesResolved", "b", remote_state, 0, 0),
SD_BUS_PROPERTY("Connected", "b", remote_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_PROPERTY("ServicesResolved", "b", remote_state, 0, SD_BUS_VTABLE_PROPERTY_EMITS_CHANGE),
SD_BUS_VTABLE_END
};
static const sd_bus_vtable remote_vtable[] = {