diff options
author | Richard Hughes <richard@hughsie.com> | 2013-01-09 10:28:58 +0000 |
---|---|---|
committer | Richard Hughes <richard@hughsie.com> | 2013-01-10 12:08:46 +0000 |
commit | b1f12feb1fd4535255f04c91bef90ae11ce57311 (patch) | |
tree | 2d99025ec329b8e295a8c42c9ab15d54f28090bf /src/linux/hidpp-device.h | |
parent | b188a49a9c9a2521429552c644151ae4a3acdfc6 (diff) | |
download | upower-b1f12feb1fd4535255f04c91bef90ae11ce57311.tar.gz |
Factor out the Logitech Unifying support to support other devices
Diffstat (limited to 'src/linux/hidpp-device.h')
-rw-r--r-- | src/linux/hidpp-device.h | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/src/linux/hidpp-device.h b/src/linux/hidpp-device.h new file mode 100644 index 0000000..935cd07 --- /dev/null +++ b/src/linux/hidpp-device.h @@ -0,0 +1,94 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- + * + * Copyright (C) 2012 Julien Danjou <julien@danjou.info> + * Copyright (C) 2012 Richard Hughes <richard@hughsie.com> + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + * + */ + +#ifndef __HIDPP_DEVICE_H__ +#define __HIDPP_DEVICE_H__ + +#include <glib-object.h> + +#include "hidpp-device.h" + +G_BEGIN_DECLS + +#define HIDPP_TYPE_DEVICE (hidpp_device_get_type ()) +#define HIDPP_DEVICE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), HIDPP_TYPE_DEVICE, HidppDevice)) +#define HIDPP_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), HIDPP_TYPE_DEVICE, HidppDeviceClass)) +#define HIDPP_IS_DEVICE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), HIDPP_TYPE_DEVICE)) +#define HIDPP_IS_DEVICE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), HIDPP_TYPE_DEVICE)) +#define HIDPP_DEVICE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), HIDPP_TYPE_DEVICE, HidppDeviceClass)) + +typedef struct HidppDevicePrivate HidppDevicePrivate; + +typedef struct +{ + GObject parent; + HidppDevicePrivate *priv; +} HidppDevice; + +typedef struct +{ + GObjectClass parent_class; +} HidppDeviceClass; + +typedef enum { + HIDPP_DEVICE_KIND_KEYBOARD, + HIDPP_DEVICE_KIND_MOUSE, + HIDPP_DEVICE_KIND_TOUCHPAD, + HIDPP_DEVICE_KIND_TRACKBALL, + HIDPP_DEVICE_KIND_TABLET, + HIDPP_DEVICE_KIND_UNKNOWN +} HidppDeviceKind; + +typedef enum { + HIDPP_DEVICE_BATT_STATUS_CHARGING, + HIDPP_DEVICE_BATT_STATUS_DISCHARGING, + HIDPP_DEVICE_BATT_STATUS_CHARGED, + HIDPP_DEVICE_BATT_STATUS_UNKNOWN +} HidppDeviceBattStatus; + +typedef enum { + HIDPP_REFRESH_FLAGS_VERSION = 1, + HIDPP_REFRESH_FLAGS_KIND = 2, + HIDPP_REFRESH_FLAGS_BATTERY = 4, + HIDPP_REFRESH_FLAGS_MODEL = 8 +} HidppRefreshFlags; + +GType hidpp_device_get_type (void); +const gchar *hidpp_device_get_model (HidppDevice *device); +guint hidpp_device_get_batt_percentage (HidppDevice *device); +guint hidpp_device_get_version (HidppDevice *device); +HidppDeviceBattStatus hidpp_device_get_batt_status (HidppDevice *device); +HidppDeviceKind hidpp_device_get_kind (HidppDevice *device); +void hidpp_device_set_hidraw_device (HidppDevice *device, + const gchar *hidraw_device); +void hidpp_device_set_index (HidppDevice *device, + guint device_idx); +void hidpp_device_set_enable_debug (HidppDevice *device, + gboolean enable_debug); +gboolean hidpp_device_refresh (HidppDevice *device, + HidppRefreshFlags refresh_flags, + GError **error); +HidppDevice *hidpp_device_new (void); + +G_END_DECLS + +#endif /* __HIDPP_DEVICE_H__ */ + |