ssm: Add getter for the device

In some cases it can be useful to be able to retrieve the device. Add
the corresponding getter to do so.
This commit is contained in:
Benjamin Berg 2021-03-03 14:46:18 +01:00
parent e8a7ff1033
commit 4a700758a6
3 changed files with 18 additions and 0 deletions

View file

@ -227,6 +227,7 @@ fpi_ssm_mark_completed
fpi_ssm_mark_failed fpi_ssm_mark_failed
fpi_ssm_set_data fpi_ssm_set_data
fpi_ssm_get_data fpi_ssm_get_data
fpi_ssm_get_device
fpi_ssm_get_error fpi_ssm_get_error
fpi_ssm_dup_error fpi_ssm_dup_error
fpi_ssm_get_cur_state fpi_ssm_get_cur_state

View file

@ -181,6 +181,22 @@ fpi_ssm_get_data (FpiSsm *machine)
return machine->ssm_data; return machine->ssm_data;
} }
/**
* fpi_ssm_get_device:
* @machine: an #FpiSsm state machine
*
* Retrieve the device that the SSM is for.
*
* Returns: #FpDevice
*/
FpDevice *
fpi_ssm_get_device (FpiSsm *machine)
{
g_return_val_if_fail (machine, NULL);
return machine->dev;
}
static void static void
fpi_ssm_clear_delayed_action (FpiSsm *machine) fpi_ssm_clear_delayed_action (FpiSsm *machine)
{ {

View file

@ -93,6 +93,7 @@ void fpi_ssm_set_data (FpiSsm *machine,
gpointer ssm_data, gpointer ssm_data,
GDestroyNotify ssm_data_destroy); GDestroyNotify ssm_data_destroy);
gpointer fpi_ssm_get_data (FpiSsm *machine); gpointer fpi_ssm_get_data (FpiSsm *machine);
FpDevice * fpi_ssm_get_device (FpiSsm *machine);
GError * fpi_ssm_get_error (FpiSsm *machine); GError * fpi_ssm_get_error (FpiSsm *machine);
GError * fpi_ssm_dup_error (FpiSsm *machine); GError * fpi_ssm_dup_error (FpiSsm *machine);
int fpi_ssm_get_cur_state (FpiSsm *machine); int fpi_ssm_get_cur_state (FpiSsm *machine);