/* plugin.c generated by valac 0.16.1, the Vala compiler
 * generated from plugin.vala, do not modify */

/*
 * Copyright (C) 2009-2012 Michael 'Mickey' Lauer <mlauer@vanille-media.de>
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.

 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.

 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301  USA
 *
 */

#include <glib.h>
#include <glib-object.h>
#include <fsobasics.h>
#include <freesmartphone.h>
#include <stdlib.h>
#include <string.h>
#include <fsoframework.h>
#include <gio/gio.h>


#define KERNEL26_TYPE_POWER_SUPPLY (kernel26_power_supply_get_type ())
#define KERNEL26_POWER_SUPPLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KERNEL26_TYPE_POWER_SUPPLY, Kernel26PowerSupply))
#define KERNEL26_POWER_SUPPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KERNEL26_TYPE_POWER_SUPPLY, Kernel26PowerSupplyClass))
#define KERNEL26_IS_POWER_SUPPLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KERNEL26_TYPE_POWER_SUPPLY))
#define KERNEL26_IS_POWER_SUPPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KERNEL26_TYPE_POWER_SUPPLY))
#define KERNEL26_POWER_SUPPLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KERNEL26_TYPE_POWER_SUPPLY, Kernel26PowerSupplyClass))

typedef struct _Kernel26PowerSupply Kernel26PowerSupply;
typedef struct _Kernel26PowerSupplyClass Kernel26PowerSupplyClass;
typedef struct _Kernel26PowerSupplyPrivate Kernel26PowerSupplyPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY (kernel26_aggregate_power_supply_get_type ())
#define KERNEL26_AGGREGATE_POWER_SUPPLY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY, Kernel26AggregatePowerSupply))
#define KERNEL26_AGGREGATE_POWER_SUPPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY, Kernel26AggregatePowerSupplyClass))
#define KERNEL26_IS_AGGREGATE_POWER_SUPPLY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY))
#define KERNEL26_IS_AGGREGATE_POWER_SUPPLY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY))
#define KERNEL26_AGGREGATE_POWER_SUPPLY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY, Kernel26AggregatePowerSupplyClass))

typedef struct _Kernel26AggregatePowerSupply Kernel26AggregatePowerSupply;
typedef struct _Kernel26AggregatePowerSupplyClass Kernel26AggregatePowerSupplyClass;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_dir_close0(var) ((var == NULL) ? NULL : (var = (g_dir_close (var), NULL)))
typedef struct _Kernel26PowerSupplyGetInfoData Kernel26PowerSupplyGetInfoData;
typedef struct _Kernel26PowerSupplyGetPowerStatusData Kernel26PowerSupplyGetPowerStatusData;
typedef struct _Kernel26PowerSupplyGetCapacityData Kernel26PowerSupplyGetCapacityData;
typedef struct _Kernel26AggregatePowerSupplyPrivate Kernel26AggregatePowerSupplyPrivate;
typedef struct _Kernel26AggregatePowerSupplyGetNameData Kernel26AggregatePowerSupplyGetNameData;
typedef struct _Kernel26AggregatePowerSupplyGetInfoData Kernel26AggregatePowerSupplyGetInfoData;
typedef struct _Kernel26AggregatePowerSupplyGetPowerStatusData Kernel26AggregatePowerSupplyGetPowerStatusData;
typedef struct _Kernel26AggregatePowerSupplyGetCapacityData Kernel26AggregatePowerSupplyGetCapacityData;

struct _Kernel26PowerSupply {
	FsoFrameworkAbstractObject parent_instance;
	Kernel26PowerSupplyPrivate * priv;
	gchar* name;
	gchar* typ;
	FreeSmartphoneDevicePowerStatus status;
	gboolean present;
};

struct _Kernel26PowerSupplyClass {
	FsoFrameworkAbstractObjectClass parent_class;
};

struct _Kernel26PowerSupplyPrivate {
	FsoFrameworkSubsystem* subsystem;
	gchar* sysfsnode;
};

struct _Kernel26PowerSupplyGetInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26PowerSupply* self;
	GHashTable* result;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* res;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	GVariant* _tmp5_;
	const gchar* _tmp6_;
	GDir* _tmp7_;
	GDir* dir;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* entry;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* filename;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* contents;
	const gchar* _tmp17_;
	const gchar* _tmp18_;
	gchar* _tmp19_;
	const gchar* _tmp20_;
	GVariant* _tmp21_;
	const gchar* _tmp22_;
	gchar* _tmp23_;
	GError * _inner_error_;
};

struct _Kernel26PowerSupplyGetPowerStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26PowerSupply* self;
	FreeSmartphoneDevicePowerStatus result;
	FreeSmartphoneDevicePowerStatus _tmp0_;
};

struct _Kernel26PowerSupplyGetCapacityData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26PowerSupply* self;
	gint result;
	gint _tmp0_;
};

struct _Kernel26AggregatePowerSupply {
	FsoFrameworkAbstractObject parent_instance;
	Kernel26AggregatePowerSupplyPrivate * priv;
};

struct _Kernel26AggregatePowerSupplyClass {
	FsoFrameworkAbstractObjectClass parent_class;
};

struct _Kernel26AggregatePowerSupplyPrivate {
	FsoFrameworkSubsystem* subsystem;
	gchar* sysfsnode;
	FreeSmartphoneDevicePowerStatus status;
	gint energy;
	gchar** supported_chargers;
	gint supported_chargers_length1;
	gint _supported_chargers_size_;
};

struct _Kernel26AggregatePowerSupplyGetNameData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26AggregatePowerSupply* self;
	gchar* result;
	const gchar* _tmp0_;
	gchar* _tmp1_;
};

struct _Kernel26AggregatePowerSupplyGetInfoData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26AggregatePowerSupply* self;
	GHashTable* result;
	GHashFunc _tmp0_;
	GEqualFunc _tmp1_;
	GHashTable* _tmp2_;
	GHashTable* res;
	gchar* _tmp3_;
	GVariant* _tmp4_;
};

struct _Kernel26AggregatePowerSupplyGetPowerStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26AggregatePowerSupply* self;
	FreeSmartphoneDevicePowerStatus result;
	FreeSmartphoneDevicePowerStatus _tmp0_;
};

struct _Kernel26AggregatePowerSupplyGetCapacityData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Kernel26AggregatePowerSupply* self;
	gint result;
	gint _tmp0_;
};


static gpointer kernel26_power_supply_parent_class = NULL;
static guint kernel26_power_supply_counter;
static guint kernel26_power_supply_counter = 0U;
extern Kernel26AggregatePowerSupply* aggregate;
static FreeSmartphoneDevicePowerSupplyIface* kernel26_power_supply_free_smartphone_device_power_supply_parent_iface = NULL;
static FreeSmartphoneInfoIface* kernel26_power_supply_free_smartphone_info_parent_iface = NULL;
static GType kernel26_power_supply_type_id = 0;
static gpointer kernel26_aggregate_power_supply_parent_class = NULL;
extern GList* instances;
static FreeSmartphoneDevicePowerSupplyIface* kernel26_aggregate_power_supply_free_smartphone_device_power_supply_parent_iface = NULL;
static GType kernel26_aggregate_power_supply_type_id = 0;
extern gchar* sysfs_root;
gchar* sysfs_root = NULL;
extern gchar* sys_class_powersupplies;
gchar* sys_class_powersupplies = NULL;
GList* instances = NULL;
Kernel26AggregatePowerSupply* aggregate = NULL;

GType kernel26_power_supply_get_type (void) G_GNUC_CONST;
GType kernel26_power_supply_register_type (GTypeModule * module);
#define KERNEL26_POWER_SUPPLY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), KERNEL26_TYPE_POWER_SUPPLY, Kernel26PowerSupplyPrivate))
enum  {
	KERNEL26_POWER_SUPPLY_DUMMY_PROPERTY
};
Kernel26PowerSupply* kernel26_power_supply_new (FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode);
Kernel26PowerSupply* kernel26_power_supply_construct (GType object_type, FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode);
gboolean kernel26_power_supply_onIdle (Kernel26PowerSupply* self);
static gboolean _kernel26_power_supply_onIdle_gsource_func (gpointer self);
static gchar* kernel26_power_supply_real_repr (FsoFrameworkAbstractObject* base);
static void _g_free0_ (gpointer var);
GType kernel26_aggregate_power_supply_get_type (void) G_GNUC_CONST;
GType kernel26_aggregate_power_supply_register_type (GTypeModule * module);
void kernel26_aggregate_power_supply_onPowerSupplyChangeNotification (Kernel26AggregatePowerSupply* self, GHashTable* properties);
gboolean kernel26_power_supply_isBattery (Kernel26PowerSupply* self);
gboolean kernel26_power_supply_isPresent (Kernel26PowerSupply* self);
gint kernel26_power_supply_getCapacity (Kernel26PowerSupply* self);
static void kernel26_power_supply_real_get_info_data_free (gpointer _data);
static void kernel26_power_supply_real_get_info (FreeSmartphoneInfo* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean kernel26_power_supply_real_get_info_co (Kernel26PowerSupplyGetInfoData* _data_);
static void _g_variant_unref0_ (gpointer var);
static GVariant* _variant_new1 (const gchar* value);
static GVariant* _variant_new2 (const gchar* value);
static void kernel26_power_supply_real_get_power_status_data_free (gpointer _data);
static void kernel26_power_supply_real_get_power_status (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean kernel26_power_supply_real_get_power_status_co (Kernel26PowerSupplyGetPowerStatusData* _data_);
static void kernel26_power_supply_real_get_capacity_data_free (gpointer _data);
static void kernel26_power_supply_real_get_capacity (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean kernel26_power_supply_real_get_capacity_co (Kernel26PowerSupplyGetCapacityData* _data_);
static void kernel26_power_supply_finalize (GObject* obj);
#define KERNEL26_AGGREGATE_POWER_SUPPLY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY, Kernel26AggregatePowerSupplyPrivate))
enum  {
	KERNEL26_AGGREGATE_POWER_SUPPLY_DUMMY_PROPERTY
};
#define KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_CHECK_INTERVAL ((guint) (5 * 60))
#define KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_CRITICAL ((guint) 7)
#define KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_EMPTY ((guint) 3)
Kernel26AggregatePowerSupply* kernel26_aggregate_power_supply_new (FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode);
Kernel26AggregatePowerSupply* kernel26_aggregate_power_supply_construct (GType object_type, FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode);
static void _kernel26_aggregate_power_supply_onPowerSupplyChangeNotification_fso_framework_kobject_notifier_func (GHashTable* properties, gpointer self);
gboolean kernel26_aggregate_power_supply_onIdle (Kernel26AggregatePowerSupply* self);
static gboolean _kernel26_aggregate_power_supply_onIdle_gsource_func (gpointer self);
static gchar* kernel26_aggregate_power_supply_real_repr (FsoFrameworkAbstractObject* base);
gboolean kernel26_aggregate_power_supply_onTimeout (Kernel26AggregatePowerSupply* self);
static gboolean _kernel26_aggregate_power_supply_onTimeout_gsource_func (gpointer self);
gint kernel26_aggregate_power_supply_getCapacity (Kernel26AggregatePowerSupply* self);
void kernel26_aggregate_power_supply_sendCapacityIfChanged (Kernel26AggregatePowerSupply* self, gint energy);
void kernel26_aggregate_power_supply_sendStatusIfChanged (Kernel26AggregatePowerSupply* self, FreeSmartphoneDevicePowerStatus status);
void kernel26_aggregate_power_supply_computeNewStatus (Kernel26AggregatePowerSupply* self);
const gchar* free_smartphone_device_power_status_to_string (FreeSmartphoneDevicePowerStatus self);
static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle);
static void _vala_array_add1 (Kernel26PowerSupply*** array, int* length, int* size, Kernel26PowerSupply* value);
static void kernel26_aggregate_power_supply_get_name_data_free (gpointer _data);
void kernel26_aggregate_power_supply_get_name (Kernel26AggregatePowerSupply* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar* kernel26_aggregate_power_supply_get_name_finish (Kernel26AggregatePowerSupply* self, GAsyncResult* _res_, GError** error);
static gboolean kernel26_aggregate_power_supply_get_name_co (Kernel26AggregatePowerSupplyGetNameData* _data_);
static void kernel26_aggregate_power_supply_get_info_data_free (gpointer _data);
void kernel26_aggregate_power_supply_get_info (Kernel26AggregatePowerSupply* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
GHashTable* kernel26_aggregate_power_supply_get_info_finish (Kernel26AggregatePowerSupply* self, GAsyncResult* _res_, GError** error);
static gboolean kernel26_aggregate_power_supply_get_info_co (Kernel26AggregatePowerSupplyGetInfoData* _data_);
static GVariant* _variant_new3 (const gchar* value);
static void kernel26_aggregate_power_supply_real_get_power_status_data_free (gpointer _data);
static void kernel26_aggregate_power_supply_real_get_power_status (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean kernel26_aggregate_power_supply_real_get_power_status_co (Kernel26AggregatePowerSupplyGetPowerStatusData* _data_);
static void kernel26_aggregate_power_supply_real_get_capacity_data_free (gpointer _data);
static void kernel26_aggregate_power_supply_real_get_capacity (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean kernel26_aggregate_power_supply_real_get_capacity_co (Kernel26AggregatePowerSupplyGetCapacityData* _data_);
static void kernel26_aggregate_power_supply_finalize (GObject* obj);
gchar* fso_factory_function (FsoFrameworkSubsystem* subsystem, GError** error);
void fso_register_function (GTypeModule* module);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static gboolean _kernel26_power_supply_onIdle_gsource_func (gpointer self) {
	gboolean result;
	result = kernel26_power_supply_onIdle (self);
	return result;
}


Kernel26PowerSupply* kernel26_power_supply_construct (GType object_type, FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode) {
	Kernel26PowerSupply * self = NULL;
	FsoFrameworkSubsystem* _tmp0_;
	FsoFrameworkSubsystem* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gboolean _tmp9_ = FALSE;
	gboolean _tmp10_;
	const gchar* _tmp12_;
	gchar* _tmp13_ = NULL;
	gchar* _tmp14_;
	gchar* _tmp15_ = NULL;
	gchar* _tmp16_;
	gchar* _tmp17_ = NULL;
	FsoFrameworkSubsystem* _tmp18_;
	guint _tmp19_;
	gchar* _tmp20_ = NULL;
	gchar* _tmp21_;
	FsoFrameworkSubsystem* _tmp22_;
	guint _tmp23_;
	gchar* _tmp24_ = NULL;
	gchar* _tmp25_;
	FsoFrameworkLogger* _tmp26_;
	g_return_val_if_fail (subsystem != NULL, NULL);
	g_return_val_if_fail (sysfsnode != NULL, NULL);
	self = (Kernel26PowerSupply*) fso_framework_abstract_object_construct (object_type);
	_tmp0_ = subsystem;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->subsystem);
	self->priv->subsystem = _tmp1_;
	_tmp2_ = sysfsnode;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->sysfsnode);
	self->priv->sysfsnode = _tmp3_;
	_tmp4_ = sysfsnode;
	_tmp5_ = g_path_get_basename (_tmp4_);
	_g_free0 (self->name);
	self->name = _tmp5_;
	_tmp6_ = sysfsnode;
	_tmp7_ = g_strdup_printf ("%s/type", _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = fso_framework_file_handling_isPresent (_tmp8_);
	_tmp10_ = !_tmp9_;
	_g_free0 (_tmp8_);
	if (_tmp10_) {
		FsoFrameworkLogger* _tmp11_;
		_tmp11_ = ((FsoFrameworkAbstractObject*) self)->logger;
		fso_framework_logger_error (_tmp11_, "^^^ sysfs class is damaged; skipping.");
		return self;
	}
	_tmp12_ = sysfsnode;
	_tmp13_ = g_strdup_printf ("%s/type", _tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = fso_framework_file_handling_read (_tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = g_utf8_strdown (_tmp16_, (gssize) (-1));
	_g_free0 (self->typ);
	self->typ = _tmp17_;
	_g_free0 (_tmp16_);
	_g_free0 (_tmp14_);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _kernel26_power_supply_onIdle_gsource_func, g_object_ref (self), g_object_unref);
	_tmp18_ = subsystem;
	_tmp19_ = kernel26_power_supply_counter;
	_tmp20_ = g_strdup_printf ("%s/%u", FSO_FRAMEWORK_DEVICE_PowerSupplyServicePath, _tmp19_);
	_tmp21_ = _tmp20_;
	fso_framework_subsystem_registerObjectForService (_tmp18_, FREE_SMARTPHONE_DEVICE_TYPE_POWER_SUPPLY, (GBoxedCopyFunc) g_object_ref, g_object_unref, FSO_FRAMEWORK_DEVICE_ServiceDBusName, _tmp21_, (FreeSmartphoneDevicePowerSupply*) self);
	_g_free0 (_tmp21_);
	_tmp22_ = subsystem;
	_tmp23_ = kernel26_power_supply_counter;
	kernel26_power_supply_counter = _tmp23_ + 1;
	_tmp24_ = g_strdup_printf ("%s/%u", FSO_FRAMEWORK_DEVICE_PowerSupplyServicePath, _tmp23_);
	_tmp25_ = _tmp24_;
	fso_framework_subsystem_registerObjectForService (_tmp22_, FREE_SMARTPHONE_TYPE_INFO, (GBoxedCopyFunc) g_object_ref, g_object_unref, FSO_FRAMEWORK_DEVICE_ServiceDBusName, _tmp25_, (FreeSmartphoneInfo*) self);
	_g_free0 (_tmp25_);
	_tmp26_ = ((FsoFrameworkAbstractObject*) self)->logger;
	fso_framework_logger_info (_tmp26_, "Created");
	return self;
}


Kernel26PowerSupply* kernel26_power_supply_new (FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode) {
	return kernel26_power_supply_construct (KERNEL26_TYPE_POWER_SUPPLY, subsystem, sysfsnode);
}


static const gchar* string_to_string (const gchar* self) {
	const gchar* result = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}


static gchar* kernel26_power_supply_real_repr (FsoFrameworkAbstractObject* base) {
	Kernel26PowerSupply * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	self = (Kernel26PowerSupply*) base;
	_tmp0_ = self->priv->sysfsnode;
	_tmp1_ = string_to_string (_tmp0_);
	_tmp2_ = g_strconcat ("<", _tmp1_, ">", NULL);
	result = _tmp2_;
	return result;
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


gboolean kernel26_power_supply_onIdle (Kernel26PowerSupply* self) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gboolean _tmp1_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->sysfsnode;
	_tmp1_ = g_str_has_prefix (_tmp0_, "/sys");
	if (_tmp1_) {
		FsoFrameworkLogger* _tmp2_;
		gboolean _tmp3_ = FALSE;
		const gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_;
		_tmp2_ = ((FsoFrameworkAbstractObject*) self)->logger;
		_tmp3_ = fso_framework_logger_debug (_tmp2_, "Triggering initial coldplug change notification");
		g_assert (_tmp3_);
		_tmp4_ = self->priv->sysfsnode;
		_tmp5_ = g_strdup_printf ("%s/uevent", _tmp4_);
		_tmp6_ = _tmp5_;
		fso_framework_file_handling_write ("change", _tmp6_, FALSE);
		_g_free0 (_tmp6_);
	} else {
		FsoFrameworkLogger* _tmp7_;
		gboolean _tmp8_ = FALSE;
		const gchar* _tmp9_;
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_;
		gchar* _tmp12_ = NULL;
		gchar* _tmp13_;
		gchar* uevent;
		const gchar* _tmp14_;
		gchar** _tmp15_;
		gchar** _tmp16_ = NULL;
		gchar** parts;
		gint parts_length1;
		gint _parts_size_;
		GHashFunc _tmp17_;
		GEqualFunc _tmp18_;
		GHashTable* _tmp19_;
		GHashTable* properties;
		gchar** _tmp20_;
		gint _tmp20__length1;
		Kernel26AggregatePowerSupply* _tmp33_;
		GHashTable* _tmp34_;
		_tmp7_ = ((FsoFrameworkAbstractObject*) self)->logger;
		_tmp8_ = fso_framework_logger_debug (_tmp7_, "Synthesizing initial coldplug change notification");
		g_assert (_tmp8_);
		_tmp9_ = self->priv->sysfsnode;
		_tmp10_ = g_strdup_printf ("%s/uevent", _tmp9_);
		_tmp11_ = _tmp10_;
		_tmp12_ = fso_framework_file_handling_read (_tmp11_);
		_tmp13_ = _tmp12_;
		_g_free0 (_tmp11_);
		uevent = _tmp13_;
		_tmp14_ = uevent;
		_tmp16_ = _tmp15_ = g_strsplit (_tmp14_, "\n", 0);
		parts = _tmp16_;
		parts_length1 = _vala_array_length (_tmp15_);
		_parts_size_ = parts_length1;
		_tmp17_ = g_str_hash;
		_tmp18_ = g_str_equal;
		_tmp19_ = g_hash_table_new_full (_tmp17_, _tmp18_, _g_free0_, _g_free0_);
		properties = _tmp19_;
		_tmp20_ = parts;
		_tmp20__length1 = parts_length1;
		{
			gchar** part_collection = NULL;
			gint part_collection_length1 = 0;
			gint _part_collection_size_ = 0;
			gint part_it = 0;
			part_collection = _tmp20_;
			part_collection_length1 = _tmp20__length1;
			for (part_it = 0; part_it < _tmp20__length1; part_it = part_it + 1) {
				gchar* _tmp21_;
				gchar* part = NULL;
				_tmp21_ = g_strdup (part_collection[part_it]);
				part = _tmp21_;
				{
					const gchar* _tmp22_;
					gchar** _tmp23_;
					gchar** _tmp24_ = NULL;
					gchar** elements;
					gint elements_length1;
					gint _elements_size_;
					gchar** _tmp25_;
					gint _tmp25__length1;
					_tmp22_ = part;
					_tmp24_ = _tmp23_ = g_strsplit (_tmp22_, "=", 0);
					elements = _tmp24_;
					elements_length1 = _vala_array_length (_tmp23_);
					_elements_size_ = elements_length1;
					_tmp25_ = elements;
					_tmp25__length1 = elements_length1;
					if (_tmp25__length1 == 2) {
						GHashTable* _tmp26_;
						gchar** _tmp27_;
						gint _tmp27__length1;
						const gchar* _tmp28_;
						gchar* _tmp29_;
						gchar** _tmp30_;
						gint _tmp30__length1;
						const gchar* _tmp31_;
						gchar* _tmp32_;
						_tmp26_ = properties;
						_tmp27_ = elements;
						_tmp27__length1 = elements_length1;
						_tmp28_ = _tmp27_[0];
						_tmp29_ = g_strdup (_tmp28_);
						_tmp30_ = elements;
						_tmp30__length1 = elements_length1;
						_tmp31_ = _tmp30_[1];
						_tmp32_ = g_strdup (_tmp31_);
						g_hash_table_insert (_tmp26_, _tmp29_, _tmp32_);
					}
					elements = (_vala_array_free (elements, elements_length1, (GDestroyNotify) g_free), NULL);
					_g_free0 (part);
				}
			}
		}
		_tmp33_ = aggregate;
		_tmp34_ = properties;
		kernel26_aggregate_power_supply_onPowerSupplyChangeNotification (_tmp33_, _tmp34_);
		_g_hash_table_unref0 (properties);
		parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
		_g_free0 (uevent);
	}
	result = FALSE;
	return result;
}


gboolean kernel26_power_supply_isBattery (Kernel26PowerSupply* self) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->typ;
	result = g_strcmp0 (_tmp0_, "battery") == 0;
	return result;
}


gboolean kernel26_power_supply_isPresent (Kernel26PowerSupply* self) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* node;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar* _tmp8_ = NULL;
	gchar* _tmp9_;
	gchar* value;
	gboolean _tmp10_ = FALSE;
	const gchar* _tmp11_;
	gboolean _tmp13_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = kernel26_power_supply_isBattery (self);
	if (_tmp1_) {
		_tmp0_ = "%s/present";
	} else {
		_tmp0_ = "%s/online";
	}
	_tmp2_ = _tmp0_;
	_tmp3_ = g_strdup (_tmp2_);
	node = _tmp3_;
	_tmp4_ = node;
	_tmp5_ = self->priv->sysfsnode;
	_tmp6_ = g_strdup_printf (_tmp4_, _tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = fso_framework_file_handling_read (_tmp7_);
	_tmp9_ = _tmp8_;
	_g_free0 (_tmp7_);
	value = _tmp9_;
	_tmp11_ = value;
	if (_tmp11_ != NULL) {
		const gchar* _tmp12_;
		_tmp12_ = value;
		_tmp10_ = g_strcmp0 (_tmp12_, "1") == 0;
	} else {
		_tmp10_ = FALSE;
	}
	_tmp13_ = _tmp10_;
	result = _tmp13_;
	_g_free0 (value);
	_g_free0 (node);
	return result;
}


gint kernel26_power_supply_getCapacity (Kernel26PowerSupply* self) {
	gint result = 0;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	const gchar* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	gchar* _tmp6_;
	gchar* value;
	const gchar* _tmp7_;
	const gchar* _tmp10_;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_;
	gchar* _tmp13_ = NULL;
	gchar* _tmp14_;
	gchar* energy_full;
	const gchar* _tmp15_;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_;
	gchar* _tmp18_ = NULL;
	gchar* _tmp19_;
	gchar* energy_now;
	gboolean _tmp20_ = FALSE;
	const gchar* _tmp21_;
	gboolean _tmp23_;
	const gchar* _tmp28_;
	gchar* _tmp29_ = NULL;
	gchar* _tmp30_;
	gchar* _tmp31_ = NULL;
	gchar* _tmp32_;
	gchar* charge_full;
	const gchar* _tmp33_;
	gchar* _tmp34_ = NULL;
	gchar* _tmp35_;
	gchar* _tmp36_ = NULL;
	gchar* _tmp37_;
	gchar* charge_now;
	gboolean _tmp38_ = FALSE;
	const gchar* _tmp39_;
	gboolean _tmp41_;
	g_return_val_if_fail (self != NULL, 0);
	_tmp0_ = kernel26_power_supply_isBattery (self);
	if (!_tmp0_) {
		result = -1;
		return result;
	}
	_tmp1_ = kernel26_power_supply_isPresent (self);
	if (!_tmp1_) {
		result = -1;
		return result;
	}
	_tmp2_ = self->priv->sysfsnode;
	_tmp3_ = g_strdup_printf ("%s/capacity", _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = fso_framework_file_handling_readIfPresent (_tmp4_);
	_tmp6_ = _tmp5_;
	_g_free0 (_tmp4_);
	value = _tmp6_;
	_tmp7_ = value;
	if (g_strcmp0 (_tmp7_, "") != 0) {
		const gchar* _tmp8_;
		gint _tmp9_ = 0;
		_tmp8_ = value;
		_tmp9_ = atoi (_tmp8_);
		result = _tmp9_;
		_g_free0 (value);
		return result;
	}
	_tmp10_ = self->priv->sysfsnode;
	_tmp11_ = g_strdup_printf ("%s/energy_full", _tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = fso_framework_file_handling_readIfPresent (_tmp12_);
	_tmp14_ = _tmp13_;
	_g_free0 (_tmp12_);
	energy_full = _tmp14_;
	_tmp15_ = self->priv->sysfsnode;
	_tmp16_ = g_strdup_printf ("%s/energy_now", _tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = fso_framework_file_handling_readIfPresent (_tmp17_);
	_tmp19_ = _tmp18_;
	_g_free0 (_tmp17_);
	energy_now = _tmp19_;
	_tmp21_ = energy_full;
	if (g_strcmp0 (_tmp21_, "") != 0) {
		const gchar* _tmp22_;
		_tmp22_ = energy_now;
		_tmp20_ = g_strcmp0 (_tmp22_, "") != 0;
	} else {
		_tmp20_ = FALSE;
	}
	_tmp23_ = _tmp20_;
	if (_tmp23_) {
		const gchar* _tmp24_;
		gdouble _tmp25_ = 0.0;
		const gchar* _tmp26_;
		gdouble _tmp27_ = 0.0;
		_tmp24_ = energy_now;
		_tmp25_ = g_ascii_strtod (_tmp24_, NULL);
		_tmp26_ = energy_full;
		_tmp27_ = g_ascii_strtod (_tmp26_, NULL);
		result = (gint) ((_tmp25_ / _tmp27_) * 100.0);
		_g_free0 (energy_now);
		_g_free0 (energy_full);
		_g_free0 (value);
		return result;
	}
	_tmp28_ = self->priv->sysfsnode;
	_tmp29_ = g_strdup_printf ("%s/charge_full", _tmp28_);
	_tmp30_ = _tmp29_;
	_tmp31_ = fso_framework_file_handling_readIfPresent (_tmp30_);
	_tmp32_ = _tmp31_;
	_g_free0 (_tmp30_);
	charge_full = _tmp32_;
	_tmp33_ = self->priv->sysfsnode;
	_tmp34_ = g_strdup_printf ("%s/charge_now", _tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = fso_framework_file_handling_readIfPresent (_tmp35_);
	_tmp37_ = _tmp36_;
	_g_free0 (_tmp35_);
	charge_now = _tmp37_;
	_tmp39_ = charge_full;
	if (g_strcmp0 (_tmp39_, "") != 0) {
		const gchar* _tmp40_;
		_tmp40_ = charge_now;
		_tmp38_ = g_strcmp0 (_tmp40_, "") != 0;
	} else {
		_tmp38_ = FALSE;
	}
	_tmp41_ = _tmp38_;
	if (_tmp41_) {
		const gchar* _tmp42_;
		gdouble _tmp43_ = 0.0;
		const gchar* _tmp44_;
		gdouble _tmp45_ = 0.0;
		_tmp42_ = charge_now;
		_tmp43_ = g_ascii_strtod (_tmp42_, NULL);
		_tmp44_ = charge_full;
		_tmp45_ = g_ascii_strtod (_tmp44_, NULL);
		result = (gint) ((_tmp43_ / _tmp45_) * 100.0);
		_g_free0 (charge_now);
		_g_free0 (charge_full);
		_g_free0 (energy_now);
		_g_free0 (energy_full);
		_g_free0 (value);
		return result;
	}
	result = -1;
	_g_free0 (charge_now);
	_g_free0 (charge_full);
	_g_free0 (energy_now);
	_g_free0 (energy_full);
	_g_free0 (value);
	return result;
}


static void kernel26_power_supply_real_get_info_data_free (gpointer _data) {
	Kernel26PowerSupplyGetInfoData* _data_;
	_data_ = _data;
	_g_hash_table_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26PowerSupplyGetInfoData, _data_);
}


static void kernel26_power_supply_real_get_info (FreeSmartphoneInfo* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26PowerSupply * self;
	Kernel26PowerSupplyGetInfoData* _data_;
	Kernel26PowerSupply* _tmp0_;
	self = (Kernel26PowerSupply*) base;
	_data_ = g_slice_new0 (Kernel26PowerSupplyGetInfoData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_power_supply_real_get_info);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_power_supply_real_get_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_power_supply_real_get_info_co (_data_);
}


static GHashTable* kernel26_power_supply_real_get_info_finish (FreeSmartphoneInfo* base, GAsyncResult* _res_, GError** error) {
	GHashTable* result;
	Kernel26PowerSupplyGetInfoData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _g_variant_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
}


static GVariant* _variant_new1 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static GVariant* _variant_new2 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static gboolean kernel26_power_supply_real_get_info_co (Kernel26PowerSupplyGetInfoData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, _g_variant_unref0_);
	_data_->res = _data_->_tmp2_;
	_data_->_tmp3_ = g_strdup ("name");
	_data_->_tmp4_ = _data_->self->name;
	_data_->_tmp5_ = _variant_new1 (_data_->_tmp4_);
	g_hash_table_insert (_data_->res, _data_->_tmp3_, _data_->_tmp5_);
	_data_->_tmp6_ = _data_->self->priv->sysfsnode;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = g_dir_open (_data_->_tmp6_, (guint) 0, &_data_->_inner_error_);
	_data_->dir = _data_->_tmp7_;
	if (_data_->_inner_error_ != NULL) {
		if ((_data_->_inner_error_->domain == G_DBUS_ERROR) || (_data_->_inner_error_->domain == G_IO_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_hash_table_unref0 (_data_->res);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_hash_table_unref0 (_data_->res);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = g_dir_read_name (_data_->dir);
	_data_->_tmp9_ = g_strdup (_data_->_tmp8_);
	_data_->entry = _data_->_tmp9_;
	while (TRUE) {
		_data_->_tmp10_ = _data_->entry;
		if (!(_data_->_tmp10_ != NULL)) {
			break;
		}
		_data_->_tmp11_ = _data_->entry;
		if (g_strcmp0 (_data_->_tmp11_, "uevent") != 0) {
			_data_->_tmp12_ = _data_->self->priv->sysfsnode;
			_data_->_tmp13_ = _data_->entry;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = g_build_filename (_data_->_tmp12_, _data_->_tmp13_, NULL);
			_data_->filename = _data_->_tmp14_;
			_data_->_tmp15_ = _data_->filename;
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = fso_framework_file_handling_read (_data_->_tmp15_);
			_data_->contents = _data_->_tmp16_;
			_data_->_tmp17_ = _data_->contents;
			if (g_strcmp0 (_data_->_tmp17_, "") != 0) {
				_data_->_tmp18_ = _data_->entry;
				_data_->_tmp19_ = g_strdup (_data_->_tmp18_);
				_data_->_tmp20_ = _data_->contents;
				_data_->_tmp21_ = _variant_new2 (_data_->_tmp20_);
				g_hash_table_insert (_data_->res, _data_->_tmp19_, _data_->_tmp21_);
			}
			_g_free0 (_data_->contents);
			_g_free0 (_data_->filename);
		}
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = g_dir_read_name (_data_->dir);
		_data_->_tmp23_ = g_strdup (_data_->_tmp22_);
		_g_free0 (_data_->entry);
		_data_->entry = _data_->_tmp23_;
	}
	_data_->result = _data_->res;
	_g_free0 (_data_->entry);
	_g_dir_close0 (_data_->dir);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_free0 (_data_->entry);
	_g_dir_close0 (_data_->dir);
	_g_hash_table_unref0 (_data_->res);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_power_supply_real_get_power_status_data_free (gpointer _data) {
	Kernel26PowerSupplyGetPowerStatusData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26PowerSupplyGetPowerStatusData, _data_);
}


static void kernel26_power_supply_real_get_power_status (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26PowerSupply * self;
	Kernel26PowerSupplyGetPowerStatusData* _data_;
	Kernel26PowerSupply* _tmp0_;
	self = (Kernel26PowerSupply*) base;
	_data_ = g_slice_new0 (Kernel26PowerSupplyGetPowerStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_power_supply_real_get_power_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_power_supply_real_get_power_status_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_power_supply_real_get_power_status_co (_data_);
}


static FreeSmartphoneDevicePowerStatus kernel26_power_supply_real_get_power_status_finish (FreeSmartphoneDevicePowerSupply* base, GAsyncResult* _res_, GError** error) {
	FreeSmartphoneDevicePowerStatus result;
	Kernel26PowerSupplyGetPowerStatusData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gboolean kernel26_power_supply_real_get_power_status_co (Kernel26PowerSupplyGetPowerStatusData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->status;
	_data_->result = _data_->_tmp0_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_power_supply_real_get_capacity_data_free (gpointer _data) {
	Kernel26PowerSupplyGetCapacityData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26PowerSupplyGetCapacityData, _data_);
}


static void kernel26_power_supply_real_get_capacity (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26PowerSupply * self;
	Kernel26PowerSupplyGetCapacityData* _data_;
	Kernel26PowerSupply* _tmp0_;
	self = (Kernel26PowerSupply*) base;
	_data_ = g_slice_new0 (Kernel26PowerSupplyGetCapacityData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_power_supply_real_get_capacity);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_power_supply_real_get_capacity_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_power_supply_real_get_capacity_co (_data_);
}


static gint kernel26_power_supply_real_get_capacity_finish (FreeSmartphoneDevicePowerSupply* base, GAsyncResult* _res_, GError** error) {
	gint result;
	Kernel26PowerSupplyGetCapacityData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gboolean kernel26_power_supply_real_get_capacity_co (Kernel26PowerSupplyGetCapacityData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = kernel26_power_supply_getCapacity (_data_->self);
	_data_->result = _data_->_tmp0_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_power_supply_class_init (Kernel26PowerSupplyClass * klass) {
	kernel26_power_supply_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (Kernel26PowerSupplyPrivate));
	FSO_FRAMEWORK_ABSTRACT_OBJECT_CLASS (klass)->repr = kernel26_power_supply_real_repr;
	G_OBJECT_CLASS (klass)->finalize = kernel26_power_supply_finalize;
}


static void kernel26_power_supply_free_smartphone_device_power_supply_interface_init (FreeSmartphoneDevicePowerSupplyIface * iface) {
	kernel26_power_supply_free_smartphone_device_power_supply_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_power_status = (FreeSmartphoneDevicePowerStatus (*)(FreeSmartphoneDevicePowerSupply*, GError**)) kernel26_power_supply_real_get_power_status;
	iface->get_power_status_finish = kernel26_power_supply_real_get_power_status_finish;
	iface->get_capacity = (gint (*)(FreeSmartphoneDevicePowerSupply*, GError**)) kernel26_power_supply_real_get_capacity;
	iface->get_capacity_finish = kernel26_power_supply_real_get_capacity_finish;
}


static void kernel26_power_supply_free_smartphone_info_interface_init (FreeSmartphoneInfoIface * iface) {
	kernel26_power_supply_free_smartphone_info_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_info = (GHashTable* (*)(FreeSmartphoneInfo*, GError**)) kernel26_power_supply_real_get_info;
	iface->get_info_finish = kernel26_power_supply_real_get_info_finish;
}


static void kernel26_power_supply_instance_init (Kernel26PowerSupply * self) {
	self->priv = KERNEL26_POWER_SUPPLY_GET_PRIVATE (self);
	self->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_UNKNOWN;
}


static void kernel26_power_supply_finalize (GObject* obj) {
	Kernel26PowerSupply * self;
	self = KERNEL26_POWER_SUPPLY (obj);
	_g_object_unref0 (self->priv->subsystem);
	_g_free0 (self->priv->sysfsnode);
	_g_free0 (self->name);
	_g_free0 (self->typ);
	G_OBJECT_CLASS (kernel26_power_supply_parent_class)->finalize (obj);
}


/**
 * Implementation of org.freesmartphone.Device.PowerSupply for the Kernel26 Power-Class Device
 **/
GType kernel26_power_supply_get_type (void) {
	return kernel26_power_supply_type_id;
}


GType kernel26_power_supply_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (Kernel26PowerSupplyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kernel26_power_supply_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Kernel26PowerSupply), 0, (GInstanceInitFunc) kernel26_power_supply_instance_init, NULL };
	static const GInterfaceInfo free_smartphone_device_power_supply_info = { (GInterfaceInitFunc) kernel26_power_supply_free_smartphone_device_power_supply_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo free_smartphone_info_info = { (GInterfaceInitFunc) kernel26_power_supply_free_smartphone_info_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	kernel26_power_supply_type_id = g_type_module_register_type (module, FSO_FRAMEWORK_TYPE_ABSTRACT_OBJECT, "Kernel26PowerSupply", &g_define_type_info, 0);
	g_type_module_add_interface (module, kernel26_power_supply_type_id, FREE_SMARTPHONE_DEVICE_TYPE_POWER_SUPPLY, &free_smartphone_device_power_supply_info);
	g_type_module_add_interface (module, kernel26_power_supply_type_id, FREE_SMARTPHONE_TYPE_INFO, &free_smartphone_info_info);
	return kernel26_power_supply_type_id;
}


static void _kernel26_aggregate_power_supply_onPowerSupplyChangeNotification_fso_framework_kobject_notifier_func (GHashTable* properties, gpointer self) {
	kernel26_aggregate_power_supply_onPowerSupplyChangeNotification (self, properties);
}


static gboolean _kernel26_aggregate_power_supply_onIdle_gsource_func (gpointer self) {
	gboolean result;
	result = kernel26_aggregate_power_supply_onIdle (self);
	return result;
}


Kernel26AggregatePowerSupply* kernel26_aggregate_power_supply_construct (GType object_type, FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode) {
	Kernel26AggregatePowerSupply * self = NULL;
	FsoFrameworkSubsystem* _tmp0_;
	FsoFrameworkSubsystem* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	FsoFrameworkSubsystem* _tmp4_;
	GList* _tmp5_;
	guint _tmp6_ = 0U;
	FsoFrameworkLogger* _tmp7_;
	g_return_val_if_fail (subsystem != NULL, NULL);
	g_return_val_if_fail (sysfsnode != NULL, NULL);
	self = (Kernel26AggregatePowerSupply*) fso_framework_abstract_object_construct (object_type);
	_tmp0_ = subsystem;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->subsystem);
	self->priv->subsystem = _tmp1_;
	_tmp2_ = sysfsnode;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->sysfsnode);
	self->priv->sysfsnode = _tmp3_;
	_tmp4_ = subsystem;
	fso_framework_subsystem_registerObjectForService (_tmp4_, FREE_SMARTPHONE_DEVICE_TYPE_POWER_SUPPLY, (GBoxedCopyFunc) g_object_ref, g_object_unref, FSO_FRAMEWORK_DEVICE_ServiceDBusName, FSO_FRAMEWORK_DEVICE_PowerSupplyServicePath, (FreeSmartphoneDevicePowerSupply*) self);
	fso_framework_base_kobject_notifier_addMatch ("change", "power_supply", _kernel26_aggregate_power_supply_onPowerSupplyChangeNotification_fso_framework_kobject_notifier_func, self);
	_tmp5_ = instances;
	_tmp6_ = g_list_length (_tmp5_);
	if (_tmp6_ > ((guint) 0)) {
		g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _kernel26_aggregate_power_supply_onIdle_gsource_func, g_object_ref (self), g_object_unref);
	}
	_tmp7_ = ((FsoFrameworkAbstractObject*) self)->logger;
	fso_framework_logger_info (_tmp7_, "Created");
	return self;
}


Kernel26AggregatePowerSupply* kernel26_aggregate_power_supply_new (FsoFrameworkSubsystem* subsystem, const gchar* sysfsnode) {
	return kernel26_aggregate_power_supply_construct (KERNEL26_TYPE_AGGREGATE_POWER_SUPPLY, subsystem, sysfsnode);
}


static gchar* kernel26_aggregate_power_supply_real_repr (FsoFrameworkAbstractObject* base) {
	Kernel26AggregatePowerSupply * self;
	gchar* result = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	self = (Kernel26AggregatePowerSupply*) base;
	_tmp0_ = self->priv->sysfsnode;
	_tmp1_ = string_to_string (_tmp0_);
	_tmp2_ = g_strconcat ("<", _tmp1_, ">", NULL);
	result = _tmp2_;
	return result;
}


static gboolean _kernel26_aggregate_power_supply_onTimeout_gsource_func (gpointer self) {
	gboolean result;
	result = kernel26_aggregate_power_supply_onTimeout (self);
	return result;
}


gboolean kernel26_aggregate_power_supply_onIdle (Kernel26AggregatePowerSupply* self) {
	gboolean result = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	kernel26_aggregate_power_supply_onTimeout (self);
	g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_CHECK_INTERVAL, _kernel26_aggregate_power_supply_onTimeout_gsource_func, g_object_ref (self), g_object_unref);
	result = FALSE;
	return result;
}


gboolean kernel26_aggregate_power_supply_onTimeout (Kernel26AggregatePowerSupply* self) {
	gboolean result = FALSE;
	gint _tmp0_ = 0;
	gint capacity;
	gint _tmp1_;
	FreeSmartphoneDevicePowerStatus _tmp2_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = kernel26_aggregate_power_supply_getCapacity (self);
	capacity = _tmp0_;
	_tmp1_ = capacity;
	kernel26_aggregate_power_supply_sendCapacityIfChanged (self, _tmp1_);
	_tmp2_ = self->priv->status;
	if (_tmp2_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_DISCHARGING) {
		gint _tmp3_;
		_tmp3_ = capacity;
		if (((guint) _tmp3_) <= KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_EMPTY) {
			kernel26_aggregate_power_supply_sendStatusIfChanged (self, FREE_SMARTPHONE_DEVICE_POWER_STATUS_EMPTY);
		} else {
			gint _tmp4_;
			_tmp4_ = capacity;
			if (((guint) _tmp4_) <= KERNEL26_AGGREGATE_POWER_SUPPLY_POWER_SUPPLY_CAPACITY_CRITICAL) {
				kernel26_aggregate_power_supply_sendStatusIfChanged (self, FREE_SMARTPHONE_DEVICE_POWER_STATUS_CRITICAL);
			}
		}
	}
	result = TRUE;
	return result;
}


void kernel26_aggregate_power_supply_onPowerSupplyChangeNotification (Kernel26AggregatePowerSupply* self, GHashTable* properties) {
	GHashTable* _tmp0_;
	gconstpointer _tmp1_ = NULL;
	gchar* _tmp2_;
	gchar* name;
	const gchar* _tmp3_;
	GHashTable* _tmp5_;
	gconstpointer _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar* technology;
	GHashTable* _tmp8_;
	gconstpointer _tmp9_ = NULL;
	gchar* _tmp10_;
	gchar* typ;
	const gchar* _tmp11_;
	gchar* _tmp18_;
	gchar* status;
	gboolean present;
	const gchar* _tmp19_;
	gchar* _tmp20_ = NULL;
	gchar* _tmp21_;
	gboolean _tmp22_;
	const gchar* _tmp55_;
	FsoFrameworkLogger* _tmp56_;
	const gchar* _tmp57_;
	const gchar* _tmp58_ = NULL;
	const gchar* _tmp59_;
	const gchar* _tmp60_ = NULL;
	gchar* _tmp61_ = NULL;
	gchar* _tmp62_;
	GList* _tmp63_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (properties != NULL);
	_tmp0_ = properties;
	_tmp1_ = g_hash_table_lookup (_tmp0_, "POWER_SUPPLY_NAME");
	_tmp2_ = g_strdup ((const gchar*) _tmp1_);
	name = _tmp2_;
	_tmp3_ = name;
	if (_tmp3_ == NULL) {
		FsoFrameworkLogger* _tmp4_;
		_tmp4_ = ((FsoFrameworkAbstractObject*) self)->logger;
		fso_framework_logger_warning (_tmp4_, "POWER_SUPPLY_NAME not present, ignoring power supply change notificati" \
"on");
		_g_free0 (name);
		return;
	}
	_tmp5_ = properties;
	_tmp6_ = g_hash_table_lookup (_tmp5_, "POWER_SUPPLY_TECHNOLOGY");
	_tmp7_ = g_strdup ((const gchar*) _tmp6_);
	technology = _tmp7_;
	_tmp8_ = properties;
	_tmp9_ = g_hash_table_lookup (_tmp8_, "POWER_SUPPLY_TYPE");
	_tmp10_ = g_strdup ((const gchar*) _tmp9_);
	typ = _tmp10_;
	_tmp11_ = typ;
	if (_tmp11_ == NULL) {
		FsoFrameworkLogger* _tmp12_;
		const gchar* _tmp13_;
		_tmp12_ = ((FsoFrameworkAbstractObject*) self)->logger;
		fso_framework_logger_warning (_tmp12_, "POWER_SUPPLY_TYPE not present, checking for POWER_SUPPLY_TECHNOLOGY...");
		_tmp13_ = technology;
		if (_tmp13_ != NULL) {
			FsoFrameworkLogger* _tmp14_;
			gchar* _tmp15_;
			_tmp14_ = ((FsoFrameworkAbstractObject*) self)->logger;
			fso_framework_logger_warning (_tmp14_, "Present; treating it like a battery");
			_tmp15_ = g_strdup ("battery");
			_g_free0 (typ);
			typ = _tmp15_;
		} else {
			FsoFrameworkLogger* _tmp16_;
			gchar* _tmp17_;
			_tmp16_ = ((FsoFrameworkAbstractObject*) self)->logger;
			fso_framework_logger_warning (_tmp16_, "Not present; treating it like an AC adapter");
			_tmp17_ = g_strdup ("ac");
			_g_free0 (typ);
			typ = _tmp17_;
		}
	}
	_tmp18_ = g_strdup ("unknown");
	status = _tmp18_;
	present = FALSE;
	_tmp19_ = typ;
	_tmp20_ = g_utf8_strdown (_tmp19_, (gssize) (-1));
	_tmp21_ = _tmp20_;
	_tmp22_ = g_strcmp0 (_tmp21_, "battery") != 0;
	_g_free0 (_tmp21_);
	if (_tmp22_) {
		GHashTable* _tmp23_;
		gconstpointer _tmp24_ = NULL;
		gchar* _tmp25_;
		gchar* online;
		const gchar* _tmp26_;
		const gchar* _tmp28_;
		gchar* _tmp29_ = NULL;
		gchar* _tmp30_;
		const gchar* _tmp31_ = NULL;
		gboolean _tmp32_;
		const gchar* _tmp33_;
		gchar* _tmp34_;
		_tmp23_ = properties;
		_tmp24_ = g_hash_table_lookup (_tmp23_, "POWER_SUPPLY_ONLINE");
		_tmp25_ = g_strdup ((const gchar*) _tmp24_);
		online = _tmp25_;
		_tmp26_ = online;
		if (_tmp26_ == NULL) {
			FsoFrameworkLogger* _tmp27_;
			_tmp27_ = ((FsoFrameworkAbstractObject*) self)->logger;
			fso_framework_logger_warning (_tmp27_, "POWER_SUPPLY_ONLY not present, ignoring power supply change notificati" \
"on");
			_g_free0 (online);
			_g_free0 (status);
			_g_free0 (typ);
			_g_free0 (technology);
			_g_free0 (name);
			return;
		}
		_tmp28_ = online;
		_tmp29_ = g_utf8_strdown (_tmp28_, (gssize) (-1));
		_tmp30_ = _tmp29_;
		present = g_strcmp0 (_tmp30_, "1") == 0;
		_g_free0 (_tmp30_);
		_tmp32_ = present;
		if (_tmp32_) {
			_tmp31_ = "online";
		} else {
			_tmp31_ = "offline";
		}
		_tmp33_ = _tmp31_;
		_tmp34_ = g_strdup (_tmp33_);
		_g_free0 (status);
		status = _tmp34_;
		_g_free0 (online);
	} else {
		GHashTable* _tmp35_;
		gconstpointer _tmp36_ = NULL;
		gchar* _tmp37_;
		gchar* pres;
		const gchar* _tmp38_;
		GHashTable* _tmp40_;
		gconstpointer _tmp41_ = NULL;
		gchar* _tmp42_;
		gchar* stat;
		const gchar* _tmp43_;
		const gchar* _tmp46_;
		gchar* _tmp47_ = NULL;
		gchar* _tmp48_;
		const gchar* _tmp49_;
		gchar* _tmp50_ = NULL;
		gboolean _tmp51_;
		_tmp35_ = properties;
		_tmp36_ = g_hash_table_lookup (_tmp35_, "POWER_SUPPLY_PRESENT");
		_tmp37_ = g_strdup ((const gchar*) _tmp36_);
		pres = _tmp37_;
		_tmp38_ = pres;
		if (_tmp38_ == NULL) {
			FsoFrameworkLogger* _tmp39_;
			_tmp39_ = ((FsoFrameworkAbstractObject*) self)->logger;
			fso_framework_logger_warning (_tmp39_, "POWER_SUPPLY_PRESENT not present, ignoring power supply change notific" \
"ation");
			_g_free0 (pres);
			_g_free0 (status);
			_g_free0 (typ);
			_g_free0 (technology);
			_g_free0 (name);
			return;
		}
		_tmp40_ = properties;
		_tmp41_ = g_hash_table_lookup (_tmp40_, "POWER_SUPPLY_STATUS");
		_tmp42_ = g_strdup ((const gchar*) _tmp41_);
		stat = _tmp42_;
		_tmp43_ = stat;
		if (_tmp43_ == NULL) {
			FsoFrameworkLogger* _tmp44_;
			gchar* _tmp45_;
			_tmp44_ = ((FsoFrameworkAbstractObject*) self)->logger;
			fso_framework_logger_warning (_tmp44_, "POWER_SUPPLY_STATUS not present, battery might have been removed");
			_tmp45_ = g_strdup ("unknown");
			_g_free0 (stat);
			stat = _tmp45_;
		}
		_tmp46_ = pres;
		_tmp47_ = g_utf8_strdown (_tmp46_, (gssize) (-1));
		_tmp48_ = _tmp47_;
		present = g_strcmp0 (_tmp48_, "1") == 0;
		_g_free0 (_tmp48_);
		_tmp49_ = stat;
		_tmp50_ = g_utf8_strdown (_tmp49_, (gssize) (-1));
		_g_free0 (status);
		status = _tmp50_;
		_tmp51_ = present;
		if (!_tmp51_) {
			gchar* _tmp52_;
			_tmp52_ = g_strdup ("removed");
			_g_free0 (status);
			status = _tmp52_;
		} else {
			const gchar* _tmp53_;
			_tmp53_ = status;
			if (g_strcmp0 (_tmp53_, "not charging") == 0) {
				gchar* _tmp54_;
				_tmp54_ = g_strdup ("full");
				_g_free0 (status);
				status = _tmp54_;
			}
		}
		_g_free0 (stat);
		_g_free0 (pres);
	}
	_tmp55_ = status;
	g_assert (_tmp55_ != NULL);
	_tmp56_ = ((FsoFrameworkAbstractObject*) self)->logger;
	_tmp57_ = name;
	_tmp58_ = string_to_string (_tmp57_);
	_tmp59_ = status;
	_tmp60_ = string_to_string (_tmp59_);
	_tmp61_ = g_strconcat ("Got power status change notification for ", _tmp58_, ": ", _tmp60_, NULL);
	_tmp62_ = _tmp61_;
	fso_framework_logger_info (_tmp56_, _tmp62_);
	_g_free0 (_tmp62_);
	_tmp63_ = instances;
	{
		GList* supply_collection = NULL;
		GList* supply_it = NULL;
		supply_collection = _tmp63_;
		for (supply_it = supply_collection; supply_it != NULL; supply_it = supply_it->next) {
			Kernel26PowerSupply* _tmp64_;
			Kernel26PowerSupply* supply = NULL;
			_tmp64_ = _g_object_ref0 ((Kernel26PowerSupply*) supply_it->data);
			supply = _tmp64_;
			{
				Kernel26PowerSupply* _tmp65_;
				const gchar* _tmp66_;
				const gchar* _tmp67_;
				_tmp65_ = supply;
				_tmp66_ = _tmp65_->name;
				_tmp67_ = name;
				if (g_strcmp0 (_tmp66_, _tmp67_) == 0) {
					Kernel26PowerSupply* _tmp68_;
					gboolean _tmp69_;
					const gchar* _tmp70_;
					const gchar* _tmp71_;
					GQuark _tmp73_ = 0U;
					static GQuark _tmp72_label0 = 0;
					static GQuark _tmp72_label1 = 0;
					static GQuark _tmp72_label2 = 0;
					static GQuark _tmp72_label3 = 0;
					static GQuark _tmp72_label4 = 0;
					static GQuark _tmp72_label5 = 0;
					static GQuark _tmp72_label6 = 0;
					static GQuark _tmp72_label7 = 0;
					_tmp68_ = supply;
					_tmp69_ = present;
					_tmp68_->present = _tmp69_;
					_tmp70_ = status;
					_tmp71_ = _tmp70_;
					_tmp73_ = (NULL == _tmp71_) ? 0 : g_quark_from_string (_tmp71_);
					if (_tmp73_ == ((0 != _tmp72_label0) ? _tmp72_label0 : (_tmp72_label0 = g_quark_from_static_string ("unknown")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp74_;
								_tmp74_ = supply;
								_tmp74_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_UNKNOWN;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label1) ? _tmp72_label1 : (_tmp72_label1 = g_quark_from_static_string ("error")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp75_;
								_tmp75_ = supply;
								_tmp75_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_UNKNOWN;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label2) ? _tmp72_label2 : (_tmp72_label2 = g_quark_from_static_string ("online")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp76_;
								_tmp76_ = supply;
								_tmp76_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_ONLINE;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label3) ? _tmp72_label3 : (_tmp72_label3 = g_quark_from_static_string ("offline")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp77_;
								_tmp77_ = supply;
								_tmp77_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_OFFLINE;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label4) ? _tmp72_label4 : (_tmp72_label4 = g_quark_from_static_string ("removed")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp78_;
								_tmp78_ = supply;
								_tmp78_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_REMOVED;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label5) ? _tmp72_label5 : (_tmp72_label5 = g_quark_from_static_string ("charging")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp79_;
								_tmp79_ = supply;
								_tmp79_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_CHARGING;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label6) ? _tmp72_label6 : (_tmp72_label6 = g_quark_from_static_string ("discharging")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp80_;
								_tmp80_ = supply;
								_tmp80_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_DISCHARGING;
								break;
							}
						}
					} else if (_tmp73_ == ((0 != _tmp72_label7) ? _tmp72_label7 : (_tmp72_label7 = g_quark_from_static_string ("full")))) {
						switch (0) {
							default:
							{
								Kernel26PowerSupply* _tmp81_;
								_tmp81_ = supply;
								_tmp81_->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_FULL;
								break;
							}
						}
					} else {
						switch (0) {
							default:
							{
								FsoFrameworkLogger* _tmp82_;
								_tmp82_ = ((FsoFrameworkAbstractObject*) self)->logger;
								fso_framework_logger_error (_tmp82_, "Received unexpected power status");
								break;
							}
						}
					}
				}
				_g_object_unref0 (supply);
			}
		}
	}
	kernel26_aggregate_power_supply_computeNewStatus (self);
	_g_free0 (status);
	_g_free0 (typ);
	_g_free0 (technology);
	_g_free0 (name);
}


static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) {
	int i;
	for (i = 0; i < stack_length; i++) {
		if (g_strcmp0 (stack[i], needle) == 0) {
			return TRUE;
		}
	}
	return FALSE;
}


static void _vala_array_add1 (Kernel26PowerSupply*** array, int* length, int* size, Kernel26PowerSupply* value) {
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (Kernel26PowerSupply*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


void kernel26_aggregate_power_supply_computeNewStatus (Kernel26AggregatePowerSupply* self) {
	gboolean statusForAll;
	Kernel26PowerSupply* battery;
	Kernel26PowerSupply** _tmp0_ = NULL;
	Kernel26PowerSupply** chargers;
	gint chargers_length1;
	gint _chargers_size_;
	GList* _tmp1_;
	gboolean _tmp37_;
	Kernel26PowerSupply** _tmp40_;
	gint _tmp40__length1;
	gboolean _tmp45_ = FALSE;
	Kernel26PowerSupply* _tmp46_;
	gboolean _tmp49_;
	g_return_if_fail (self != NULL);
	statusForAll = TRUE;
	battery = NULL;
	_tmp0_ = g_new0 (Kernel26PowerSupply*, 0 + 1);
	chargers = _tmp0_;
	chargers_length1 = 0;
	_chargers_size_ = chargers_length1;
	_tmp1_ = instances;
	{
		GList* supply_collection = NULL;
		GList* supply_it = NULL;
		supply_collection = _tmp1_;
		for (supply_it = supply_collection; supply_it != NULL; supply_it = supply_it->next) {
			Kernel26PowerSupply* _tmp2_;
			Kernel26PowerSupply* supply = NULL;
			_tmp2_ = _g_object_ref0 ((Kernel26PowerSupply*) supply_it->data);
			supply = _tmp2_;
			{
				FsoFrameworkLogger* _tmp3_;
				Kernel26PowerSupply* _tmp4_;
				const gchar* _tmp5_;
				const gchar* _tmp6_ = NULL;
				Kernel26PowerSupply* _tmp7_;
				FreeSmartphoneDevicePowerStatus _tmp8_;
				GEnumValue* _tmp9_;
				gchar* _tmp10_ = NULL;
				gchar* _tmp11_;
				gboolean _tmp12_ = FALSE;
				FsoFrameworkLogger* _tmp13_;
				Kernel26PowerSupply* _tmp14_;
				const gchar* _tmp15_;
				const gchar* _tmp16_ = NULL;
				Kernel26PowerSupply* _tmp17_;
				const gchar* _tmp18_;
				const gchar* _tmp19_ = NULL;
				gchar* _tmp20_ = NULL;
				gchar* _tmp21_;
				gboolean _tmp22_ = FALSE;
				Kernel26PowerSupply* _tmp23_;
				FreeSmartphoneDevicePowerStatus _tmp24_;
				Kernel26PowerSupply* _tmp25_;
				const gchar* _tmp26_;
				_tmp3_ = ((FsoFrameworkAbstractObject*) self)->logger;
				_tmp4_ = supply;
				_tmp5_ = _tmp4_->name;
				_tmp6_ = string_to_string (_tmp5_);
				_tmp7_ = supply;
				_tmp8_ = _tmp7_->status;
				_tmp9_ = g_enum_get_value (g_type_class_ref (FREE_SMARTPHONE_DEVICE_TYPE_POWER_STATUS), _tmp8_);
				_tmp10_ = g_strconcat ("supply ", _tmp6_, " status = ", (_tmp9_ != NULL) ? _tmp9_->value_name : NULL, NULL);
				_tmp11_ = _tmp10_;
				_tmp12_ = fso_framework_logger_debug (_tmp3_, _tmp11_);
				g_assert (_tmp12_);
				_g_free0 (_tmp11_);
				_tmp13_ = ((FsoFrameworkAbstractObject*) self)->logger;
				_tmp14_ = supply;
				_tmp15_ = _tmp14_->name;
				_tmp16_ = string_to_string (_tmp15_);
				_tmp17_ = supply;
				_tmp18_ = _tmp17_->typ;
				_tmp19_ = string_to_string (_tmp18_);
				_tmp20_ = g_strconcat ("supply ", _tmp16_, " type = ", _tmp19_, NULL);
				_tmp21_ = _tmp20_;
				_tmp22_ = fso_framework_logger_debug (_tmp13_, _tmp21_);
				g_assert (_tmp22_);
				_g_free0 (_tmp21_);
				_tmp23_ = supply;
				_tmp24_ = _tmp23_->status;
				if (_tmp24_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_UNKNOWN) {
					statusForAll = FALSE;
					_g_object_unref0 (supply);
					break;
				}
				_tmp25_ = supply;
				_tmp26_ = _tmp25_->typ;
				if (g_strcmp0 (_tmp26_, "battery") == 0) {
					Kernel26PowerSupply* _tmp27_;
					Kernel26PowerSupply* _tmp28_;
					_tmp27_ = supply;
					_tmp28_ = _g_object_ref0 (_tmp27_);
					_g_object_unref0 (battery);
					battery = _tmp28_;
				} else {
					Kernel26PowerSupply* _tmp29_;
					FreeSmartphoneDevicePowerStatus _tmp30_;
					_tmp29_ = supply;
					_tmp30_ = _tmp29_->status;
					if (_tmp30_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_ONLINE) {
						Kernel26PowerSupply* _tmp31_;
						const gchar* _tmp32_;
						gchar** _tmp33_;
						gint _tmp33__length1;
						_tmp31_ = supply;
						_tmp32_ = _tmp31_->typ;
						_tmp33_ = self->priv->supported_chargers;
						_tmp33__length1 = self->priv->supported_chargers_length1;
						if (_vala_string_array_contains (_tmp33_, _tmp33__length1, _tmp32_)) {
							Kernel26PowerSupply** _tmp34_;
							gint _tmp34__length1;
							Kernel26PowerSupply* _tmp35_;
							Kernel26PowerSupply* _tmp36_;
							_tmp34_ = chargers;
							_tmp34__length1 = chargers_length1;
							_tmp35_ = supply;
							_tmp36_ = _g_object_ref0 (_tmp35_);
							_vala_array_add1 (&chargers, &chargers_length1, &_chargers_size_, _tmp36_);
						}
					}
				}
				_g_object_unref0 (supply);
			}
		}
	}
	_tmp37_ = statusForAll;
	if (!_tmp37_) {
		FsoFrameworkLogger* _tmp38_;
		gboolean _tmp39_ = FALSE;
		_tmp38_ = ((FsoFrameworkAbstractObject*) self)->logger;
		_tmp39_ = fso_framework_logger_debug (_tmp38_, "^^^ not enough information present to compute overall status");
		g_assert (_tmp39_);
		chargers = (_vala_array_free (chargers, chargers_length1, (GDestroyNotify) g_object_unref), NULL);
		_g_object_unref0 (battery);
		return;
	}
	_tmp40_ = chargers;
	_tmp40__length1 = chargers_length1;
	if (_tmp40__length1 > 0) {
		Kernel26PowerSupply** _tmp41_;
		gint _tmp41__length1;
		_tmp41_ = chargers;
		_tmp41__length1 = chargers_length1;
		{
			Kernel26PowerSupply** charger_collection = NULL;
			gint charger_collection_length1 = 0;
			gint _charger_collection_size_ = 0;
			gint charger_it = 0;
			charger_collection = _tmp41_;
			charger_collection_length1 = _tmp41__length1;
			for (charger_it = 0; charger_it < _tmp41__length1; charger_it = charger_it + 1) {
				Kernel26PowerSupply* _tmp42_;
				Kernel26PowerSupply* charger = NULL;
				_tmp42_ = _g_object_ref0 (charger_collection[charger_it]);
				charger = _tmp42_;
				{
					Kernel26PowerSupply* _tmp43_;
					FreeSmartphoneDevicePowerStatus _tmp44_;
					_tmp43_ = charger;
					_tmp44_ = _tmp43_->status;
					if (_tmp44_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_ONLINE) {
						kernel26_aggregate_power_supply_sendStatusIfChanged (self, FREE_SMARTPHONE_DEVICE_POWER_STATUS_AC);
						_g_object_unref0 (charger);
						chargers = (_vala_array_free (chargers, chargers_length1, (GDestroyNotify) g_object_unref), NULL);
						_g_object_unref0 (battery);
						return;
					}
					_g_object_unref0 (charger);
				}
			}
		}
	}
	_tmp46_ = battery;
	if (_tmp46_ != NULL) {
		Kernel26PowerSupply* _tmp47_;
		FreeSmartphoneDevicePowerStatus _tmp48_;
		_tmp47_ = battery;
		_tmp48_ = _tmp47_->status;
		_tmp45_ = _tmp48_ != FREE_SMARTPHONE_DEVICE_POWER_STATUS_REMOVED;
	} else {
		_tmp45_ = FALSE;
	}
	_tmp49_ = _tmp45_;
	if (_tmp49_) {
		Kernel26PowerSupply* _tmp50_;
		FreeSmartphoneDevicePowerStatus _tmp51_;
		_tmp50_ = battery;
		_tmp51_ = _tmp50_->status;
		kernel26_aggregate_power_supply_sendStatusIfChanged (self, _tmp51_);
	} else {
		kernel26_aggregate_power_supply_sendStatusIfChanged (self, FREE_SMARTPHONE_DEVICE_POWER_STATUS_AC);
	}
	chargers = (_vala_array_free (chargers, chargers_length1, (GDestroyNotify) g_object_unref), NULL);
	_g_object_unref0 (battery);
}


void kernel26_aggregate_power_supply_sendStatusIfChanged (Kernel26AggregatePowerSupply* self, FreeSmartphoneDevicePowerStatus status) {
	FsoFrameworkLogger* _tmp0_;
	FreeSmartphoneDevicePowerStatus _tmp1_;
	FreeSmartphoneDevicePowerStatus _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gboolean _tmp5_ = FALSE;
	FreeSmartphoneDevicePowerStatus _tmp6_;
	gboolean _tmp8_;
	FreeSmartphoneDevicePowerStatus _tmp10_;
	FreeSmartphoneDevicePowerStatus _tmp11_;
	FreeSmartphoneDevicePowerStatus _tmp12_;
	FreeSmartphoneDevicePowerStatus _tmp13_;
	g_return_if_fail (self != NULL);
	_tmp0_ = ((FsoFrameworkAbstractObject*) self)->logger;
	_tmp1_ = self->priv->status;
	_tmp2_ = status;
	_tmp3_ = g_strdup_printf ("sendStatusIfChanged old %d new %d", (gint) _tmp1_, (gint) _tmp2_);
	_tmp4_ = _tmp3_;
	fso_framework_logger_debug (_tmp0_, _tmp4_);
	_g_free0 (_tmp4_);
	_tmp6_ = self->priv->status;
	if (_tmp6_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_DISCHARGING) {
		FreeSmartphoneDevicePowerStatus _tmp7_;
		_tmp7_ = status;
		_tmp5_ = _tmp7_ == FREE_SMARTPHONE_DEVICE_POWER_STATUS_FULL;
	} else {
		_tmp5_ = FALSE;
	}
	_tmp8_ = _tmp5_;
	if (_tmp8_) {
		FsoFrameworkLogger* _tmp9_;
		_tmp9_ = ((FsoFrameworkAbstractObject*) self)->logger;
		fso_framework_logger_warning (_tmp9_, "BUG: power supply class sent 'full' after 'discharging'");
		return;
	}
	_tmp10_ = self->priv->status;
	_tmp11_ = status;
	if (_tmp10_ == _tmp11_) {
		return;
	}
	_tmp12_ = status;
	self->priv->status = _tmp12_;
	_tmp13_ = status;
	g_signal_emit_by_name ((FreeSmartphoneDevicePowerSupply*) self, "power-status", _tmp13_);
}


void kernel26_aggregate_power_supply_sendCapacityIfChanged (Kernel26AggregatePowerSupply* self, gint energy) {
	gint _tmp0_;
	gint _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->energy;
	_tmp1_ = energy;
	if (_tmp0_ == _tmp1_) {
		return;
	}
	_tmp2_ = energy;
	self->priv->energy = _tmp2_;
	_tmp3_ = energy;
	g_signal_emit_by_name ((FreeSmartphoneDevicePowerSupply*) self, "capacity", _tmp3_);
}


gint kernel26_aggregate_power_supply_getCapacity (Kernel26AggregatePowerSupply* self) {
	gint result = 0;
	gint amount;
	gint numValues;
	GList* _tmp0_;
	gint _tmp8_ = 0;
	gint _tmp9_;
	gint _tmp12_;
	g_return_val_if_fail (self != NULL, 0);
	amount = -1;
	numValues = 0;
	_tmp0_ = instances;
	{
		GList* supply_collection = NULL;
		GList* supply_it = NULL;
		supply_collection = _tmp0_;
		for (supply_it = supply_collection; supply_it != NULL; supply_it = supply_it->next) {
			Kernel26PowerSupply* _tmp1_;
			Kernel26PowerSupply* supply = NULL;
			_tmp1_ = _g_object_ref0 ((Kernel26PowerSupply*) supply_it->data);
			supply = _tmp1_;
			{
				Kernel26PowerSupply* _tmp2_;
				gint _tmp3_ = 0;
				gint v;
				gint _tmp4_;
				_tmp2_ = supply;
				_tmp3_ = kernel26_power_supply_getCapacity (_tmp2_);
				v = _tmp3_;
				_tmp4_ = v;
				if (_tmp4_ != (-1)) {
					gint _tmp5_;
					gint _tmp6_;
					gint _tmp7_;
					_tmp5_ = amount;
					_tmp6_ = v;
					amount = _tmp5_ + _tmp6_;
					_tmp7_ = numValues;
					numValues = _tmp7_ + 1;
				}
				_g_object_unref0 (supply);
			}
		}
	}
	_tmp9_ = numValues;
	if (_tmp9_ > 0) {
		gint _tmp10_;
		gint _tmp11_;
		_tmp10_ = amount;
		_tmp11_ = numValues;
		_tmp8_ = _tmp10_ / _tmp11_;
	} else {
		_tmp8_ = -1;
	}
	_tmp12_ = _tmp8_;
	result = _tmp12_;
	return result;
}


static void kernel26_aggregate_power_supply_get_name_data_free (gpointer _data) {
	Kernel26AggregatePowerSupplyGetNameData* _data_;
	_data_ = _data;
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26AggregatePowerSupplyGetNameData, _data_);
}


void kernel26_aggregate_power_supply_get_name (Kernel26AggregatePowerSupply* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26AggregatePowerSupplyGetNameData* _data_;
	Kernel26AggregatePowerSupply* _tmp0_;
	_data_ = g_slice_new0 (Kernel26AggregatePowerSupplyGetNameData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_aggregate_power_supply_get_name);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_aggregate_power_supply_get_name_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_aggregate_power_supply_get_name_co (_data_);
}


gchar* kernel26_aggregate_power_supply_get_name_finish (Kernel26AggregatePowerSupply* self, GAsyncResult* _res_, GError** error) {
	gchar* result;
	Kernel26AggregatePowerSupplyGetNameData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static gboolean kernel26_aggregate_power_supply_get_name_co (Kernel26AggregatePowerSupplyGetNameData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->sysfsnode;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = g_path_get_basename (_data_->_tmp0_);
	_data_->result = _data_->_tmp1_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_aggregate_power_supply_get_info_data_free (gpointer _data) {
	Kernel26AggregatePowerSupplyGetInfoData* _data_;
	_data_ = _data;
	_g_hash_table_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26AggregatePowerSupplyGetInfoData, _data_);
}


void kernel26_aggregate_power_supply_get_info (Kernel26AggregatePowerSupply* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26AggregatePowerSupplyGetInfoData* _data_;
	Kernel26AggregatePowerSupply* _tmp0_;
	_data_ = g_slice_new0 (Kernel26AggregatePowerSupplyGetInfoData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_aggregate_power_supply_get_info);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_aggregate_power_supply_get_info_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_aggregate_power_supply_get_info_co (_data_);
}


GHashTable* kernel26_aggregate_power_supply_get_info_finish (Kernel26AggregatePowerSupply* self, GAsyncResult* _res_, GError** error) {
	GHashTable* result;
	Kernel26AggregatePowerSupplyGetInfoData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static GVariant* _variant_new3 (const gchar* value) {
	return g_variant_ref_sink (g_variant_new_string (value));
}


static gboolean kernel26_aggregate_power_supply_get_info_co (Kernel26AggregatePowerSupplyGetInfoData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = g_str_hash;
	_data_->_tmp1_ = g_str_equal;
	_data_->_tmp2_ = g_hash_table_new_full (_data_->_tmp0_, _data_->_tmp1_, _g_free0_, _g_variant_unref0_);
	_data_->res = _data_->_tmp2_;
	_data_->_tmp3_ = g_strdup ("type");
	_data_->_tmp4_ = _variant_new3 ("aggregate");
	g_hash_table_insert (_data_->res, _data_->_tmp3_, _data_->_tmp4_);
	_data_->result = _data_->res;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_hash_table_unref0 (_data_->res);
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_aggregate_power_supply_real_get_power_status_data_free (gpointer _data) {
	Kernel26AggregatePowerSupplyGetPowerStatusData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26AggregatePowerSupplyGetPowerStatusData, _data_);
}


static void kernel26_aggregate_power_supply_real_get_power_status (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26AggregatePowerSupply * self;
	Kernel26AggregatePowerSupplyGetPowerStatusData* _data_;
	Kernel26AggregatePowerSupply* _tmp0_;
	self = (Kernel26AggregatePowerSupply*) base;
	_data_ = g_slice_new0 (Kernel26AggregatePowerSupplyGetPowerStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_aggregate_power_supply_real_get_power_status);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_aggregate_power_supply_real_get_power_status_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_aggregate_power_supply_real_get_power_status_co (_data_);
}


static FreeSmartphoneDevicePowerStatus kernel26_aggregate_power_supply_real_get_power_status_finish (FreeSmartphoneDevicePowerSupply* base, GAsyncResult* _res_, GError** error) {
	FreeSmartphoneDevicePowerStatus result;
	Kernel26AggregatePowerSupplyGetPowerStatusData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gboolean kernel26_aggregate_power_supply_real_get_power_status_co (Kernel26AggregatePowerSupplyGetPowerStatusData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->status;
	_data_->result = _data_->_tmp0_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_aggregate_power_supply_real_get_capacity_data_free (gpointer _data) {
	Kernel26AggregatePowerSupplyGetCapacityData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (Kernel26AggregatePowerSupplyGetCapacityData, _data_);
}


static void kernel26_aggregate_power_supply_real_get_capacity (FreeSmartphoneDevicePowerSupply* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Kernel26AggregatePowerSupply * self;
	Kernel26AggregatePowerSupplyGetCapacityData* _data_;
	Kernel26AggregatePowerSupply* _tmp0_;
	self = (Kernel26AggregatePowerSupply*) base;
	_data_ = g_slice_new0 (Kernel26AggregatePowerSupplyGetCapacityData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, kernel26_aggregate_power_supply_real_get_capacity);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, kernel26_aggregate_power_supply_real_get_capacity_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	kernel26_aggregate_power_supply_real_get_capacity_co (_data_);
}


static gint kernel26_aggregate_power_supply_real_get_capacity_finish (FreeSmartphoneDevicePowerSupply* base, GAsyncResult* _res_, GError** error) {
	gint result;
	Kernel26AggregatePowerSupplyGetCapacityData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return 0;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	return result;
}


static gboolean kernel26_aggregate_power_supply_real_get_capacity_co (Kernel26AggregatePowerSupplyGetCapacityData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = kernel26_aggregate_power_supply_getCapacity (_data_->self);
	_data_->result = _data_->_tmp0_;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void kernel26_aggregate_power_supply_class_init (Kernel26AggregatePowerSupplyClass * klass) {
	kernel26_aggregate_power_supply_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (Kernel26AggregatePowerSupplyPrivate));
	FSO_FRAMEWORK_ABSTRACT_OBJECT_CLASS (klass)->repr = kernel26_aggregate_power_supply_real_repr;
	G_OBJECT_CLASS (klass)->finalize = kernel26_aggregate_power_supply_finalize;
}


static void kernel26_aggregate_power_supply_free_smartphone_device_power_supply_interface_init (FreeSmartphoneDevicePowerSupplyIface * iface) {
	kernel26_aggregate_power_supply_free_smartphone_device_power_supply_parent_iface = g_type_interface_peek_parent (iface);
	iface->get_power_status = (FreeSmartphoneDevicePowerStatus (*)(FreeSmartphoneDevicePowerSupply*, GError**)) kernel26_aggregate_power_supply_real_get_power_status;
	iface->get_power_status_finish = kernel26_aggregate_power_supply_real_get_power_status_finish;
	iface->get_capacity = (gint (*)(FreeSmartphoneDevicePowerSupply*, GError**)) kernel26_aggregate_power_supply_real_get_capacity;
	iface->get_capacity_finish = kernel26_aggregate_power_supply_real_get_capacity_finish;
}


static void kernel26_aggregate_power_supply_instance_init (Kernel26AggregatePowerSupply * self) {
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar** _tmp2_ = NULL;
	self->priv = KERNEL26_AGGREGATE_POWER_SUPPLY_GET_PRIVATE (self);
	self->priv->status = FREE_SMARTPHONE_DEVICE_POWER_STATUS_UNKNOWN;
	self->priv->energy = -1;
	_tmp0_ = g_strdup ("usb");
	_tmp1_ = g_strdup ("mains");
	_tmp2_ = g_new0 (gchar*, 2 + 1);
	_tmp2_[0] = _tmp0_;
	_tmp2_[1] = _tmp1_;
	self->priv->supported_chargers = _tmp2_;
	self->priv->supported_chargers_length1 = 2;
	self->priv->_supported_chargers_size_ = self->priv->supported_chargers_length1;
}


static void kernel26_aggregate_power_supply_finalize (GObject* obj) {
	Kernel26AggregatePowerSupply * self;
	self = KERNEL26_AGGREGATE_POWER_SUPPLY (obj);
	_g_object_unref0 (self->priv->subsystem);
	_g_free0 (self->priv->sysfsnode);
	self->priv->supported_chargers = (_vala_array_free (self->priv->supported_chargers, self->priv->supported_chargers_length1, (GDestroyNotify) g_free), NULL);
	G_OBJECT_CLASS (kernel26_aggregate_power_supply_parent_class)->finalize (obj);
}


/**
 * Implementation of org.freesmartphone.Device.PowerSupply as aggregated Kernel26 Power-Class Devices
 **/
GType kernel26_aggregate_power_supply_get_type (void) {
	return kernel26_aggregate_power_supply_type_id;
}


GType kernel26_aggregate_power_supply_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (Kernel26AggregatePowerSupplyClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) kernel26_aggregate_power_supply_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Kernel26AggregatePowerSupply), 0, (GInstanceInitFunc) kernel26_aggregate_power_supply_instance_init, NULL };
	static const GInterfaceInfo free_smartphone_device_power_supply_info = { (GInterfaceInitFunc) kernel26_aggregate_power_supply_free_smartphone_device_power_supply_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	kernel26_aggregate_power_supply_type_id = g_type_module_register_type (module, FSO_FRAMEWORK_TYPE_ABSTRACT_OBJECT, "Kernel26AggregatePowerSupply", &g_define_type_info, 0);
	g_type_module_add_interface (module, kernel26_aggregate_power_supply_type_id, FREE_SMARTPHONE_DEVICE_TYPE_POWER_SUPPLY, &free_smartphone_device_power_supply_info);
	return kernel26_aggregate_power_supply_type_id;
}


/**
 * This function gets called on plugin initialization time.
 * @return the name of your plugin here
 * @note that it needs to be a name in the format <subsystem>.<plugin>
 * else your module will be unloaded immediately.
 **/
gchar* fso_factory_function (FsoFrameworkSubsystem* subsystem, GError** error) {
	gchar* result = NULL;
	FsoFrameworkSmartKeyFile* _tmp0_;
	FsoFrameworkSmartKeyFile* _tmp1_;
	FsoFrameworkSmartKeyFile* config;
	gchar* _tmp2_ = NULL;
	const gchar* _tmp3_;
	gchar* _tmp4_ = NULL;
	const gchar* _tmp5_;
	GDir* _tmp6_ = NULL;
	GDir* dir;
	const gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar* entry;
	FsoFrameworkSubsystem* _tmp18_;
	const gchar* _tmp19_;
	Kernel26AggregatePowerSupply* _tmp20_;
	gchar* _tmp21_;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (subsystem != NULL, NULL);
	_tmp0_ = fso_framework_theConfig;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	config = _tmp1_;
	_tmp2_ = fso_framework_smart_key_file_stringValue (config, "cornucopia", "sysfs_root", "/sys");
	_g_free0 (sysfs_root);
	sysfs_root = _tmp2_;
	_tmp3_ = sysfs_root;
	_tmp4_ = g_strdup_printf ("%s/class/power_supply", _tmp3_);
	_g_free0 (sys_class_powersupplies);
	sys_class_powersupplies = _tmp4_;
	_tmp5_ = sys_class_powersupplies;
	_tmp6_ = g_dir_open (_tmp5_, (guint) 0, &_inner_error_);
	dir = _tmp6_;
	if (_inner_error_ != NULL) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (config);
		return NULL;
	}
	_tmp7_ = g_dir_read_name (dir);
	_tmp8_ = g_strdup (_tmp7_);
	entry = _tmp8_;
	while (TRUE) {
		const gchar* _tmp9_;
		const gchar* _tmp10_;
		const gchar* _tmp11_;
		gchar* _tmp12_ = NULL;
		gchar* filename;
		FsoFrameworkSubsystem* _tmp13_;
		const gchar* _tmp14_;
		Kernel26PowerSupply* _tmp15_;
		const gchar* _tmp16_ = NULL;
		gchar* _tmp17_;
		_tmp9_ = entry;
		if (!(_tmp9_ != NULL)) {
			break;
		}
		_tmp10_ = sys_class_powersupplies;
		_tmp11_ = entry;
		_tmp12_ = g_build_filename (_tmp10_, _tmp11_, NULL);
		filename = _tmp12_;
		_tmp13_ = subsystem;
		_tmp14_ = filename;
		_tmp15_ = kernel26_power_supply_new (_tmp13_, _tmp14_);
		instances = g_list_append (instances, _tmp15_);
		_tmp16_ = g_dir_read_name (dir);
		_tmp17_ = g_strdup (_tmp16_);
		_g_free0 (entry);
		entry = _tmp17_;
		_g_free0 (filename);
	}
	_tmp18_ = subsystem;
	_tmp19_ = sys_class_powersupplies;
	_tmp20_ = kernel26_aggregate_power_supply_new (_tmp18_, _tmp19_);
	_g_object_unref0 (aggregate);
	aggregate = _tmp20_;
	_tmp21_ = g_strdup ("fsodevice.kernel26_powersupply");
	result = _tmp21_;
	_g_free0 (entry);
	_g_dir_close0 (dir);
	_g_object_unref0 (config);
	return result;
}


void fso_register_function (GTypeModule* module) {
	FsoFrameworkLogger* _tmp0_;
	g_return_if_fail (module != NULL);
	kernel26_power_supply_register_type (module);
	kernel26_aggregate_power_supply_register_type (module);
	_tmp0_ = fso_framework_theLogger;
	fso_framework_logger_debug (_tmp0_, "fsodevice.kernel26_powersupply fso_register_function()");
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



