From 8f81dc8788b4062fdc6c6c63c1bb8089cf19ea76 Mon Sep 17 00:00:00 2001 From: Milind Ramesh Murhekar Date: Mon, 3 Jul 2017 17:29:00 +0530 Subject: [PATCH] Allow notification for connected client devices for P2P Tethering. Description: This patch allows the existing API's to notify the connected client info to the Application. Change-Id: Id0cf69d8d634b73a423f7c7fe0cbf66b8512ecb9 Signed-off-by: Milind Ramesh Murhekar --- packaging/capi-network-tethering.spec | 2 +- src/tethering.c | 11 ++++++++--- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/packaging/capi-network-tethering.spec b/packaging/capi-network-tethering.spec index bfa824b..e20b6b3 100644 --- a/packaging/capi-network-tethering.spec +++ b/packaging/capi-network-tethering.spec @@ -1,6 +1,6 @@ Name: capi-network-tethering Summary: Tethering Framework -Version: 1.0.53 +Version: 1.0.54 Release: 1 Group: System/Network License: Apache-2.0 diff --git a/src/tethering.c b/src/tethering.c index a78d27d..a991af3 100755 --- a/src/tethering.c +++ b/src/tethering.c @@ -153,7 +153,8 @@ static bool __any_tethering_is_enabled(tethering_h tethering) { if (tethering_is_enabled(tethering, TETHERING_TYPE_USB) || tethering_is_enabled(tethering, TETHERING_TYPE_WIFI) || - tethering_is_enabled(tethering, TETHERING_TYPE_BT)) + tethering_is_enabled(tethering, TETHERING_TYPE_BT) || + tethering_is_enabled(tethering, TETHERING_TYPE_P2P)) return true; return false; @@ -367,6 +368,8 @@ static void __handle_dhcp(GDBusConnection *connection, const gchar *sender_name, type = TETHERING_TYPE_WIFI; else if (ap_type == MOBILE_AP_TYPE_BT) type = TETHERING_TYPE_BT; + else if (ap_type == MOBILE_AP_TYPE_P2P) + type = TETHERING_TYPE_P2P; else { ERR("Not supported tethering type [%d]\n", ap_type); goto DONE; @@ -2333,6 +2336,8 @@ API int tethering_foreach_connected_clients(tethering_h tethering, tethering_typ client.interface = TETHERING_TYPE_WIFI; else if (interface == MOBILE_AP_TYPE_BT) client.interface = TETHERING_TYPE_BT; + else if (interface == MOBILE_AP_TYPE_P2P) + client.interface = TETHERING_TYPE_P2P; else { ERR("Invalid interface\n"); g_free(key); @@ -2602,7 +2607,7 @@ API int tethering_set_connection_state_changed_cb(tethering_h tethering, tetheri } /* TETHERING_TYPE_ALL */ - for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) { + for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) { th->changed_cb[ti] = callback; th->changed_user_data[ti] = user_data; } @@ -2643,7 +2648,7 @@ API int tethering_unset_connection_state_changed_cb(tethering_h tethering, tethe } /* TETHERING_TYPE_ALL */ - for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_BT; ti++) { + for (ti = TETHERING_TYPE_USB; ti <= TETHERING_TYPE_P2P; ti++) { th->changed_cb[ti] = NULL; th->changed_user_data[ti] = NULL; } -- 2.7.4