+gboolean handle_tdls_channel_switch(Wifi *wifi, GDBusMethodInvocation *context,
+ gchar *peer_mac_Addr, int freq)
+{
+ GVariant *message = NULL;
+ GVariantBuilder *builder;
+ GVariant *params;
+ char *if_path = NULL;
+ unsigned char oper_class = 0;
+
+ if (peer_mac_Addr == NULL) {
+ ERR("TDLS: Invalid Parameter");
+ wifi_complete_tdls_channel_switch(wifi, context,
+ NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+
+ oper_class = _netconfig_get_operating_class(freq);
+
+ if (!oper_class) {
+ ERR("TDLS: Invalid Parameter");
+ wifi_complete_tdls_channel_switch(wifi, context,
+ NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+
+ builder = g_variant_builder_new(G_VARIANT_TYPE("a{sv}"));
+
+ g_variant_builder_add(builder, "{sv}", "PeerAddress", g_variant_new_string(peer_mac_Addr));
+ g_variant_builder_add(builder, "{sv}", "Frequency", g_variant_new_uint32(freq));
+ g_variant_builder_add(builder, "{sv}", "OperClass", g_variant_new_byte(oper_class));
+ params = g_variant_new("(@a{sv})", g_variant_builder_end(builder));
+ g_variant_builder_unref(builder);
+
+ if_path = netconfig_wifi_get_supplicant_interface();
+
+ if (if_path == NULL) {
+ ERR("Fail to get wpa_supplicant DBus path");
+ wifi_complete_tdls_channel_switch(wifi, context,
+ NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+
+ message = netconfig_invoke_dbus_method(SUPPLICANT_SERVICE,
+ if_path, SUPPLICANT_INTERFACE ".Interface", "TDLSChannelSwitch", params);
+
+ g_free(if_path);
+ if (message == NULL) {
+ ERR(" TDLS : Fail to Process TDLS Channel Switch Request !!!");
+ wifi_complete_tdls_channel_switch(wifi, context,
+ NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+
+ INFO("TDLS Channel Change Request: Success");
+ wifi_complete_tdls_channel_switch(wifi, context, NETCONFIG_ERROR_TDLS_NO_ERROR);
+
+ g_variant_unref(message);
+ return TRUE;
+}
+
+
+gboolean handle_tdls_cancel_channel_switch(Wifi *wifi, GDBusMethodInvocation *context,
+ gchar *peer_mac_Addr)
+{
+ GVariant *message = NULL;
+
+ if (peer_mac_Addr == NULL) {
+ INFO("TDLS: Invalid Parameter");
+ wifi_complete_tdls_cancel_channel_switch(wifi, context, NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+ message = __netconfig_wifi_tdls_send_dbus_str("TDLSCancelChannelSwitch", (const char*)peer_mac_Addr);
+ if (message == NULL) {
+ ERR(" TDLS : Fail to TDLS Cancel Channel Swicth Request !!!");
+ wifi_complete_tdls_cancel_channel_switch(wifi, context, NETCONFIG_ERROR_TDLS_FAIL_CHANNEL_SWITCH);
+ return TRUE;
+ }
+
+ INFO("TDLS Cancel Channel Swicth Request : Success");
+ wifi_complete_tdls_cancel_channel_switch(wifi, context, NETCONFIG_ERROR_TDLS_NO_ERROR);
+
+ g_variant_unref(message);
+ return TRUE;
+}
+