2008-08-01 12:07:56 +01:00
|
|
|
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
|
2008-05-08 22:29:38 -04:00
|
|
|
*
|
2008-11-11 10:13:24 -05:00
|
|
|
* Copyright (C) 2008 David Zeuthen <davidz@redhat.com>
|
2008-08-08 13:59:30 +01:00
|
|
|
* Copyright (C) 2008 Richard Hughes <richard@hughsie.com>
|
2008-05-08 22:29:38 -04:00
|
|
|
*
|
|
|
|
|
* 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
|
|
|
|
|
*
|
|
|
|
|
*/
|
|
|
|
|
|
2010-01-18 12:49:30 +00:00
|
|
|
#ifndef __UP_DEVICE_H__
|
|
|
|
|
#define __UP_DEVICE_H__
|
2008-05-08 22:29:38 -04:00
|
|
|
|
2015-06-01 10:02:22 -07:00
|
|
|
#include <dbus/up-device-generated.h>
|
2010-01-18 12:26:55 +00:00
|
|
|
#include "up-daemon.h"
|
2008-05-08 22:29:38 -04:00
|
|
|
|
|
|
|
|
G_BEGIN_DECLS
|
|
|
|
|
|
2010-01-18 12:49:30 +00:00
|
|
|
#define UP_TYPE_DEVICE (up_device_get_type ())
|
2008-08-09 14:27:32 +01:00
|
|
|
|
2022-05-10 17:14:09 +02:00
|
|
|
G_DECLARE_DERIVABLE_TYPE (UpDevice, up_device, UP, DEVICE, UpExportedDeviceSkeleton)
|
2008-05-08 22:29:38 -04:00
|
|
|
|
2022-05-03 13:46:57 +02:00
|
|
|
typedef enum {
|
|
|
|
|
UP_REFRESH_INIT,
|
|
|
|
|
UP_REFRESH_POLL,
|
|
|
|
|
UP_REFRESH_RESUME,
|
|
|
|
|
UP_REFRESH_EVENT,
|
2022-05-12 19:09:16 +02:00
|
|
|
UP_REFRESH_LINE_POWER,
|
2022-05-03 13:46:57 +02:00
|
|
|
} UpRefreshReason;
|
|
|
|
|
|
2022-05-10 17:14:09 +02:00
|
|
|
struct _UpDeviceClass
|
2008-05-08 22:29:38 -04:00
|
|
|
{
|
2015-06-01 10:02:22 -07:00
|
|
|
UpExportedDeviceSkeletonClass parent_class;
|
2008-05-08 22:29:38 -04:00
|
|
|
|
2008-08-01 12:07:56 +01:00
|
|
|
/* vtable */
|
2010-01-18 12:49:30 +00:00
|
|
|
gboolean (*coldplug) (UpDevice *device);
|
2022-05-12 15:59:01 +02:00
|
|
|
void (*sibling_discovered) (UpDevice *device,
|
|
|
|
|
GObject *sibling);
|
2022-05-03 13:46:57 +02:00
|
|
|
gboolean (*refresh) (UpDevice *device,
|
|
|
|
|
UpRefreshReason reason);
|
2010-01-18 12:49:30 +00:00
|
|
|
const gchar *(*get_id) (UpDevice *device);
|
|
|
|
|
gboolean (*get_on_battery) (UpDevice *device,
|
2008-08-08 13:59:30 +01:00
|
|
|
gboolean *on_battery);
|
2010-01-18 12:49:30 +00:00
|
|
|
gboolean (*get_online) (UpDevice *device,
|
2009-05-26 11:51:49 +01:00
|
|
|
gboolean *online);
|
2022-05-10 17:14:09 +02:00
|
|
|
};
|
2008-05-08 22:29:38 -04:00
|
|
|
|
2010-01-18 12:49:30 +00:00
|
|
|
GType up_device_get_type (void);
|
2022-04-01 11:32:24 +02:00
|
|
|
UpDevice *up_device_new (UpDaemon *daemon,
|
2009-07-27 16:40:11 +01:00
|
|
|
GObject *native);
|
2022-04-01 11:32:24 +02:00
|
|
|
|
2010-01-18 12:49:30 +00:00
|
|
|
UpDaemon *up_device_get_daemon (UpDevice *device);
|
|
|
|
|
GObject *up_device_get_native (UpDevice *device);
|
|
|
|
|
const gchar *up_device_get_object_path (UpDevice *device);
|
|
|
|
|
gboolean up_device_get_on_battery (UpDevice *device,
|
2008-08-08 13:59:30 +01:00
|
|
|
gboolean *on_battery);
|
2010-01-18 12:49:30 +00:00
|
|
|
gboolean up_device_get_online (UpDevice *device,
|
2009-05-26 11:51:49 +01:00
|
|
|
gboolean *online);
|
2024-08-15 14:13:38 +08:00
|
|
|
const gchar *up_device_get_state_dir_override (UpDevice *device);
|
2024-08-08 15:57:46 +08:00
|
|
|
gboolean up_device_polkit_is_allowed (UpDevice *device,
|
|
|
|
|
GDBusMethodInvocation *invocation);
|
2022-05-12 15:59:01 +02:00
|
|
|
void up_device_sibling_discovered (UpDevice *device,
|
|
|
|
|
GObject *sibling);
|
2022-05-03 13:46:57 +02:00
|
|
|
gboolean up_device_refresh_internal (UpDevice *device,
|
|
|
|
|
UpRefreshReason reason);
|
2022-09-05 16:11:14 +02:00
|
|
|
void up_device_unregister (UpDevice *device);
|
2023-07-05 12:24:02 +02:00
|
|
|
gboolean up_device_register (UpDevice *device);
|
2023-07-05 12:24:49 +02:00
|
|
|
gboolean up_device_is_registered (UpDevice *device);
|
2008-08-09 14:27:32 +01:00
|
|
|
|
2008-05-08 22:29:38 -04:00
|
|
|
G_END_DECLS
|
|
|
|
|
|
2010-01-18 12:49:30 +00:00
|
|
|
#endif /* __UP_DEVICE_H__ */
|