A good way to test the compatibility of your applications with the next release of the OS for a time to market as short as possible.
Get the WM 6.1 Images on the Device Emulator with MDM here.
Enjoy.
- Nicolas
All news and tips around the Windows Embedded community.
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Windows Mobile
[DllImport ("coredll.dll")]
private static extern int CreateFile(
string lpFileName, int dwDesiredAccess,
int dwShareMode, int lpSecurityAttributes,
int dwCreationDisposition, int dwFlagsAndAttributes,
int hTemplateFile);
[DllImport ("coredll.dll")]
private static extern int CreateFile(
string lpFileName,
int dwDesiredAccess,
int dwShareMode,
int lpSecurityAttributes,
int dwCreationDisposition,
int dwFlagsAndAttributes,
int hTemplateFile);
[DllImport ("coredll.dll")]
private static extern int CloseHandle(int hObject);
[DllImport ("coredll.dll")]
private static extern int ReadFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToRead,
ref int lpNumberOfBytesRead,
ref OVERLAPPED lpOverlapped);
[DllImport ("coredll.dll")]
private static extern int WriteFile(
int hFile,
byte[] lpBuffer,
int nNumberOfBytesToWrite,
ref int lpNumberOfBytesWritten,
ref OVERLAPPED lpOverlapped);
[DllImport ("coredll.dll")]
private static extern int SetFilePointer(
int hFile,
int nDistanceToMove,
ref int lpDistanceToMoveHigh,
uint nMoveMethod);
[DllImport ("coredll.dll")]
private static extern int DeviceIoControl(
int hFile,
uint dwIoControlCode,
byte[] lpInBuffer,
uint nInBufferSize,
byte[] lpOutBuffer,
uint nOutBufferSize,
ref uint lpBytesReturned,
ref OVERLAPPED lpOverlapped);
private class OVERLAPPED
{
public int Internal; // Reserved for operating system use.
public int InternalHigh; // Reserved for operating system use.
public int Offset; // Specifies a file position at which to start the transfer.
public int OffsetHigh; // Specifies the high word of the byte offset at which to start the transfer.
public int hEvent; // Handle to an event set to the signaled state when the operation has been completed.
}
public bool Open(String strDriverName)
{
m_intHandle = CreateFile(strDriverName, GENERIC_READ | GENERIC_WRITE, 0, 0, OPEN_EXISTING, 0, 0);
return m_intHandle != INVALID_HANDLE_VALUE;
}
Posted by Nicolas BESSON [MVP] 3 comments
Labels: .Net Compact FrameWork, Device Drivers, Windows CE 5.0, Windows CE 6.0, Windows Mobile
Posted by Nicolas BESSON [MVP] 0 comments
Labels: General
Posted by Nicolas BESSON [MVP] 0 comments
Labels: General
Applications can also interact with the power manager to change the current power state of the system or to be notified on power state transitions.
Application System Interaction
Using the Power Manager, applications can request system power state using the SetSystemPowerState. This is true for the system but applications can also interact with drivers. Imagine that a device driver is powered off after being used, this for power consumption reason, when applications requires an access to this driver, the driver must be turned on again. Using SetPowerRequirement, applications can ask drivers through the Power Manager, to switch to a specific power state. Then using ReleasePowerRequirement, the power requirement will be release and the driver will switch back to his original power state.
Request power notification
Using message queue, applications can be notified of power transition occurring on the system. When system is entering suspend, this is transparent for applications, and the only way for applications to be notified of resuming from suspend is to register to this message queue using the RequestPowerNotification function. The messages read from the message queue provide information on the status of the system.
Modify the Power Manager
The source code of the power manager is provided with Windows Embedded CE and can be located in %_WINCEROOT% \PUBLIC\COMMON\OAK\DRIVERS\PM . This gives you a chance to adapt the behavior of the Power Manager to your requirements. Most of the time, you do not have to make any modification in the code; instead use the registry to change the default behavior.
In conclusion the power management is straightforward for Windows Embedded CE when the power requirement of your device is simple, but can start to be tricky when more complicated. In any case, the system can be fully customized through the registry or for advanced usage by modifying the behavior of the Power Manager by directly modifying the source code. Applications can be notified of power transition and act if required, but it can also interact with the system to change the power state of drivers or the system. On their side device drivers can implement power management to support 5 different levels, and optimize the power consumption of your device. The Power Manager is the only one on the system to manage the power, applications and drivers always have to send request to the Power Manager that will relay the requests to the correct system component according to his internal state machine.
-Nicolas
Posted by Nicolas BESSON [MVP] 2 comments
Labels: General, Windows CE 5.0, Windows CE 6.0
In the last article we saw that the Power Manager is in charge of the management of the power on a Windows CE device, and interact with the system to change the system power consumption according to the user and system activity. Each driver can support 5 different levels of power states that can be setup from the registry.
Device Drivers Interface
The Power Manager is using IoControls to communicate with the drivers, to set, get the current power state of the driver. So drivers have to implement the support of those IoControl codes if they can manage the power of the managed device. The command codes are the following:
Power Manager interface for device drivers
The device drivers cannot change their power state by themselves, without notifying the power manager; otherwise the power manager is not aware of state modification and cannot optimize the power on the device. When drivers require power level modification, they should request the power manager for that by calling DevicePowerNotify from the driver. Then the power manager will use the IoControls to request user to change is power state.
Next time we will identify how the applications can request system power transition.
[Updated] : Access to part 3/3
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: General, Windows CE 5.0, Windows CE 6.0
Posted by Nicolas BESSON [MVP] 1 comments
Labels: General, Windows CE 5.0, Windows CE 6.0
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Press Release, Windows CE 6.0
Few weeks ago I did a live web cast session for the device drivers development under Windows Embedded CE 6.0 R2. All the webcast sessions recorded at this time are available now from the Microsoft Embedded Seminars website. For the Device Driver development session use this link.
Enjoy the nice French accent of your host.
- Nicolas
Posted by Nicolas BESSON [MVP] 0 comments
Labels: Device Drivers, Webcast, Windows CE 6.0
Windows Embedded CE 6.0 training with FREE development kit
Next session: Contact Adeneo
Contact Adeneo for information and registration
Also custom dedicated training are available.