fwupd/src/fu-engine-request.c
Richard Hughes df89cd566e Allow firmware to require specific features from front-end clients
At the moment we just blindly assume the capabilities of the front-end client
when installing firmware. We can somewhat work around by requiring a new enough
fwupd daemon version, but the client software may be older or just incomplete.

This would allow, for instance, the firmware to specify that it requries the
client to be able to show a detach image. This would not be set by a command
line tool using FwupdClient, but would be set by a GUI client that is capable
of downloading a URL and showing a PNG image.

Clients that do not register features are assumed to be dumb.
2020-06-27 15:43:57 +01:00

71 lines
1.5 KiB
C

/*
* Copyright (C) 2020 Richard Hughes <richard@hughsie.com>
*
* SPDX-License-Identifier: LGPL-2.1+
*/
#define G_LOG_DOMAIN "FuEngine"
#include "config.h"
#include "fu-engine-request.h"
struct _FuEngineRequest
{
GObject parent_instance;
FwupdFeatureFlags feature_flags;
FwupdDeviceFlags device_flags;
};
G_DEFINE_TYPE (FuEngineRequest, fu_engine_request, G_TYPE_OBJECT)
FwupdFeatureFlags
fu_engine_request_get_feature_flags (FuEngineRequest *self)
{
g_return_val_if_fail (FU_IS_ENGINE_REQUEST (self), FALSE);
return self->feature_flags;
}
void
fu_engine_request_set_feature_flags (FuEngineRequest *self,
FwupdFeatureFlags feature_flags)
{
g_return_if_fail (FU_IS_ENGINE_REQUEST (self));
self->feature_flags = feature_flags;
}
FwupdDeviceFlags
fu_engine_request_get_device_flags (FuEngineRequest *self)
{
g_return_val_if_fail (FU_IS_ENGINE_REQUEST (self), FALSE);
return self->device_flags;
}
void
fu_engine_request_set_device_flags (FuEngineRequest *self,
FwupdDeviceFlags device_flags)
{
g_return_if_fail (FU_IS_ENGINE_REQUEST (self));
self->device_flags = device_flags;
}
static void
fu_engine_request_init (FuEngineRequest *self)
{
self->device_flags = FWUPD_DEVICE_FLAG_NONE;
self->feature_flags = FWUPD_FEATURE_FLAG_NONE;
}
static void
fu_engine_request_class_init (FuEngineRequestClass *klass)
{
}
FuEngineRequest *
fu_engine_request_new (void)
{
FuEngineRequest *self;
self = g_object_new (FU_TYPE_ENGINE_REQUEST, NULL);
return FU_ENGINE_REQUEST (self);
}