-->

Cell Tracking

/ index

Introduction
Constraints
Component Overview
Requirements
Information required
Reference
Debugging and Exception handling
Launch program at start
Launch program at intervals
Cause a program to sleep
Save information to a file
Copy file to the computer
Read and write EXIF and IPTC tags
Find photographs in the mobile
Respond to events in the mobile
Read a database of cell locations
Update the cell location database from public resources
Transfer cell location database to mobile
Webservices

Introduction

I have several digital cameras and a Nokia N73 mobile. The mobile knows where it is at all times because the network tells it the ID of the cell in which it is sitting. The mobile also has a camera which is very handy because, unlike my other cameras, it is always with me so whenever I see something interesting I can snap it.

This means I take more pictures than before so now I have an even greater problem of identifying the locations, or will have in the future.

But if I can write a simple program to log the names of the cells I can surely write another program that can look at the dates and times of the photographs and match them with entries in the log. then I can add the cell ids to the IPTC data of the photographs.

I can make another list that can translate between cell ids and locations so that the actual location can be added to the photograph as well.

The rest of this page contains notes about what the application suite should do. Example code will be found in CellTrackingCode.

Constraints

Component Overview

To make this work I need several pieces of sofware and some data files:

Cell tracker
an application running on the mobile that records the date and time of entry to each cell.
Photo tagger
an application running on my computer that reads the date and time at which each photograph was taken and searches the log for a matching date and time so that it can add the cell id and location to the photograph.
Database
a list of cell ids and location names

The tagger runs on the computer so that it can tag phographs not taken by the mobile. If it were written in Python it should be possible to run it on the mobile as well so that the pictures are tagged immediately after being taken.

Requirements

The cell tracker must:

The cell location database must be:

The tagger must:

Information required

To comply with the requirements I need to know how to:

Reference

Details of API calls, web services, IPTC and EXIF tags etc.

Debugging and Exception handling

See http://wiki.forum.nokia.com/index.php/Python_debugging_techniques

try:
    # Actual program is here.
    1 / 0
except:
    import sys
    import traceback
    import e32
    import appuifw
    appuifw.app.screen="normal"               # Restore screen to normal size.
    appuifw.app.focus=None                    # Disable focus callback.
    body=appuifw.Text()
    appuifw.app.body=body                     # Create and use a text control.
    applock=e32.Ao_lock()
    def quit():applock.signal()
    appuifw.app.exit_key_handler=quit         # Override softkey handler.
    appuifw.app.menu=[(u"Exit", quit)]        # Override application menu.
    body.set(unicode("\n".join(traceback.format_exception(*sys.exc_info()))))
    applock.wait()                            # Wait for exit key to be pressed.
    appuifw.app.set_exit()

Launch program at start

Rumour has it that Open Signed Online applications can't do this. I'll set the flag next time I try Ensymble.

Launch program at intervals

Nokia don't even provide proper repeating calendar entries so this might be difficult.

Cause a program to sleep

Use e32.ao_sleep(interval_seconds). See API_Reference_for_Python.pdf.

From: http://snippets.dzone.com/posts/show/738

This could be used to create a repeat loop for every interval. I show this in a previous snippet.

import e32, time

def showtime():
  print time.clock()
  e32.ao_sleep(1, showtime)  # sleep then call itself again

showtime()  # start the loop

Save information to a file

Copy file to the computer

Read and write EXIF and IPTC tags

Thanks to http://akuaku.org/archives/2003/05/gps_tagged_jpeg.shtml for a useful link.

Use pyexif.

Find photographs in the mobile

Just assume that they are in c:\DATA\Images.

Respond to events in the mobile

Read a database of cell locations

Initially the simplest thing to do will be to use a text file with the cell id,mnc, mcc, lac as the first fields and the rest of the line the cell description.

Update the cell location database from public resources

There are many public cell location resources but there appears to be no common API or file format and the coverage is extremely variable

Yahoo ZoneTags

Yahoo has a webservice for retrieving and updating a cell location database: ZoneTag Web Services.

To retrieve the data for a cell it is enough to construct a URL containing the cellid, mcc, lac, and mnc values returned by gsm_location(). The web service will send back an xml document containing one or more location elements the child elements of which contain the information you want (name, country, coordinates, post code, etc.).

Unfortunately coverage is sparse. Still this is worthwhile.

This generates some secondary requirements:

Janus Liebregts

At http://janus.liebregts.nl/cellid/index_en.html there are links to xml files containing some data for UK, NL, and FR.

The xml holds cellid, network id, and free text description

The page also has links for other resources.

Jürgen Morhöfer

At http://kbs.cs.tu-berlin.de/~jutta/gsm/gsm-list.html is a list of network operator codes.

Nobbis GSM-Seiten

Another list of operators is at http://www.nobbi.com/netw_country.htm.

Sites listing themselves as member of senderliste.de use the same format for their pages.

Matthias Fonfara

Cells in Rhein-Main: http://www.senderlisteffm.de/

Cell Spotting

At http://cellspotting.com/thick/browse.php. Unfortunately the database is not downloadable.

Antenna Search

At http://www.antennasearch.com/sitestart.asp is a service that does a lookup of cells given the street address (USA only).

This service could be used to populate the database for areas you have visited or intend to visit. Unfortunately the reports it provides do not give enough information to decide if an antenna is a cell or not let alone the cell id, mnc, mcc, and lac.

Transfer cell location database to mobile

Webservices

To retrieve data from ZoneTag Web Services we must be able issue a REST query and parse the returned document.