DC_PARSER_GET_FIELD(3)
π dc_parser_get_field(3) β like, the whole manual page, bestie
okay so real quick: this is from the Library Functions Manual (section 3, the function-calls one, iykyk), and it's the glow-up guide to dc_parser_get_field. it pulls one single field out of a dive you already parsed. that's the whole vibe. let's get into it β¨
π NAME π
dc_parser_get_field β extract a field from a parsed dive
π LIBRARY π
library βlibdivecomputerβ
πΈ SYNOPSIS πΈ
#include <libdivecomputer/parser.h>
dc_status_t
dc_parser_get_field(dc_parser_t *parser, dc_field_type_t type,
unsigned int flags, void *value);
π¦ DESCRIPTION π¦
so you've got a dive, right? and you've got a parser β one that you literally already set up with dc_parser_new(3) (we see you, preparer of parsers π). this function grabs a field out of it. π
here's the tea: the value field type is not one-size-fits-all β what you pass there depends entirely on the type you asked for. and the flags field? highkey ignored for every type except DC_FIELD_GASMIX and DC_FIELD_TANK. everyone else gets the silent treatment. π
the type can be any one of these bad boys:
DC_FIELD_DIVETIMEβ how long the dive lasted, in seconds β±οΈ. thevaluehas to be anunsigned int.DC_FIELD_MAXDEPTHβ deepest point, in metres π. thevaluehas to be adouble.DC_FIELD_AVGDEPTHβ average depth across all the samples, in metres. thevaluehas to be adouble.DC_FIELD_GASMIX_COUNTβ how many different gas mixes got used on this dive π«§. thevaluehas to be aunsigned int.DC_FIELD_GASMIXβ the mixture for one particular gas. thevaluehas to be adc_gasmix_t, which hasdoublefields for oxygen, helium, and nitrogen. heads up: these are set to the unit fraction of gas, not a percentage π. and theflagsvalue is read as the gas mixture index β which has to be less than the value ofDC_FIELD_GASMIX_COUNT. no skipping the line, bestie.DC_FIELD_SALINITYβ the water salinity, as adc_salinity_tfield. that one's made of a type β eitherDC_WATER_FRESHorDC_WATER_SALTβ plus the salinity density. π§DC_FIELD_ATMOSPHERICβ atmospheric pressure in bar. thevaluefield has to be adouble.DC_FIELD_TEMPERATURE_SURFACEβ air temperature at the surface, in Celsius βοΈ. thevaluefield has to be adouble.DC_FIELD_TEMPERATURE_MINIMUMβ minimum water temperature surface, in Celsius π₯Ά. thevaluefield has to be adouble. (yes, the manual literally says βwater temperature surfaceβ β we don't make the rules, we just report them π )DC_FIELD_TEMPERATURE_MAXIMUMβ maximum water temperature, in Celsius π₯. thevaluefield has to be adouble.DC_FIELD_TANK_COUNTβ the number of tanks, as anunsigned int.DC_FIELD_TANKβ tank configuration, as adc_tank_t. this structure is a whole little squad:gasmixβ retrievable withDC_FIELD_GASMIXtypeβ the tank volume units, one ofDC_TANKVOLUME_NONE,DC_TANKVOLUME_IMPERIAL, orDC_TANKVOLUME_METRICvolumeβ the tank volume in litres, or zero if the tank isDC_TANKVOLUME_NONEworkpressureβ the work pressure in bar, or zero ifDC_TANKVOLUME_NONE, and maybe zero ifDC_TANKVOLUME_METRIC(life is unpredictable π)beginpressureandendpressureβ the pressures at start and finish, in bar
and the flags value here is the tank index. periodt.
DC_FIELD_DIVEMODEβ the mode of the dive, and there are five flavors:DC_DIVEMODE_FREEDIVEβ free-diving π¬DC_DIVEMODE_GAUGEβ gauge mode, i.e. running as a plain record and not computing stuff like decompression eventsDC_DIVEMODE_OCβ standard open-circuit divingDC_DIVEMODE_CCRβ closed circuit βrebreatherβ divingDC_DIVEMODE_SCRβ semi closed circuit βrebreatherβ diving π«§
ngl, when the manual says βDC_DIVEMODE_CCRandDC_DIVEMODE_SCRfor respectively closed circuit and semi closed circuitβ β that's your order, okay? CCR first, SCR second. don't mix 'em up. π«Ά
β RETURN VALUES β
DC_STATUS_SUCCESSβ yay!! the field was retrieved πDC_STATUS_UNSUPPORTEDβ the field just isn't supported by the device, no hard feelings π- anything else β βother error messages on further failureβ π something else went wrong, go look at the error.
π SEE ALSO π
dc_parser_new(3)β the origin story, start there bestie
π AUTHORS π
the library βlibdivecomputerβ library was written by Jef Driesen, jef@libdivecomputer.org. π«Ά
the manpages were written by Kristaps Dzonsons, kristaps@bsd.lv.
and that's a wrap, babe π this page came to you from Debian, dated January 5, 2017, and the header on the tin says DC_PARSER_GET_FIELD(3). go forth and extract fields, icon π
β¨
π¦ where this page comes from
- nixos 26.05: libdivecomputer 0.9.0
- nixpkgs unstable: libdivecomputer 0.9.0
- Copyright (C) 2017 Kristaps Dzonsons <kristaps@bsd.lv>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms