summaryrefslogtreecommitdiff
path: root/libdevkit-power
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2008-08-10 18:02:48 +0100
committerRichard Hughes <richard@hughsie.com>2008-08-10 18:02:48 +0100
commit72a13ae91dfdaba247a8633b3df0bed30f1295a2 (patch)
treea4193b8fda24ad674a35ed5638572a20979dbd9a /libdevkit-power
parenta0be0fea1782ed7b0eb0753f67866811eb166f48 (diff)
the enums of of DkpDevice origin, not DkpSource
Diffstat (limited to 'libdevkit-power')
-rw-r--r--libdevkit-power/dkp-enum.c136
-rw-r--r--libdevkit-power/dkp-enum.h60
-rw-r--r--libdevkit-power/dkp-history-obj.c8
-rw-r--r--libdevkit-power/dkp-history-obj.h4
-rw-r--r--libdevkit-power/dkp-object.c52
-rw-r--r--libdevkit-power/dkp-object.h6
6 files changed, 133 insertions, 133 deletions
diff --git a/libdevkit-power/dkp-enum.c b/libdevkit-power/dkp-enum.c
index 26fd788..04b673a 100644
--- a/libdevkit-power/dkp-enum.c
+++ b/libdevkit-power/dkp-enum.c
@@ -25,35 +25,35 @@
#include "dkp-enum.h"
/**
- * dkp_source_type_to_text:
+ * dkp_device_type_to_text:
**/
const gchar *
-dkp_source_type_to_text (DkpSourceType type_enum)
+dkp_device_type_to_text (DkpDeviceType type_enum)
{
const gchar *type = NULL;
switch (type_enum) {
- case DKP_SOURCE_TYPE_LINE_POWER:
+ case DKP_DEVICE_TYPE_LINE_POWER:
type = "line-power";
break;
- case DKP_SOURCE_TYPE_BATTERY:
+ case DKP_DEVICE_TYPE_BATTERY:
type = "battery";
break;
- case DKP_SOURCE_TYPE_UPS:
+ case DKP_DEVICE_TYPE_UPS:
type = "ups";
break;
- case DKP_SOURCE_TYPE_MOUSE:
+ case DKP_DEVICE_TYPE_MOUSE:
type = "mouse";
break;
- case DKP_SOURCE_TYPE_KEYBOARD:
+ case DKP_DEVICE_TYPE_KEYBOARD:
type = "keyboard";
break;
- case DKP_SOURCE_TYPE_PDA:
+ case DKP_DEVICE_TYPE_PDA:
type = "pda";
break;
- case DKP_SOURCE_TYPE_PHONE:
+ case DKP_DEVICE_TYPE_PHONE:
type = "phone";
break;
- case DKP_SOURCE_TYPE_UNKNOWN:
+ case DKP_DEVICE_TYPE_UNKNOWN:
type = "unknown";
break;
default:
@@ -64,51 +64,51 @@ dkp_source_type_to_text (DkpSourceType type_enum)
}
/**
- * dkp_source_type_from_text:
+ * dkp_device_type_from_text:
**/
-DkpSourceType
-dkp_source_type_from_text (const gchar *type)
+DkpDeviceType
+dkp_device_type_from_text (const gchar *type)
{
if (type == NULL)
- return DKP_SOURCE_TYPE_UNKNOWN;
+ return DKP_DEVICE_TYPE_UNKNOWN;
if (strcmp (type, "line-power") == 0)
- return DKP_SOURCE_TYPE_LINE_POWER;
+ return DKP_DEVICE_TYPE_LINE_POWER;
if (strcmp (type, "battery") == 0)
- return DKP_SOURCE_TYPE_BATTERY;
+ return DKP_DEVICE_TYPE_BATTERY;
if (strcmp (type, "ups") == 0)
- return DKP_SOURCE_TYPE_UPS;
+ return DKP_DEVICE_TYPE_UPS;
if (strcmp (type, "mouse") == 0)
- return DKP_SOURCE_TYPE_MOUSE;
+ return DKP_DEVICE_TYPE_MOUSE;
if (strcmp (type, "keyboard") == 0)
- return DKP_SOURCE_TYPE_KEYBOARD;
+ return DKP_DEVICE_TYPE_KEYBOARD;
if (strcmp (type, "pda") == 0)
- return DKP_SOURCE_TYPE_PDA;
+ return DKP_DEVICE_TYPE_PDA;
if (strcmp (type, "phone") == 0)
- return DKP_SOURCE_TYPE_PHONE;
- return DKP_SOURCE_TYPE_UNKNOWN;
+ return DKP_DEVICE_TYPE_PHONE;
+ return DKP_DEVICE_TYPE_UNKNOWN;
}
/**
- * dkp_source_state_to_text:
+ * dkp_device_state_to_text:
**/
const gchar *
-dkp_source_state_to_text (DkpSourceState state_enum)
+dkp_device_state_to_text (DkpDeviceState state_enum)
{
const gchar *state = NULL;
switch (state_enum) {
- case DKP_SOURCE_STATE_CHARGING:
+ case DKP_DEVICE_STATE_CHARGING:
state = "charging";
break;
- case DKP_SOURCE_STATE_DISCHARGING:
+ case DKP_DEVICE_STATE_DISCHARGING:
state = "discharging";
break;
- case DKP_SOURCE_STATE_EMPTY:
+ case DKP_DEVICE_STATE_EMPTY:
state = "empty";
break;
- case DKP_SOURCE_STATE_FULLY_CHARGED:
+ case DKP_DEVICE_STATE_FULLY_CHARGED:
state = "fully-charged";
break;
- case DKP_SOURCE_STATE_UNKNOWN:
+ case DKP_DEVICE_STATE_UNKNOWN:
state = "unknown";
break;
default:
@@ -119,51 +119,51 @@ dkp_source_state_to_text (DkpSourceState state_enum)
}
/**
- * dkp_source_state_from_text:
+ * dkp_device_state_from_text:
**/
-DkpSourceState
-dkp_source_state_from_text (const gchar *state)
+DkpDeviceState
+dkp_device_state_from_text (const gchar *state)
{
if (state == NULL)
- return DKP_SOURCE_STATE_UNKNOWN;
+ return DKP_DEVICE_STATE_UNKNOWN;
if (strcmp (state, "charging") == 0)
- return DKP_SOURCE_STATE_CHARGING;
+ return DKP_DEVICE_STATE_CHARGING;
if (strcmp (state, "discharging") == 0)
- return DKP_SOURCE_STATE_DISCHARGING;
+ return DKP_DEVICE_STATE_DISCHARGING;
if (strcmp (state, "empty") == 0)
- return DKP_SOURCE_STATE_EMPTY;
+ return DKP_DEVICE_STATE_EMPTY;
if (strcmp (state, "fully-charged") == 0)
- return DKP_SOURCE_STATE_FULLY_CHARGED;
- return DKP_SOURCE_STATE_UNKNOWN;
+ return DKP_DEVICE_STATE_FULLY_CHARGED;
+ return DKP_DEVICE_STATE_UNKNOWN;
}
/**
- * dkp_source_technology_to_text:
+ * dkp_device_technology_to_text:
**/
const gchar *
-dkp_source_technology_to_text (DkpSourceTechnology technology_enum)
+dkp_device_technology_to_text (DkpDeviceTechnology technology_enum)
{
const gchar *technology = NULL;
switch (technology_enum) {
- case DKP_SOURCE_TECHNOLGY_LITHIUM_ION:
+ case DKP_DEVICE_TECHNOLGY_LITHIUM_ION:
technology = "lithium-ion";
break;
- case DKP_SOURCE_TECHNOLGY_LITHIUM_POLYMER:
+ case DKP_DEVICE_TECHNOLGY_LITHIUM_POLYMER:
technology = "lithium-polymer";
break;
- case DKP_SOURCE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE:
+ case DKP_DEVICE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE:
technology = "lithium-iron-phosphate";
break;
- case DKP_SOURCE_TECHNOLGY_LEAD_ACID:
+ case DKP_DEVICE_TECHNOLGY_LEAD_ACID:
technology = "lead-acid";
break;
- case DKP_SOURCE_TECHNOLGY_NICKEL_CADMIUM:
+ case DKP_DEVICE_TECHNOLGY_NICKEL_CADMIUM:
technology = "nickel-cadmium";
break;
- case DKP_SOURCE_TECHNOLGY_NICKEL_METAL_HYDRIDE:
+ case DKP_DEVICE_TECHNOLGY_NICKEL_METAL_HYDRIDE:
technology = "nickel-metal-hydride";
break;
- case DKP_SOURCE_TECHNOLGY_UNKNOWN:
+ case DKP_DEVICE_TECHNOLGY_UNKNOWN:
technology = "unknown";
break;
default:
@@ -174,56 +174,56 @@ dkp_source_technology_to_text (DkpSourceTechnology technology_enum)
}
/**
- * dkp_source_technology_from_text:
+ * dkp_device_technology_from_text:
**/
-DkpSourceTechnology
-dkp_source_technology_from_text (const gchar *technology)
+DkpDeviceTechnology
+dkp_device_technology_from_text (const gchar *technology)
{
if (technology == NULL)
- return DKP_SOURCE_TECHNOLGY_UNKNOWN;
+ return DKP_DEVICE_TECHNOLGY_UNKNOWN;
if (strcmp (technology, "lithium-ion") == 0)
- return DKP_SOURCE_TECHNOLGY_LITHIUM_ION;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_ION;
if (strcmp (technology, "lithium-polymer") == 0)
- return DKP_SOURCE_TECHNOLGY_LITHIUM_POLYMER;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_POLYMER;
if (strcmp (technology, "lithium-iron-phosphate") == 0)
- return DKP_SOURCE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE;
if (strcmp (technology, "lead-acid") == 0)
- return DKP_SOURCE_TECHNOLGY_LEAD_ACID;
+ return DKP_DEVICE_TECHNOLGY_LEAD_ACID;
if (strcmp (technology, "nickel-cadmium") == 0)
- return DKP_SOURCE_TECHNOLGY_NICKEL_CADMIUM;
+ return DKP_DEVICE_TECHNOLGY_NICKEL_CADMIUM;
if (strcmp (technology, "nickel-metal-hydride") == 0)
- return DKP_SOURCE_TECHNOLGY_NICKEL_METAL_HYDRIDE;
- return DKP_SOURCE_TECHNOLGY_UNKNOWN;
+ return DKP_DEVICE_TECHNOLGY_NICKEL_METAL_HYDRIDE;
+ return DKP_DEVICE_TECHNOLGY_UNKNOWN;
}
/**
- * dkp_acpi_to_source_technology:
+ * dkp_acpi_to_device_technology:
**/
-DkpSourceTechnology
-dkp_acpi_to_source_technology (const gchar *type)
+DkpDeviceTechnology
+dkp_acpi_to_device_technology (const gchar *type)
{
if (type == NULL) {
- return DKP_SOURCE_TECHNOLGY_UNKNOWN;
+ return DKP_DEVICE_TECHNOLGY_UNKNOWN;
}
/* every case combination of Li-Ion is commonly used.. */
if (strcasecmp (type, "li-ion") == 0 ||
strcasecmp (type, "lion") == 0) {
- return DKP_SOURCE_TECHNOLGY_LITHIUM_ION;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_ION;
}
if (strcasecmp (type, "pb") == 0 ||
strcasecmp (type, "pbac") == 0) {
- return DKP_SOURCE_TECHNOLGY_LEAD_ACID;
+ return DKP_DEVICE_TECHNOLGY_LEAD_ACID;
}
if (strcasecmp (type, "lip") == 0 ||
strcasecmp (type, "lipo") == 0) {
- return DKP_SOURCE_TECHNOLGY_LITHIUM_POLYMER;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_POLYMER;
}
if (strcasecmp (type, "nimh") == 0) {
- return DKP_SOURCE_TECHNOLGY_NICKEL_METAL_HYDRIDE;
+ return DKP_DEVICE_TECHNOLGY_NICKEL_METAL_HYDRIDE;
}
if (strcasecmp (type, "lifo") == 0) {
- return DKP_SOURCE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE;
+ return DKP_DEVICE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE;
}
- return DKP_SOURCE_TECHNOLGY_UNKNOWN;
+ return DKP_DEVICE_TECHNOLGY_UNKNOWN;
}
diff --git a/libdevkit-power/dkp-enum.h b/libdevkit-power/dkp-enum.h
index 6565566..f825461 100644
--- a/libdevkit-power/dkp-enum.h
+++ b/libdevkit-power/dkp-enum.h
@@ -27,41 +27,41 @@
G_BEGIN_DECLS
typedef enum {
- DKP_SOURCE_TYPE_LINE_POWER,
- DKP_SOURCE_TYPE_BATTERY,
- DKP_SOURCE_TYPE_UPS,
- DKP_SOURCE_TYPE_MOUSE,
- DKP_SOURCE_TYPE_KEYBOARD,
- DKP_SOURCE_TYPE_PDA,
- DKP_SOURCE_TYPE_PHONE,
- DKP_SOURCE_TYPE_UNKNOWN
-} DkpSourceType;
+ DKP_DEVICE_TYPE_LINE_POWER,
+ DKP_DEVICE_TYPE_BATTERY,
+ DKP_DEVICE_TYPE_UPS,
+ DKP_DEVICE_TYPE_MOUSE,
+ DKP_DEVICE_TYPE_KEYBOARD,
+ DKP_DEVICE_TYPE_PDA,
+ DKP_DEVICE_TYPE_PHONE,
+ DKP_DEVICE_TYPE_UNKNOWN
+} DkpDeviceType;
typedef enum {
- DKP_SOURCE_STATE_CHARGING,
- DKP_SOURCE_STATE_DISCHARGING,
- DKP_SOURCE_STATE_EMPTY,
- DKP_SOURCE_STATE_FULLY_CHARGED,
- DKP_SOURCE_STATE_UNKNOWN
-} DkpSourceState;
+ DKP_DEVICE_STATE_CHARGING,
+ DKP_DEVICE_STATE_DISCHARGING,
+ DKP_DEVICE_STATE_EMPTY,
+ DKP_DEVICE_STATE_FULLY_CHARGED,
+ DKP_DEVICE_STATE_UNKNOWN
+} DkpDeviceState;
typedef enum {
- DKP_SOURCE_TECHNOLGY_LITHIUM_ION,
- DKP_SOURCE_TECHNOLGY_LITHIUM_POLYMER,
- DKP_SOURCE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE,
- DKP_SOURCE_TECHNOLGY_LEAD_ACID,
- DKP_SOURCE_TECHNOLGY_NICKEL_CADMIUM,
- DKP_SOURCE_TECHNOLGY_NICKEL_METAL_HYDRIDE,
- DKP_SOURCE_TECHNOLGY_UNKNOWN
-} DkpSourceTechnology;
+ DKP_DEVICE_TECHNOLGY_LITHIUM_ION,
+ DKP_DEVICE_TECHNOLGY_LITHIUM_POLYMER,
+ DKP_DEVICE_TECHNOLGY_LITHIUM_IRON_PHOSPHATE,
+ DKP_DEVICE_TECHNOLGY_LEAD_ACID,
+ DKP_DEVICE_TECHNOLGY_NICKEL_CADMIUM,
+ DKP_DEVICE_TECHNOLGY_NICKEL_METAL_HYDRIDE,
+ DKP_DEVICE_TECHNOLGY_UNKNOWN
+} DkpDeviceTechnology;
-const gchar *dkp_source_type_to_text (DkpSourceType type_enum);
-const gchar *dkp_source_state_to_text (DkpSourceState state_enum);
-const gchar *dkp_source_technology_to_text (DkpSourceTechnology technology_enum);
-DkpSourceType dkp_source_type_from_text (const gchar *type);
-DkpSourceState dkp_source_state_from_text (const gchar *state);
-DkpSourceTechnology dkp_source_technology_from_text (const gchar *technology);
-DkpSourceTechnology dkp_acpi_to_source_technology (const char *type);
+const gchar *dkp_device_type_to_text (DkpDeviceType type_enum);
+const gchar *dkp_device_state_to_text (DkpDeviceState state_enum);
+const gchar *dkp_device_technology_to_text (DkpDeviceTechnology technology_enum);
+DkpDeviceType dkp_device_type_from_text (const gchar *type);
+DkpDeviceState dkp_device_state_from_text (const gchar *state);
+DkpDeviceTechnology dkp_device_technology_from_text (const gchar *technology);
+DkpDeviceTechnology dkp_acpi_to_device_technology (const char *type);
G_END_DECLS
diff --git a/libdevkit-power/dkp-history-obj.c b/libdevkit-power/dkp-history-obj.c
index b65d7fa..491ddaf 100644
--- a/libdevkit-power/dkp-history-obj.c
+++ b/libdevkit-power/dkp-history-obj.c
@@ -71,7 +71,7 @@ dkp_history_obj_equal (const DkpHistoryObj *obj1, const DkpHistoryObj *obj2)
gboolean
dkp_history_obj_print (const DkpHistoryObj *obj)
{
- g_print ("%i\t%.3f\t%s", obj->time, obj->value, dkp_source_state_to_text (obj->state));
+ g_print ("%i\t%.3f\t%s", obj->time, obj->value, dkp_device_state_to_text (obj->state));
return TRUE;
}
@@ -116,7 +116,7 @@ dkp_history_obj_free (DkpHistoryObj *obj)
* dkp_history_obj_create:
**/
DkpHistoryObj *
-dkp_history_obj_create (gdouble value, DkpSourceState state)
+dkp_history_obj_create (gdouble value, DkpDeviceState state)
{
DkpHistoryObj *obj;
GTimeVal timeval;
@@ -154,7 +154,7 @@ dkp_history_obj_from_string (const gchar *text)
obj = dkp_history_obj_new ();
obj->time = atoi (parts[0]);
obj->value = atof (parts[1]);
- obj->state = dkp_source_state_from_text (parts[2]);
+ obj->state = dkp_device_state_from_text (parts[2]);
out:
g_strfreev (parts);
return obj;
@@ -168,6 +168,6 @@ dkp_history_obj_to_string (const DkpHistoryObj *obj)
{
if (obj == NULL)
return NULL;
- return g_strdup_printf ("%i\t%.3f\t%s", obj->time, obj->value, dkp_source_state_to_text (obj->state));
+ return g_strdup_printf ("%i\t%.3f\t%s", obj->time, obj->value, dkp_device_state_to_text (obj->state));
}
diff --git a/libdevkit-power/dkp-history-obj.h b/libdevkit-power/dkp-history-obj.h
index ab9771e..d98abbb 100644
--- a/libdevkit-power/dkp-history-obj.h
+++ b/libdevkit-power/dkp-history-obj.h
@@ -30,7 +30,7 @@ typedef struct
{
guint time;
gdouble value;
- DkpSourceState state;
+ DkpDeviceState state;
} DkpHistoryObj;
DkpHistoryObj *dkp_history_obj_new (void);
@@ -39,7 +39,7 @@ gboolean dkp_history_obj_free (DkpHistoryObj *obj);
DkpHistoryObj *dkp_history_obj_copy (const DkpHistoryObj *cobj);
gboolean dkp_history_obj_print (const DkpHistoryObj *obj);
DkpHistoryObj *dkp_history_obj_create (gdouble value,
- DkpSourceState state);
+ DkpDeviceState state);
gboolean dkp_history_obj_equal (const DkpHistoryObj *obj1,
const DkpHistoryObj *obj2);
DkpHistoryObj *dkp_history_obj_from_string (const gchar *text);
diff --git a/libdevkit-power/dkp-object.c b/libdevkit-power/dkp-object.c
index d181e8e..4f34293 100644
--- a/libdevkit-power/dkp-object.c
+++ b/libdevkit-power/dkp-object.c
@@ -32,7 +32,7 @@
static void
dkp_object_clear_internal (DkpObject *obj)
{
- obj->type = DKP_SOURCE_TYPE_UNKNOWN;
+ obj->type = DKP_DEVICE_TYPE_UNKNOWN;
obj->update_time = 0;
obj->battery_energy = -1;
obj->battery_energy_full = -1;
@@ -42,8 +42,8 @@ dkp_object_clear_internal (DkpObject *obj)
obj->battery_capacity = -1;
obj->battery_time_to_empty = -1;
obj->battery_time_to_full = -1;
- obj->battery_state = DKP_SOURCE_STATE_UNKNOWN;
- obj->battery_technology = DKP_SOURCE_TECHNOLGY_UNKNOWN;
+ obj->battery_state = DKP_DEVICE_STATE_UNKNOWN;
+ obj->battery_technology = DKP_DEVICE_TECHNOLGY_UNKNOWN;
obj->vendor = NULL;
obj->model = NULL;
obj->serial = NULL;
@@ -73,7 +73,7 @@ dkp_object_collect_props (const char *key, const GValue *value, DkpObject *obj)
else if (strcmp (key, "update-time") == 0)
obj->update_time = g_value_get_uint64 (value);
else if (strcmp (key, "type") == 0)
- obj->type = dkp_source_type_from_text (g_value_get_string (value));
+ obj->type = dkp_device_type_from_text (g_value_get_string (value));
else if (strcmp (key, "line-power-online") == 0)
obj->line_power_online = g_value_get_boolean (value);
else if (strcmp (key, "battery-energy") == 0)
@@ -93,7 +93,7 @@ dkp_object_collect_props (const char *key, const GValue *value, DkpObject *obj)
else if (strcmp (key, "battery-percentage") == 0)
obj->battery_percentage = g_value_get_double (value);
else if (strcmp (key, "battery-technology") == 0)
- obj->battery_technology = dkp_source_technology_from_text (g_value_get_string (value));
+ obj->battery_technology = dkp_device_technology_from_text (g_value_get_string (value));
else if (strcmp (key, "battery-is-present") == 0)
obj->battery_is_present = g_value_get_boolean (value);
else if (strcmp (key, "battery-is-rechargeable") == 0)
@@ -103,7 +103,7 @@ dkp_object_collect_props (const char *key, const GValue *value, DkpObject *obj)
else if (strcmp (key, "battery-capacity") == 0)
obj->battery_capacity = g_value_get_double (value);
else if (strcmp (key, "battery-state") == 0)
- obj->battery_state = dkp_source_state_from_text (g_value_get_string (value));
+ obj->battery_state = dkp_device_state_from_text (g_value_get_string (value));
else
handled = FALSE;
@@ -284,13 +284,13 @@ dkp_object_print (const DkpObject *obj)
g_print (" serial: %s\n", obj->serial);
g_print (" power supply: %s\n", dkp_object_bool_to_text (obj->power_supply));
g_print (" updated: %s (%d seconds ago)\n", time_buf, (int) (time (NULL) - obj->update_time));
- g_print (" %s\n", dkp_source_type_to_text (obj->type));
+ g_print (" %s\n", dkp_device_type_to_text (obj->type));
- if (obj->type == DKP_SOURCE_TYPE_BATTERY) {
+ if (obj->type == DKP_DEVICE_TYPE_BATTERY) {
g_print (" battery\n");
g_print (" present: %s\n", dkp_object_bool_to_text (obj->battery_is_present));
g_print (" rechargeable: %s\n", dkp_object_bool_to_text (obj->battery_is_rechargeable));
- g_print (" state: %s\n", dkp_source_state_to_text (obj->battery_state));
+ g_print (" state: %s\n", dkp_device_state_to_text (obj->battery_state));
g_print (" energy: %g Wh\n", obj->battery_energy);
g_print (" energy-empty: %g Wh\n", obj->battery_energy_empty);
g_print (" energy-full: %g Wh\n", obj->battery_energy_full);
@@ -308,17 +308,17 @@ dkp_object_print (const DkpObject *obj)
}
g_print (" percentage: %g%%\n", obj->battery_percentage);
g_print (" capacity: %g%%\n", obj->battery_capacity);
- g_print (" technology: %s\n", dkp_source_technology_to_text (obj->battery_technology));
- } else if (obj->type == DKP_SOURCE_TYPE_LINE_POWER) {
+ g_print (" technology: %s\n", dkp_device_technology_to_text (obj->battery_technology));
+ } else if (obj->type == DKP_DEVICE_TYPE_LINE_POWER) {
g_print (" line-power\n");
g_print (" online: %s\n", dkp_object_bool_to_text (obj->line_power_online));
- } else if (obj->type == DKP_SOURCE_TYPE_MOUSE || obj->type == DKP_SOURCE_TYPE_KEYBOARD) {
+ } else if (obj->type == DKP_DEVICE_TYPE_MOUSE || obj->type == DKP_DEVICE_TYPE_KEYBOARD) {
g_print (" present: %s\n", dkp_object_bool_to_text (obj->battery_is_present));
g_print (" rechargeable: %s\n", dkp_object_bool_to_text (obj->battery_is_rechargeable));
- g_print (" state: %s\n", dkp_source_state_to_text (obj->battery_state));
+ g_print (" state: %s\n", dkp_device_state_to_text (obj->battery_state));
g_print (" percentage: %g%%\n", obj->battery_percentage);
} else {
- g_print (" unknown power source type '%s'\n", dkp_source_type_to_text (obj->type));
+ g_print (" unknown device type '%s'\n", dkp_device_type_to_text (obj->type));
ret = FALSE;
}
return ret;
@@ -342,8 +342,8 @@ dkp_object_diff (const DkpObject *old, const DkpObject *obj)
if (!dkp_strequal (obj->serial, old->serial))
g_print (" serial: %s -> %s\n", old->serial, obj->serial);
- g_print (" %s\n", dkp_source_type_to_text (obj->type));
- if (obj->type == DKP_SOURCE_TYPE_BATTERY) {
+ g_print (" %s\n", dkp_device_type_to_text (obj->type));
+ if (obj->type == DKP_DEVICE_TYPE_BATTERY) {
if (old->battery_is_present != obj->battery_is_present)
g_print (" present: %s -> %s\n",
dkp_object_bool_to_text (old->battery_is_present),
@@ -354,8 +354,8 @@ dkp_object_diff (const DkpObject *old, const DkpObject *obj)
dkp_object_bool_to_text (obj->battery_is_rechargeable));
if (old->battery_state != obj->battery_state)
g_print (" state: %s -> %s\n",
- dkp_source_state_to_text (old->battery_state),
- dkp_source_state_to_text (obj->battery_state));
+ dkp_device_state_to_text (old->battery_state),
+ dkp_device_state_to_text (obj->battery_state));
if (old->battery_energy != obj->battery_energy)
g_print (" energy: %g -> %g Wh\n",
old->battery_energy,
@@ -403,14 +403,14 @@ dkp_object_diff (const DkpObject *old, const DkpObject *obj)
obj->battery_capacity);
if (old->battery_technology != obj->battery_technology)
g_print (" technology: %s -> %s\n",
- dkp_source_technology_to_text (old->battery_technology),
- dkp_source_technology_to_text (obj->battery_technology));
- } else if (obj->type == DKP_SOURCE_TYPE_LINE_POWER) {
+ dkp_device_technology_to_text (old->battery_technology),
+ dkp_device_technology_to_text (obj->battery_technology));
+ } else if (obj->type == DKP_DEVICE_TYPE_LINE_POWER) {
if (old->line_power_online != obj->line_power_online)
g_print (" online: %s -> %s\n",
dkp_object_bool_to_text (old->line_power_online),
dkp_object_bool_to_text (obj->line_power_online));
- } else if (obj->type == DKP_SOURCE_TYPE_MOUSE || obj->type == DKP_SOURCE_TYPE_KEYBOARD) {
+ } else if (obj->type == DKP_DEVICE_TYPE_MOUSE || obj->type == DKP_DEVICE_TYPE_KEYBOARD) {
if (old->battery_is_present != obj->battery_is_present)
g_print (" present: %s -> %s\n",
dkp_object_bool_to_text (old->battery_is_present),
@@ -421,14 +421,14 @@ dkp_object_diff (const DkpObject *old, const DkpObject *obj)
dkp_object_bool_to_text (obj->battery_is_rechargeable));
if (old->battery_state != obj->battery_state)
g_print (" state: %s -> %s\n",
- dkp_source_state_to_text (old->battery_state),
- dkp_source_state_to_text (obj->battery_state));
+ dkp_device_state_to_text (old->battery_state),
+ dkp_device_state_to_text (obj->battery_state));
if (old->battery_percentage != obj->battery_percentage)
g_print (" percentage: %g%% -> %g%%\n",
old->battery_percentage,
obj->battery_percentage);
} else {
- g_print (" unknown power source type '%s'\n", dkp_source_type_to_text (obj->type));
+ g_print (" unknown device type '%s'\n", dkp_device_type_to_text (obj->type));
ret = FALSE;
}
return ret;
@@ -499,7 +499,7 @@ dkp_object_get_id (DkpObject *obj)
return id;
/* only valid for batteries */
- if (obj->type != DKP_SOURCE_TYPE_BATTERY)
+ if (obj->type != DKP_DEVICE_TYPE_BATTERY)
return id;
/* we don't have an ID if we are not present */
diff --git a/libdevkit-power/dkp-object.h b/libdevkit-power/dkp-object.h
index 372af4b..103be6e 100644
--- a/libdevkit-power/dkp-object.h
+++ b/libdevkit-power/dkp-object.h
@@ -36,9 +36,9 @@ typedef struct {
gboolean line_power_online;
gboolean battery_is_present;
gboolean battery_is_rechargeable;
- DkpSourceType type;
- DkpSourceState battery_state;
- DkpSourceTechnology battery_technology;
+ DkpDeviceType type;
+ DkpDeviceState battery_state;
+ DkpDeviceTechnology battery_technology;
gdouble battery_capacity;
gdouble battery_energy;
gdouble battery_energy_empty;