Linux + iPhone Continuity / iMessage / SMS
fix: improve ANCS/LE reconnect reliability
Zack Bartel7e058b538534
diff --git a/docs/BLUETOOTH.md b/docs/BLUETOOTH.mdindex 9dacdb8..5c5de2f 100644--- a/docs/BLUETOOTH.md+++ b/docs/BLUETOOTH.md@@ -2526,7 +2526,7 @@ iPhone's Control Center audio picker. Adding `a2dp_sink` produced the card insta```$ pactl list cards short-827 bluez_card.60_57_C8_30_6A_F7 module-bluez5-device.c+827 bluez_card.02_00_00_00_00_01 module-bluez5-device.c...Active Profile: audio-gateway```@@ -3057,7 +3057,7 @@ threshold as the trigger. RSSI is not available to this daemon, measured againstBlueZ 5.87 with the phone bonded and connected:```-$ busctl --system get-property org.bluez /org/bluez/hci0/dev_60_57_C8_30_6A_F7 \+$ busctl --system get-property org.bluez /org/bluez/hci0/dev_02_00_00_00_00_01 \org.bluez.Device1 RSSIFailed to get property RSSI on interface org.bluez.Device1: No such property 'RSSI'```@@ -3069,7 +3069,7 @@ machine, including the connected iPhone, and stays absent through eight secondsactive discovery. The kernel does hold the number, and it is out of reach:```-$ btmgmt --index 0 conn-info 60:57:C8:30:6A:F7+$ btmgmt --index 0 conn-info 02:00:00:00:00:01Get Conn Info failed, status 0x14 (Permission Denied)```@@ -3352,3 +3352,58 @@ next connect, so the buds arrive with no sink and everything plays out of the lafresh daemon has an empty `handoff->released` and restores nothing. `audio::revive_bluez_card()`runs on the AirPods connect edge -- not on every BlueZ property change, the check costs a `pactl`of its own -- and switches A2DP back on for buds this run did not release.++### 2026-09-12 - A BR/EDR reconnect re-latched the LE link++| | |+|---|---|+| Controller | MediaTek `usb:v0E8Dp0717`, HCI version 13 |+| BlueZ | 5.87 with `--experimental` |+| Phone | iPhone 15 Pro, iOS 26 |++Back from out of range, MAP, PBAP and HFP all reconnected and notifications never returned.+No `notification session` line, no `0xa2`, no resubscribe: the daemon did not think anything+was wrong. `--bt-connection` read "LE: yes" and "Notification mirroring is active." The bus:++| Signal | Value |+|---|---|+| `Bearer.LE1.Connected` | false |+| `Bearer.BREDR1.Connected` | true, reconnected |+| ANCS notify sources `Notifying` | true |+| `Device1.ServicesResolved` | **true** |++The 2026-09-06 fix required `ServicesResolved` beside the notify flag because it went false+when only LE dropped. That test kept BR/EDR up. Here BR/EDR dropped too, and its rediscovery on+return set the device-wide `ServicesResolved` true again, over a cached GATT tree still marked+`Notifying`. `le_link_up()` latched through the other bearer, so the supervisor's LE recovery+was unreachable again, and `verify_subscription()`, which reads only `Notifying`, kept `ready`+true and the path held.++No property distinguishes the case. A read does:++```+$ busctl call org.bluez .../service0001/char0002 org.bluez.GattCharacteristic1 ReadValue a{sv} 0+Call failed: Not connected (3ms)+```++`gatt_link_alive()` reads the GAP Device Name (0x2A00) and reports down only on+`Not connected`. It confirms an inferred LE link in the bearer ops' `le_connected()`, and in the+ANCS client before `StartNotify` and in `verify_subscription()`, which now drops `ready` with+`LE link gone` so the path clears after `ANCS_BEARER_GRACE_SECONDS`.++Verified by walking out of range with the fix installed:++```+15:52:49 Bearer.LE1 disconnected (Timeout)+15:53:26 Bearer.BREDR1 disconnected (Timeout)+15:53:51 ancs: the notification subscription is no longer live (LE link gone), rebuilding it+15:54:15 ancs: The iPhone is not connected over LE.+ soliciting ANCS every 180s while away+16:01:19 ancs: notification session 5 started+```++A new notification popped up afterwards with nothing touched on the phone.++Not settled: the read on a live *inbound* link where `Bearer.LE1.Connected` reads false+(2026-08-19). Any error other than `Not connected` counts as up; if BlueZ answers+`Not connected` there, this drops a working session every 30 seconds.diff --git a/src/core/include/tether/audio.hpp b/src/core/include/tether/audio.hppindex 4f8adc3..68efbc3 100644--- a/src/core/include/tether/audio.hpp+++ b/src/core/include/tether/audio.hpp@@ -9,7 +9,7 @@ namespace tether::audio {// The sink the audio server is currently sending new streams to.std::string default_sink();- // The sink for a Bluetooth device ("bluez_output.AC_F2_3C_AF_52_9C.1")+ // The sink for a Bluetooth device ("bluez_output.02_00_00_00_00_02.1")// or empty when the device has no sink right now.std::string bluez_sink(const std::string& address);diff --git a/src/core/include/tether/bluetooth/config.hpp b/src/core/include/tether/bluetooth/config.hppindex 4672988..c18a2d3 100644--- a/src/core/include/tether/bluetooth/config.hpp+++ b/src/core/include/tether/bluetooth/config.hpp@@ -26,7 +26,7 @@ namespace tether::bluetooth {// Persisted at ~/.config/tether/bluetooth.json.struct Config {- // Address of the selected iPhone, e.g. "81:71:C8:30:6A:F3".+ // Address of the selected iPhone, e.g. "02:00:00:00:00:04".std::string device_address;AuthStrategy auth_strategy = AuthStrategy::ConnectFirst;// Whether to mirror notifications. Dual bond turns it on; nothing else writes it but the userdiff --git a/src/core/include/tether/bluetooth/monitor.hpp b/src/core/include/tether/bluetooth/monitor.hppindex 1345edc..6423112 100644--- a/src/core/include/tether/bluetooth/monitor.hpp+++ b/src/core/include/tether/bluetooth/monitor.hpp@@ -64,4 +64,7 @@ namespace tether::bluetooth {std::optional<bool> probe_secure_connections(const std::string& adapter_id,std::chrono::milliseconds timeout = std::chrono::seconds(1));+ // Whether the ATT link under a GATT characteristic is up.+ bool gatt_link_alive(GDBusConnection* conn, const std::string& characteristic_path);+} // namespace tether::bluetoothdiff --git a/src/core/include/tether/bluetooth/objects.hpp b/src/core/include/tether/bluetooth/objects.hppindex b070212..502524a 100644--- a/src/core/include/tether/bluetooth/objects.hpp+++ b/src/core/include/tether/bluetooth/objects.hpp@@ -64,6 +64,9 @@ namespace tether::bluetooth {bool ancs_notifying = false;+ // GAP Device Name characteristic+ std::string gap_name_path;+// Device1.ServicesResolvedbool services_resolved = false;diff --git a/src/core/src/bluetooth/ancs/client.cpp b/src/core/src/bluetooth/ancs/client.cppindex 1636a38..f506b74 100644--- a/src/core/src/bluetooth/ancs/client.cpp+++ b/src/core/src/bluetooth/ancs/client.cpp@@ -82,6 +82,7 @@ namespace tether::bluetooth::ancs {void unsubscribe();void drop_gatt_paths();void verify_subscription();+ bool link_alive() const;void handle_source_event(const SourceEvent& event, int64_t now);void handle_response(const Request& request, const Response& response, int64_t now);std::string app_display_name(const std::string& app_id);@@ -243,6 +244,10 @@ namespace tether::bluetooth::ancs {if (!monitor || !monitor->connection())return false;+ // cached tree can accept StartNotify with no link+ if (!link_alive())+ return false;+GDBusConnection* conn = monitor->connection();bool object_gone = false;auto start_notify = [&](const std::string& path) {@@ -377,12 +382,16 @@ namespace tether::bluetooth::ancs {g_variant_unref(reply);}- if (!object_gone && notifying)+ // Notifying stays set on a cached tree after the LE link drops.+ const bool link_gone = !object_gone && notifying && !link_alive();+ if (!object_gone && notifying && !link_gone)return;debug::log(INFO,"ancs: the notification subscription is no longer live ({}), rebuilding it",- object_gone ? "characteristics gone" : "BlueZ cleared Notifying");+ object_gone ? "characteristics gone"+ : link_gone ? "LE link gone"+ : "BlueZ cleared Notifying");if (object_gone) {drop_gatt_paths();set_status(false, "Waiting for the iPhone's notification service.");@@ -396,6 +405,14 @@ namespace tether::bluetooth::ancs {in_progress.clear();}+ bool AncsClientState::link_alive() const {+ for (const auto& device : monitor->snapshot().devices) {+ if (device.path == device_path)+ return gatt_link_alive(monitor->connection(), device.gap_name_path);+ }+ return true;+ }+void AncsClientState::handle_source_event(const SourceEvent& event, int64_t now) {(void)now;Decision decision;diff --git a/src/core/src/bluetooth/connection.cpp b/src/core/src/bluetooth/connection.cppindex 39e40b0..caacac0 100644--- a/src/core/src/bluetooth/connection.cpp+++ b/src/core/src/bluetooth/connection.cpp@@ -315,7 +315,7 @@ namespace tether::bluetooth {bool le_connected() const override {auto device = lookup();- return device && device->le_link_up();+ return device && link_up(*device);}std::string preferred_bearer() const override {@@ -364,7 +364,7 @@ namespace tether::bluetooth {}}- if (!device->le_link_up())+ if (!link_up(*device))set_preferred_bearer("bredr");if (call(device->path, IFACE_DEVICE, "Connect", err))return ConnectResult::Requested;@@ -504,6 +504,14 @@ namespace tether::bluetooth {return std::nullopt;}+ // A BR/EDR reconnect sets ServicesResolved again while the stale ANCS+ // Notifying flag survives, so the inferred LE link is confirmed with a read.+ bool link_up(const Device& device) const {+ if (device.le_connected)+ return true;+ return device.le_link_up() && gatt_link_alive(monitor_.connection(), device.gap_name_path);+ }+bool call(const std::string& path,const char* iface,const char* method,diff --git a/src/core/src/bluetooth/monitor.cpp b/src/core/src/bluetooth/monitor.cppindex 5c292f2..633f5bb 100644--- a/src/core/src/bluetooth/monitor.cpp+++ b/src/core/src/bluetooth/monitor.cpp@@ -615,4 +615,29 @@ namespace tether::bluetooth {return impl_->preferred_adapter_id;}+ bool gatt_link_alive(GDBusConnection* conn, const std::string& characteristic_path) {+ if (!conn || characteristic_path.empty())+ return true;+ GError* error = nullptr;+ GVariant* reply = g_dbus_connection_call_sync(+ conn,+ BLUEZ_NAME,+ characteristic_path.c_str(),+ "org.bluez.GattCharacteristic1",+ "ReadValue",+ g_variant_new("(@a{sv})", g_variant_new_array(G_VARIANT_TYPE("{sv}"), nullptr, 0)),+ nullptr,+ G_DBUS_CALL_FLAGS_NONE,+ 2000,+ nullptr,+ &error);+ if (reply) {+ g_variant_unref(reply);+ return true;+ }+ const bool down = error && std::string(error->message).find("Not connected") != std::string::npos;+ g_clear_error(&error);+ return !down;+ }+} // namespace tether::bluetoothdiff --git a/src/core/src/bluetooth/objects.cpp b/src/core/src/bluetooth/objects.cppindex 89eaef2..fed88ca 100644--- a/src/core/src/bluetooth/objects.cpp+++ b/src/core/src/bluetooth/objects.cpp@@ -22,6 +22,7 @@ namespace tether::bluetooth {constexpr const char* IFACE_BEARER_BREDR = "org.bluez.Bearer.BREDR1";constexpr const char* IFACE_CHARACTERISTIC = "org.bluez.GattCharacteristic1";constexpr const char* UUID_ANCS_NOTIFICATION_SOURCE = "9fbf120d-6301-42d9-8c58-25e699a21dbd";+ constexpr const char* UUID_GAP_DEVICE_NAME = "00002a00-0000-1000-8000-00805f9b34fb";bool iequals(const std::string& a, const std::string& b) {return a.size() == b.size() &&@@ -343,6 +344,7 @@ namespace tether::bluetooth {const gchar* path = nullptr;GVariant* ifaces = nullptr;std::vector<std::string> ancs_char_paths;+ std::vector<std::string> gap_name_paths;g_variant_iter_init(&iter, dict);while (g_variant_iter_loop(&iter, "{&o@a{sa{sv}}}", &path, &ifaces)) {read_adapter(path, ifaces, out);@@ -353,8 +355,11 @@ namespace tether::bluetooth {GVariant* chr = g_variant_lookup_value(ifaces, IFACE_CHARACTERISTIC, G_VARIANT_TYPE("a{sv}"));if (!chr)continue;- if (iequals(get_string(chr, "UUID"), UUID_ANCS_NOTIFICATION_SOURCE) && get_bool(chr, "Notifying"))+ const std::string uuid = get_string(chr, "UUID");+ if (iequals(uuid, UUID_ANCS_NOTIFICATION_SOURCE) && get_bool(chr, "Notifying"))ancs_char_paths.emplace_back(path);+ else if (iequals(uuid, UUID_GAP_DEVICE_NAME))+ gap_name_paths.emplace_back(path);g_variant_unref(chr);}g_variant_unref(dict);@@ -367,6 +372,12 @@ namespace tether::bluetooth {device.ancs_notifying = true;}}+ for (const auto& char_path : gap_name_paths) {+ for (auto& device : out.devices) {+ if (char_path.rfind(device.path + "/", 0) == 0)+ device.gap_name_path = char_path;+ }+ }// BlueZ enumerates in a stable but unspecified order; sorting keeps// snapshot comparison and UI listing deterministic.diff --git a/test/test_airpods.cpp b/test/test_airpods.cppindex d3c79b7..5a7ea50 100644--- a/test/test_airpods.cpp+++ b/test/test_airpods.cpp@@ -196,31 +196,31 @@ TEST(AirPods, ParsesTheConnectedDeviceList) {// Two hosts: this machine, then an iPhone sitting idle. The count is at offset 8// and addresses are in display order.const std::vector<uint8_t> packet = {0x04, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x00, 0x00, 0x02,- 0xac, 0xf2, 0x3c, 0xaf, 0x52, 0x9c, 0x00, 0x03,- 0x60, 0x57, 0xc8, 0x30, 0x6a, 0xf7, 0x01, 0x15};+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x03,+ 0x02, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x15};auto peers = parse_connected_devices(packet.data(), packet.size());ASSERT_TRUE(peers.has_value());ASSERT_EQ(peers->size(), 2u);- EXPECT_EQ((*peers)[0].address, "AC:F2:3C:AF:52:9C");+ EXPECT_EQ((*peers)[0].address, "02:00:00:00:00:02");EXPECT_EQ((*peers)[0].state, 0x03);- EXPECT_EQ((*peers)[1].address, "60:57:C8:30:6A:F7");+ EXPECT_EQ((*peers)[1].address, "02:00:00:00:00:01");// 0x15 is an iPhone sitting there doing nothing, which is the state this machine// claims the buds out of. Reading it as "taken" means never claiming at all.EXPECT_FALSE((*peers)[1].taking_over());EXPECT_FALSE((*peers)[1].active());// Misreading the layout makes this machine's own entry a peer holding the buds.- const auto summary = summarize_peers(*peers, "AC:F2:3C:AF:52:9C");+ const auto summary = summarize_peers(*peers, "02:00:00:00:00:02");EXPECT_FALSE(summary.taking_over);EXPECT_FALSE(summary.active);// Captured 2026-09-10 from AirPods Pro 3 with only this machine attached.const std::vector<uint8_t> alone = {- 0x04, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x01, 0x00, 0x01, 0xac, 0xf2, 0x3c, 0xaf, 0x52, 0x9c, 0x02, 0x02};+ 0x04, 0x00, 0x04, 0x00, 0x2e, 0x00, 0x01, 0x00, 0x01, 0x02, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02};auto only_us = parse_connected_devices(alone.data(), alone.size());ASSERT_TRUE(only_us.has_value());ASSERT_EQ(only_us->size(), 1u);- EXPECT_EQ((*only_us)[0].address, "AC:F2:3C:AF:52:9C");+ EXPECT_EQ((*only_us)[0].address, "02:00:00:00:00:02");EXPECT_EQ((*only_us)[0].state, 0x02);// A truncated list is not a list.@@ -231,7 +231,7 @@ TEST(AirPods, ParsesTheConnectedDeviceList) {// A peer on its way to the buds blocks a claim; one already holding them also ends// local playback. An idle peer does neither.TEST(AirPods, SeparatesAnIdlePeerFromOneTakingTheBuds) {- const auto peer = [](uint8_t state) { return AapPeer{"81:71:C8:30:6A:F3", 0x02, state}; };+ const auto peer = [](uint8_t state) { return AapPeer{"02:00:00:00:00:04", 0x02, state}; };EXPECT_FALSE(peer(0x15).taking_over());EXPECT_TRUE(peer(0x10).taking_over());EXPECT_FALSE(peer(0x10).active());@@ -248,7 +248,7 @@ TEST(AirPods, SeparatesAnIdlePeerFromOneTakingTheBuds) {// 0x02, and neither ever reaches 0x10. An owner that has finished is what a reclaim claims from,// so owning must not read as taking over.TEST(AirPods, ReadsOwnershipFromTheOwnerBit) {- const auto peer = [](uint8_t state) { return AapPeer{"81:71:C8:30:6A:F3", 0x02, state}; };+ const auto peer = [](uint8_t state) { return AapPeer{"02:00:00:00:00:04", 0x02, state}; };EXPECT_FALSE(peer(0x05).active());EXPECT_TRUE(peer(0x07).active());EXPECT_FALSE(peer(0x00).active());@@ -264,20 +264,20 @@ TEST(AirPods, ReadsOwnershipFromTheOwnerBit) {// implementation. The layout is fixed: opcode, the target address least-significant byte first,// then ASCII keys with this machine's address in the middle.TEST(AirPods, BuildsTheHostRegistrationPackets) {- const std::string self = "AC:F2:3C:AF:52:9C";- const auto add = tipi_add_device(self, "60:57:C8:30:6A:F7");+ const std::string self = "02:00:00:00:00:02";+ const auto add = tipi_add_device(self, "02:00:00:00:00:01");ASSERT_EQ(add.size(), 96u);EXPECT_EQ(std::vector<uint8_t>(add.begin(), add.begin() + 6),(std::vector<uint8_t>{0x04, 0x00, 0x04, 0x00, 0x10, 0x00}));EXPECT_EQ(std::vector<uint8_t>(add.begin() + 6, add.begin() + 12),- (std::vector<uint8_t>{0xf7, 0x6a, 0x30, 0xc8, 0x57, 0x60}));+ (std::vector<uint8_t>{0x01, 0x00, 0x00, 0x00, 0x00, 0x02}));// Body offsets counted from the end of the prefix.EXPECT_EQ(std::string(add.begin() + 6 + 11, add.begin() + 6 + 19), "idleTime");EXPECT_EQ(std::string(add.begin() + 6 + 40, add.begin() + 6 + 57), self);EXPECT_EQ(std::string(add.begin() + 6 + 65, add.begin() + 6 + 72), "Android");EXPECT_EQ(add.back(), 0x0e);- const auto media = tipi_media_info(self, "60:57:C8:30:6A:F7");+ const auto media = tipi_media_info(self, "02:00:00:00:00:01");ASSERT_EQ(media.size(), 122u);EXPECT_EQ(std::string(media.begin() + 6 + 11, media.begin() + 6 + 21), "playingApp");EXPECT_EQ(std::string(media.begin() + 6 + 25, media.begin() + 6 + 43), "hostStreamingState");@@ -286,7 +286,7 @@ TEST(AirPods, BuildsTheHostRegistrationPackets) {// An address that will not parse is no packet at all.EXPECT_TRUE(tipi_add_device(self, "nonsense").empty());- EXPECT_TRUE(tipi_media_info("", "60:57:C8:30:6A:F7").empty());+ EXPECT_TRUE(tipi_media_info("", "02:00:00:00:00:01").empty());}// Handoff yields to a phone that owns the buds and is playing through them. Ownership alone is a@@ -303,29 +303,29 @@ TEST(AirPods, YieldsOnlyToAnOwnerWithAudio) {// This machine's own entry rises with its own ownership and is never a peer.TEST(AirPods, SummarisesPeersWithoutCountingItself) {- const std::vector<AapPeer> peers = {{"AC:F2:3C:AF:52:9C", 0x01, 0x17}, {"81:71:C8:30:6A:F3", 0x02, 0x10}};- const auto summary = summarize_peers(peers, "AC:F2:3C:AF:52:9C");+ const std::vector<AapPeer> peers = {{"02:00:00:00:00:02", 0x01, 0x17}, {"02:00:00:00:00:04", 0x02, 0x10}};+ const auto summary = summarize_peers(peers, "02:00:00:00:00:02");EXPECT_TRUE(summary.taking_over);EXPECT_FALSE(summary.active);// A phone on a call is the case handoff exists for.- const std::vector<AapPeer> on_a_call = {{"81:71:C8:30:6A:F3", 0x02, 0x17}};- EXPECT_TRUE(summarize_peers(on_a_call, "AC:F2:3C:AF:52:9C").active);+ const std::vector<AapPeer> on_a_call = {{"02:00:00:00:00:04", 0x02, 0x17}};+ EXPECT_TRUE(summarize_peers(on_a_call, "02:00:00:00:00:02").active);// Without a local address every entry counts, which is the safe way round.EXPECT_TRUE(summarize_peers(peers, "").active);// `present` errs the other way: with no local address there is no peer to hand the buds to.- EXPECT_TRUE(summarize_peers(peers, "AC:F2:3C:AF:52:9C").present);+ EXPECT_TRUE(summarize_peers(peers, "02:00:00:00:00:02").present);EXPECT_FALSE(summarize_peers(peers, "").present);- EXPECT_FALSE(summarize_peers({{"AC:F2:3C:AF:52:9C", 0x02, 0x02}}, "AC:F2:3C:AF:52:9C").present);+ EXPECT_FALSE(summarize_peers({{"02:00:00:00:00:02", 0x02, 0x02}}, "02:00:00:00:00:02").present);}TEST(AirPods, ParsesTheAudioSource) {// Here the address is least-significant byte first.- const std::vector<uint8_t> packet = {0x04, 0x00, 0x04, 0x00, 0x0e, 0x00, 0xf7, 0x6a, 0x30, 0xc8, 0x57, 0x60, 0x01};+ const std::vector<uint8_t> packet = {0x04, 0x00, 0x04, 0x00, 0x0e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x02, 0x01};auto event = parse_audio_source(packet.data(), packet.size());ASSERT_TRUE(event.has_value());- EXPECT_EQ(event->address, "60:57:C8:30:6A:F7");+ EXPECT_EQ(event->address, "02:00:00:00:00:01");EXPECT_EQ(event->source, AudioSource::Call);EXPECT_FALSE(parse_audio_source(packet.data(), packet.size() - 1).has_value());@@ -334,7 +334,7 @@ TEST(AirPods, ParsesTheAudioSource) {// Measured on AirPods Pro 3: the buds route this machine's stream while the phone still owns// them, then hand the route back to the phone within seconds.TEST(AirPods, ClaimsWhenPlayingHereWithoutOwningTheBuds) {- const std::string local = "AC:F2:3C:AF:52:9C";+ const std::string local = "02:00:00:00:00:02";const AudioSourceEvent here{local, AudioSource::Media};EXPECT_TRUE(claims_for_playback(here, local, false, false));EXPECT_FALSE(claims_for_playback(here, local, true, false));@@ -342,7 +342,7 @@ TEST(AirPods, ClaimsWhenPlayingHereWithoutOwningTheBuds) {EXPECT_FALSE(claims_for_playback(here, local, std::nullopt, false));// Taking the buds off a phone call is the one thing this must never do.EXPECT_FALSE(claims_for_playback(here, local, false, true));- EXPECT_FALSE(claims_for_playback({"60:57:C8:30:6A:F7", AudioSource::Media}, local, false, false));+ EXPECT_FALSE(claims_for_playback({"02:00:00:00:00:01", AudioSource::Media}, local, false, false));EXPECT_FALSE(claims_for_playback({local, AudioSource::None}, local, false, false));EXPECT_FALSE(claims_for_playback(here, "", false, false));}diff --git a/test/test_audio.cpp b/test/test_audio.cppindex 108e1ba..b615702 100644--- a/test/test_audio.cpp+++ b/test/test_audio.cpp@@ -6,8 +6,8 @@ using namespace tether::audio;// The audio server names a Bluetooth sink by the address in upper case with// underscores, whatever case BlueZ reported it in.TEST(Audio, NamesTheSinkAfterTheAddress) {- EXPECT_EQ(sink_prefix("ac:f2:3c:af:52:9c"), "bluez_output.AC_F2_3C_AF_52_9C");- EXPECT_EQ(sink_prefix("AC:F2:3C:AF:52:9C"), "bluez_output.AC_F2_3C_AF_52_9C");+ EXPECT_EQ(sink_prefix("02:00:00:00:00:02"), "bluez_output.02_00_00_00_00_02");+ EXPECT_EQ(sink_prefix("02:00:00:00:00:02"), "bluez_output.02_00_00_00_00_02");EXPECT_EQ(sink_prefix(""), "bluez_output.");}@@ -26,10 +26,10 @@ TEST(Audio, ReadsARawSinkVolume) {}TEST(Audio, ReadsACardsActiveProfile) {- const std::string cards = "Card #82\n\tName: bluez_card.60_57_C8_30_6A_F7\n\tActive Profile: audio-gateway\n"- "Card #245\n\tName: bluez_card.F8_D3_F0_3C_84_4A\n\tProperties:\n"- "\t\tdevice.name = \"bluez_card.F8_D3_F0_3C_84_4A\"\n\tActive Profile: a2dp-sink\n";- EXPECT_EQ(active_profile_in(cards, "bluez_card.F8_D3_F0_3C_84_4A"), "a2dp-sink");- EXPECT_EQ(active_profile_in(cards, "bluez_card.60_57_C8_30_6A_F7"), "audio-gateway");+ const std::string cards = "Card #82\n\tName: bluez_card.02_00_00_00_00_01\n\tActive Profile: audio-gateway\n"+ "Card #245\n\tName: bluez_card.02_00_00_00_00_03\n\tProperties:\n"+ "\t\tdevice.name = \"bluez_card.02_00_00_00_00_03\"\n\tActive Profile: a2dp-sink\n";+ EXPECT_EQ(active_profile_in(cards, "bluez_card.02_00_00_00_00_03"), "a2dp-sink");+ EXPECT_EQ(active_profile_in(cards, "bluez_card.02_00_00_00_00_01"), "audio-gateway");EXPECT_TRUE(active_profile_in(cards, "bluez_card.00_00_00_00_00_00").empty());}diff --git a/test/test_bluetooth_objects.cpp b/test/test_bluetooth_objects.cppindex 2ce5e32..535ba45 100644--- a/test/test_bluetooth_objects.cpp+++ b/test/test_bluetooth_objects.cpp@@ -35,7 +35,7 @@ namespace {constexpr const char* ADAPTER_FULL = R"({'/org/bluez/hci0': {'org.bluez.Adapter1': {- 'Address': <'AC:F2:3C:AF:52:9C'>,+ 'Address': <'02:00:00:00:00:02'>,'Alias': <'btw'>,'Class': <uint32 8127496>,'Powered': <true>,@@ -52,7 +52,7 @@ namespace {constexpr const char* ADAPTER_NO_ADVERTISING = R"({'/org/bluez/hci0': {'org.bluez.Adapter1': {- 'Address': <'AC:F2:3C:AF:52:9C'>,+ 'Address': <'02:00:00:00:00:02'>,'Alias': <'btw'>,'Class': <uint32 8127496>,'Powered': <true>,@@ -63,9 +63,9 @@ namespace {// An iPhone bonded on both transports, exposing MAP, PBAP and ANCS.constexpr const char* IPHONE_BONDED = R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {- 'Address': <'60:57:C8:30:6A:F7'>,+ 'Address': <'02:00:00:00:00:01'>,'Alias': <'Zack 15 Pro'>,'Adapter': <objectpath '/org/bluez/hci0'>,'Paired': <true>,@@ -100,7 +100,7 @@ TEST(BluetoothObjects, ParsesAdapterProperties) {ASSERT_EQ(objects.adapters.size(), 1u);const auto& a = objects.adapters[0];EXPECT_EQ(a.path, "/org/bluez/hci0");- EXPECT_EQ(a.address, "AC:F2:3C:AF:52:9C");+ EXPECT_EQ(a.address, "02:00:00:00:00:02");EXPECT_EQ(a.name, "btw");EXPECT_TRUE(a.powered);EXPECT_TRUE(a.has_role("central"));@@ -132,7 +132,7 @@ TEST(BluetoothObjects, ParsesDeviceAndBearer) {ASSERT_EQ(objects.devices.size(), 1u);const auto& d = objects.devices[0];- EXPECT_EQ(d.address, "60:57:C8:30:6A:F7");+ EXPECT_EQ(d.address, "02:00:00:00:00:01");EXPECT_EQ(d.name, "Zack 15 Pro");EXPECT_EQ(d.adapter_path, "/org/bluez/hci0");EXPECT_TRUE(d.bonded);@@ -241,7 +241,7 @@ TEST(Capability, SecureConnectionsStateIsInjectedRatherThanReadDuringResolution)// is conclusive.TEST(Capability, CompatibilityWhenExperimentalIsOff) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true> }}})")@@ -268,7 +268,7 @@ TEST(Capability, CompatibilityWhenExperimentalIsOff) {// -- which in turn latched notification mirroring off after every pairing.TEST(Capability, AnEmptyBearerInterfaceIsNotProofOfTheApi) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true> },'org.bluez.Bearer.LE1': {},'org.bluez.Bearer.BREDR1': {}@@ -288,7 +288,7 @@ TEST(Capability, AnEmptyBearerInterfaceIsNotProofOfTheApi) {TEST(Capability, ClassicOnlyBondDoesNotDisproveBearerApi) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_F8_D3_F0_3C_84_4A': {+ '/org/bluez/hci0/dev_02_00_00_00_00_03': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true> }}})")@@ -308,7 +308,7 @@ TEST(Capability, ClassicOnlyBondDoesNotDisproveBearerApi) {// -- was a dead end in every bug report it produced.TEST(Capability, ClassicOnlyIphoneBondIsNamedAsSuch) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {'Paired': <true>,'Bonded': <true>,@@ -347,7 +347,7 @@ TEST(Capability, ClassicOnlyIphoneBondIsNamedAsSuch) {// the controller had derived the LE keys at all.TEST(Capability, APopulatedLeBearerIsNotProofOfAnLeBond) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {'Paired': <true>,'Bonded': <true>,@@ -379,7 +379,7 @@ TEST(Capability, APopulatedLeBearerIsNotProofOfAnLeBond) {// terminate -- which is exactly what issue #118 recorded, three times over.TEST(Capability, NoRepairAdviceWhenTheAdapterCannotAdvertise) {Payload p(join(ADAPTER_NO_ADVERTISING, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {'Paired': <true>,'Bonded': <true>,@@ -412,7 +412,7 @@ TEST(Capability, NoRepairAdviceWhenTheAdapterCannotAdvertise) {// those as a broken bond fires on nearly every machine.TEST(Capability, ClassicOnlyBondOnANonPhoneIsNotReported) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_F8_D3_F0_3C_84_4A': {+ '/org/bluez/hci0/dev_02_00_00_00_00_03': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Alias': <'ZBZ AirPros'> }}})")@@ -433,12 +433,12 @@ TEST(Capability, ClassicOnlyBondOnANonPhoneIsNotReported) {// presence is the more trustworthy signal of the two.TEST(DeviceParsing, AnAncsNotifySessionProvesTheLeLinkIsUp) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>,'ServicesResolved': <true> },'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> }},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/service004f/char0050': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/service004f/char0050': {'org.bluez.GattCharacteristic1': { 'UUID': <'9FBF120D-6301-42D9-8C58-25E699A21DBD'>, 'Notifying': <true> }}})")@@ -459,13 +459,13 @@ TEST(DeviceParsing, AnAncsNotifySessionProvesTheLeLinkIsUp) {// recovery, the solicitation and the outbound dial all off the table.TEST(DeviceParsing, ANotifyFlagLeftOverADeadLeBearerIsNotALink) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>,'ServicesResolved': <false> },'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> },'org.bluez.Bearer.BREDR1': { 'Connected': <true> }},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/service004f/char0050': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/service004f/char0050': {'org.bluez.GattCharacteristic1': { 'UUID': <'9FBF120D-6301-42D9-8C58-25E699A21DBD'>, 'Notifying': <true> }}})")@@ -479,17 +479,43 @@ TEST(DeviceParsing, ANotifyFlagLeftOverADeadLeBearerIsNotALink) {EXPECT_TRUE(objects.devices[0].classic_link_up()) << "Classic is up throughout; only LE dropped";}+// Captured after BR/EDR dropped out of range and came back without LE: BR/EDR+// discovery sets ServicesResolved again, so the parsed properties read as a live+// LE link. Only a read through gap_name_path can tell, so the path must be found.+TEST(DeviceParsing, ClassicReconnectLeavesAStaleLeLinkThatNeedsAReadToDisprove) {+ Payload p(join(ADAPTER_FULL, R"({+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {+ 'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>,+ 'ServicesResolved': <true> },+ 'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> },+ 'org.bluez.Bearer.BREDR1': { 'Connected': <true> }+ },+ '/org/bluez/hci0/dev_02_00_00_00_00_01/service0001/char0002': {+ 'org.bluez.GattCharacteristic1': { 'UUID': <'00002a00-0000-1000-8000-00805f9b34fb'> }+ },+ '/org/bluez/hci0/dev_02_00_00_00_00_01/service0059/char005d': {+ 'org.bluez.GattCharacteristic1': { 'UUID': <'9fbf120d-6301-42d9-8c58-25e699a21dbd'>, 'Notifying': <true> }+ }+ })")+ .c_str());+ auto objects = parse_managed_objects(p.v);++ ASSERT_EQ(objects.devices.size(), 1u);+ EXPECT_TRUE(objects.devices[0].le_link_up()) << "the fixture is not reproducing the latch";+ EXPECT_EQ(objects.devices[0].gap_name_path, "/org/bluez/hci0/dev_02_00_00_00_00_01/service0001/char0002");+}+// The characteristic has to belong to this device. A sibling device's GATT tree// saying nothing about ours is the whole reason the paths are matched.TEST(DeviceParsing, AnAncsNotifySessionBelongsToOneDeviceOnly) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true> }},- '/org/bluez/hci0/dev_F8_D3_F0_3C_84_4A': {+ '/org/bluez/hci0/dev_02_00_00_00_00_03': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true> }},- '/org/bluez/hci0/dev_F8_D3_F0_3C_84_4A/service004f/char0050': {+ '/org/bluez/hci0/dev_02_00_00_00_00_03/service004f/char0050': {'org.bluez.GattCharacteristic1': { 'UUID': <'9fbf120d-6301-42d9-8c58-25e699a21dbd'>, 'Notifying': <true> }}})")@@ -509,11 +535,11 @@ TEST(DeviceParsing, AnAncsNotifySessionBelongsToOneDeviceOnly) {// one, which stopped the bearer supervisor dialling it at all.TEST(DeviceParsing, CachedCharacteristicsWithoutNotifyAreNotALink) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true>, 'ServicesResolved': <true> },'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> }},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/service006f/char0073': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/service006f/char0073': {'org.bluez.GattCharacteristic1': { 'UUID': <'9fbf120d-6301-42d9-8c58-25e699a21dbd'>, 'Notifying': <false> }}})")@@ -527,7 +553,7 @@ TEST(DeviceParsing, CachedCharacteristicsWithoutNotifyAreNotALink) {TEST(DeviceParsing, NoGattTreeAtAllMeansNoLeLink) {Payload p(join(ADAPTER_FULL, R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <true> },'org.bluez.Bearer.LE1': { 'Paired': <true>, 'Bonded': <true>, 'Connected': <false> }}@@ -714,9 +740,9 @@ TEST(PreferredAdapter, PrefersPoweredThenFirst) {// "Unable to find service record". Reading the aggregate as the Classic link// makes the daemon report a healthy BR/EDR connection and never reconnect it.constexpr const char* IPHONE_LE_ONLY_LINK = R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {- 'Address': <'60:57:C8:30:6A:F7'>,+ 'Address': <'02:00:00:00:00:01'>,'Adapter': <objectpath '/org/bluez/hci0'>,'Paired': <true>,'Bonded': <true>,@@ -783,9 +809,9 @@ TEST(BluetoothObjects, ClassicLinkFallsBackToTheAggregateWithoutBearers) {// "BR/EDR is down" would let a stub contradict a link that is genuinely up.TEST(BluetoothObjects, StubBearerIsNotMistakenForAReading) {constexpr const char* STUB_BEARERS = R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {'org.bluez.Device1': {- 'Address': <'60:57:C8:30:6A:F7'>,+ 'Address': <'02:00:00:00:00:01'>,'Adapter': <objectpath '/org/bluez/hci0'>,'Paired': <true>,'Connected': <true>,diff --git a/test/test_bluetooth_pairing.cpp b/test/test_bluetooth_pairing.cppindex a51cab0..633cf63 100644--- a/test/test_bluetooth_pairing.cpp+++ b/test/test_bluetooth_pairing.cpp@@ -71,7 +71,7 @@ TEST(Passkey, FormatsSixDigitsWithLeadingZeros) {TEST(BluetoothConfig, RoundTrips) {Config config;- config.device_address = "60:57:C8:30:6A:F7";+ config.device_address = "02:00:00:00:00:01";config.auth_strategy = AuthStrategy::ExplicitPair;config.ancs_enabled = false;config.enabled = false;@@ -117,7 +117,7 @@ TEST(BluetoothConfig, ClampsTheAwayGraceToAtLeastASecond) {// re-dialling a link the user disconnected.TEST(BluetoothConfig, SupervisedAddressIsEmptyWhenDisabled) {Config config;- config.device_address = "60:57:C8:30:6A:F7";+ config.device_address = "02:00:00:00:00:01";EXPECT_EQ(supervised_address(config), config.device_address);config.enabled = false;diff --git a/test/test_bt_diagnostics.cpp b/test/test_bt_diagnostics.cppindex af96936..8ab681b 100644--- a/test/test_bt_diagnostics.cpp+++ b/test/test_bt_diagnostics.cpp@@ -9,17 +9,17 @@ using namespace tether::bluetooth;TEST(BtDiagnostics, RedactsBareAddress) {Redactor r;- EXPECT_EQ(r.text("connecting to 60:57:C8:30:6A:F7"), "connecting to <address-1>");+ EXPECT_EQ(r.text("connecting to 02:00:00:00:00:01"), "connecting to <address-1>");}TEST(BtDiagnostics, RedactsDeviceNodeInObjectPath) {Redactor r;- EXPECT_EQ(r.text("/org/bluez/hci0/dev_60_57_C8_30_6A_F7"), "/org/bluez/hci0/dev_<address-1>");+ EXPECT_EQ(r.text("/org/bluez/hci0/dev_02_00_00_00_00_01"), "/org/bluez/hci0/dev_<address-1>");}TEST(BtDiagnostics, SameDeviceGetsSamePlaceholderAcrossSpellings) {Redactor r;- const std::string out = r.text("dev_60_57_C8_30_6A_F7 is 60:57:c8:30:6a:f7");+ const std::string out = r.text("dev_02_00_00_00_00_01 is 02:00:00:00:00:01");EXPECT_EQ(out, "dev_<address-1> is <address-1>");}@@ -60,8 +60,8 @@ TEST(BtDiagnostics, LeavesAGenericDeviceNameAlone) {// one placeholder rather than being half-eaten by the patterns.TEST(BtDiagnostics, AnAliasWinsOverThePatternsInsideIt) {Redactor r;- r.hide("Zack 60:57:C8:30:6A:F7", "name");- EXPECT_EQ(r.text("connecting Zack 60:57:C8:30:6A:F7"), "connecting <name-1>");+ r.hide("Zack 02:00:00:00:00:01", "name");+ EXPECT_EQ(r.text("connecting Zack 02:00:00:00:00:01"), "connecting <name-1>");}TEST(BtDiagnostics, LeavesTimestampsAndErrorCodesAlone) {@@ -104,7 +104,7 @@ TEST(BtDiagnostics, DropsContentKeysRatherThanRedactingThem) {{"body", "meet me at the usual place"},{"sender", "Jane"},{"name", "Jane's iPhone"},- {"address", "60:57:C8:30:6A:F7"},+ {"address", "02:00:00:00:00:01"},};const nlohmann::json out = r.value(in);@@ -169,14 +169,14 @@ TEST(BtDiagnostics, TimelineIsBounded) {TEST(BtDiagnostics, ReportCarriesNoAddressOrContent) {clear_diagnostic_timeline();record_diagnostic_event({{"command", "bt_connection_changed"},- {"link_reason", "Connecting to 60:57:C8:30:6A:F7"},+ {"link_reason", "Connecting to 02:00:00:00:00:01"},{"map_open", false}});const nlohmann::json status = {{"adapters", {{{"address", "AA:BB:CC:DD:EE:FF"}, {"name", "someone-laptop"}}}}};- const nlohmann::json connection = {{"link_reason", "no route to 60:57:C8:30:6A:F7"}};+ const nlohmann::json connection = {{"link_reason", "no route to 02:00:00:00:00:01"}};const std::string dumped = build_diagnostics(status, connection).dump();- EXPECT_EQ(dumped.find("60:57:C8:30:6A:F7"), std::string::npos);+ EXPECT_EQ(dumped.find("02:00:00:00:00:01"), std::string::npos);EXPECT_EQ(dumped.find("AA:BB:CC:DD:EE:FF"), std::string::npos);EXPECT_EQ(dumped.find("someone-laptop"), std::string::npos);}diff --git a/test/test_telephony.cpp b/test/test_telephony.cppindex 1e05c2c..e4a30e2 100644--- a/test/test_telephony.cpp+++ b/test/test_telephony.cpp@@ -30,10 +30,10 @@ namespace {// Two phones, each with a gateway; one is ringing, the other is on a call.// Recorded from bluetoothd 5.87 --experimental against a live iPhone.constexpr const char* TWO_GATEWAYS = R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {- 'org.bluez.Device1': { 'Address': <'60:57:C8:30:6A:F7'>, 'Alias': <'Zack 15 Pro'> }+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {+ 'org.bluez.Device1': { 'Address': <'02:00:00:00:00:01'>, 'Alias': <'Zack 15 Pro'> }},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony0': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/telephony0': {'org.bluez.Telephony1': {'UUID': <'0000111f-0000-1000-8000-00805f9b34fb'>,'State': <'connected'>,@@ -46,7 +46,7 @@ namespace {'InbandRingtone': <false>}},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony0/call1': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/telephony0/call1': {'org.bluez.Call1': {'LineIdentification': <'+15555550123'>,'Name': <''>,@@ -101,9 +101,9 @@ TEST(Telephony, ParsesTheGateway) {Payload payload(TWO_GATEWAYS);const BluezObjects objects = parse_managed_objects(payload.v);- const Telephony* gw = objects.find_telephony("/org/bluez/hci0/dev_60_57_C8_30_6A_F7");+ const Telephony* gw = objects.find_telephony("/org/bluez/hci0/dev_02_00_00_00_00_01");ASSERT_NE(gw, nullptr);- EXPECT_EQ(gw->path, "/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony0");+ EXPECT_EQ(gw->path, "/org/bluez/hci0/dev_02_00_00_00_00_01/telephony0");EXPECT_EQ(gw->operator_name, "AT&T");EXPECT_EQ(gw->signal, 1);EXPECT_EQ(gw->battery, 4);@@ -121,7 +121,7 @@ TEST(Telephony, ParsesOnlyTheSelectedGatewaysCalls) {Payload payload(TWO_GATEWAYS);const BluezObjects objects = parse_managed_objects(payload.v);- const auto calls = objects.calls_for("/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony0");+ const auto calls = objects.calls_for("/org/bluez/hci0/dev_02_00_00_00_00_01/telephony0");ASSERT_EQ(calls.size(), 1u);EXPECT_EQ(calls[0].number, "+15555550123");EXPECT_EQ(calls[0].state, "incoming");@@ -129,37 +129,37 @@ TEST(Telephony, ParsesOnlyTheSelectedGatewaysCalls) {EXPECT_FALSE(calls[0].connected());EXPECT_TRUE(objects.calls_for("").empty());- EXPECT_TRUE(objects.calls_for("/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony9").empty());+ EXPECT_TRUE(objects.calls_for("/org/bluez/hci0/dev_02_00_00_00_00_01/telephony9").empty());}// The gateway path is a prefix of its calls' paths, and BlueZ numbers both per// device: telephony1 must not collect telephony10's calls.TEST(Telephony, GatewayPathIsMatchedWholeNotAsAPrefix) {Payload payload(R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony1/call1': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/telephony1/call1': {'org.bluez.Call1': { 'State': <'active'> }},- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony10/call1': {+ '/org/bluez/hci0/dev_02_00_00_00_00_01/telephony10/call1': {'org.bluez.Call1': { 'State': <'active'> }}})");const BluezObjects objects = parse_managed_objects(payload.v);- EXPECT_EQ(objects.calls_for("/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony1").size(), 1u);- EXPECT_EQ(objects.calls_for("/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony10").size(), 1u);+ EXPECT_EQ(objects.calls_for("/org/bluez/hci0/dev_02_00_00_00_00_01/telephony1").size(), 1u);+ EXPECT_EQ(objects.calls_for("/org/bluez/hci0/dev_02_00_00_00_00_01/telephony10").size(), 1u);}// The objects exist only under bluetoothd --experimental and only while HFP is// connected. Their absence is the normal state, not a parse failure.TEST(Telephony, AbsentWhenHandsFreeIsNotConnected) {Payload payload(R"({- '/org/bluez/hci0/dev_60_57_C8_30_6A_F7': {- 'org.bluez.Device1': { 'Address': <'60:57:C8:30:6A:F7'> }+ '/org/bluez/hci0/dev_02_00_00_00_00_01': {+ 'org.bluez.Device1': { 'Address': <'02:00:00:00:00:01'> }}})");const BluezObjects objects = parse_managed_objects(payload.v);EXPECT_TRUE(objects.telephony.empty());EXPECT_TRUE(objects.calls.empty());- EXPECT_EQ(objects.find_telephony("/org/bluez/hci0/dev_60_57_C8_30_6A_F7"), nullptr);+ EXPECT_EQ(objects.find_telephony("/org/bluez/hci0/dev_02_00_00_00_00_01"), nullptr);}// A gateway that is still bringing up its service level connection is not ready@@ -229,7 +229,7 @@ TEST(Telephony, WithheldCallerIdIsNotANumber) {TEST(Telephony, SerializesCallsForClients) {Payload payload(TWO_GATEWAYS);const BluezObjects objects = parse_managed_objects(payload.v);- const nlohmann::json j = to_json(objects.calls_for("/org/bluez/hci0/dev_60_57_C8_30_6A_F7/telephony0"));+ const nlohmann::json j = to_json(objects.calls_for("/org/bluez/hci0/dev_02_00_00_00_00_01/telephony0"));ASSERT_EQ(j.size(), 1u);EXPECT_EQ(j[0]["number"], "+15555550123");@@ -242,7 +242,7 @@ TEST(Telephony, SerializesCallsForClients) {TEST(Telephony, SerializesTheGatewayForClients) {Payload payload(TWO_GATEWAYS);const BluezObjects objects = parse_managed_objects(payload.v);- const nlohmann::json j = to_json(*objects.find_telephony("/org/bluez/hci0/dev_60_57_C8_30_6A_F7"));+ const nlohmann::json j = to_json(*objects.find_telephony("/org/bluez/hci0/dev_02_00_00_00_00_01"));EXPECT_TRUE(j["available"]);EXPECT_EQ(j["operator"], "AT&T");@@ -258,7 +258,7 @@ namespace {constexpr const char* PIPEWIRE_ROOT = R"({'/org/pipewire/Telephony/ag1': {'org.pipewire.Telephony.AudioGateway1': {- 'Address': <'60:57:C8:30:6A:F7'>,+ 'Address': <'02:00:00:00:00:01'>,'SpeakerVolume': <byte 15>,'MicrophoneVolume': <byte 15>},@@ -310,14 +310,14 @@ namespace {}std::unique_ptr<TelephonyClient> client_of(std::vector<std::unique_ptr<TelephonySource>> sources) {- return std::make_unique<TelephonyClient>(std::move(sources), "60:57:C8:30:6A:F7");+ return std::make_unique<TelephonyClient>(std::move(sources), "02:00:00:00:00:01");}} // namespaceTEST(PipewireTelephony, MatchesTheGatewayByAddress) {Payload payload(PIPEWIRE_ROOT);- const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "60:57:c8:30:6a:f7");+ const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "02:00:00:00:00:01");EXPECT_EQ(snap.gateway.path, "/org/pipewire/Telephony/ag1") << "address match must be case-insensitive";EXPECT_TRUE(snap.gateway.ready()) << "a registered gateway means the service level connection is up";@@ -328,7 +328,7 @@ TEST(PipewireTelephony, MatchesTheGatewayByAddress) {// from it is how the Hang up button goes missing.TEST(PipewireTelephony, RootManagerCarriesNoCalls) {Payload payload(PIPEWIRE_ROOT);- const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "60:57:C8:30:6A:F7");+ const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "02:00:00:00:00:01");EXPECT_TRUE(snap.calls.empty());}@@ -366,7 +366,7 @@ TEST(PipewireTelephony, UnknownAddressYieldsNoGateway) {// their defaults rather than being invented.TEST(PipewireTelephony, ReportsNoCellularIndicators) {Payload payload(PIPEWIRE_ROOT);- const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "60:57:C8:30:6A:F7");+ const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "02:00:00:00:00:01");EXPECT_TRUE(snap.gateway.operator_name.empty());EXPECT_EQ(snap.gateway.signal, 0);@@ -376,7 +376,7 @@ TEST(PipewireTelephony, ReportsNoCellularIndicators) {TEST(PipewireTelephony, EmptyPayloadIsNotAFailure) {Payload payload("@a{oa{sa{sv}}} {}");- const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "60:57:C8:30:6A:F7");+ const TelephonySnapshot snap = parse_pipewire_telephony(payload.v, "02:00:00:00:00:01");EXPECT_TRUE(snap.gateway.path.empty());}