Device configuration is managed by "profiles" (see Device profiles). More...
Data Structures | |
struct | ratbag_device |
A ratbag context represents one single device. More... | |
Functions | |
struct ratbag_device * | ratbag_device_ref (struct ratbag_device *device) |
Add a reference to the device. More... | |
struct ratbag_device * | ratbag_device_unref (struct ratbag_device *device) |
Dereference the ratbag device. More... | |
void | ratbag_device_set_user_data (struct ratbag_device *device, void *userdata) |
Set caller-specific data associated with this device. More... | |
void * | ratbag_device_get_user_data (const struct ratbag_device *device) |
Get the caller-specific data associated with this device, if any. More... | |
const char * | ratbag_device_get_name (const struct ratbag_device *device) |
const char * | ratbag_device_get_svg_name (const struct ratbag_device *device) |
int | ratbag_device_has_capability (const struct ratbag_device *device, enum ratbag_device_capability cap) |
Note that a device may not support any of the capabilities but still initialize fine otherwise. More... | |
unsigned int | ratbag_device_get_num_profiles (struct ratbag_device *device) |
Return the number of profiles supported by this device. More... | |
unsigned int | ratbag_device_get_num_buttons (struct ratbag_device *device) |
Return the number of buttons available on this device. More... | |
Detailed Description
Device configuration is managed by "profiles" (see Device profiles).
In the simplest case, a device has a single profile that can be fetched, queried and manipulated and then re-applied to the device. Other devices may have multiple profiles, each of which can be queried and managed independently.
Enumeration Type Documentation
Function Documentation
const char* ratbag_device_get_name | ( | const struct ratbag_device * | device | ) |
- Parameters
-
device A previously initialized ratbag device
- Returns
- The name of the device associated with the given ratbag.
unsigned int ratbag_device_get_num_buttons | ( | struct ratbag_device * | device | ) |
Return the number of buttons available on this device.
- Parameters
-
device A previously initialized ratbag device
- Returns
- The number of buttons available on this device.
unsigned int ratbag_device_get_num_profiles | ( | struct ratbag_device * | device | ) |
Return the number of profiles supported by this device.
Note that the number of profiles available may be different to the number of profiles currently active. This function returns the maximum number of profiles available and is static for the lifetime of the device.
A device that does not support profiles in hardware provides a single profile that reflects the current settings of the device.
- Parameters
-
device A previously initialized ratbag device
- Returns
- The number of profiles available on this device.
const char* ratbag_device_get_svg_name | ( | const struct ratbag_device * | device | ) |
- Parameters
-
device A previously initialized ratbag device
- Returns
- The file name of the svg drawing associated with the given ratbag. If there is no file associated to the device, NULL is returned.
void* ratbag_device_get_user_data | ( | const struct ratbag_device * | device | ) |
Get the caller-specific data associated with this device, if any.
- Parameters
-
device A previously initialized ratbag device
- Returns
- The caller-specific data previously assigned in ratbag_device_set_user_data().
int ratbag_device_has_capability | ( | const struct ratbag_device * | device, |
enum ratbag_device_capability | cap | ||
) |
Note that a device may not support any of the capabilities but still initialize fine otherwise.
This is the case for devices that have no configurable options set, or for devices that have some configuration options but none that are currently exposed by libratbag. A client is expected to handle this situation.
- Return values
-
1 The device has the capability 0 The device does not have the capability
struct ratbag_device* ratbag_device_ref | ( | struct ratbag_device * | device | ) |
Add a reference to the device.
A device is destroyed whenever the reference count reaches 0. See ratbag_device_unref.
- Parameters
-
device A previously initialized valid ratbag device
- Returns
- The passed ratbag device
void ratbag_device_set_user_data | ( | struct ratbag_device * | device, |
void * | userdata | ||
) |
Set caller-specific data associated with this device.
libratbag does not manage, look at, or modify this data. The caller must ensure the data is valid.
- Parameters
-
device A previously initialized device userdata Caller-specific data passed to the various callback interfaces.
struct ratbag_device* ratbag_device_unref | ( | struct ratbag_device * | device | ) |
Dereference the ratbag device.
When the internal refcount reaches zero, all resources associated with this object are released. The object must be considered invalid once unref is called.
- Parameters
-
device A previously initialized ratbag device
- Returns
- Always NULL