Cell Tracking
/ index
- Introduction
- 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
- All code running on the mobile should be in Python.
- All code running on the computer must be usable in Ubuntu Linux 7.04 on x86. Python to be the preferred language and toolkit.
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:
- run continually,
- not drain the battery too fast,
- not require Internet access,
The cell location database must be:
- amenable to manual updating,
- amenable to automatic updating from public resources.
The tagger must:
- operate as a command line program,
- be safe. That is it must not disturb existing tags,
- inform the user when a photograph has tags that conflict with the tag that the tagger wants to apply.
Information required
To comply with the requirements I need to know how to:
- launch a program when the mobile is started,
- launch a program at intervals or how to cause a program to sleep in the intervals,
- save information to a file,
- copy that file to the computer,
- read and write IPTC tags in photograph files,
- determine the date and time a photograph was taken. This can come from the EXIF tags or, sometimes, from the filename,
- find photographs in the mobile and apply tags to them immediately,
- discover that a new photograph has been taken and which it is,
- read a database of cell ids and locations,
- update the cell location database manually,
- update the cell location database from public resources.
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:
- need to be able to interrogate a web service using a url,
- need to be able to parse the xml document that is returned.
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.
No comments:
Post a Comment