100 lines
3.2 KiB
C#

//----------------------------------------------------------------------------
//
// Copyright (c) Intel Corporation, 2012 - 2014 All Rights Reserved.
//
//----------------------------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Text;
using HLAPI.Wireless;
using Intel.Manageability.Exceptions;
using Intel.Manageability;
namespace WiFiConfigurationLocalSample
{
class WirelessLocalFunctionality
{
#region Private Members
const string USER_PROFILE_NAME = "Wireless-Profile-Local";
IAMTInstance amt;
#endregion
#region Constructor
public WirelessLocalFunctionality(IAMTInstance amt)
{
this.amt = amt;
}
#endregion
#region Public Functions
public void AddWirelessUserProfile()
{
Console.WriteLine("\nAdd wireless user profile with keys:");
Console.WriteLine("===========================\n");
// Add user wireless profile configuration setting.
List<string> keys = new List<string>();
keys.Add("ABCABCABCA123");
keys.Add("ABCABCABC0136");
UserProfile userProfile = new UserProfile(USER_PROFILE_NAME,
keys,
0);
try
{
// Add user wireless profile from local machine.
amt.Config.Wireless.Local.CreateOrUpdateProfile(userProfile);
Console.WriteLine("Wireless user profile added successfully.");
}
catch (WirelessManageabilityException ex)
{
Console.WriteLine(ex.Message);
}
}
public void UpdateWirelessUserProfile()
{
Console.WriteLine("\nUpdate user profile with no encryption:");
Console.WriteLine("=======================================\n");
// Update user wireless profile configuration setting.
UserProfile userProfile = new UserProfile(USER_PROFILE_NAME);
try
{
// Update user wireless profile from the local machine.
amt.Config.Wireless.Local.CreateOrUpdateProfile(userProfile);
Console.WriteLine("Wireless user profile updated successfully.");
}
catch (WirelessManageabilityException ex)
{
Console.WriteLine(ex.Message);
}
}
public void DeleteWirelessUserProfile()
{
try
{
Console.WriteLine("\nDelete wireless user profile \"" + USER_PROFILE_NAME + "\":");
Console.WriteLine("=================================================\n");
// Delete admin profile by name.
amt.Config.Wireless.Local.DeleteUserProfile(USER_PROFILE_NAME);
Console.WriteLine("Delete wireless user profile completed successfully.");
}
catch (WirelessManageabilityException ex)
{
Console.WriteLine(ex.Message);
}
}
#endregion
}
}