Книга: Microsoft Windows Embedded CE 6.0 Exam Preparation Kit

? Adding Power Management Support

? Adding Power Management Support

1. Turn off and detach from the Device Emulator.

2. Add the IClass for generic power management devices with the following line to the string driver's registry key in String.reg:

"IClass"=multi_sz:"{A32942B7-920C-486b-B0E6-92A702A99B35}"

3. Add the power management code that you can find in the StringDriverPowerCode.txt file under LabsStringDriverPower on the companion CD to the string driver's IOControl function to support IOCTL_POWER_GET, IOCTL_POWER_SET, and IOCTL_POWER_CAPABILITIES.

4. Add code to the string driver's device context so it stores its current power state:

CEDEVICE_POWER_STATE CurrentDx;

5. Add the header <pm.h> to the application, and add calls to SetDevicePower with the name of the string driver and different power states; for example:

SetDevicePower(L"STR1:", POWER_NAME, D2);

6. Run the application again, and observe the power state-related debug messages when Power Manager changes the string driver's power state, as shown in Figure 6-13.


Figure 6-13 Power management-related debug messages from the string driver

Оглавление книги


Генерация: 1.070. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз