DC_DEVICE_FOREACH(3)
πΈ NAME πΈ
okay bestie, this is the DC_DEVICE_FOREACH(3) page from the Library Functions Manual π
and the name is literally: dc_device_foreach β iterate over dives in a dive computer. Thatβs the whole vibe: dive computer goes brrr, we walk through the dives β¨
π«Ά LIBRARY π«Ά
the library is βlibdivecomputerβ π
β¨ SYNOPSIS β¨
#include <libdivecomputer/device.h>
typedef int
(*dc_dive_callback_t)(const unsigned char *data, unsigned int size,
const unsigned char *fingerprint, unsigned int fsize,
void *userdata);
dc_status_t
dc_device_foreach(dc_device_t *device, dc_dive_callback_t callback,
void *userdata);
π DESCRIPTION π
okay so iterate over all dives on device by calling callback with userdata. Thatβs the main character move π
Every single dive invokes callback with the dive data β which should be parsed with dc_parser_new(3) β and the binary fingerprint of the dive. no cap, both things show up π«Ά
The fingerprint is lowkey iconic for this: you can use it to record the newest dive, and then on subsequent invocations stop processing when the same dive fingerprint is encountered. iykyk β¨
Your callback function must return non-zero to continue downloading dives, or zero to stop. Thatβs the rule, bestie π
π₯ RETURN VALUES π₯
This returns DC_STATUS_SUCCESS on success or one of several error values on error. If callback returns zero, this will not be reflected in the return value (usually DC_STATUS_SUCCESS). fr fr π
π¦ 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. iconic behavior, honestly π
okay thatβs the whole page! π this one comes from Debian, dated January 5, 2017, and itβs DC_DEVICE_FOREACH(3) β slay, go read some dives bestie π«Ά
π¦ 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