1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
|
#include <time.h>
#include <urfkill.h>
#include <stdio.h>
#include <glib.h>
static void
print_urf_device (UrfDevice *device)
{
guint index, type;
gboolean soft, hard, platform;
char *name;
g_object_get (device,
"index", &index,
"type", &type,
"soft", &soft,
"hard", &hard,
"name", &name,
"platform", &platform,
NULL);
printf ("index = %u\n", index);
printf ("type = %u\n", type);
printf ("soft = %d\n", soft);
printf ("hard = %d\n", hard);
printf ("name = %s\n", name);
printf ("platform = %d\n", platform);
}
int
main ()
{
UrfClient *client = NULL;
UrfDevice *device;
GList *devices, *item;
#if !GLIB_CHECK_VERSION(2,36,0)
g_type_init();
#endif
client = urf_client_new ();
urf_client_enumerate_devices_sync (client, NULL, NULL);
g_print ("Daemon Version: %s\n\n", urf_client_get_daemon_version (client));
devices = urf_client_get_devices (client);
for (item = devices; item; item = item->next) {
device = (UrfDevice *)item->data;
print_urf_device (device);
printf ("\n");
}
g_object_unref (client);
return 0;
}
|