DC_PARSER_SAMPLES_FOREACH(3)
π 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 thetimefield β±οΈDC_SAMPLE_DEPTHβ the depth taken at the sample, in metres. sets thedepthfield πDC_SAMPLE_PRESSUREβ tank pressure taken at the sample. sets the tank index (peep theDC_FIELD_TANK_COUNTindc_parser_get_field(3)) and the pressure in bar. π«§DC_SAMPLE_TEMPERATUREβ temperature in celsius. sets thetemperaturefield π‘οΈDC_SAMPLE_EVENTβ a diving event raised by the computer π. thetypevalue of the event structure may be set toSAMPLE_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, orSAMPLE_EVENT_TISSUELEVEL.DC_SAMPLE_RBTβ the remaining bottom time, in seconds. sets therbtfield β³DC_SAMPLE_HEARTBEATβ the diver's heartbeat in beats per minute. sets theheartbeatfield πDC_SAMPLE_BEARINGβ the diver's bearing in degrees. sets thebearingfield π§DC_SAMPLE_VENDORβ a vendor-specific data field π·οΈDC_SAMPLE_SETPOINTβ the closed-circuit setpoint (PO2) has changed. sets thesetpointvalue in bar βοΈDC_SAMPLE_PPO2β the partial pressure of oxygen has changed (in bar). sets theppo2field π«DC_SAMPLE_CNSβ the CNS (central nervous system oxygen toxicity) value as a unit fraction. sets thecnsvalue π§DC_SAMPLE_DECOβ decompression phase, of typeDC_DECO_NDL(no decompression limit),DC_DECO_SAFETYSTOP(the safety stop),DC_DECO_DECOSTOP(a decompression stop), orDC_DECO_DEEPSTOP(a mandatory or suggested deep-stop). also sets thedepthin metres and thetimein seconds πDC_SAMPLE_GASMIXβ switch to a given gas mix index (see theDC_FIELD_GASMIX_COUNTindc_parser_get_field(3)). sets thegasmixfield π¨
π― RETURN VALUES π―
Returns DC_STATUS_OK on success, and another code on failure π€ (she's not always in the mood okay).
π 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. 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
- 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