Showing posts with label wm6. Show all posts
Showing posts with label wm6. Show all posts

Wednesday, December 12, 2007

The WM6 Endless Reboot Cycle

Apparently, I became a victim of a common Windows Mobile 6 bug today. A problem with using an SD storage card can get Windows Mobile 6 into a state where it continuously reboots.

A Google search helped me determine the problem was related to the SD card and removing the card allowed the device to boot normally. However, when I powered down and reinserted the SD card, the device went back to its endless reboot cycle again. (Not all users experience this problem after reinserting the storage card, but some do.) A little more investigation was required.

I decided to boot the device without the SD card - success. Without rebooting, I inserted the SD card and opened File Explorer. I noticed the storage card was labeled as "Storage Card2" instead of the usual "Storage Card". WM6 had created a "Storage Card" folder on its own when I booted without the card to store message attachments. I deleted the "Storage Card" folder (which only contained empty folders) and rebooted. I was back in the reboot cycle. Ugh!

I removed the SD card again and booted. This time I deleted the "Storage Card" folder before inserting the SD card. I inserted the SD card and WM6 recognized it as "Storage Card". I rebooted, and... The OS booted correctly.

It's quite strange that this happened in the first place, but I offer my findings here to help anyone else who may run into the problem with WM6 and SD storage cards.

Friday, December 7, 2007

Stopping Time

As mentioned in a previous post, Mobile Stopwatch uses System.Environment.TickCount as a timer reference. If you record the TickCount value when the stopwatch starts, the elapsed time can be calculated by subtracting the initial TickCount value from the current TickCount value. The only problem with this method occurs when a Windows Mobile device goes into suspend mode and TickCount is not updated. Suspend mode effectively stops the stopwatch and it is restarted when suspend mode ends.

One solution to this problem is to prevent the device from entering suspend mode while the stopwatch is running. It turns out this is a rather simple thing to do since the Windows Mobile SDK provides us with an API for resetting the device's idle timer:
void WINAPI SystemIdleTimerReset(void);
Periodically calling this function will prevent a Windows Mobile device from suspending - we only need to determine how often this function needs to be called. Fortunately, the registry holds this information at the following key location:
Key: HKLM\SYSTEM\CurrentControlSet\Control\Power\Timeouts
Value: BattSuspendTimeout
Type: DWORD
The value stored here indicates the number of seconds that must elapse before the device enters suspend mode. As long as you call SystemIdleTimerReset() more frequently than this timeout value, the device will not suspend and TickCount will keep updating.

The down side of this solution is that your battery life will suffer if the stopwatch needs to run for long periods of time. I'll present a solution that resolves that dilemma in a future posting.

Note, it is still possible to turn off the display by pressing the device's power button, but this shouldn't be confused with the device entering a suspended state.

[As a side note, suspend mode is only an issue on Windows Mobile Professional. Windows Mobile Standard doesn't enter suspend mode, but only turns off the display.]

Wednesday, December 5, 2007

Office Mobile 6.1 Upgrade

If you need to access Office 2007 file formats on your mobile device, you can upgrade to Office Mobile 6.1 here. (An existing version of Office Mobile is required.)

Monday, November 26, 2007

The Missing Stopwatch and the Missing Milliseconds


While I've benefited tremendously from having my T-Mobile Wing, one of the things it's missing is a convenient stopwatch feature. My old cell phone provided a nice stopwatch, but there's nothing like this on the Wing. Even my Garmin GPS has a stopwatch feature, so I figure my cell phone should get one too.

This seems like a simple enough project and an excellent opportunity to jump into writing a C# project on the .NET Compact Framework. Well, the first thing I found out was that the DateTime object's Milliseconds property is always zero on a T-Mobile Wing. Some quick web searching revealed that this isn't a Wing peculiarity, but a lot of Windows CE devices don't provide millisecond resolution for calls to GetLocalTime() (which is ultimately beneath .NET's DateTime class).

A nice summary of alternatives can be found here. The simplest solution is to use System.Environment.TickCount to simply get the number of milliseconds that have passed since the operating system started. The only caveat is that the TickCount is suspended when the system goes into suspend mode. So if your device suspends, your stopwatch will stop ticking. However, for my needs this is sufficient for the time being. I'll look at workarounds in the future if I should need one.

Mobile Stopwatch can be found in the Mobile Tools download from this blog.

Switching to Windows Mobile

About six months ago I decided my Virgin Mobile prepaid cell phone was beginning to cost enough each month that I should look at a fixed price alternative. With the upgrade I was also hoping to add some new features to my phone.

I wanted to sync contacts and appointments with Outlook, so some kind of Palm/Blackberry/Windows Mobile device was worth investigating. Since I have a background developing software for Windows desktop operating systems, I figured with a Windows Mobile device and Microsoft Visual Studio I could learn a new development environment.

After some web searching I found I could get a pretty nice Windows Mobile 6 Professional device from T-Mobile for $99 (current offers can be found here) and my prepaid plan was history. I'll be blogging here about my experiences with Windows Mobile from both a user and developer perspective.