Skip to content

feat(discovery): implement BLE scanner and advertiser - #38

Merged
Mrwicks00 merged 1 commit into
StellarConduit:mainfrom
Favour4712:feat/discovery-ble-scanner
Mar 9, 2026
Merged

feat(discovery): implement BLE scanner and advertiser#38
Mrwicks00 merged 1 commit into
StellarConduit:mainfrom
Favour4712:feat/discovery-ble-scanner

Conversation

@Favour4712

Copy link
Copy Markdown
Contributor

feat(discovery): Implement BLE Peer Scanner and Advertiser

Closes #23

Description

This PR implements the BLE discovery layer in src/discovery/ble.rs.

Changes

  • BleAdvertisementPayload: 33-byte struct (32-byte pubkey + 1-byte caps). Encodes/decodes the manufacturer data payload embedded in BLE advertisements. Capability flags: bit 0 = is_relay, bit 1 = has_wifi_direct.
  • BleScanner: Holds an Arc<Mutex<PeerList>> and a broadcast::Sender<DiscoveryEvent>. The testable handle_advertisement() method decodes the payload, calls PeerList::insert_or_update (using the advertisement RSSI as signal_strength), and broadcasts the resulting DiscoveryEvent to all subscribers. The start() / stop() stubs hook into the btleplug scan loop in production.
  • BleAdvertiser: Encodes the local PeerIdentity into a BleAdvertisementPayload and begins advertising with SC_SERVICE_UUID. The build_payload() method is testable without hardware.
  • Added #[derive(Clone)] to DiscoveryEvent to satisfy the broadcast::Sender<T> bound.
  • Fixed a pre-existing flaky assertion in the bloom filter rotation test that was incorrectly asserting false on probabilistic bloom filter membership checks.

Platform Note: btleplug requires a real or virtual BLE adapter for integration tests. Unit tests cover all pure Rust logic.

@Mrwicks00
Mrwicks00 merged commit 4dc8df4 into StellarConduit:main Mar 9, 2026
@grantfox-oss

grantfox-oss Bot commented Jun 22, 2026

Copy link
Copy Markdown

🎉 This issue has been marked as completed on GrantFox as part of the Official Campaign campaign!

@BigNathan1's PR #144 was approved and merged by @Mrwicks00.

🏆 @BigNathan1: You earned 35 FoxPoints for this contribution! Your current tier: Explorer (48 total points). Track your full progress on GrantFox.

👏 Great work, @BigNathan1! Keep contributing to StellarConduit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(discovery): Implement BLE Peer Scanner and Advertiser

2 participants