mirror of
https://github.com/albfan/miraclecast.git
synced 2025-03-09 23:38:56 +00:00
demo/miracle-wfdctl: Wait for P2PState changing before do P2P scanning
This commit is contained in:
parent
aa499be0dc
commit
490be6fbe2
2 changed files with 16 additions and 5 deletions
|
@ -23,7 +23,7 @@ namespace Org {
|
|||
public abstract GLib.ObjectPath link { owned get; }
|
||||
|
||||
[DBus (name = "P2PMac")]
|
||||
public abstract string p2_p_mac { owned get; }
|
||||
public abstract string p2p_mac { owned get; }
|
||||
|
||||
[DBus (name = "FriendlyName")]
|
||||
public abstract string friendly_name { owned get; }
|
||||
|
@ -77,8 +77,11 @@ namespace Org {
|
|||
[DBus (name = "Managed")]
|
||||
public abstract bool managed { get; }
|
||||
|
||||
[DBus (name = "P2PState")]
|
||||
public abstract int p2p_state { get; }
|
||||
|
||||
[DBus (name = "P2PScanning")]
|
||||
public abstract bool p2_p_scanning { get; set; }
|
||||
public abstract bool p2p_scanning { get; set; }
|
||||
|
||||
[DBus (name = "WfdSubelements")]
|
||||
public abstract string wfd_subelements { owned get; set; }
|
||||
|
|
|
@ -339,9 +339,17 @@ private class WfdCtl : GLib.Application
|
|||
yield wait_prop_changed(l as DBusProxy, "WfdSubelements");
|
||||
}
|
||||
|
||||
if(!l.p2_p_scanning) {
|
||||
if(-1 == l.p2p_state) {
|
||||
error("link %s has no P2P supporting", l.interface_name);
|
||||
}
|
||||
else if(0 == l.p2p_state) {
|
||||
info("wait for P2P supporting status...");
|
||||
yield wait_prop_changed(l as DBusProxy, "P2PState", 3);
|
||||
}
|
||||
|
||||
if(!l.p2p_scanning) {
|
||||
info("start P2P scanning...");
|
||||
l.p2_p_scanning = true;
|
||||
l.p2p_scanning = true;
|
||||
yield wait_prop_changed(l as DBusProxy, "P2PScanning");
|
||||
}
|
||||
|
||||
|
@ -379,7 +387,7 @@ private class WfdCtl : GLib.Application
|
|||
l = decode_path(l.substring(l.last_index_of_char('/') + 1));
|
||||
Peer p = peers.lookup(l);
|
||||
|
||||
info("forming P2P group with %s (%s)...", p.p2_p_mac, p.friendly_name);
|
||||
info("forming P2P group with %s (%s)...", p.p2p_mac, p.friendly_name);
|
||||
|
||||
ulong id = p.formation_failure.connect((r) => {
|
||||
info("failed to form P2P group: %s", r);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue