summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJose Blanquicet <blanquicet@gmail.com>2016-05-19 17:09:56 +0200
committerPatrik Flykt <patrik.flykt@linux.intel.com>2016-05-30 10:46:06 +0300
commitb0bb2e4bb17396fef80630c7e66b3956c4a4e665 (patch)
treeaaf890ce440bfd181cf628a52279543040af951a
parent9aad337b765dc6ae195e5f21d7764a71b2e82801 (diff)
downloadconnman-b0bb2e4bb17396fef80630c7e66b3956c4a4e665.tar.gz
peer: Update Connected Propererty of P2P Technology
Currently the property Connected is not used for P2P Technology thus it always remains False. This patch aims to keep it updated in order to make easier for the UI to show if P2P technology has an active P2P connection or not. This implementation has a limitation in cases of complex systems where multiple P2P interfaces are present and can be connected simultaneously, it is because the disconnection of one of those interfaces will cause that the property becomes False even if there is another interface still connected. But let say that such a complex systems are not very common.
-rw-r--r--doc/technology-api.txt3
-rw-r--r--src/peer.c3
2 files changed, 5 insertions, 1 deletions
diff --git a/doc/technology-api.txt b/doc/technology-api.txt
index f3703c00..f22e9b29 100644
--- a/doc/technology-api.txt
+++ b/doc/technology-api.txt
@@ -63,6 +63,9 @@ Properties boolean Powered [readwrite]
If this property is True it means that at least one
service of this technology is in ready state.
+ In case of P2P technology, this property indicates
+ if the peer is fully connected to another peer.
+
string Name [readonly]
Name of this technology.
diff --git a/src/peer.c b/src/peer.c
index 8a380c96..ad4e4457 100644
--- a/src/peer.c
+++ b/src/peer.c
@@ -905,6 +905,7 @@ int connman_peer_set_state(struct connman_peer *peer,
break;
case CONNMAN_PEER_STATE_READY:
reply_pending(peer, 0);
+ __connman_technology_set_connected(CONNMAN_SERVICE_TYPE_P2P, true);
break;
case CONNMAN_PEER_STATE_DISCONNECT:
if (peer->connection_master)
@@ -913,7 +914,7 @@ int connman_peer_set_state(struct connman_peer *peer,
__connman_dhcp_stop(peer->ipconfig);
peer->connection_master = false;
peer->sub_device = NULL;
-
+ __connman_technology_set_connected(CONNMAN_SERVICE_TYPE_P2P, false);
break;
case CONNMAN_PEER_STATE_FAILURE:
if (manage_peer_error(peer) == 0)