VeloAce Log Database Format

Release Information

This documentation: © 2005, 2006, 2009 Mark Hämmerling.
Revision: 2009-06-08-A.

Introduction

This document specifies the streaming format of Log1 Type databases for the VeloAce Open Source Bike Computer System for Palm OS.

Preliminary Status

Please note that this is not yet a finalized official specification. Please do not rely on the information stated here, as this document is still under development.

Specification

Palm OS Database Information

Creator IDType
'VAce''Log1'

Stream Header and Compatibility

Log Sessions

Any section of a stream compatible to the Log1 Container Type is prepended with a Log Session Init (LSI) event. A new stream section is started with each new log session, i.e. when the user initiates a new log database or appends to an existing log database. All values defined during the previous log session shall be reset to their default values upon opening a new log session.
Each log session is closed with a Log Session End (LSE) event, indicating that the session was properly shut down and no software or hardware malfunction did interrupt the recording.

Note: The LSI event code was chosen in such a manner that it does not conflict with known codes from Log0 databases. This helps identifying Log1 Type streams.

Mixing Log Types

Note: Mixing Log0 and Log1 data within the same database is discouraged and only described here in order to allow developers to make their analyzing algorithms as robust as possible.
VeloAce will not support recording mixtures of Log DB Types, so it should be safe to decide about the type of database at the very first event (LSI or not).

The analyzing algorithm shall start interpreting the data as a Log0 stream. Upon detection of an LSI event code, it shall switch to Log1 mode and continue interpreting the succeeding data as a Log1 stream, until the detection of an LSE event, which switches back to the Log0 interpreter for compatibility.

Global Database Header

There is no global database header. Each contained log session is initiated and ended through events.

Handling Of Reserved Data

When analyzing a Log1 Type DB, reading of data specified as reserved shall lead to a fatal error, as interpreter errors are an indication for unsupported features that might lead to misinterpretation of the data.
As an option, the interpreter might just print a non-fatal warning message upon reading reserved events and continue trying to decode the stream.

Database Structure

The data is recorded as a stream of bytes. It starts at record #0 and is then continued in the next record, wrapped at any byte(!) on each 16384 Byte (16kB) boundary.

Stream Data Format

The stream consists of concatenated events, each initiated by an Event Header (EH) byte. Each event consists of two (EH only) or three (EH, plus data) parts:

Event Data Length Field

The type and length of the event data is encoded in bits 2..0 of the Event Header byte. Listed are the masked values (bit mask 0x07):

ValueData typeData format
0x00IntegerNo data following, or zero (when treated as integer).
0x01Integer1 byte of data following.
0x02Integer2 bytes of data following, encoded in big-endian.
0x03Integer3 bytes of data following, encoded in big-endian.
0x04Integer4 bytes of data following, encoded in big-endian.
0x05(reserved)
0x06(reserved)
0x07StringZero-terminated string following, 1 byte per character.

Event Type Code Field

The actual type of the event is encoded in bits 7..3 of the Event Header byte. Listed are the masked values (bit mask 0xf8):

ValueDescriptionData typeData
0xf8 Log Session Init (LSI): New log session following. Integer Time of event (Palm OS Epoch).
0xf0 Log Session End (LSE): End of log session. Integer Time of event (Palm OS Epoch).
0x00 Wheel Circumference Definition (WCD). Integer Circumference for any succeeding wheel revolution (until changed), unit: 1 cm. Default (initial) value: 200.
0x08 Initial Wheel Revolution (WRI), for resynchronization. Integer Time of event (Palm OS Epoch).
0x10 Succeeding Wheel Revolution, high resolution (WRH). This is used if the time difference fits into 32 bits. Integer Time since previous revolution (WRI, WRH, or WRL), unit: 1/25600 s.
0x18 Succeeding Wheel Revolution, low resolution (WRL). This is used if the time difference, expressed in high precision, would overflow 32 bits. Integer Time since previous revolution (WRI, WRH, or WRL), unit: 1/100 s.
0x20 Sleep Mode Enter (SME), going into standby mode. Integer Time of event (Palm OS Epoch).
0x28 Sleep Mode Leave (SML), waking up. Integer Time of event (Palm OS Epoch).
0x30 Anonymous Mark (MKA). None None.
0x38 Titled Mark (MKT). String User defined name of the mark.
0x40 Lap Start (LPS). Integer Lap number.
0x48 Lap Finish (LPF). None None.
0x50
..
0xf0
(reserved)