HAFAS-j2me Timetable File Format ================================ Document version: 0.8 Copyright (c) 2006 Arkadiusz [Yak] Wahlig This document describes the file format of the precalculated timetable file used by HAFAS-j2me application for Java enabled mobile phones. http://www.hacon.de/hafas_e/j2me.shtml Such files can easily be calculated using folmular on this site: http://persoenlicherfahrplan.bahn.de Select "J2ME for Java mobiles (zipped)" as the format. Extract the JAR file from the ZIP. Change its extension from .jar to .zip and then extract the "plandata" file from it. This is the generated timetable. Other files contain the Java browser for this file. No code was disassembled to gain this information. Every piece of information was observed using a HEX viewer only. General: ======== All integer numbers are stored in Little-Endian. Abbreviations: ============== This document uses following abbreviations: STR: Value is an offset into Strings table record DATE: Value is a number of days after 31.12.1979 TIME: Value is time stored as decimal value, for example 4:33 is stored as 433 (0x1b1) Header: ======= Offset Length Description ----------------------------------------------------------------------- 0x0000 0x0002 File version (0x0002) 0x0002 0x0002 File size in bytes 0x0004 0x0032 Origin name (Ascii) 0x0036 0x0032 Destination name (Ascii) 0x0068 0x0002 ? (0x0001) 0x006a 0x0002 Number of Connections in file 0x006c 0x0002 Offset to Availability table 0x006e 0x0002 Size of Availability table 0x0070 0x0002 Offset to Strings table 0x0072 0x0002 Size of Strings table 0x0074 0x0002 DATE: Availability table base date 0x0076 0x0002 Language as two lower-case Ascii chars (for example: "en" for english) 0x0078 0x0002 DATE: Timetable creation date 0x007a 0x0002 STR: Connections availability range 0x007c 0x0006 Timetable ID (Ascii, for example "i1s1g"), null-padded 0x0082 0x0002 STR: Some code (?) 0x0084 ...... Connections table, see below Strings table: ============== Concatenated Ascii strings separated by '\0' character. Connections table: ================== Consists of one or more connections: Connection (size = 0x0008): --------------------------- 0x0000 0x0002 Offset into the Availability table 0x0002 0x0002 Offset from Connections table to Means table 0x0004 0x0002 Number of Means 0x0006 0x0002 Number of transitions Means table: ============ Consists of one or more means of transportation: Mean (size = 0x000e): --------------------- 0x0000 0x0002 TIME: Departure time 0x0002 0x0002 STR: Origin name 0x0004 0x0002 TIME: Arrival time 0x0006 0x0002 STR: Destination name 0x0008 0x0002 Mean type (1=walk, 2=ride, ...) 0x000a 0x0002 STR: Mean name 0x000c 0x0002 STR: Info (number of minutes for walk, platform number for trains, end-stop for buses, ...) Availability table: =================== Consists of one or more availability entries: Warning! Since this table is placed right after strings table, it can start at odd offset! Availability: ------------- 0x0000 0x0002 STR: Connection availability (unused, always 0x0000) 0x0002 0x0002 Number of 8-days chunks after base date (see Header) 0x0004 0x0002 Size of availability data in bytes 0x0006 ...... Availability data. Each bit represents one day. Connection is available in this day if bit equals 1.