Commit 8d4ec582 authored by Richard Hughes's avatar Richard Hughes

trivial: switch to using the new enum names internally (no ABI or API break)

parent 6845dc14
......@@ -84,6 +84,36 @@ typedef DkpDeviceTechnology UpDeviceTechnology;
#define up_device_state_from_text dkp_device_state_from_text
#define up_device_technology_from_text dkp_device_technology_from_text
#define up_qos_type_from_text dkp_qos_type_from_text
#define UP_DEVICE_TYPE_UNKNOWN DKP_DEVICE_TYPE_UNKNOWN
#define UP_DEVICE_TYPE_LINE_POWER DKP_DEVICE_TYPE_LINE_POWER
#define UP_DEVICE_TYPE_BATTERY DKP_DEVICE_TYPE_BATTERY
#define UP_DEVICE_TYPE_UPS DKP_DEVICE_TYPE_UPS
#define UP_DEVICE_TYPE_MONITOR DKP_DEVICE_TYPE_MONITOR
#define UP_DEVICE_TYPE_MOUSE DKP_DEVICE_TYPE_MOUSE
#define UP_DEVICE_TYPE_KEYBOARD DKP_DEVICE_TYPE_KEYBOARD
#define UP_DEVICE_TYPE_PDA DKP_DEVICE_TYPE_PDA
#define UP_DEVICE_TYPE_PHONE DKP_DEVICE_TYPE_PHONE
#define UP_DEVICE_TYPE_LAST DKP_DEVICE_TYPE_LAST
#define UP_DEVICE_STATE_UNKNOWN DKP_DEVICE_STATE_UNKNOWN
#define UP_DEVICE_STATE_CHARGING DKP_DEVICE_STATE_CHARGING
#define UP_DEVICE_STATE_DISCHARGING DKP_DEVICE_STATE_DISCHARGING
#define UP_DEVICE_STATE_EMPTY DKP_DEVICE_STATE_EMPTY
#define UP_DEVICE_STATE_FULLY_CHARGED DKP_DEVICE_STATE_FULLY_CHARGED
#define UP_DEVICE_STATE_PENDING_CHARGE DKP_DEVICE_STATE_PENDING_CHARGE
#define UP_DEVICE_STATE_PENDING_DISCHARGE DKP_DEVICE_STATE_PENDING_DISCHARGE
#define UP_DEVICE_STATE_LAST DKP_DEVICE_STATE_LAST
#define UP_DEVICE_TECHNOLOGY_UNKNOWN DKP_DEVICE_TECHNOLOGY_UNKNOWN
#define UP_DEVICE_TECHNOLOGY_LITHIUM_ION DKP_DEVICE_TECHNOLOGY_LITHIUM_ION
#define UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER
#define UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE
#define UP_DEVICE_TECHNOLOGY_LEAD_ACID DKP_DEVICE_TECHNOLOGY_LEAD_ACID
#define UP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM DKP_DEVICE_TECHNOLOGY_NICKEL_CADMIUM
#define UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE
#define UP_DEVICE_TECHNOLOGY_LAST DKP_DEVICE_TECHNOLOGY_LAST
#define UP_QOS_TYPE_UNKNOWN DKP_QOS_TYPE_UNKNOWN
#define UP_QOS_TYPE_NETWORK DKP_QOS_TYPE_NETWORK
#define UP_QOS_TYPE_CPU_DMA DKP_QOS_TYPE_CPU_DMA
#define UP_QOS_TYPE_LAST DKP_QOS_TYPE_LAST
const gchar *dkp_device_type_to_text (DkpDeviceType type_enum);
const gchar *dkp_device_state_to_text (DkpDeviceState state_enum);
......
......@@ -166,14 +166,14 @@ up_backend_init (UpBackend *backend)
"vendor", "hughsie",
"model", "BAT1",
"serial", "0001",
"type", DKP_DEVICE_TYPE_BATTERY,
"type", UP_DEVICE_TYPE_BATTERY,
"online", FALSE,
"power-supply", TRUE,
"is-present", TRUE,
"is-rechargeable", TRUE,
"has-history", FALSE,
"has-statistics", FALSE,
"state", DKP_DEVICE_STATE_DISCHARGING,
"state", UP_DEVICE_STATE_DISCHARGING,
"energy", 0.0f,
"energy-empty", 0.0f,
"energy-full", 10.0f,
......
......@@ -68,22 +68,22 @@ static UpDeviceTechnology
up_device_supply_convert_device_technology (const gchar *type)
{
if (type == NULL)
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
if (g_ascii_strcasecmp (type, "li-ion") == 0 ||
g_ascii_strcasecmp (type, "lion") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_ION;
return UP_DEVICE_TECHNOLOGY_LITHIUM_ION;
if (g_ascii_strcasecmp (type, "pb") == 0 ||
g_ascii_strcasecmp (type, "pbac") == 0)
return DKP_DEVICE_TECHNOLOGY_LEAD_ACID;
return UP_DEVICE_TECHNOLOGY_LEAD_ACID;
if (g_ascii_strcasecmp (type, "lip") == 0 ||
g_ascii_strcasecmp (type, "lipo") == 0 ||
g_ascii_strcasecmp (type, "li-poly") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER;
return UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER;
if (g_ascii_strcasecmp (type, "nimh") == 0)
return DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE;
return UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE;
if (g_ascii_strcasecmp (type, "lifo") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE;
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
}
/**
......@@ -105,7 +105,7 @@ up_device_supply_reset_values (UpDevice *device)
"is-rechargeable", FALSE,
"has-history", FALSE,
"has-statistics", FALSE,
"state", DKP_DEVICE_STATE_UNKNOWN,
"state", UP_DEVICE_STATE_UNKNOWN,
"capacity", (gdouble) 0.0,
"energy-empty", (gdouble) 0.0,
"energy-full", (gdouble) 0.0,
......@@ -115,7 +115,7 @@ up_device_supply_reset_values (UpDevice *device)
"time-to-empty", (guint64) 0,
"time-to-full", (guint64) 0,
"percentage", (gdouble) 0.0,
"technology", DKP_DEVICE_TECHNOLOGY_UNKNOWN,
"technology", UP_DEVICE_TECHNOLOGY_UNKNOWN,
NULL);
}
......@@ -130,7 +130,7 @@ up_device_supply_acline_coldplug (UpDevice *device)
g_object_set (device,
"online", FALSE,
"power-supply", TRUE,
"type", DKP_DEVICE_TYPE_LINE_POWER,
"type", UP_DEVICE_TYPE_LINE_POWER,
NULL);
ret = up_device_supply_acline_set_properties (device);
......@@ -146,7 +146,7 @@ up_device_supply_battery_coldplug (UpDevice *device, DkpAcpiNative *native)
{
gboolean ret;
g_object_set (device, "type", DKP_DEVICE_TYPE_BATTERY, NULL);
g_object_set (device, "type", UP_DEVICE_TYPE_BATTERY, NULL);
ret = up_device_supply_battery_set_properties (device, native);
return ret;
......@@ -286,7 +286,7 @@ up_device_supply_battery_set_properties (UpDevice *device, DkpAcpiNative *native
time_to_full = 0;
if (battinfo.battinfo.state & ACPI_BATT_STAT_DISCHARG) {
state = DKP_DEVICE_STATE_DISCHARGING;
state = UP_DEVICE_STATE_DISCHARGING;
if (battinfo.battinfo.min > 0)
time_to_empty = battinfo.battinfo.min * 60;
else if (rate > 0) {
......@@ -295,7 +295,7 @@ up_device_supply_battery_set_properties (UpDevice *device, DkpAcpiNative *native
time_to_empty = 0;
}
} else if (battinfo.battinfo.state & ACPI_BATT_STAT_CHARGING) {
state = DKP_DEVICE_STATE_CHARGING;
state = UP_DEVICE_STATE_CHARGING;
if (battinfo.battinfo.min > 0)
time_to_full = battinfo.battinfo.min * 60;
else if (rate > 0) {
......@@ -304,11 +304,11 @@ up_device_supply_battery_set_properties (UpDevice *device, DkpAcpiNative *native
time_to_full = 0;
}
} else if (battinfo.battinfo.state & ACPI_BATT_STAT_CRITICAL) {
state = DKP_DEVICE_STATE_EMPTY;
state = UP_DEVICE_STATE_EMPTY;
} else if (battinfo.battinfo.state == 0) {
state = DKP_DEVICE_STATE_FULLY_CHARGED;
state = UP_DEVICE_STATE_FULLY_CHARGED;
} else {
state = DKP_DEVICE_STATE_UNKNOWN;
state = UP_DEVICE_STATE_UNKNOWN;
}
g_object_set (device,
......@@ -391,10 +391,10 @@ up_device_supply_refresh (UpDevice *device)
g_object_get (device, "type", &type, NULL);
switch (type) {
case DKP_DEVICE_TYPE_LINE_POWER:
case UP_DEVICE_TYPE_LINE_POWER:
ret = up_device_supply_acline_set_properties (device);
break;
case DKP_DEVICE_TYPE_BATTERY:
case UP_DEVICE_TYPE_BATTERY:
object = up_device_get_native (device);
ret = up_device_supply_battery_set_properties (device, DKP_ACPI_NATIVE (object));
break;
......@@ -429,14 +429,14 @@ up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
"is-present", &is_present,
NULL);
if (type != DKP_DEVICE_TYPE_BATTERY)
if (type != UP_DEVICE_TYPE_BATTERY)
return FALSE;
if (state == DKP_DEVICE_STATE_UNKNOWN)
if (state == UP_DEVICE_STATE_UNKNOWN)
return FALSE;
if (!is_present)
return FALSE;
*on_battery = (state == DKP_DEVICE_STATE_DISCHARGING);
*on_battery = (state == UP_DEVICE_STATE_DISCHARGING);
return TRUE;
}
......@@ -482,7 +482,7 @@ up_device_supply_get_online (UpDevice *device, gboolean *online)
"online", &online_tmp,
NULL);
if (type != DKP_DEVICE_TYPE_LINE_POWER)
if (type != UP_DEVICE_TYPE_LINE_POWER)
return FALSE;
*online = online_tmp;
......
......@@ -146,9 +146,9 @@ up_device_csr_coldplug (UpDevice *device)
/* which one? */
if (g_strcmp0 (type, "mouse") == 0)
g_object_set (device, "type", DKP_DEVICE_TYPE_MOUSE, NULL);
g_object_set (device, "type", UP_DEVICE_TYPE_MOUSE, NULL);
else if (g_strcmp0 (type, "keyboard") == 0)
g_object_set (device, "type", DKP_DEVICE_TYPE_KEYBOARD, NULL);
g_object_set (device, "type", UP_DEVICE_TYPE_KEYBOARD, NULL);
else {
egg_debug ("not a recognised csr device");
goto out;
......@@ -193,7 +193,7 @@ up_device_csr_coldplug (UpDevice *device)
"power-supply", FALSE,
"is-present", TRUE,
"is-rechargeable", TRUE,
"state", DKP_DEVICE_STATE_DISCHARGING,
"state", UP_DEVICE_STATE_DISCHARGING,
"has-history", TRUE,
NULL);
......
......@@ -170,11 +170,11 @@ static UpDeviceTechnology
up_device_hid_convert_device_technology (const gchar *type)
{
if (type == NULL)
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
if (g_ascii_strcasecmp (type, "pb") == 0 ||
g_ascii_strcasecmp (type, "pbac") == 0)
return DKP_DEVICE_TECHNOLOGY_LEAD_ACID;
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_LEAD_ACID;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
}
/**
......@@ -196,11 +196,11 @@ up_device_hid_set_values (UpDeviceHid *hid, int code, int value)
break;
case UP_DEVICE_HID_CHARGING:
if (value != 0)
g_object_set (device, "state", DKP_DEVICE_STATE_CHARGING, NULL);
g_object_set (device, "state", UP_DEVICE_STATE_CHARGING, NULL);
break;
case UP_DEVICE_HID_DISCHARGING:
if (value != 0)
g_object_set (device, "state", DKP_DEVICE_STATE_DISCHARGING, NULL);
g_object_set (device, "state", UP_DEVICE_STATE_DISCHARGING, NULL);
break;
case UP_DEVICE_HID_BATTERY_PRESENT:
g_object_set (device, "is-present", (value != 0), NULL);
......@@ -292,9 +292,9 @@ up_device_hid_fixup_state (UpDevice *device)
/* map states the UPS cannot express */
g_object_get (device, "percentage", &percentage, NULL);
if (percentage < 0.01)
g_object_set (device, "state", DKP_DEVICE_STATE_EMPTY, NULL);
g_object_set (device, "state", UP_DEVICE_STATE_EMPTY, NULL);
if (percentage > 99.9)
g_object_set (device, "state", DKP_DEVICE_STATE_FULLY_CHARGED, NULL);
g_object_set (device, "state", UP_DEVICE_STATE_FULLY_CHARGED, NULL);
}
/**
......@@ -347,7 +347,7 @@ up_device_hid_coldplug (UpDevice *device)
/* hardcode some values */
g_object_set (device,
"type", DKP_DEVICE_TYPE_UPS,
"type", UP_DEVICE_TYPE_UPS,
"is-rechargeable", TRUE,
"power-supply", TRUE,
"is-present", TRUE,
......
......@@ -141,14 +141,14 @@ up_device_supply_get_on_battery (UpDevice *device, gboolean *on_battery)
"is-present", &is_present,
NULL);
if (type != DKP_DEVICE_TYPE_BATTERY)
if (type != UP_DEVICE_TYPE_BATTERY)
return FALSE;
if (state == DKP_DEVICE_STATE_UNKNOWN)
if (state == UP_DEVICE_STATE_UNKNOWN)
return FALSE;
if (!is_present)
return FALSE;
*on_battery = (state == DKP_DEVICE_STATE_DISCHARGING);
*on_battery = (state == UP_DEVICE_STATE_DISCHARGING);
return TRUE;
}
......@@ -200,7 +200,7 @@ up_device_supply_get_online (UpDevice *device, gboolean *online)
"online", &online_tmp,
NULL);
if (type != DKP_DEVICE_TYPE_LINE_POWER)
if (type != UP_DEVICE_TYPE_LINE_POWER)
return FALSE;
*online = online_tmp;
......@@ -255,23 +255,23 @@ static UpDeviceTechnology
up_device_supply_convert_device_technology (const gchar *type)
{
if (type == NULL)
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
/* every case combination of Li-Ion is commonly used.. */
if (g_ascii_strcasecmp (type, "li-ion") == 0 ||
g_ascii_strcasecmp (type, "lion") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_ION;
return UP_DEVICE_TECHNOLOGY_LITHIUM_ION;
if (g_ascii_strcasecmp (type, "pb") == 0 ||
g_ascii_strcasecmp (type, "pbac") == 0)
return DKP_DEVICE_TECHNOLOGY_LEAD_ACID;
return UP_DEVICE_TECHNOLOGY_LEAD_ACID;
if (g_ascii_strcasecmp (type, "lip") == 0 ||
g_ascii_strcasecmp (type, "lipo") == 0 ||
g_ascii_strcasecmp (type, "li-poly") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER;
return UP_DEVICE_TECHNOLOGY_LITHIUM_POLYMER;
if (g_ascii_strcasecmp (type, "nimh") == 0)
return DKP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE;
return UP_DEVICE_TECHNOLOGY_NICKEL_METAL_HYDRIDE;
if (g_ascii_strcasecmp (type, "lifo") == 0)
return DKP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE;
return DKP_DEVICE_TECHNOLOGY_UNKNOWN;
return UP_DEVICE_TECHNOLOGY_LITHIUM_IRON_PHOSPHATE;
return UP_DEVICE_TECHNOLOGY_UNKNOWN;
}
/**
......@@ -512,26 +512,26 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
status = g_strstrip (sysfs_get_string (native_path, "status"));
if (g_ascii_strcasecmp (status, "charging") == 0)
state = DKP_DEVICE_STATE_CHARGING;
state = UP_DEVICE_STATE_CHARGING;
else if (g_ascii_strcasecmp (status, "discharging") == 0)
state = DKP_DEVICE_STATE_DISCHARGING;
state = UP_DEVICE_STATE_DISCHARGING;
else if (g_ascii_strcasecmp (status, "full") == 0)
state = DKP_DEVICE_STATE_FULLY_CHARGED;
state = UP_DEVICE_STATE_FULLY_CHARGED;
else if (g_ascii_strcasecmp (status, "empty") == 0)
state = DKP_DEVICE_STATE_EMPTY;
state = UP_DEVICE_STATE_EMPTY;
else if (g_ascii_strcasecmp (status, "unknown") == 0)
state = DKP_DEVICE_STATE_UNKNOWN;
state = UP_DEVICE_STATE_UNKNOWN;
else {
egg_warning ("unknown status string: %s", status);
state = DKP_DEVICE_STATE_UNKNOWN;
state = UP_DEVICE_STATE_UNKNOWN;
}
/* only disable the polling if the kernel tells us we're fully charged,
not if we've guessed the state to be fully charged */
supply->priv->enable_poll = (state != DKP_DEVICE_STATE_FULLY_CHARGED);
supply->priv->enable_poll = (state != UP_DEVICE_STATE_FULLY_CHARGED);
/* reset unknown counter */
if (state != DKP_DEVICE_STATE_UNKNOWN) {
if (state != UP_DEVICE_STATE_UNKNOWN) {
egg_debug ("resetting unknown timeout after %i retries", supply->priv->unknown_retries);
supply->priv->unknown_retries = 0;
}
......@@ -583,15 +583,15 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
}
/* some batteries stop charging much before 100% */
if (state == DKP_DEVICE_STATE_UNKNOWN &&
if (state == UP_DEVICE_STATE_UNKNOWN &&
percentage > UP_DEVICE_SUPPLY_CHARGED_THRESHOLD) {
egg_debug ("fixing up unknown %f", percentage);
state = DKP_DEVICE_STATE_FULLY_CHARGED;
state = UP_DEVICE_STATE_FULLY_CHARGED;
}
/* the battery isn't charging or discharging, it's just
* sitting there half full doing nothing: try to guess a state */
if (state == DKP_DEVICE_STATE_UNKNOWN) {
if (state == UP_DEVICE_STATE_UNKNOWN) {
/* get global battery status */
daemon = up_device_get_daemon (device);
......@@ -600,27 +600,27 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
NULL);
/* only guess when we have more than one battery devices */
battery_count = up_daemon_get_number_devices_of_type (daemon, DKP_DEVICE_TYPE_BATTERY);
battery_count = up_daemon_get_number_devices_of_type (daemon, UP_DEVICE_TYPE_BATTERY);
/* try to find a suitable icon depending on AC state */
if (battery_count > 1) {
if (on_battery && percentage < 1.0f) {
/* battery is low */
state = DKP_DEVICE_STATE_EMPTY;
state = UP_DEVICE_STATE_EMPTY;
} else if (on_battery) {
/* battery is waiting */
state = DKP_DEVICE_STATE_PENDING_DISCHARGE;
state = UP_DEVICE_STATE_PENDING_DISCHARGE;
} else {
/* battery is waiting */
state = DKP_DEVICE_STATE_PENDING_CHARGE;
state = UP_DEVICE_STATE_PENDING_CHARGE;
}
} else {
if (on_battery) {
/* battery is assumed discharging */
state = DKP_DEVICE_STATE_DISCHARGING;
state = UP_DEVICE_STATE_DISCHARGING;
} else {
/* battery is waiting */
state = DKP_DEVICE_STATE_FULLY_CHARGED;
state = UP_DEVICE_STATE_FULLY_CHARGED;
}
}
......@@ -632,9 +632,9 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
}
/* if empty, and BIOS does not know what to do */
if (state == DKP_DEVICE_STATE_UNKNOWN && energy < 0.01) {
if (state == UP_DEVICE_STATE_UNKNOWN && energy < 0.01) {
egg_warning ("Setting %s state empty as unknown and very low", native_path);
state = DKP_DEVICE_STATE_EMPTY;
state = UP_DEVICE_STATE_EMPTY;
}
/* some batteries give out massive rate values when nearly empty */
......@@ -645,9 +645,9 @@ up_device_supply_refresh_battery (UpDeviceSupply *supply)
time_to_empty = 0;
time_to_full = 0;
if (energy_rate > 0) {
if (state == DKP_DEVICE_STATE_DISCHARGING)
if (state == UP_DEVICE_STATE_DISCHARGING)
time_to_empty = 3600 * (energy / energy_rate);
else if (state == DKP_DEVICE_STATE_CHARGING)
else if (state == UP_DEVICE_STATE_CHARGING)
time_to_full = 3600 * ((energy_full - energy) / energy_rate);
/* TODO: need to factor in battery charge metrics */
}
......@@ -718,7 +718,7 @@ up_device_supply_coldplug (UpDevice *device)
GUdevDevice *native;
const gchar *native_path;
gchar *device_type = NULL;
UpDeviceType type = DKP_DEVICE_TYPE_UNKNOWN;
UpDeviceType type = UP_DEVICE_TYPE_UNKNOWN;
up_device_supply_reset_values (supply);
......@@ -734,21 +734,21 @@ up_device_supply_coldplug (UpDevice *device)
device_type = up_device_supply_get_string (native_path, "type");
if (device_type != NULL) {
if (g_ascii_strcasecmp (device_type, "mains") == 0) {
type = DKP_DEVICE_TYPE_LINE_POWER;
type = UP_DEVICE_TYPE_LINE_POWER;
} else if (g_ascii_strcasecmp (device_type, "battery") == 0) {
type = DKP_DEVICE_TYPE_BATTERY;
type = UP_DEVICE_TYPE_BATTERY;
} else {
egg_warning ("did not recognise type %s, please report", device_type);
}
}
/* if reading the device type did not work, use the previous method */
if (type == DKP_DEVICE_TYPE_UNKNOWN) {
if (type == UP_DEVICE_TYPE_UNKNOWN) {
if (sysfs_file_exists (native_path, "online")) {
type = DKP_DEVICE_TYPE_LINE_POWER;
type = UP_DEVICE_TYPE_LINE_POWER;
} else {
/* this is a good guess as UPS and CSR are not in the kernel */
type = DKP_DEVICE_TYPE_BATTERY;
type = UP_DEVICE_TYPE_BATTERY;
}
}
......@@ -778,7 +778,7 @@ up_device_supply_setup_poll (UpDevice *device)
goto out;
/* if it's unknown, poll faster than we would normally */
if (state == DKP_DEVICE_STATE_UNKNOWN &&
if (state == UP_DEVICE_STATE_UNKNOWN &&
supply->priv->unknown_retries < UP_DEVICE_SUPPLY_UNKNOWN_RETRIES) {
supply->priv->poll_timer_id =
g_timeout_add_seconds (UP_DEVICE_SUPPLY_UNKNOWN_TIMEOUT,
......@@ -816,10 +816,10 @@ up_device_supply_refresh (UpDevice *device)
g_object_get (device, "type", &type, NULL);
switch (type) {
case DKP_DEVICE_TYPE_LINE_POWER:
case UP_DEVICE_TYPE_LINE_POWER:
ret = up_device_supply_refresh_line_power (supply);
break;
case DKP_DEVICE_TYPE_BATTERY:
case UP_DEVICE_TYPE_BATTERY:
ret = up_device_supply_refresh_battery (supply);
/* Seems that we don't get change uevents from the
......
......@@ -363,7 +363,7 @@ up_device_wup_coldplug (UpDevice *device)
/* hardcode some values */
native_path = g_udev_device_get_sysfs_path (native);
g_object_set (device,
"type", DKP_DEVICE_TYPE_MONITOR,
"type", UP_DEVICE_TYPE_MONITOR,
"is-rechargeable", FALSE,
"power-supply", FALSE,
"is-present", FALSE,
......@@ -371,7 +371,7 @@ up_device_wup_coldplug (UpDevice *device)
"model", product,
"serial", g_strstrip (sysfs_get_string (native_path, "serial")),
"has-history", TRUE,
"state", DKP_DEVICE_STATE_DISCHARGING,
"state", UP_DEVICE_STATE_DISCHARGING,
NULL);
/* coldplug */
......
......@@ -455,7 +455,7 @@ up_daemon_refresh_battery_devices (UpDaemon *daemon)
g_object_get (device,
"type", &type,
NULL);
if (type == DKP_DEVICE_TYPE_BATTERY)
if (type == UP_DEVICE_TYPE_BATTERY)
up_device_refresh_internal (device);
}
g_ptr_array_unref (array);
......@@ -752,7 +752,7 @@ up_daemon_device_changed_cb (UpDevice *device, UpDaemon *daemon)
g_object_get (device,
"type", &type,
NULL);
if (type == DKP_DEVICE_TYPE_LINE_POWER) {
if (type == UP_DEVICE_TYPE_LINE_POWER) {
/* refresh now, and again in a little while */
up_daemon_refresh_battery_devices (daemon);
up_daemon_poll_battery_devices_for_a_little_bit (daemon);
......@@ -809,7 +809,7 @@ up_daemon_device_added_cb (UpBackend *backend, GObject *native, UpDevice *device
g_object_get (device,
"type", &type,
NULL);
if (type == DKP_DEVICE_TYPE_BATTERY)
if (type == UP_DEVICE_TYPE_BATTERY)
up_daemon_poll_battery_devices_for_a_little_bit (daemon);
/* emit */
......@@ -846,7 +846,7 @@ up_daemon_device_removed_cb (UpBackend *backend, GObject *native, UpDevice *devi
g_object_get (device,
"type", &type,
NULL);
if (type == DKP_DEVICE_TYPE_BATTERY)
if (type == UP_DEVICE_TYPE_BATTERY)
up_daemon_poll_battery_devices_for_a_little_bit (daemon);
/* emit */
......
......@@ -433,11 +433,11 @@ up_device_get_id (UpDevice *device)
gchar *id = NULL;
/* line power */
if (device->priv->type == DKP_DEVICE_TYPE_LINE_POWER) {
if (device->priv->type == UP_DEVICE_TYPE_LINE_POWER) {
goto out;
/* batteries */
} else if (device->priv->type == DKP_DEVICE_TYPE_BATTERY) {
} else if (device->priv->type == UP_DEVICE_TYPE_BATTERY) {
/* we don't have an ID if we are not present */
if (!device->priv->is_present)
goto out;
......@@ -1047,9 +1047,9 @@ up_device_class_init (UpDeviceClass *klass)
PROP_TYPE,
g_param_spec_uint ("type",
NULL, NULL,
DKP_DEVICE_TYPE_UNKNOWN,
DKP_DEVICE_TYPE_LAST,
DKP_DEVICE_TYPE_UNKNOWN,
UP_DEVICE_TYPE_UNKNOWN,
UP_DEVICE_TYPE_LAST,
UP_DEVICE_TYPE_UNKNOWN,
G_PARAM_READWRITE));
/**
* UpDevice:state:
......@@ -1058,9 +1058,9 @@ up_device_class_init (UpDeviceClass *klass)
PROP_STATE,
g_param_spec_uint ("state",
NULL, NULL,
DKP_DEVICE_STATE_UNKNOWN,
DKP_DEVICE_STATE_LAST,
DKP_DEVICE_STATE_UNKNOWN,
UP_DEVICE_STATE_UNKNOWN,
UP_DEVICE_STATE_LAST,
UP_DEVICE_STATE_UNKNOWN,
G_PARAM_READWRITE));
/**
* UpDevice:technology:
......@@ -1069,9 +1069,9 @@ up_device_class_init (UpDeviceClass *klass)
PROP_TECHNOLOGY,
g_param_spec_uint ("technology",
NULL, NULL,
DKP_DEVICE_TECHNOLOGY_UNKNOWN,
DKP_DEVICE_TECHNOLOGY_LAST,
DKP_DEVICE_TECHNOLOGY_UNKNOWN,
UP_DEVICE_TECHNOLOGY_UNKNOWN,
UP_DEVICE_TECHNOLOGY_LAST,
UP_DEVICE_TECHNOLOGY_UNKNOWN,
G_PARAM_READWRITE));
/**
* UpDevice:capacity:
......
......@@ -114,7 +114,7 @@ dkp_history_array_limit_resolution (GPtrArray *array, guint max_num)
guint last;
guint first;
GPtrArray *new;
UpDeviceState state = DKP_DEVICE_STATE_UNKNOWN;
UpDeviceState state = UP_DEVICE_STATE_UNKNOWN;
guint64 time_s = 0;
gdouble value = 0;
guint64 count = 0;
......@@ -317,8 +317,8 @@ dkp_history_get_profile_data (DkpHistory *history, gboolean charging)
time_s = obj->time - obj_old->time;
/* use the accuracy field as a counter for now */
if ((charging && obj->state == DKP_DEVICE_STATE_CHARGING) ||
(!charging && obj->state == DKP_DEVICE_STATE_DISCHARGING)) {
if ((charging && obj->state == UP_DEVICE_STATE_CHARGING) ||
(!charging && obj->state == UP_DEVICE_STATE_DISCHARGING)) {
stats = (DkpStatsObj *) g_ptr_array_index (data, bin);
stats->value += time_s;
stats->accuracy++;
......@@ -551,7 +551,7 @@ dkp_history_is_low_power (DkpHistory *history)
const DkpHistoryObj *obj;
/* current status is always up to date */
if (history->priv->state != DKP_DEVICE_STATE_DISCHARGING)
if (history->priv->state != UP_DEVICE_STATE_DISCHARGING)
return FALSE;
/* have we got any data? */
......@@ -561,7 +561,7 @@ dkp_history_is_low_power (DkpHistory *history)
/* get the last saved charge object */
obj = (const DkpHistoryObj *) g_ptr_array_index (history->priv->data_charge, length-1);
if (obj->state != DKP_DEVICE_STATE_DISCHARGING)
if (obj->state != UP_DEVICE_STATE_DISCHARGING)
return FALSE;
/* high enough */
......@@ -632,7 +632,7 @@ dkp_history_load_data (DkpHistory *history)
g_free (filename);
/* save a marker so we don't use incomplete percentages */
obj = dkp_history_obj_create (0, DKP_DEVICE_STATE_UNKNOWN);
obj = dkp_history_obj_create (0, UP_DEVICE_STATE_UNKNOWN);
g_ptr_array_add (history->priv->data_rate, dkp_history_obj_copy (obj));
g_ptr_array_add (history->priv->data_charge, dkp_history_obj_copy (obj));
g_ptr_array_add (history->priv->data_time_full, dkp_history_obj_copy (obj));
......@@ -691,7 +691,7 @@ dkp_history_set_charge_data (DkpHistory *history, gdouble percentage)
if (history->priv->id == NULL)
return FALSE;
if (history->priv->state == DKP_DEVICE_STATE_UNKNOWN)
if (history->priv->state == UP_DEVICE_STATE_UNKNOWN)
return FALSE;
if (history->priv->percentage_last == percentage)
return FALSE;
......@@ -719,7 +719,7 @@ dkp_history_set_rate_data (DkpHistory *history, gdouble rate)
if (history->priv->id == NULL)
return FALSE;
if (history->priv->state ==