DC_DEVICE_FOREACH(3)

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

🌸 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 πŸ¦‹

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. 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