下面在对UpdateDeviceState(pds)做具体说明
UpdateDeviceState
{
//获取当前设备的电源级别最大值(ceilingDx)和最小值(floorDx)
GetNewDeviceStateInfo
{
1.对于newCeilingDx
//首先每个系统电源状态都对应一个默认的所有设备的最大电源级别
newCeilingDx = psps->defaultCeilingDx;
//在链表gpCeilingDx里查找特定的一类设备的最大电源级别
devId.pGuid = pds->pListHead->pGuid;
devId.pszName = NULL;
if((pdpr = PowerRestrictionFindList(pCeilingDxList,&devId,NULL))!= NULL)
{
newCeilingDx = pdpr->devDx;
}
//在链表gpCeilingDx里寻找特定的某个设备的最大电源级别
devId.pszName = pds->pszName;
if((pdpr = PowerRestrictionFindList(pCeilingDxList,&devId,NULL)) != NULL)
{
newCeilingDx = pdpr->devDx;
}
2.对于newFloorDx
newFloorDx = D4;//先设置为最小电源级别D4
//在链表gpFloorDx 里去查找某一类设备的最小电源级别
devId.pszName = NULL;
pdpr = pFloorDxList;
while((pdpr = PowerRestrictionFindList(pdpr,&devId,NULL))!= NULL)