Untyped

An application using an interface where the CIM class definitions are not built in is “untyped”. Such an application does not have built-in a priori knowledge of the MOF structure. The application provides text values for field names, method names and parameters. An application can Get an object and then receive field/value string pairs associated with the object. The CimObject class provides the mechanisms used for applications that do not need strong typing.

This approach is used in scripting applications that have definitions included in them in the form of strings (for example, URIs, field names, and special methods). The strings are validated only at runtime, when Intel AMT will return an error status when an incorrect value is used. A disadvantage of the untyped approach is that it is impossible to discover any special methods associated with a class.

Sample of a “Not Typed” Implementation

Untyped functions require text versions of the class name, field names, and field values. Further, the CimObject returns text field names and values.

The generated classes know the resource URI for the class. The untyped functions require supplying the URI explicitly.

First of all you have to create a CimOpenWsmanClient object:

CimOpenWsmanClient wsmanClient(string host, int port, bool secure, auth_method,string username, string password, string proxy, string proxy_username, string proxy_password, bool local, string cert, string oid);

After that you can perform the desired operations: Get, Put, special methods, etc.

Here are a few examples:

Get the AMT_WlanDebug instance.

CimObject GetWlanDebugInstance(ICimWsmanClient* wsmanClient)

{

  string bcsName = "AMT_WlanDebug";

 

  CimObject wlanDebug(wsmanClient,bcsName, "http://intel.com/wbem/wscim/1/amt-schema/1/"+bcsName,"f", "http://intel.com/wbem/wscim/1/amt-schema/1/"+ bcsName);

  wlanDebug.Get();

 

  return wlanDebug;

}

Invoke a method:

void ReadMemBufferFW(ICimWsmanClient *wsmanClient)

{

  string bcsName = "AMT_WlanDebug";

 

  CimObject wlanDebug(wsmanClient,bcsName, "http://intel.com/wbem/wscim/1/amt-schema/1/"+bcsName,"f", "http://intel.com/wbem/wscim/1/amt-schema/1/"+ bcsName);

  CimObject::CimKeys objWlanKeys;

  objWlanKeys.SetKey("Name", Name);

  wlanDebug.Get(objWlanKeys);

 

  // 1. Prepare method name

  string methodName = "readMemBufferFW";

  // 2. Prepare input object

  CimParam input;

  input.SetOrAddField("addr",Value);

  input.SetOrAddField("bytesCount", Value);

  // 3. Prepare output object

  CimParam output;

 

  // 4. Invoke a command

  returnValue = wlanDebug.Invoke(methodName, objWlanKeys, input, output);

 

  if(!output.ContainsField("ReturnValue"))

  {

    throw Exception("readMemBufferFW failed for unknown reason");

  }

  if (returnValue != PT_STATUS_SUCCESS)

  {

    throw Exception("readMemBufferFW returned the error code: ", returnValue);

  }

}

 

Set a property:

void SetBiosOptions(ICimWsmanClient *wsmanClient)

{

  CimObject wlanDebug = GetWlanDebugInstance (wsmanClient);

          bootSettingData.SetOrAddField("PropertyName",Value);

  CimObject::CimKeys keys;

  keys.SetKey("InstanceID", Value);

  bootSettingData.Put(keys);

 

}

 

Another Sample of a “Not Typed” Implementation

The Remote Control WS-Management C++ sample is written using the both the typed and untyped approach. The following snippet also demonstrates an untyped implementation. Untyped functions require text versions of the class name, field names, and field values. Further, the CimObject returns text field names and values.

The generated classes know the resource URI for the class. The untyped functions require supplying the URI explicitly.

// Generate a resource URI

string resourceURI = "http://schemas.dmtf.org/wbem/wscim/1/cim-schema/2/CIM_PhysicalMemory";

 

// Enumerate the class identified in the URI

vector<shared_ptr<CimObject>> cimPhisicalMemoryVec = CimObject::Enumerate(wsmanClient, resourceURI);

 

// Display the values

vector<tr1::shared_ptr<CimObject>>::iterator itr;

for(itr=orderedComponents.begin(); itr!=cimPhisicalMemoryVec.end(); itr++)

{

  if ((*itr)->ContainsField("Capacity"))

  {

    cout << "Capacity: "  <<  (*itr)->GetField("Capacity")[0] << endl;

  }

  if((*itr)->ContainsField("FormFactor"))

  {

    cout << "FormFactor: " <<  (*itr)->GetField("FormFactor")[0] << endl;

  }

  if((*itr)->ContainsField("MemoryType"))

  {

    cout << "Memory Type: ";

    switch ((*itr)->GetField("MemoryType")[0])

    {

    case 0:

          cout << "Unknown" << endl;

          break;

    case 1:

          cout << "Other" << endl;

          break;

    case 2:

          cout << "DRAM" << endl;

          break;

    case 3:

          cout << "Synchronous DRAM" << endl;

          break;

    default:

          cout << "Value not recognized by the sample. please update your SDK software" << endl;

          break;

    }

  }

  if((*itr)->ContainsField("Speed"))

  {

    cout << "Speed: " << (*itr)->GetField("Speed")[0] << endl;

  }

  if((*itr)->ContainsField("Manufacturer"))

  {

    cout << "Manufacturer: "  <<  (*itr)->GetField("Manufacturer")[0] << endl;

  }

  if((*itr)->ContainsField("SerialNumber"))

  {

    cout << "Serial Number: "  <<  (*itr)->GetField("SerialNumber")[0] << endl;

  }

  cout << "Tag: " << (*itr)->GetField("Tag")[0] << endl;

 

  if((*itr)->ContainsField("PartNumber"))

  {

    cout << "Part Number: "  <<  (*itr)->GetField("PartNumber")[0] << endl;

  }

}

Copyright © 2006-2022, Intel Corporation. All rights reserved.