The following List Description commands use the DmiListDescReq command block:
The format for the command block is: ┌──────────────────────────────────────────────────────────────────────────────┐│Table33
.DmiListDescReqCommandBlock │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 64 │ STRUCT │ DmiMgmtCommand │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 64 │ 4 │ INT │ iComponentId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 68 │ 4 │ INT │ iGroupId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 72 │ 4 │ INT │ iAttributeId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 76 │ 4 │ INT │ iOffset │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
Variable Name
DmiListComponentDescCmd
On return, the service layer updates this field with the index of the last character written into the confirm buffer and sets iStatus accordingly. If iStatus indicates that there are more characters to be received, the application can re-issue the call to get more of the description text.
On return from this call, the confirm buffer contains the text from the description associated with the entity requested. In the command block, iCnfCount is always set to 1.
Issuing DmiListDescReq displays an example of how to issue the DmiListDescReq
command to the MI. IssuingDmiListDescReq
ULONG IssueLoadDescription(ULONG Comp,ULONG Group,ULONG Attr,ULONG Command)
{
DMI_ListDescReq_t *ListDesc;
ULONG RC;
ListDesc = (DMI_ListDescReq_t *)malloc(sizeof(DMI_ListDescReq_t));
memset((void *)ListDesc,0,sizeof(DMI_ListDescReq_t));
ListDesc->iAttributeId = Attr;
ListDesc->iGroupId = Group;
ListDesc->iComponentId = Comp;
ListDesc->iOffset = 0; // start at the beginning of the description
ListDesc->DmiMgmtCommand.iLevelCheck = DMI_LEVEL_CHECK;
ListDesc->DmiMgmtCommand.iMgmtHandle = YOUR_MGMT_HANDLE; // set the app handle
ListDesc->DmiMgmtCommand.iCmdHandle = YOUR_COMMAND_HANDLE; // set the command counter
ListDesc->DmiMgmtCommand.iCnfBufLen = 4000UL; // set the size of the response
ListDesc->DmiMgmtCommand.pCnfBuf = (void *)malloc(4000UL); // set up the response buffer
ListDesc->DmiMgmtCommand.iRequestCount = 1;
ListDesc->DmiMgmtCommand.iCmdLen = sizeof(DMI_ListDescReq_t);
ListDesc->DmiMgmtCommand.iCommand = Command; // set the command:
// DmiListComponentDescCmd
// DmiListGroupDescCmd
// DmiListAttributeDescCmd
if((RC = DmiInvoke((DMI_MgmtCommand_t *)ListDesc)) != SLERR_NO_ERROR) { // ask for the description
free(ListDesc->DmiMgmtCommand.pCnfBuf);
free(ListDesc);
}
return RC;
}
Processing the Callback from DmiListDescReq displays an example of how to
process the callback from the the DmiListDescReq command.
Processing the Callback from DmiListDescReq
case DmiListComponentDescCmd: // the list component command
case DmiListAttributeDescCmd: // this is the description command for the attribute
case DmiListGroupDescCmd: // list the group description
if(!miCommand->iStatus){ // we've gotten a good return code back
Work = (DMI_STRING *)miCommand->pCnfBuf;
Working = malloc(Work->length + 1);
memcpy(Working,Work->body,Work->length);
// Do whatever your application needs to do here
free(Working);
}
break;