Archive for November, 2007

Night hike preparation

It’s about zero degrees outside, perfect to go on a night hike for 10 miles around Cookham with a load of Scouts I’d say! Here’s how I’m packed:

All my walking gear spread out in a mess over my bed

Bag main compartment:

  • Waterproofs
  • Headlamp
  • Food
  • Spare map

Front compartment:

  • First aid kit
  • Camera
  • GPS (for plotting route on the computer later)
  • Spare batteries
  • Wallet
  • Keys
  • Space blanket

Fleece pockets:

  • Woolly hat
  • Gloves
  • Compass
  • Folded up map, printed from an OS map

In the rear of the bag is a big pocket for my water bladder, 2 litres so that I’ve got plenty spare. I just need to charge my phone now and that’s me pretty much ready.

Discovering background threads on Windows Mobile

This isn’t actually all that amazing to anyone that already knows how to use the .Net Compact Framework on Windows Mobile devices. It’s interesting to me because I’m only recently started on application programming, let alone creating applications for my phone.

My discovery this evening is that it is incredibly simple to make my phone run C# code while it is in sleep mode, by just using threading. This opens up quite a few ideas for me which help me progress towards a better Jaiku-like client for my phone:

  1. I can send “Keep-Alive” packets at regular intervals to make sure my XMPP connection to Jabber didn’t time out.
  2. I can automatically find out the current cell tower I’m connected to at regular intervals - and possibly also send these straight to Jaiku and the web by SMS/GPRS. (Update: this is now implemented in my GSM Stumbler application)
  3. I can scan for nearby bluetooth devices and wireless networks throughout the day.

All that while my phone is looking harmless and the screen is completely off, very handy:

ThreadStart starter = new ThreadStart(this.FindCurrentLocation);
Thread backgroundThread = new Thread(starter);
backgroundThread.Start();

Tracking my phone on Google Earth

After looking through various KML samples on the web during lunch today, I spent a little time experimenting with converting my existing location data into something that Google Earth could read - allowing people to track my location in real time.

Manual labour

About 6 times per day, I press a button on my phone and it sends a text message to my website with my current cell tower ID. My website then takes over and does all the smart stuff by itself. If I’ve traveled somewhere new, it automatically looks up the cell ID in a large UK database using their API to find the latitude and longitude of the cell tower I’m currently connected to. But big decimal numbers showing my current latitude and longitude aren’t all that interesting on their own.

Sidebar widget

The next step in my process was to add the widget on the side of my website to show everyone my current location. It’s not particularly fascinating - either I’m in my home town, at work, or traveling somewhere in between. But I’ve just added something a little more interesting.

Google Earth

Whereas before the link on my current location just took you to the coordinates where I’m currently sat, it will now load up a KML file showing a nice picture of a man standing on my current location, and hopefully a number of little cell towers which will show where I’ve been over the last 7 days.

The historic data isn’t all that interesting in Google Maps, but if you open up My KML file in Google Earth then you’re exposed to seeing the timeline control and you can choose to see where I was at different times and even animate my location over time.

What’s next?

I’ve got a habit of always wanting to do more.  I’ve cleaned up my location database so I could add in other locations (i.e. not just cell towers) and try plotting even more data. I’d like to try the following:

  • Load up GPS data for any hikes I go on
  • Add a few key locations onto the map such as the Scout hut, my brother’s place in Canada, anything relevant to me
  • Add some kind of refresh so that it updates automatically when I’m on the move
  • Create some kind of JavScript timeline interface for Google Maps

Jaiku over GPRS stays active

Tonight I’ve been focusing on creating a Jabber IM client that will connect to Jaiku and receive live updates as and when they happen.

Development

I started off again by looking at the agsXMPP MiniClient code. This covers pretty much everything I was interested in achieving tonight, but I wanted to break it down to a bare-bones application that just showed me my communications with Jaiku and some debugging information.

This was great, and worked well to show me the many #testku messages I was sending. The screenshot on the right shows one of the test messages received.

Going wireless

I unplugged my phone from the computer and turned on the wireless LAN. Again, predictably, I could connect fine and it was pretty cool receiving updates from Jaiku as I walked around the house - yes, I’m that sad.

The problem here was that the moment I touch the power button on my phone, the wireless card turns off and the connection is lost, which definitely doesn’t help me. I had a sneaky feeling that GPRS might be slightly different, so I tried that instead.

Jaiku over GPRS

Like the other day, I had trouble again connecting to Jabber over GPRS. It seems to send a few packets and receive a few back, but then halt when trying to send any more. A handful of attempts later I was able to create a full connection.

GPRS was on, Jabber was connected, and Jaiku was slowly receiving messages. So I turned my phone off.

And turned it back on.

Amazing! I was truly impressed that the message I had sent from the PC while my phone was off was already waiting for me to see when I turned the phone back on. Not only was the connection re-established, but it had never been lost - implying that the Jabber connection was still receiving messages in the background even though the phone looked dead.

What does this mean?

In short, it means I can make a program which stays connected to the internet all day and receives updates about my contacts and their statuses. Jaiku for Windows Mobile could work even better than I thought.

Jabber over GPRS on Windows Mobile

agsXMPP MiniClient screenshot

Andy Smith (a key developer at Jaiku) confirmed recently that the Jaiku Mobile Nokia client uses XMPP (Jabber) to communicate with Jaiku. Although the full API used for this interface hasn’t yet been revealed, I thought I best make sure first thatI could create a suitable Jabber connection over GPRS from my phone.

A little Google searching at lunch led me to the agsXMPP SDK, a dual licensed XMPP library which definitely has the potential to do what I want. The project is very well structured, with versions not only for Visual Studio 2003 and 2005, but also Mono for any Linux users.

The screenshot on the right is the sample MiniClient PPC project provided with the SDK. It took me a few attempts to connect, and then after that I had a pretty stable and responsive chat with myself over a GPRS connection.

I look forward to integrating this with my Jaiku application.

« Previous PageNext Page »