104 lines
3.2 KiB
C#
104 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;
|
|
using Intel.Manageability.Exceptions;
|
|
using Common.Utils;
|
|
using System.IO;
|
|
using System.Runtime.InteropServices;
|
|
|
|
namespace WiFiConfigurationRemoteSample
|
|
{
|
|
class Program
|
|
{
|
|
[DllImport("kernel32.dll", CallingConvention = CallingConvention.StdCall)]
|
|
[return: MarshalAs(UnmanagedType.Bool)]
|
|
public static extern bool SetDefaultDllDirectories(int directoryFlags);
|
|
|
|
static void Main(string[] args)
|
|
{
|
|
// set default dll lookup directory to system
|
|
SetDefaultDllDirectories(0x00000800); //LOAD_LIBRARY_SEARCH_SYSTEM32
|
|
|
|
IAMTInstance amt = null;
|
|
ConnectionInfoEX ci = null;
|
|
string SSID = "MyRouter";
|
|
|
|
try
|
|
{
|
|
// Check if JSON path was provided as an argument. If not, default path would be used.
|
|
try
|
|
{
|
|
ci = ProgramInput.DeserializeJsonToStruct(args.Length > 0 ? args[0] : null);
|
|
}
|
|
catch (IOException e)
|
|
{
|
|
Console.WriteLine($"Could not read argument file: {e.Message}");
|
|
return;
|
|
}
|
|
|
|
amt = AMTInstanceFactory.CreateEX(ci);
|
|
}
|
|
catch (ManageabilityException e)
|
|
{
|
|
ci?.Dispose();
|
|
Console.WriteLine(e.Message);
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
WirelessRemoteFunctionality wireless = new WirelessRemoteFunctionality(amt);
|
|
|
|
|
|
// Set and get link policy.
|
|
wireless.SetAndGetLinkPolicy();
|
|
|
|
// Add wireless profiles.
|
|
wireless.AddWirelessProfiles(SSID);
|
|
|
|
// Update wireless profiles.
|
|
wireless.UpdateWirelessProfiles(SSID);
|
|
|
|
// Get wireless profiles.
|
|
wireless.GetWirelessProfiles();
|
|
|
|
// Delete wireless profiles.
|
|
wireless.DeleteWirelessProfiles();
|
|
|
|
// Get link preference, link control, and automatic link transition state.
|
|
wireless.GetLinkProperties();
|
|
|
|
// Set link preference.
|
|
wireless.SetLinkPreference();
|
|
|
|
// Pause automatic link transition.
|
|
wireless.PauseAutoLinkTransition();
|
|
|
|
// Set and get link policy.
|
|
wireless.SetAndGetLinkPolicy();
|
|
|
|
// Set profile synchronization enable.
|
|
wireless.SetUserProfileSync(ProfileSynchronization.EnableUserSynchronization);
|
|
|
|
// Get profile synchronization.
|
|
wireless.GetUserProfileSync();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
finally
|
|
{
|
|
amt?.Dispose();
|
|
}
|
|
}
|
|
}
|
|
} |