Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Common dive data model

Every family document ends by mapping its raw records into the model defined here. The model is deliberately small: it holds what divers and logbook software use, in SI units, and keeps everything else as raw bytes so nothing is lost. Field names below are descriptive, not an API; implementations choose their own identifiers.

Units (see ../conventions.md): depth m, temperature °C, pressure bar, time s, gas fractions 0..1, volume litres (water capacity), ppO2 bar, CNS as a fraction 0..1 (100 % = 1.0).

1. Download result

A download produces one device record and zero or more dive records, ordered newest first (the order devices naturally deliver them).

1.1 Device record

FieldTypeNotes
vendor, producttextfrom the identification step
familyidentifierthe family document that applies
model codeintegeras reported by the device (see family document)
serial numbertextdevices report numbers, BCD or ASCII; keep the device’s rendering
firmware versiontext
hardware idinteger, optionalwhere a family distinguishes hardware revisions
clock correlation(device_ticks, host_local_time), optionalrequired for device-relative clocks (datetime.md section 6)
raw identification bytesbytesthe unparsed identity/version reply

1.2 Dive record

FieldTypeNotes
fingerprintbytessection 4
rawbytesthe dive’s raw header and profile exactly as read (enables re-parsing)
headersection 2
sampleslist of section 3in time order

Confidence: likely (design).

2. Dive header

All fields are optional; a family fills what its data provides and leaves the rest absent (never zero-filled).

FieldType / unitNotes
startlocal date-time + optional UTC offset (s)datetime.md
numberintegerthe device’s own dive counter, if any
durationsas stored by the device; may differ from the last sample time (devices often exclude surface time at the end)
max depthmas stored in the header, not recomputed
average depthm
min / max / surface temperature°C
surface (atmospheric) pressurebaras measured or assumed by the device
water typefresh / salt / en13319 / custom density (kg/m³)the device’s depth-conversion setting
dive modeopen circuit, closed circuit (CCR), semi-closed (SCR), gauge, freedive, unknown
deco modelbühlmann (+ gradient factors low/high, 0..1), vpm (+ conservatism), rgbm (+ conservatism), dciem, none/unknownconservatism kept as the device’s own integer setting
personal adjustment / altitude levelinteger, device-defined
surface interval before the dives
desaturation / no-fly time after the dives
CNS at end, OTUfraction, units
gas mixeslist of gas mix (2.1)index used by samples
tankslist of tank (2.2)index used by samples
locationlatitude, longitude (degrees, WGS 84), optionalsome GPS-capable devices
vendor fieldskey → valueanything else worth keeping

2.1 Gas mix

FieldUnitNotes
O2fraction 0..1
Hefraction 0..10 for nitrox
N2fractionderived: 1 − O2 − He
usageopen circuit, diluent, oxygen, bailout, unknown
enabledbooleansome devices store disabled mixes

Devices store fractions as percent integers or in other scaled units; a value of 0 % O2 often means “air” (21 %) and the family document says so.

2.2 Tank

FieldUnitNotes
gas mix indexindex into gas mixesoptional
water volumeloptional; imperial devices store “nominal gas volume at working pressure” in cubic feet; convert with the working pressure: V_water_l = V_gas_cuft × 28.3168 × 1.01325 / P_work_bar (ideal-gas approximation)
working pressurebaroptional
begin / end pressurebarfrom the header or the first/last pressure samples
sensor / transmitter idintegerwireless air-integration transmitter
usageopen circuit, diluent, oxygen, sidemount left/right, unknown

Confidence: likely (design).

3. Samples

A sample is a time point with any subset of the following values. Families deliver samples at a fixed interval with optional extra values interleaved; hosts SHOULD merge everything that belongs to the same time into one sample.

FieldUnitNotes
times since dive startstrictly increasing
depthm
temperature°C
tank pressurebar, per tank indexseveral tanks possible
ppO2bar, per sensor index, plus optional “computed/voted” valueCCR
setpointbarCCR
CNSfraction
deco statekind (ndl, safety stop, deco stop, deep stop) + stop depth (m) + time (s; NDL remaining or stop time)
time to surfaces
remaining bottom / air timesair-integrated devices
current gas mixindexset when it changes
heart rate1/min
bearingdegrees 0..359compass
ascent ratem/sif stored, not derived
eventslist (3.1)
vendor data(type, bytes)unparsed extra records

3.1 Events

EventValueNotes
gas switchgas mix indexalso reflected in “current gas mix”
ascent rate warningseverity / rate
deco ceiling violation—
missed / violated deco stop—
safety stop (voluntary / mandatory) begin/end—
deep stop—
ppO2 high / lowppO2 (bar)
CNS / OTU warningvalue
max depth / max time alarm—
low tank pressure / reservetank index
transmitter lost / low batterytank index
battery low (device)—
bookmark / user mark—
surface / dive end detected—
setpoint switchbarCCR
bailoutgas mix index
heading setdegrees
workload / tissue saturation indicatordevice-defined
vendor event(code, value)anything not mapped

Events carry the time of the sample they belong to. A family document lists, for every raw event or alarm bit, which event it maps to; unknown bits become vendor events.

Confidence: likely (design).

4. Fingerprints and incremental download

A fingerprint is a short byte string that uniquely identifies a dive on a given device, and is stable across downloads. Most families use the raw bytes of the dive’s timestamp (4-8 bytes); some use a dive number or a header CRC. The family document defines it exactly.

Incremental download: the host stores the fingerprint of the newest dive it has; on the next download it reads dives newest first and stops at the first dive whose fingerprint equals the stored one. Devices that transfer only on request per dive (most modern ones) save time this way; devices that dump their whole memory still dump it, and the fingerprint only limits parsing.

Some devices filter on the device side instead: the host sends a timestamp and the device returns only newer dives (Uwatec Smart). The threshold is derived from the newest stored dive time as described in datetime.md section 6.

Confidence: likely.

5. Ring buffers

Many devices store profiles in a circular memory region [begin, end). Shared definitions, used by the family documents:

  • Normalise an address a: begin + ((a − begin) mod (end − begin)), taking a non-negative modulo.
  • Distance from a to b (moving forward): (b − a) mod size. When a == b the distance is ambiguous: 0 if the buffer is defined empty, size if it is full. Each family states which applies (typically “full” when walking from the newest dive’s end back to its own start).
  • Increment / decrement with wrap-around.
  • A profile that crosses end continues at begin.

Reading a ring buffer backwards from the newest data (the common case) is done in chunks: start at the end pointer, read the chunk ending there, move the pointer back, wrapping from begin to end. Hosts SHOULD align chunk boundaries to the device’s page size so that each read request is a whole number of pages, and SHOULD cache the most recent chunk because consecutive dives share pages.

Logbook (header) areas are often a separate ring of fixed-size entries with their own begin/end and an index of the newest entry. An entry or profile consisting only of FF (erased flash) or 00 marks unused space.

Confidence: likely.

6. Depth from pressure

Several devices record absolute or relative pressure instead of depth. Families MUST document the device’s own conversion. The common form is

depth_m = (p_abs − p_surface) / (ρ × g)

with p in pascals, g = 9.80665 m/s², and the device’s water density ρ (commonly 1000 kg/m³ fresh, 1025 or 1030 kg/m³ salt; EN 13319 uses 1020 kg/m³). Hosts that let the user override density MUST still default to the device’s convention so that depths match what the diver saw.

Confidence: likely.

7. Raw preservation

Hosts SHOULD keep, per download, the device record’s raw identification bytes and each dive’s raw bytes. Parsers improve over time; raw data lets old downloads be re-parsed. A full memory dump, where the family supports it, is the most complete record and SHOULD be kept when the user asks for diagnostics.

References

  • libdivecomputer (LGPL-2.1), consulted for the range of fields devices provide; no code or structure copied. https://www.libdivecomputer.org/
  • EN 13319:2000, Diving accessories — depth gauges (reference density for depth display)