The following Get commands use the DmiSetAttributeReq command block:
The format for the command block is: ┌──────────────────────────────────────────────────────────────────────────────┐│Table39
.DmiGetRowReqCommandBlock │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 64 │ STRUCT │ DmiMgmtCommand │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 64 │ 4 │ INT │ iComponentId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 68 │ 4 │ INT │ iGroupId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 72 │ 4 │ INT │ iGroupKeyCount │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 76 │ 4 │ OFFSET │ oGroupKeyList │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 80 │ 4 │ INT │ iAttributeId │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
Variable Name
DmiGetRowCmd
Issuing DmiGetRowReq displays an example of how to issue the DmiGetRowReq
command to the MI. IssuingDmiGetRowReq
ULONG IssueGetRow(ULONG CompID,ULONG GroupID,DMI_GetRowCnf_t *Row) // get the list group started
{
DMI_GetRowReq_t *GetRow; // command block to use
DMI_GroupKeyData_t *NewKey, *ThisKey;
USHORT x; // just a counter
char *Working;
DMI_STRING *Work;
DMI_UNSIGNED Size;
ULONG RC;
GetRow = (DMI_GetRowReq_t *)malloc(4000);
memset((void *)GetRow,0,sizeof(DMI_GetRowReq_t));
GetRow->iGroupId = GroupID;
GetRow->iComponentId = CompID;
GetRow->DmiMgmtCommand.iLevelCheck = DMI_LEVEL_CHECK;
GetRow->DmiMgmtCommand.iMgmtHandle = YOUR_MGMT_HANDLE; // set the app handle
GetRow->DmiMgmtCommand.iCmdHandle = YOUR_COMMAND_HANDLE; // point to the addinfo block
GetRow->DmiMgmtCommand.iCnfBufLen = 8000UL; // set the size of the response
GetRow->DmiMgmtCommand.pCnfBuf = (void *)malloc(8000UL); // set up the response buffer
GetRow->DmiMgmtCommand.iRequestCount = 1;
GetRow->DmiMgmtCommand.iCmdLen = 4000L;
if(Row == (DMI_GetRowCnf_t *)NULL) GetRow->DmiMgmtCommand.iCommand = DmiGetFirstRowCmd; // set the
// command
else{
GetRow->DmiMgmtCommand.iCommand = DmiGetNextRowCmd; // get the next row in the table
ThisKey = (DMI_GroupKeyData_t *)((char *)Row + Row->oGroupKeyList);
NewKey = (DMI_GroupKeyData_t *)((char *)GetRow + sizeof(DMI_GetRowReq_t));
GetRow->oGroupKeyList = sizeof(DMI_GetRowReq_t);
GetRow->iGroupKeyCount = Row->iGroupKeyCount;
Working = (char *)((char *)NewKey + (Row->iGroupKeyCount * sizeof(DMI_GroupKeyData_t)));
for(x = 0;x != Row->iGroupKeyCount;x++,ThisKey++,NewKey++){
memcpy(NewKey,ThisKey,sizeof(DMI_GroupKeyData_t)); // move the key block over
switch(ThisKey->iAttributeType){ // switch on the data type
case MIF_COUNTER:
case MIF_COUNTER64:
case MIF_GAUGE:
case MIF_INT:
case MIF_INTEGER64:
Size = sizeof(DMI_UNSIGNED);
goto FinishGroup;
case MIF_DATE:
Size = sizeof(DMI_TimeStamp_t);
goto FinishGroup;
case MIF_DISPLAYSTRING:
case MIF_OCTETSTRING:
Work = (DMI_STRING *)((char *)Row + ThisKey->oKeyValue);
Size = (Work->length + sizeof(DMI_UNSIGNED));
FinishGroup:
memcpy(Working,(char *)((char *)Row + ThisKey->oKeyValue),Size);
NewKey->oKeyValue = (DMI_OFFSET)((char *)Working - (char *)GetRow);
Working += Size;
break;
case MIF_UNKNOWN_DATA_TYPE: // this is the error case
default:
break;
}
}
}
if((RC = DmiInvoke((DMI_MgmtCommand_t *)GetRow)) != SLERR_NO_ERROR) { // ask for the description
free(GetRow->DmiMgmtCommand.pCnfBuf);
free(GetRow);
free((char *)Handle); // free up the add information (AddInfo) block
}
return RC;
}