Skip to content

This python script describes how you can read symbian (Nokia) Sports Tracker log files (W*.dat) in binary format. You can use this code to convert from DAT file to GPX file.

License

Notifications You must be signed in to change notification settings

ekspla/Read-Symbian-SportsTracker-file

Repository files navigation

Read-Symbian-SportsTracker-file -- How to read binary dat files.

This python script, convert_nst_files_to_gpx.py, describes how you can read symbian (Nokia) Sports Tracker files (W*.dat and R*.dat) stored in your phone as binary format. You can use this code, as it is, to convert from dat to gpx. The code depends on lxml with a fallback to built-in ElementTree. For performance reasons, use of lxml is highly recommended.

The code was tested with > 1000 of track log files copied from my Nokia phone equipped with GPS receiver, never tested with heart-rate sensor, though...

There is still a few unknown part in the track logs. So, your feedback is welcomed.

How to use

Install from PyPI

pip install symbian-sports-tracker

alternatively from github as follows:

pip install "git+https://github.com/ekspla/Read-Symbian-SportsTracker-file.git@pip_install"

or simply download/copy the *.py files to an appropriate directory from the master branch in github.

Now you can run

convert_nst_files_to_gpx input_filename.dat > output_filename.gpx

where input_filename.dat is the name of the track or route file.

The reference and test files (see below), that are not included in the package of PyPI, can be obtained from github.

Detailed explanation

This package consists of five *.py files. nst.py, scsu.py and mini_gpx.pyare pure library modules while convert_nst_files_to_gpx.py and convert_nst_rec_to_gpx.py are scripts using the modules.

convert_nst_files_to_gpx.py works also for track/route files created by the old Nokia Sports Tracker, whose format is a bit different from the new version released from Sports Tracking Technologies Ltd.
For details, please see the codes. (1-byte instead of 2-byte long header, start address of trackpoint is different, etc.)

The version number of the file is stored as WORD at 0x0008.

  • Track log files of the old Nokia SportsTracker (ver0): version < 10000.
  • Track/Route files of the old Nokia SportsTracker (ver1): 10000 <= version < 20000.
  • Track log files of Symbian SportsTracker (ver2): 20000 <= version.

The track reading function was tested for the old and the new NST versions of 9991-9998, 10102 and 20001-20002, while the route reading one was tested for version of 11400.

The file formats of symbian are completely different from those of Android and iOS.

These codes are not based on reverse engineering of the app itself, but on careful analysis of the track log files.

Non ASCII (non-alphanumeric) characters contained in the track log files that are encoded by SCSU are read by using an external module, scsu.py.
This is a ported version of Czyborra's decoder written in C, references/scsu.c.
(Characters of Arabic, Bengali, Chinese, German, Hindi, Japanese, Portuguese, Punjabi, Russian, Spanish and surrogate pairs were tested, see test_scsu/.)

Files in the phone

There are files as followings in the directory named drive_name:\SportsTracker\ (old version) or drive_name:\SportsTracker2\ (new version). Drive_name (C, D, E, etc.) depends on where you installed the app (phone memory, sd card, etc.).

  • config.dat: contains a lot of personal data, including id--name lookup tables of user and activity, etc.
  • W*.dat: track log files in binary format. The file formats of the new and the old versions are slightly different each other as mentioned before. A fetched sample file (the old format), another one (the new format) and the converted gpx files are in references/.
  • R*.dat: route files of the old version in binary format. The file format, though it lacks for timestamps, is very similar to that of track log of the old version NST.
  • Rec*.tmp: temporal track log files we see on application crash. More example is needed, yet a file useful to test was obtained from the internet. The file format seems to be very simple, see references/Rec211109168_dump.txt (a hex dump file with comments), convert_nst_rec_to_gpx.py (the script) and references/Rec211109168.gpx (the converted gpx file) for details.

Limitation

  • Units other than Metrics (km and km/h), such as Imperial (mi and mph) and Nautical (nm and kn), were not tested.

Note added for the users of www.sports-tracker.com

  • Its gpx handling code seems very faulty.
  • The time format should be YYYY-MM-DDThh:mm:ss[.SSS][+-HH:MM]. Use of Z as UTC timezone is not allowed. The resolution should be milliseconds (microseconds not allowed).

You have to modify as followings:

in format_time() of mini_gpx.py, delete .replace('+00:00', 'Z') to use +00:00 as UTC.

    return datetime.isoformat()

in store_trackpt() of nst.py, add round( , 3) to remove microseconds.

        time=dt_from_timestamp(round(tp.unix_time, 3), dt.timezone.utc), 

TODO

  • A few unknown field in the track points.
  • Support for heart rate in track log files of the new version (example files needed).

License

This software is released under the LGPL v2.1 License.

Reference

About

This python script describes how you can read symbian (Nokia) Sports Tracker log files (W*.dat) in binary format. You can use this code to convert from DAT file to GPX file.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published