Wednesday, 29 September 2010

Using events and waking devices using CeRunAppAtTime

Want to wake up a CE device at a future time (even if it is suspend), then use the CeRunAppAtTime but instead of running an app use a named event, this allows an application to wake up the device at a set time and also trap the wake event without spawning another process:

CTime nextWakeUpTime;

// get local system time and convert time to CTime for now
CTime now(time);

// 30 minutes in the future

// convert to systemtime

// set for wake up !
CeRunAppAtTime(TEXT("\\\\.\\Notifications\\NamedEvents\\SCHEDULE_WAKEEVENT_EVENT"), &time);


// wait for wake up!
if (WaitForSingleObject(wakeEvent, FALSE, INFINITE) == WAIT_OBJECT_0)
// sheduled wake up

Friday, 10 September 2010

KITL Messages Don't Support Wide Strings

I've just tracked down a minor irritation with KITL_RETAILMSG and KITL_DEBUGMSG under CE 6.0 R3 - they can't print UNICODE or wide strings.

On several platforms I've seen the KITL device name is not printed correctly. The device name is the name member of the OAL_KITL_DEVICE structure and is defined as a LPCWSTR.

Typically OALKitlInit uses KITL_RETAILMSG to report the device name but the name is never displayed correctly. The string is formatted as "%s" but only the first letter is shown - this implies that the wide string is being formatted as a character string. Trying %hs or %S to override the default does not help.

Reviewing the private sources confirms the problem. Only the %s format is supported and this is for character strings only.

Also be aware that formatting such as %08x is not supported either, but %X is fine!

Monday, 6 September 2010

Using #include from BIB files

Did you know that inside of Windows CE build system that bib files can #include other bib files. This technique is used on many BSP's to implement individual driver registry entries from the driver directory

#include "$(_TARGETPLATROOT)\SRC\DRIVERS\display\display.reg"

The same can be done for the bib file, I didn't release this before, but its there to use if you want to in CE6.0 for sure!

#include "$(_TARGETPLATROOT)\SRC\DRIVERS\display\display.bib"