The DmiGetAttributeCmd command requests the current values of attributes within groups by using the DmiGetAttributeReq block.
The format for the command block is: ┌──────────────────────────────────────────────────────────────────────────────┐
Variable Name
│ Table 34. DmiGetAttributeReq Command Block │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 64 │ STRUCT │ DmiMgmtCommand │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 64 │ 4 │ INT │ iComponentId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 68 │ 16 │ STRUCT │ DmiGetAttributeData[] │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
DmiMgmtCommand
Variable Description
The format for the DmiGetAttributeData block is as follows: ┌──────────────────────────────────────────────────────────────────────────────┐│Table35
.DmiGetAttributeDataBlock │
├───────────────┬───────────────┬───────────────┬──────────────────────────────┤
│ OFFSET │ SIZE │ TYPE │ VARIABLE NAME │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 0 │ 4 │ INT │ iGroupId │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 4 │ 4 │ INT │ iGroupKeyCount │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 8 │ 4 │ OFFSET │ oGroupKeyList │
├───────────────┼───────────────┼───────────────┼──────────────────────────────┤
│ 12 │ 4 │ INT │ iAttributeId │
└───────────────┴───────────────┴───────────────┴──────────────────────────────┘
Variable Name
Issuing DmiGetAttributeReq displays an example of how to issue the DmiGetAttributeReq
command to the MI. IssuingDmiGetAttributeReq
ULONG IssueLoadAttribute(ULONG CompID, ULONG GroupID, ULONG AttrID) // queries the service layer for // the attribute value { DMI_GetAttributeReq_t *ListComp; DMI_GroupKeyData_t *NewKey; ULONG RC; ListComp = (DMI_GetAttributeReq_t *)malloc(4000L); // allocate a big block, in case we have keys memset((void *)ListComp,0,sizeof(DMI_GetAttributeReq_t)); ListComp->DmiMgmtCommand.iLevelCheck = DMI_LEVEL_CHECK; ListComp->DmiMgmtCommand.iCommand = DmiGetAttributeCmd; // set the command ListComp->DmiMgmtCommand.iCmdLen = 4000L; ListComp->DmiMgmtCommand.iMgmtHandle = YOUR_MGMT_HANDLE; // set the app handle ListComp->DmiMgmtCommand.iCmdHandle = YOUR_COMMAND_HANDLE; // set the command counter ListComp->DmiMgmtCommand.iCnfBufLen = 4000UL; // set the size of the response ListComp->DmiMgmtCommand.pCnfBuf = (void *)malloc(4000UL); // set up the response buffer memset(ListComp->DmiMgmtCommand.pCnfBuf,0,4000UL); // clean out this thing ListComp->DmiMgmtCommand.iRequestCount = 1; ListComp->iComponentId = CompID; // set to the currently selected component ListComp->DmiGetAttributeListφ0∙.iGroupId = GroupID; ListComp->DmiGetAttributeListφ0∙.iAttributeId = AttrID; if(KEY_COUNT){ // there is a key list ListComp->DmiGetAttributeListφ0∙.iGroupKeyCount = KEY_COUNT; NewKey = (DMI_GroupKeyData_t *)((BYTE *)ListComp + sizeof(DMI_GetAttributeReq_t)); // this is the // start of the keylist ListComp->DmiGetAttributeListφ0∙.oGroupKeyList = (DMI_OFFSET)((DMI_OFFSET)NewKey - (DMI_OFFSET)ListComp); // Encode the key list here } if((RC = DmiInvoke((DMI_MgmtCommand_t *)ListComp)) != SLERR_NO_ERROR){ // call the SL and register free(ListComp->DmiMgmtCommand.pCnfBuf); // free up the response buffer free(ListComp); // free the command block } return RC; }