Working with Intel AMT: HLAPI!

Okay okay, I know it's been awhile since my last post, but I haven't forgotten about you guys! I was trying to wait until I released IT Helper 1.0, but it looks like I'll have to hold off on that for a few more days. Anyway, let's talk about the HLAPI!

The High Level API (HLAPI) makes it even easier to develop applications for Intel AMT (as if it were easy to begin with). It's like a high level programming language: it hides the complicated details, making it easier to use. This is perfect for new AMT developers. You can create a simple management console without having to learn all of the gory details. It's also good for experienced AMT developers who want to spend less time writing code. Currently, features of the HLAPI include Hardware Asset, Remote Control, and Storage.

The Hardware Asset and Remote Control features of the HLAPI can save time and/or some typing. It doesn't take too long to implement these features using the SDK, but being lazy never hurt anyone! If you don't know how to implement them using the SDK, you can check out my Hardware Asset and Remote Control samples. You'll notice that using the HLAPI is much easier.

The Storage feature, in my opinion, is the biggest benefit of using the HLAPI. Using Storage is a complicated process in general, so you can imagine how complicated it is to write code for it (if you haven't already). I wrote a sample that allocates a single block and writes "Hello World!" to it. It's 300+ lines of code. To accomplish the same thing using the HLAPI, it only took about 30 lines of code! I did have a bit of unneeded code in my original sample, but you can definitely see a huge difference in the amount of work required.

Here's how to start using the HLAPI:

    • Download it. You can get the HLAPI here.

    • Add references. You'll need to add HLAPI.dll, CIMFramework_5_0.dll, and DotNetWSManClient_5_0.dll to your project. In Visual Studio 2008, you go to Project -> Add Reference -> Browse and navigate to the "Bin" folder of the HLAPI directory.

    • Start writing code! See below for a quick example.




The code below retrieves "ComputerSystem" information from the AMT machine. You can use the same process to add full Hardware Asset functionality to your application. Remember to update ip, username, and password before running the code.


using System;
using Intel.Manageability;
using Intel.Manageability.HardwareAssets;

class Example
{
static void Main()
{
string ip, username, password;
ConnectionInfo CI;
IAMTInstance inst;
ComputerSystem computerSystem;

ip = "";
username = "";
password = "";
CI = new ConnectionInfo(ip, username, password, false, null, ConnectionInfo.AuthMethod.Digest, null, null);
inst = AMTInstanceFactory.Create(CI);
computerSystem = inst.HardwareAsset.ComputerSystem;
Console.WriteLine("Computer model: " + computerSystem.Product);
Console.WriteLine("Manufacturer: " + computerSystem.Manufacturer);
Console.WriteLine("Version: " + computerSystem.Version);
Console.WriteLine("Serial number: " + computerSystem.SerialNumber);
Console.WriteLine("\nPress Enter to exit...");
Console.ReadLine();
}
}



Wasn't that easy? Now how about adding some Remote Control capability to our application? Let's try powering down the AMT machine.

inst.Power.PowerDown();

That's it. One line of code...literally. How much easier can it get?! I won't get into it here, but the HLAPI is even more useful when working with Storage. So go try it out and let us know what you think. Remember, this is a "Technology Preview." The HLAPI is still being worked on and your feedback is absolutely essential! Download it, use it, and tell us what you want to see in the next release. As always, feel free to leave a comment/question and thanks for reading!

Click here to see all of my blog posts.

有关编译器优化的更完整信息,请参阅优化通知