private void DeleteProfiles() { if (m_WlanApi == null) { Log("Initaliziation not complete .. skipping profile cleanup"); return; } try { var profileInfoList = m_WlanApi.GetProfileList(m_TestInterface.Id); //Log ("DeleteProfiles Found "+profileInfoList.Count+" profiles"); Log(String.Format(CultureInfo.InvariantCulture, "DeleteProfiles Found {0} profiles", profileInfoList.Count)); foreach (WlanProfileInfo profileInfo in profileInfoList) { //Log("Deleting "+profileInfo); Log(String.Format(CultureInfo.InvariantCulture, "Deleting {0}", profileInfo)); m_WlanApi.DeleteProfile(m_TestInterface.Id, profileInfo.ProfileName); } } catch (Exception e) { Log("DeleteProfiles ignoring exception " + e.ToString()); } }
public bool DeleteWlanProfile(string profileName) { try { using (Wlan wlanApi = new Wlan()) { testLogger.LogComment("DeleteWlanProfile"); var wlanInterfaceList = wlanApi.EnumWlanInterfaces(); if (NetworkInterfaceDataPathTests.CheckWlanInterfaceCount(wlanApi) == false) { return(false); } var wlanInterface = wlanInterfaceList[0]; testLogger.LogComment("Deleting Profile {0}", profileName); wlanApi.DeleteProfile(wlanInterface.Id, profileName); return(true); } } catch (Exception error) { testLogger.LogError("Error encountered while Deleting the Wlan Profile {0}", profileName); testLogger.LogError(error.ToString()); return(false); } }
private void DeleteProfiles() { if (Api == null) { Log("Initaliziation not complete .. skipping profile cleanup"); return; } try { var profileInfoList = Api.GetProfileList(TestInterface.Id); Log("DeleteProfiles Found " + profileInfoList.Count + " profiles"); foreach (WlanProfileInfo profileInfo in profileInfoList) { Log("Deleting " + profileInfo); Api.DeleteProfile(TestInterface.Id, profileInfo.ProfileName); } } catch (Exception e) { Log("DeleteProfiles ignoring exception " + e.ToString()); } }
private void DisconnectAndDeleteProfile(Wlan wlanApi) { var wlanInterfaceList = wlanApi.EnumWlanInterfaces(); Verify.IsTrue(wlanInterfaceList.Count >= 1, string.Format(CultureInfo.InvariantCulture, "wlanInterfaceList.Count = {0}", wlanInterfaceList.Count)); if (wlanInterfaceList[0].State == WLAN_INTERFACE_STATE.wlan_interface_state_connected) { testLogger.LogComment("Disconnecting from AP"); wlanApi.Disconnect(wlanInterfaceList[0].Id); Wlan.Sleep(5000); } try { testLogger.LogComment("Deleting Profile"); wlanApi.DeleteProfile(wlanInterfaceList[0].Id, dot11wSSID); } catch (System.Runtime.InteropServices.COMException) { // The profile was not present to delete } }