fix: improve QR direct connection reliability and speed
This commit is contained in:
@@ -7,7 +7,8 @@ use anyhow::Context;
|
||||
use windows::{
|
||||
core::HSTRING,
|
||||
Devices::WiFiDirect::{
|
||||
WiFiDirectAdvertisementPublisher, WiFiDirectAdvertisementPublisherStatus,
|
||||
WiFiDirectAdvertisementListenStateDiscoverability, WiFiDirectAdvertisementPublisher,
|
||||
WiFiDirectAdvertisementPublisherStatus,
|
||||
},
|
||||
Security::Credentials::PasswordCredential,
|
||||
};
|
||||
@@ -32,6 +33,16 @@ impl DirectAp {
|
||||
.context("创建 Wi-Fi Direct publisher 失败")?;
|
||||
let ad = publisher.Advertisement()
|
||||
.context("读取 Wi-Fi Direct advertisement 失败")?;
|
||||
// WinRT defaults this property to `None`, which still lets the
|
||||
// publisher report `Started` but does not make the AP discoverable.
|
||||
// Android then waits in the system Wi-Fi picker until it times out,
|
||||
// exactly as if the hotspot had never been started. Intensive keeps
|
||||
// the legacy SSID discoverable even when the desktop window is not
|
||||
// foregrounded during the phone-side connection flow.
|
||||
ad.SetListenStateDiscoverability(
|
||||
WiFiDirectAdvertisementListenStateDiscoverability::Intensive,
|
||||
)
|
||||
.context("启用 QFT Wi-Fi Direct 可发现性失败")?;
|
||||
ad.SetIsAutonomousGroupOwnerEnabled(true)
|
||||
.context("启用 Autonomous Group Owner 失败")?;
|
||||
let legacy = ad.LegacySettings()
|
||||
|
||||
Reference in New Issue
Block a user