DC_PARSER_SAMPLES_FOREACH(3)

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

πŸ’– DC_PARSER_SAMPLES_FOREACH πŸ’–

okay bestie, welcome to another installment of Library Functions Manual πŸŽ€ β€” this one is literally the way you walk through every single sample recorded during a dive. yes, dive as in scuba. yes, we're being cool about it. iykyk πŸ¦‹

✨ NAME ✨

dc_parser_samples_foreach β€” iterate over samples taken during a dive 🌊

πŸ“š LIBRARY πŸ“š

library β€œlibdivecomputer” 🫢

πŸ› οΈ SYNOPSIS πŸ› οΈ

#include <libdivecomputer/parser.h>

typedef void
(*dc_sample_callback_t)(dc_sample_type_t type,
    const dc_sample_value_t *value, void *userdata);

dc_status_t
dc_parser_samples_foreach(dc_parser_t *parser,
    dc_sample_callback_t callback, void *userdata);

🌸 DESCRIPTION 🌸

So here's the vibe: this function pulls out the samples taken during a dive β€” the ones from a parser you already set up with dc_parser_new(3) ✨. Every single sample gets handed off to callback, along with the sample's type and its data value. no cap, that's it, that's the whole job.

Now the part that's giving structure πŸ‘‘: samples show up as a sequence of sample sets. Each sequence kicks off with a DC_SAMPLE_TIME, and then a bunch of sample types in that set follow. The moment the next DC_SAMPLE_TIME lands, the current sample set may be closed and a brand new one opened πŸ”. And after everything has been rendered, that last sample set should be closed. don't leave it hanging, bestie 😭

The following sample types may be raised:

  • DC_SAMPLE_TIME β€” the time of the sample, taken in milliseconds after the dive began. sets the time field ⏱️
  • DC_SAMPLE_DEPTH β€” the depth taken at the sample, in metres. sets the depth field 🌊
  • DC_SAMPLE_PRESSURE β€” tank pressure taken at the sample. sets the tank index (peep the DC_FIELD_TANK_COUNT in dc_parser_get_field(3)) and the pressure in bar. 🫧
  • DC_SAMPLE_TEMPERATURE β€” temperature in celsius. sets the temperature field 🌑️
  • DC_SAMPLE_EVENT β€” a diving event raised by the computer πŸ‘€. the type value of the event structure may be set to SAMPLE_EVENT_NONE, SAMPLE_EVENT_DECOSTOP, SAMPLE_EVENT_RBT, SAMPLE_EVENT_ASCENT, SAMPLE_EVENT_CEILING, SAMPLE_EVENT_WORKLOAD, SAMPLE_EVENT_TRANSMITTER, SAMPLE_EVENT_VIOLATION, SAMPLE_EVENT_BOOKMARK, SAMPLE_EVENT_SURFACE, SAMPLE_EVENT_SAFETYSTOP, SAMPLE_EVENT_SAFETYSTOP_VOLUNTARY, SAMPLE_EVENT_SAFETYSTOP_MANDATORY, SAMPLE_EVENT_DEEPSTOP, SAMPLE_EVENT_CEILING_SAFETYSTOP, SAMPLE_EVENT_FLOOR, SAMPLE_EVENT_DIVETIME, SAMPLE_EVENT_MAXDEPTH, SAMPLE_EVENT_OLF, SAMPLE_EVENT_PO2, SAMPLE_EVENT_AIRTIME, SAMPLE_EVENT_RGBM, SAMPLE_EVENT_HEADING, or SAMPLE_EVENT_TISSUELEVEL.
  • DC_SAMPLE_RBT β€” the remaining bottom time, in seconds. sets the rbt field ⏳
  • DC_SAMPLE_HEARTBEAT β€” the diver's heartbeat in beats per minute. sets the heartbeat field πŸ’“
  • DC_SAMPLE_BEARING β€” the diver's bearing in degrees. sets the bearing field 🧭
  • DC_SAMPLE_VENDOR β€” a vendor-specific data field 🏷️
  • DC_SAMPLE_SETPOINT β€” the closed-circuit setpoint (PO2) has changed. sets the setpoint value in bar βš™οΈ
  • DC_SAMPLE_PPO2 β€” the partial pressure of oxygen has changed (in bar). sets the ppo2 field 🫁
  • DC_SAMPLE_CNS β€” the CNS (central nervous system oxygen toxicity) value as a unit fraction. sets the cns value 🧠
  • DC_SAMPLE_DECO β€” decompression phase, of type DC_DECO_NDL (no decompression limit), DC_DECO_SAFETYSTOP (the safety stop), DC_DECO_DECOSTOP (a decompression stop), or DC_DECO_DEEPSTOP (a mandatory or suggested deep-stop). also sets the depth in metres and the time in seconds πŸ›‘
  • DC_SAMPLE_GASMIX β€” switch to a given gas mix index (see the DC_FIELD_GASMIX_COUNT in dc_parser_get_field(3)). sets the gasmix field πŸ’¨

🎯 RETURN VALUES 🎯

Returns DC_STATUS_OK on success, and another code on failure 😀 (she's not always in the mood okay).

πŸ‘€ SEE ALSO πŸ‘€

dc_parser_new(3)

πŸ‘‘ AUTHORS πŸ‘‘

The library β€œlibdivecomputer” library was written by Jef Driesen, jef@libdivecomputer.org. The manpages were written by Kristaps Dzonsons, kristaps@bsd.lv. absolute icons, both of them 🫢✨


and that's the tea, bestie β€” this page came to you from Debian, dated January 5, 2017, filed under DC_PARSER_SAMPLES_FOREACH(3). slay πŸ’…πŸ’–

πŸ“¦ where this page comes from