libgaminggear
|
Device. More...
Data Structures | |
struct | _GaminggearDevice |
struct | _GaminggearDeviceClass |
Macros | |
#define | GAMINGGEAR_DEVICE_TYPE (gaminggear_device_get_type()) |
#define | GAMINGGEAR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), GAMINGGEAR_DEVICE_TYPE, GaminggearDevice)) |
#define | IS_GAMINGGEAR_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), GAMINGGEAR_DEVICE_TYPE)) |
#define | GAMINGGEAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), GAMINGGEAR_DEVICE_TYPE, GaminggearDeviceClass)) |
#define | IS_GAMINGGEAR_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), GAMINGGEAR_DEVICE_TYPE)) |
Typedefs | |
typedef struct _GaminggearDevice | GaminggearDevice |
typedef struct _GaminggearDeviceClass | GaminggearDeviceClass |
typedef struct _GaminggearDevicePrivate | GaminggearDevicePrivate |
Functions | |
GType | gaminggear_device_get_type (void) |
GaminggearDevice * | gaminggear_device_new (gchar const *identifier, guint vendor_id, guint product_id, guint num_interfaces) |
Creates new GaminggearDevice. More... | |
const gchar * | gaminggear_device_get_identifier (GaminggearDevice const *gaminggear_dev) |
Get identifier. More... | |
guint | gaminggear_device_get_product_id (GaminggearDevice const *gaminggear_dev) |
Get product id. More... | |
guint | gaminggear_device_get_vendor_id (GaminggearDevice const *gaminggear_dev) |
Get vendor id. More... | |
guint | gaminggear_device_get_num_interfaces (GaminggearDevice const *gaminggear_dev) |
Get number of interfaces. More... | |
gboolean | gaminggear_device_matches (GaminggearDevice const *gaminggear_dev, guint vendor_id, guint product_id) |
Match device agains vendor/product id. More... | |
int | gaminggear_device_open (GaminggearDevice *gaminggear_device, gchar const *key, gint flags, GError **error) |
Open file. More... | |
gboolean | gaminggear_device_close (GaminggearDevice *gaminggear_device, gchar const *key, GError **error) |
Close file. More... | |
void | gaminggear_device_set_path (GaminggearDevice *gaminggear_device, gchar const *key, gchar const *path) |
Store a path. More... | |
const gchar * | gaminggear_device_get_path (GaminggearDevice *gaminggear_device, gchar const *key) |
Get a previously stored path. More... | |
void | gaminggear_device_lock (GaminggearDevice *gaminggear_dev) |
Lock recursive lock. More... | |
void | gaminggear_device_unlock (GaminggearDevice *gaminggear_dev) |
Unlock recursive lock. More... | |
gboolean | gaminggear_device_equal (GaminggearDevice const *one, GaminggearDevice const *other) |
Tests if two GaminggearDevices point to the same device. More... | |
Device.
#define GAMINGGEAR_DEVICE | ( | obj | ) | (G_TYPE_CHECK_INSTANCE_CAST((obj), GAMINGGEAR_DEVICE_TYPE, GaminggearDevice)) |
#define GAMINGGEAR_DEVICE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_CAST((klass), GAMINGGEAR_DEVICE_TYPE, GaminggearDeviceClass)) |
#define GAMINGGEAR_DEVICE_TYPE (gaminggear_device_get_type()) |
#define IS_GAMINGGEAR_DEVICE | ( | obj | ) | (G_TYPE_CHECK_INSTANCE_TYPE((obj), GAMINGGEAR_DEVICE_TYPE)) |
#define IS_GAMINGGEAR_DEVICE_CLASS | ( | klass | ) | (G_TYPE_CHECK_CLASS_TYPE((klass), GAMINGGEAR_DEVICE_TYPE)) |
typedef struct _GaminggearDevice GaminggearDevice |
typedef struct _GaminggearDeviceClass GaminggearDeviceClass |
typedef struct _GaminggearDevicePrivate GaminggearDevicePrivate |
gboolean gaminggear_device_close | ( | GaminggearDevice * | gaminggear_device, |
gchar const * | key, | ||
GError ** | error | ||
) |
Close file.
gaminggear_device | A GaminggearDevice. |
key | A key to identify path. |
error | Return location for error or NULL . |
condition | TRUE on success, FALSE else. |
gboolean gaminggear_device_equal | ( | GaminggearDevice const * | one, |
GaminggearDevice const * | other | ||
) |
Tests if two GaminggearDevices point to the same device.
one | A GaminggearDevice. |
other | Another GaminggearDevice. |
bool | TRUE if devices are equal, FALSE else. |
const gchar* gaminggear_device_get_identifier | ( | GaminggearDevice const * | gaminggear_dev | ) |
Get identifier.
gaminggear_dev | A GaminggearDevice. |
identifier | An identifier that was given at construction time and is unique for the usb device. |
guint gaminggear_device_get_num_interfaces | ( | GaminggearDevice const * | gaminggear_dev | ) |
Get number of interfaces.
gaminggear_dev | A GaminggearDevice. |
num_interfaces | The number of interfaces of the device given at construction time. |
const gchar* gaminggear_device_get_path | ( | GaminggearDevice * | gaminggear_device, |
gchar const * | key | ||
) |
Get a previously stored path.
gaminggear_device | A GaminggearDevice. |
key | A key to identify path. |
path | or NULL . This path is property of the device and should no be freed! |
guint gaminggear_device_get_product_id | ( | GaminggearDevice const * | gaminggear_dev | ) |
Get product id.
gaminggear_dev | A GaminggearDevice. |
product_id | The product id given at construction time. |
GType gaminggear_device_get_type | ( | void | ) |
guint gaminggear_device_get_vendor_id | ( | GaminggearDevice const * | gaminggear_dev | ) |
Get vendor id.
gaminggear_dev | A GaminggearDevice. |
vendor_id | The vendor id given at construction time. |
void gaminggear_device_lock | ( | GaminggearDevice * | gaminggear_dev | ) |
Lock recursive lock.
gaminggear_dev | A GaminggearDevice. |
gboolean gaminggear_device_matches | ( | GaminggearDevice const * | gaminggear_dev, |
guint | vendor_id, | ||
guint | product_id | ||
) |
Match device agains vendor/product id.
gaminggear_dev | A GaminggearDevice. |
vendor_id | The vendor id to match against. |
product_id | The product id to match against. |
bool | TRUE if vendor and product ids match, else FALSE . |
GaminggearDevice* gaminggear_device_new | ( | gchar const * | identifier, |
guint | vendor_id, | ||
guint | product_id, | ||
guint | num_interfaces | ||
) |
Creates new GaminggearDevice.
identifier | The unique identifier of the device. |
vendor_id | The vendor id of the device. |
product_id | The product id of the device. |
num_interfaces | The number of interfaces of the device. |
device | The new GaminggearDevice which should be freed with g_object_unref(). |
int gaminggear_device_open | ( | GaminggearDevice * | gaminggear_device, |
gchar const * | key, | ||
gint | flags, | ||
GError ** | error | ||
) |
Open file.
Once successfully opened, the file descriptor is stored and just returned on subsequent calls. File should be closed with gaminggear_device_close() instead of close(). The using code is responsible for closing all files prior to unref of GaminggearDevice.
gaminggear_device | A GaminggearDevice. |
key | A key to identify path. |
flags | Flags for open. |
error | Return location for error or NULL . |
fd | File descriptor. |
void gaminggear_device_set_path | ( | GaminggearDevice * | gaminggear_device, |
gchar const * | key, | ||
gchar const * | path | ||
) |
Store a path.
gaminggear_device | A GaminggearDevice. |
key | A key to identify path. |
path | The path to be stored. |
void gaminggear_device_unlock | ( | GaminggearDevice * | gaminggear_dev | ) |
Unlock recursive lock.
gaminggear_dev | A GaminggearDevice. |