Quick guide to starting a WinMobile widget application

It’s still early days for the W3C Widget, but the idea of been able to write a little application that I can run on numerous devices and platforms without requiring any changes is interesting (well I spose you could call that Adobe Air, maybe even my beloved Silverlight at a stretch – but even they requires an additional plug-in). So knowing that in reality they’d be difference I set of downloading various SDKs. However, I hit a number of installations problems all of which I’m sure are down to dodgy installers, beta software and 64bit Windows – not a clever combination I admit. So I grabbed trusty WinMobile and started on that first. The first issues was getting Visual Studio to sync up with the emulators. No chance, there is no project for widgets you have do everything by hand. So here is my very quick guide to get you working;

  1. Install Win Mobile 6 SDK refresh
  2. Install Win Mobile 6.5 Dev Toolkit – you’ll now have the emulators available to the device manager
  3. Create a blank web site
  4. Add content – see
  5. http://windowsteamblog.com/blogs/windowsphone/pages/getting_2D00_started_2D00_with_2D00_widgets.aspx

    http://msdn.microsoft.com/en-us/library/dd721906.aspx

  6. To test I used a great little util http://widgetemulator.codeplex.com/
  7. Then to try it out for “real” create a shared folder in the emulator pointing to your .wgt file, and browse to it from the PDA folder browser

 

     

Advertisements

Problems with Win Mobile GPS Sample freezing?

It’s been a while since I last used the GPS Sample for managed code provided in the mobile SDK. So I compiled it and added a reference to it in my project confident I’d have GPS data very soon. I added the gps class to a second form, launched the form and yah I had GPS data. However, when I closed the form the application froze/hung. After examing the code I could see where it was going wrong but I wasn’t sure why. Essentially the sample create a basic message loop by taking out a lock on itself and going into a loop where is uses Wait For Multiple Objects to get the notifications from the GPS driver. One of the notifications it waits for includes "close". However, the code that issus the close notification then takes out another lock. This should be a good idea because it waits for the lock the loop has got to be given up before it continue cleaning up the component. The problem is that the loop never seems to get the close notification so the application is now stuck waiting for a lock it will never get. Now I’m not a 100% what the problem is but it would seem that it’s probably something to do with threads. Therefore I moved the GPS class into the main form and exposed the data to the secondary form. This seems to have done the trick. As I say I don’t understand why this is since the loop certainly recieves the notifications about GPS changes so why not the close? Hopefully I’ll realise what the problem is soon, but in the meantime at least I seem to have a workaround.
 

Navigon TMC review

I "recently" purchased a dedicated Navigon SatNav (2100) with TMC as I thought my Pocket PC Navigon software was good if the TMC was a bit of a damp squid. Today I had to go on a fairly long trip around the south-east portion of the M25 and then up the M1 to Scunthorpe. The routing was, as usual, great but since I was the passenger I could keep a watch on the TMC signal. This isn’t a very scientific experiment but these are my findings. 

First off the TMC signal was non-existent until we got past Rickmansworth, then we got a good 5 mins worth of signal. Lost it for the majority of the M25 until we got close to the M1. The M1 has a couple of longer signal windows, a couple towards Milton Keynes with the best around Derbyshire. A final little window near Scunthorpe itself. So although the coverage was sparse it was enough to give the unit time to download a reasonable amount of traffic information and it did report problems on the adjoining roads (fortunately nothing bad on the route itself).

So overall the TMC works but only in specific areas, if anyone reading this knows of these zones then please let me know, if you have anecdotal evidence of areas it works then please post a comment and perhaps we can compile a working map.

A year with a Pocket PC

I’ve now spent a year with my Windows Mobile 5, Pocket Loox n560, so how has it been?

To give a decent account of the year I need to consider the hardware (Loox n560) and the software, obviously they come together but both have the pro’s and con’s. Also I thought that rather than go into some magazine style review I thought I’d say what I wanted it to do and if it managed it, so here goes…

Personal Assistant – calendar, meetings, contacts, etc
Both the device and the WM5 were good here. Creating the sync’ with my work’s Exchange had a few annoying problems they seem to be common with the majority of WM5 tasks. WM5 just isn’t very helpful. As a developer I’ve had to rely on a number of educated guesses to get things working. E.g. I couldn’t sync’ with Exchange until I removed the device from it’s cradle, why? Well I’m guessing that in the cradle it was sync’ed to my PC and couldn’t locate Exchange via the cradle, however once removed it used it’s WiFi connection and found Exchange.
Adv:
Track all those important meetings and contacts, great for when you’re stuck in a traffic jam wondering if you’re going to miss a meeting!
Cons:
For some reason I just can’t Task’s to sync
Clumsy configuration process

GPS/SatNav
A friend launched a GPS Walk site and I was keen to add the stored walks. So a mobile GPS unit seemed the idea choice. After installed the .net framework and the GPSWalk software I again hit the WM5 unhelpful configuration. After a lot of guess work and  searching development forums I finally managed to get GPSWalk to work. The problem was a combination of hardware and WM5 historical issues. The Loox allows you to specify the COM port to use for GPS but that’s a pre-WM5 virtual GPS layer technique. Essentially if your software doesn’t use the GPS layer then you have to specify your port, if it does use the newer layer then you must *not* specify the port. Again absolutely no help from WM5.
Adv.
Good, mobile, GPS device
Works with a number of GPS applications
Cons.
Sucks on the batteries

Car SatNav – Traffic Avoidance
Before buying the Loox I read a number of reviews about TMC where the SatNav can direct you around traffic jams before you meet them, excellent. I bought Navigon 5 from ebay and a TMC module for the car. After a brief struggle getting Navigon to find the GPS (see above) I couldn’t find the TMC module. Turns out to be a problem with Navigon and I needed to buy a newer version from ebay. I finally got that, from someone with a n560 that couldn’t get it to work <oops>, and both GPS and TMC worked. However, the TMC module only ever finds a TMC single when the car is parked. As soon as I move it loses the signal, so the only time it knows about jams is when I’m stuck in one!
Adv.
Very good and clear instructions from Navigon 5, much better than others I’ve seen.
Cons.
TMC just doesn’t work as advertised

.Net Development
Choosing a WM5 device meant that I can write software for it. It’s been very easy to do, I’ve written a couple of utilities and the publishing and debugging have worked very well with Visual Studio.
Adv.
Easy to develop, same skill set
Cons.
None so far

Network Music Player/ Media controller
I have the typical issue of having a large amount of my music connection held on a PC sitting upstairs and I want to play tracks through my HiFi downstairs. With a bit of research and through the use of PocketMusic and NetUse I can stream music over WiFi via the Loox, into my Hifi. Not only that but the Loox is essentially a remote control too, since I can see all the usual playlist information.
Adv:
Stream music
Cons:
Can take a fair amount of time to initialise the playlist as it seems to check every time you connect. So much so that I’m looking at other solutions.

Casual Web Browsing
This is the ace for me, "what else has that actor been in", is a not uncommon question in my household. So rather than boot a machine up the Loox is on IMDB in a flash.
Adv:
Quick to browse the web, excellent resolution from the Loox. Good at playing short webcasts.
Cons:
Pocket IE can make a mess of some sites, sites fault or IE, hmm – mostly IE I think.
WiFi connection is just plain odd, at home it always works but connecting to other public sites is more miss than hit.

General Note taking
I hate taking notes on forests of paper to simply type them up later. The Loox allows me to take notes and sync’ them with a PC later.
Adv.
Easy to carry note taker
Cons.
The input method isn’t great. The Ink implementation is very poor compared to the excellent version in Vista, a real shame. Essentially I take notes and correct them later, "x is not cc" – one day I’ll get that working.

Summary
Overall it’s been a fairly good experience, although I cannot recommend it for use by a non-IT literate person. The lack of help for a modern device is truly appalling. The fact that I’m scared to change settings is very telling, and the failure to connect to other WiFi spots is very annoying.

Pocket Loox 560N repaired

My PDA started to turn it self off whenever I moved it, this is very annoying. Worse still sometimes it wouldn’t switch back on unless I took the battery out and gave it a few mins. I finally got around to sending it off (under warranty) for repair and it’s just arrived back. Seems fine now, although I’ve not got the joy of setting it all back up again, why? Well because they force you to do a full system reset before allowing you to send it off, grrr. Anyway I was just struggling to setup the WiFi and hit a few little issues;
1. Board has changed, therefore Mac Address has changed therefore need to update the Access Control list on the router.
2. Even after entering the network key it wouldn’t connect to the network. Old trick required, for some reason network changes never seem to take on the Loox and you need to do a soft reset (with the stylus) to get to work.
 
Hurray, WiFi back, now for Exchange Sync!
 
 

Wake Up On Lan for Pocket PC

If you’ve read my previous blogs you’ll know that I became fixated on Wake Up Lan and published a code snippet for C#, you’ll also probably know that I try and cram my IT world into my Pocket PC. Well, tonight the enivatable happened, I wrote a WOL client for the Pocket PC. I’ll try and post it somewhere but if you need it in a hurray then drop me a line. It wasn’t quite a 100% port from the desktop version as the Compact Framework doesn’t support TryParse but it isn’t hard to replicate that feature. So now if I want to stream music to my stereo from my PC via the Pocket PC but my PC isn’t on, well I can now wake it up from the PDA, it will mean running for an extra 1 min to burn off those conserved calories from running up and down the stairs though.

Developing GPS software on the Loox N560

"Enough is enough, I’m sick of these dodgy Pocket PC GPS tools, time to write my own". Hmm, I did wonder why there seemed to be so many dodgy GPS tools out there and now I know why. First, a bit of history…
When GPS first hit the Pocket PC it was a "simple" matter of attaching a GPS device to the COMM port and off you went. The trouble is that COMM ports are tricky little things and it’s very easy to get things wrong. One of the classic problems is that opening a port means no one else can access it. Worse still, if you crash big time and don’t release that resource, well I think everyone with a Pocket PC is all to familiar with the reset button.
So along came Window Mobile 5 which introduced a nice GPS abstraction. Basically a a bit of software that grabs the GPS port and then becomes a proxy to all the other applications wanting GPS data. That way any number of applications can receive GPS data, great.
Ok, so how do I use this? Armed with my .Net Compact Framework, Visual Studio 2005 and my trusty (?) N560 I went to work…except I didn’t, I couldn’t find the library for the GPS API. Ah, it’s not .net, oh great, time to get PInvoke out then. Luckly just as I was dusting off my interop gloves I discovered a sample in the Compact SDK written in C# and nicely encapsulating calls such as GPSOpenDevice and GPSGetPosition into a nice GPS class. It also converts all that odd GPS text into nice Position, Satellite, etc classes. I built it and deployed it to the PDA (that was very easy in VS2005) and…not a lot. It all seemed to say the right things, "Device ON" but I noticed that the GPS was not on. So the software was sitting there waiting for data but the GPS devices was most certainly off. So it seems that the software is talking to the abstract layer ok, but the device layer is not talking to the device. I wrote a quick COMM test using the SerialDevice classes (found in .net 2.0) and opened COM8. This started the GPS device and a few event handlers later I was getting GPS text stuff. So all that lovely abstraction layer just doesn’t seem to work and I’m going to have go back to parsing the GPS text just like all the other poor developers before me.
"Only now at the end do I understand".
[Edit] or so I thought…
Asking around someone pointed me to an MSDN page about registry entries and the GPS Driver layer. This page comes up a lot on Pocket PC forums because some devices have chosen to hide the GPS Control Panel and you can unhide(?) it by a quick change of the registry. However, I decided to have a look around the registry and see if there was anything useful. Once in there I realised that the driver doesn’t actually enumerate the device looking for a GPS it simply has the port saved in the registry. Then I realised that on the GPS Control there was this strange drop down that said GPS Device Port. I thought that was telling me the port it exposed but actually it is asking me to tell it the port it should be reading from. Once I changed that to COM8 my software leapt into life, hurray! Interestingly all the software that comes with the PDA all use the port method to access the GPS and are blocked when my, now well behaved, software runs. I wonder if this is why so many people have trouble with N560, GPS and Navigation software?