#ifdef __cplusplus
}
#endif
-
+
#endif
/** Ethernet Cable Detached Event */
NET_EVENT_ETHERNET_CABLE_DETACHED,
+
+ /** Wi-Fi TDLS Peer Connected EVENT) */
+ NET_EVENT_TDLS_CONNECTED_IND,
+
+ /** Wi-Fi TDLS Peer Disconnect EVENT) */
+ NET_EVENT_TDLS_DISCONNECTED_IND,
} net_event_t;
/**
/** Length of bssid */
#define NET_WLAN_BSSID_LEN 17
-/**
- * Length of WPS PIN code
+/**
+ * Length of WPS PIN code
* WPS PIN code should be 4 or 8 digits
*/
-#define NET_WLAN_MAX_WPSPIN_LEN 8
+#define NET_WLAN_MAX_WPSPIN_LEN 8
/**
* Passphrase length should be between 8..63,
/*****************************************************************************
- * Global Enums
+ * Global Enums
*****************************************************************************/
/**
typedef struct {
/** PBC / PIN */
net_wifi_wps_type_t type;
-
+
/** Optional. This pin is needed when the user input PIN code */
char pin[NET_WLAN_MAX_WPSPIN_LEN + 1];
} net_wifi_wps_info_t;
};
/*****************************************************************************
- * Typedefs
+ * Typedefs
*****************************************************************************/
/*****************************************************************************
- * Global Functions
+ * Global Functions
*****************************************************************************/
-
+
/*****************************************************************************
* ConnMan Wi-Fi Client Interface Synchronous API Declaration
*****************************************************************************/
int net_wifi_enroll_wps_without_ssid(net_wifi_wps_info_t *wps_info);
#endif
+
+int net_wifi_tdls_disconnect(const char* peer_mac_addr);
+int net_wifi_tdls_connected_peer(char** peer_mac_addr);
+
/**
* \}
*/
Name: libnet-client
Summary: Network Client library (Shared library)
-Version: 1.1.43
+Version: 1.1.44
Release: 1
Group: System/Network
License: Flora-1.1
#endif
+int _net_dbus_tdls_disconnect(const char* peer_mac_addr);
+int _net_dbus_tdls_connected_peer(char** peer_mac_addr);
#ifdef __cplusplus
}
#define NETCONFIG_SIGNAL_SPECIFIC_SCAN_DONE "SpecificScanCompleted"
#define NETCONFIG_SIGNAL_WPS_SCAN_DONE "WpsScanCompleted"
#define NETCONFIG_SIGNAL_ETHERNET_CABLE_STATE "EthernetCableState"
+#define NETCONFIG_SIGNAL_TDLS_CONNECTED "TDLSConnect"
+#define NETCONFIG_SIGNAL_TDLS_DISCONNECTED "TDLSDisconnect"
+#define NETCONFIG_SIGNAL_TDLS_PEER_FOUND "TDLSPeerFound"
#undef LOG_TAG
#define LOG_TAG "NET_CLIENT"
*****************************************************************************/
/*****************************************************************************
- * Global Functions
+ * Global Functions
*****************************************************************************/
int _net_deregister_signal(void);
int _net_register_signal(void);
return NET_ERR_NONE;
}
#endif
+
+int _net_dbus_tdls_disconnect(const char* peer_mac_addr)
+{
+
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ GVariant *params = NULL;
+ const char *method = "TdlsDisconnect";
+ gint32 ret = -1;
+
+ params = g_variant_new("(s)", peer_mac_addr);
+
+ message = _net_invoke_dbus_method(
+ NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, method, params, &Error);
+
+ if (message == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Failed to TDLS Disconnect Request\n");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_get(message, "(i)", &ret);
+
+ NETWORK_LOG(NETWORK_HIGH, "Status [%d]\n", ret);
+
+ if(ret)
+ Error = NET_ERR_NONE;
+ else
+ Error = NET_ERR_UNKNOWN;
+
+ g_variant_unref(message);
+ __NETWORK_FUNC_EXIT__;
+
+ return Error;
+}
+
+int _net_dbus_tdls_connected_peer(char** peer_mac_addr)
+{
+
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+ GVariant *message = NULL;
+ const char *method = "TdlsConnectedPeer";
+
+
+ if(NULL == peer_mac_addr) {
+ NETWORK_LOG(NETWORK_ERROR,"Invalid Parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
+ }
+
+ message = _net_invoke_dbus_method(
+ NETCONFIG_SERVICE, NETCONFIG_WIFI_PATH,
+ NETCONFIG_WIFI_INTERFACE, method, NULL, &Error);
+
+ if (message == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "Failed to Get Peer Connected Mac address\n");
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+ }
+
+ g_variant_get(message, "(s)", peer_mac_addr);
+
+ NETWORK_LOG(NETWORK_HIGH, "TDLS Peer Mac address [%s]\n", *peer_mac_addr);
+
+ g_variant_unref(message);
+ __NETWORK_FUNC_EXIT__;
+
+ return Error;
+}
\ No newline at end of file
g_variant_unref(var);
}
}
+static int __net_handle_wifi_tdls_connected_event(GVariant *param)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariantIter *iter = NULL;
+ GVariant *value = NULL;
+ const char *key = NULL;
+ const gchar *sig_value = NULL;
+
+ g_variant_get(param, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "peermac") == 0) {
+ sig_value = g_variant_get_string(value, NULL);
+
+ NETWORK_LOG(NETWORK_ERROR, "TDLS Connected Peer Mac Adress: %s",
+ sig_value);
+ }
+ }
+ g_variant_iter_free(iter);
+
+ net_event_info_t event_data;
+ memset(&event_data, 0, sizeof(event_data));
+
+ event_data.Error = NET_ERR_NONE;
+ event_data.Event = NET_EVENT_TDLS_CONNECTED_IND;
+ event_data.Data = g_strdup(sig_value);
+
+ if(event_data.Data)
+ event_data.Datalength = strlen(event_data.Data);
+ else
+ event_data.Datalength = 0;
+
+ NETWORK_LOG(NETWORK_ERROR,"Sending NET_EVENT_TDLS_CONNECTED_IND");
+ _net_client_callback(&event_data);
+ g_free(event_data.Data);
+
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_NONE;
+}
+
+static int __net_handle_wifi_tdls_disconnected_event(GVariant *param)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ GVariantIter *iter = NULL;
+ GVariant *value = NULL;
+ const char *key = NULL;
+ const gchar *sig_value = NULL;
+
+ g_variant_get(param, "(a{sv})", &iter);
+
+ while (g_variant_iter_loop(iter, "{sv}", &key, &value)) {
+ if (g_strcmp0(key, "peermac") == 0) {
+ sig_value = g_variant_get_string(value, NULL);
+
+ NETWORK_LOG(NETWORK_ERROR, "TDLS Connected Peer Mac Adress: %s",
+ sig_value);
+ }
+ }
+ g_variant_iter_free(iter);
+
+ net_event_info_t event_data;
+ memset(&event_data, 0, sizeof(event_data));
+
+ event_data.Error = NET_ERR_NONE;
+ event_data.Event = NET_EVENT_TDLS_DISCONNECTED_IND;
+ event_data.Data = g_strdup(sig_value);
+
+ if(event_data.Data)
+ event_data.Datalength = strlen(event_data.Data);
+ else
+ event_data.Datalength = 0;
+
+ NETWORK_LOG(NETWORK_ERROR,"Sending NET_EVENT_TDLS_DISCONNECTED_IND");
+ _net_client_callback(&event_data);
+ g_free(event_data.Data);
+
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_NONE;
+}
+
+
static void __net_supplicant_signal_filter(GDBusConnection *conn,
const gchar *name, const gchar *path, const gchar *interface,
__net_handle_wifi_specific_scan_rsp(param);
else if (g_strcmp0(sig, NETCONFIG_SIGNAL_WPS_SCAN_DONE) == 0)
__net_handle_wifi_wps_scan_rsp(param);
+ else if (g_strcmp0(sig, NETCONFIG_SIGNAL_TDLS_CONNECTED) == 0)
+ __net_handle_wifi_tdls_connected_event(param);
+ else if (g_strcmp0(sig, NETCONFIG_SIGNAL_TDLS_DISCONNECTED) == 0)
+ __net_handle_wifi_tdls_disconnected_event(param);
}
static void __net_netconfig_network_signal_filter(GDBusConnection *conn,
return Error;
}
#endif
+
+EXPORT_API int net_wifi_tdls_disconnect(const char* peer_mac_addr)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+
+ if (peer_mac_addr == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "invalid parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
+ }
+
+ if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+ NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ Error = _net_dbus_tdls_disconnect(peer_mac_addr);
+
+ if (Error != NET_ERR_NONE)
+ NETWORK_LOG(NETWORK_ERROR, "_net_dbus_tdls_set_device_type failed\n");
+
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+
+}
+
+EXPORT_API int net_wifi_tdls_connected_peer(char** peer_mac_addr)
+{
+ __NETWORK_FUNC_ENTER__;
+
+ net_err_t Error = NET_ERR_NONE;
+
+ if (peer_mac_addr == NULL) {
+ NETWORK_LOG(NETWORK_ERROR, "invalid parameter\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_INVALID_PARAM;
+ }
+
+ if (g_atomic_int_get(&NetworkInfo.ref_count) == 0) {
+ NETWORK_LOG(NETWORK_ERROR, "Application is not registered\n");
+ __NETWORK_FUNC_EXIT__;
+ return NET_ERR_APP_NOT_REGISTERED;
+ }
+
+ Error = _net_dbus_tdls_connected_peer(peer_mac_addr);
+
+ if (Error != NET_ERR_NONE)
+ NETWORK_LOG(NETWORK_ERROR, "net_wifi_tdls_connected_peer failed\n");
+
+
+ __NETWORK_FUNC_EXIT__;
+ return Error;
+
+}
\ No newline at end of file