From 5022cb7aefecb919715af9391a244657acf3ddf8 Mon Sep 17 00:00:00 2001 From: Nishant Chaprana Date: Wed, 26 Aug 2015 09:53:19 +0530 Subject: [PATCH] Added device lost event in discovery state callback Description: This patch adds device lost event in discovery state callback to notify application about device disappeared. Change-Id: I6922cb66aeeb3d64832a7f2e1015e22c627590d2 Signed-off-by: Nishant Chaprana --- include/wifi-direct.h | 1 + packaging/capi-network-wifi-direct.spec | 2 +- src/include/wifi-direct-ipc.h | 1 + src/wifi-direct-client-proxy.c | 7 +++++++ test/test-wifi-direct.c | 4 ++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/wifi-direct.h b/include/wifi-direct.h index 701108c..381fa68 100755 --- a/include/wifi-direct.h +++ b/include/wifi-direct.h @@ -92,6 +92,7 @@ typedef enum { WIFI_DIRECT_ONLY_LISTEN_STARTED, /**< Only listen started */ WIFI_DIRECT_DISCOVERY_STARTED, /**< Discovery started */ WIFI_DIRECT_DISCOVERY_FOUND, /**< A remote peer is found */ + WIFI_DIRECT_DISCOVERY_LOST, /** A remote peer is lost */ WIFI_DIRECT_DISCOVERY_FINISHED, /**< Discovery finished */ } wifi_direct_discovery_state_e; diff --git a/packaging/capi-network-wifi-direct.spec b/packaging/capi-network-wifi-direct.spec index b1c46c9..48a04b1 100644 --- a/packaging/capi-network-wifi-direct.spec +++ b/packaging/capi-network-wifi-direct.spec @@ -1,6 +1,6 @@ Name: capi-network-wifi-direct Summary: Network WiFi-Direct Library -Version: 1.2.38 +Version: 1.2.39 Release: 1 Group: Network & Connectivity/Wireless License: Apache-2.0 diff --git a/src/include/wifi-direct-ipc.h b/src/include/wifi-direct-ipc.h index c530eb0..af8034f 100755 --- a/src/include/wifi-direct-ipc.h +++ b/src/include/wifi-direct-ipc.h @@ -180,6 +180,7 @@ typedef enum WIFI_DIRECT_CLI_EVENT_DISCOVER_START_SEARCH_LISTEN, /**< search, listen*/ WIFI_DIRECT_CLI_EVENT_DISCOVER_END, /**< */ WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS, /**< */ + WIFI_DIRECT_CLI_EVENT_DISCOVER_LOST_PEERS, /**< */ WIFI_DIRECT_CLI_EVENT_CONNECTION_START, /**< */ WIFI_DIRECT_CLI_EVENT_CONNECTION_REQ, /**< */ diff --git a/src/wifi-direct-client-proxy.c b/src/wifi-direct-client-proxy.c index 6d9d293..33d2aa9 100755 --- a/src/wifi-direct-client-proxy.c +++ b/src/wifi-direct-client-proxy.c @@ -188,6 +188,9 @@ static char *__wfd_print_event(wfd_client_event_e event) case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS: return "WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS"; break; + case WIFI_DIRECT_CLI_EVENT_DISCOVER_LOST_PEERS: + return "WIFI_DIRECT_CLI_EVENT_DISCOVER_LOST_PEERS"; + break; case WIFI_DIRECT_CLI_EVENT_CONNECTION_START: return "WIFI_DIRECT_CLI_EVENT_CONNECTION_START"; break; @@ -299,6 +302,9 @@ static int __wfd_convert_client_event(wfd_client_event_e event) case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS: return WIFI_DIRECT_DISCOVERY_FOUND; break; + case WIFI_DIRECT_CLI_EVENT_DISCOVER_LOST_PEERS: + return WIFI_DIRECT_DISCOVERY_LOST; + break; case WIFI_DIRECT_CLI_EVENT_DISCOVER_END: return WIFI_DIRECT_DISCOVERY_FINISHED; break; @@ -716,6 +722,7 @@ static gboolean __wfd_client_process_event(GIOChannel *source, client->user_data_for_cb_activation); break; case WIFI_DIRECT_CLI_EVENT_DISCOVER_FOUND_PEERS: + case WIFI_DIRECT_CLI_EVENT_DISCOVER_LOST_PEERS: if (client->peer_found_cb) { client->peer_found_cb(error, (wifi_direct_discovery_state_e) __wfd_convert_client_event(event), diff --git a/test/test-wifi-direct.c b/test/test-wifi-direct.c index 410dedf..61dece2 100644 --- a/test/test-wifi-direct.c +++ b/test/test-wifi-direct.c @@ -654,6 +654,10 @@ void _cb_discover(int error_code, wifi_direct_discovery_state_e discovery_state, } break; + case WIFI_DIRECT_DISCOVERY_LOST: + event_printf("event - WIFI_DIRECT_DISCOVERY_LOST\n"); + break; + default: break; } -- 2.7.4