EGD_GET_CAP(3)

πŸ’– EGD_GET_CAP(3) πŸ’–

okay bestie, welcome to the EEGDEV library manual β€” this is the page for egd_get_cap, and she's a lil query queen πŸ‘‘


🌸 NAME 🌸

egd_get_cap β€” ask the device all the juicy stuff about what it can do πŸ’…


✨ SYNOPSIS ✨

#include <eegdev.h>

int egd_get_cap(const struct eegdev* dev, int cap, void* val);

πŸ¦‹ DESCRIPTION πŸ¦‹

so basically, egd_get_cap() hands you back the info about whatever capability you asked for β€” you pick it with cap, the device is dev, and the answer lands wherever val points. no cap fr fr 🧚

and here's the thing, the type of pointer you pass as val depends entirely on which cap you asked for. so like, don't just yeet a random pointer in there. here's the full menu (the expected type that val points to is right there in the parentheses, iykyk):

  • EGD_CAP_FS (int) β€” the sampling frequency that's currently set. and the function returns that exact same value, so it's giving double confirmation πŸ’–
  • EGD_CAP_TYPELIST (const int*) β€” an array of the sensor types the device is sampling, terminated by -1. and listen: once you've opened the device dev, these values become valid arguments for egd_sensor_name(3) if they weren't already before. the number of elements in that array (not counting the -1 element) is what the function returns. so count accordingly bestie πŸŽ€
  • EGD_CAP_DEVTYPE (const char*) β€” a null-terminated string describing the type of the recording device (that's manufacturer and model if dev refers to actual hardware). the length of the string (not counting the null character) comes back as the return value. slay ✨
  • EGD_DEVID (const char*) β€” a null-terminated string describing the model of the recording device (or a unique identifier of the resource, whichever it is). the length of the string (null character not included, we're not counting that) is provided by the return value. iconic 🫢

πŸ”₯ RETURN VALUE πŸ”₯

if everything goes well, you get back a positive value and what that value means depends on the capability you requested (see above, bestie). if it doesn't go well? -1 comes back and errno gets set accordingly. no cap 😭


πŸ’€ ERRORS πŸ’€

egd_get_cap() will fail if:

  • EINVAL β€” dev is NULL, or cap isn't a valid value, or val is NULL while cap is not EGD_CAP_FS. yeah, EGD_CAP_FS is the one exception where a NULL val is fine β€” everybody else needs a real pointer. read the room πŸŽ€

πŸ‘‘ SEE ALSO πŸ‘‘

egd_sensor_name(3)


that's the whole page, you ate it πŸ’… big love to EPFL, this one's dated 2011, and it lives in the EEGDEV library manual. go forth and query your caps, bestie πŸŒˆπŸ’œ