DC_PARSER_GET_FIELD(3)

πŸ“¦ version 0.9.0, in nixos 26.05, nixpkgs unstable

πŸ’… 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 ⏱️. the value has to be an unsigned int.
  • DC_FIELD_MAXDEPTH β€” deepest point, in metres 🌊. the value has to be a double.
  • DC_FIELD_AVGDEPTH β€” average depth across all the samples, in metres. the value has to be a double.
  • DC_FIELD_GASMIX_COUNT β€” how many different gas mixes got used on this dive 🫧. the value has to be a unsigned int.
  • DC_FIELD_GASMIX β€” the mixture for one particular gas. the value has to be a dc_gasmix_t, which has double fields for oxygen, helium, and nitrogen. heads up: these are set to the unit fraction of gas, not a percentage πŸ™ˆ. and the flags value is read as the gas mixture index β€” which has to be less than the value of DC_FIELD_GASMIX_COUNT. no skipping the line, bestie.
  • DC_FIELD_SALINITY β€” the water salinity, as a dc_salinity_t field. that one's made of a type β€” either DC_WATER_FRESH or DC_WATER_SALT β€” plus the salinity density. πŸ§‚
  • DC_FIELD_ATMOSPHERIC β€” atmospheric pressure in bar. the value field has to be a double.
  • DC_FIELD_TEMPERATURE_SURFACE β€” air temperature at the surface, in Celsius β˜€οΈ. the value field has to be a double.
  • DC_FIELD_TEMPERATURE_MINIMUM β€” minimum water temperature surface, in Celsius πŸ₯Ά. the value field has to be a double. (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 πŸ”₯. the value field has to be a double.
  • DC_FIELD_TANK_COUNT β€” the number of tanks, as an unsigned int.
  • DC_FIELD_TANK β€” tank configuration, as a dc_tank_t. this structure is a whole little squad:
    • gasmix β€” retrievable with DC_FIELD_GASMIX
    • type β€” the tank volume units, one of DC_TANKVOLUME_NONE, DC_TANKVOLUME_IMPERIAL, or DC_TANKVOLUME_METRIC
    • volume β€” the tank volume in litres, or zero if the tank is DC_TANKVOLUME_NONE
    • workpressure β€” the work pressure in bar, or zero if DC_TANKVOLUME_NONE, and maybe zero if DC_TANKVOLUME_METRIC (life is unpredictable 😭)
    • beginpressure and endpressure β€” 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 events
    • DC_DIVEMODE_OC β€” standard open-circuit diving
    • DC_DIVEMODE_CCR β€” closed circuit β€œrebreather” diving
    • DC_DIVEMODE_SCR β€” semi closed circuit β€œrebreather” diving 🫧
ngl, when the manual says β€œDC_DIVEMODE_CCR and DC_DIVEMODE_SCR for 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 πŸ”—


πŸ‘‘ 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