blob: 4a47811fe3fb92eeb522f6819cac20851ef4c26c [file] [log] [blame]
Richard Hughesb333e002021-04-01 10:40:02 +01001/*
2 * Copyright (C) 2021 Richard Hughes <richard@hughsie.com>
3 *
4 * SPDX-License-Identifier: LGPL-2.1+
5 */
6
7#pragma once
8
9#include <gio/gio.h>
10
Richard Hughes4d76d182021-04-06 13:35:15 +010011#include "fu-common.h"
12
Richard Hughesb333e002021-04-01 10:40:02 +010013#define FU_TYPE_CONTEXT (fu_context_get_type ())
14G_DECLARE_DERIVABLE_TYPE (FuContext, fu_context, FU, CONTEXT, GObject)
15
16struct _FuContextClass {
17 GObjectClass parent_class;
18 /* signals */
19 void (* security_changed) (FuContext *self);
20 /*< private >*/
21 gpointer padding[30];
22};
23
24typedef void (*FuContextLookupIter) (FuContext *self,
25 const gchar *key,
26 const gchar *value,
27 gpointer user_data);
28
29const gchar *fu_context_get_smbios_string (FuContext *self,
30 guint8 structure_type,
31 guint8 offset);
32guint fu_context_get_smbios_integer (FuContext *self,
33 guint8 type,
34 guint8 offset);
35GBytes *fu_context_get_smbios_data (FuContext *self,
36 guint8 structure_type);
37gboolean fu_context_has_hwid_guid (FuContext *self,
38 const gchar *guid);
39GPtrArray *fu_context_get_hwid_guids (FuContext *self);
40const gchar *fu_context_get_hwid_value (FuContext *self,
41 const gchar *key);
42gchar *fu_context_get_hwid_replace_value (FuContext *self,
43 const gchar *keys,
44 GError **error)
45 G_GNUC_WARN_UNUSED_RESULT;
46void fu_context_add_runtime_version (FuContext *self,
47 const gchar *component_id,
48 const gchar *version);
49void fu_context_add_compile_version (FuContext *self,
50 const gchar *component_id,
51 const gchar *version);
52void fu_context_add_udev_subsystem (FuContext *self,
53 const gchar *subsystem);
54const gchar *fu_context_lookup_quirk_by_id (FuContext *self,
55 const gchar *guid,
56 const gchar *key);
57gboolean fu_context_lookup_quirk_by_id_iter (FuContext *self,
58 const gchar *guid,
59 FuContextLookupIter iter_cb,
60 gpointer user_data);
61void fu_context_add_quirk_key (FuContext *self,
62 const gchar *key);
63void fu_context_security_changed (FuContext *self);
Richard Hughes4d76d182021-04-06 13:35:15 +010064
65FuBatteryState fu_context_get_battery_state (FuContext *self);
66void fu_context_set_battery_state (FuContext *self,
67 FuBatteryState battery_state);
68guint fu_context_get_battery_level (FuContext *self);
69void fu_context_set_battery_level (FuContext *self,
70 guint battery_level);
71guint fu_context_get_battery_threshold (FuContext *self);
72void fu_context_set_battery_threshold (FuContext *self,
73 guint battery_threshold);