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

/*
 * Copyright (C) 2011 Simon Busch <morphis@gravedo.de>
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.

 * This program 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 General Public License for more details.

 * You should have received a copy of the GNU General Public License
 * along with this program; 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 <radio.h>
#include <gobject/gvaluecollector.h>


#define SAMSUNG_TYPE_MODEM_STATE (samsung_modem_state_get_type ())
#define SAMSUNG_MODEM_STATE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SAMSUNG_TYPE_MODEM_STATE, SamsungModemState))
#define SAMSUNG_MODEM_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SAMSUNG_TYPE_MODEM_STATE, SamsungModemStateClass))
#define SAMSUNG_IS_MODEM_STATE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SAMSUNG_TYPE_MODEM_STATE))
#define SAMSUNG_IS_MODEM_STATE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SAMSUNG_TYPE_MODEM_STATE))
#define SAMSUNG_MODEM_STATE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SAMSUNG_TYPE_MODEM_STATE, SamsungModemStateClass))

typedef struct _SamsungModemState SamsungModemState;
typedef struct _SamsungModemStateClass SamsungModemStateClass;
typedef struct _SamsungModemStatePrivate SamsungModemStatePrivate;
typedef struct _SamsungParamSpecModemState SamsungParamSpecModemState;

struct _SamsungModemState {
	GTypeInstance parent_instance;
	volatile int ref_count;
	SamsungModemStatePrivate * priv;
};

struct _SamsungModemStateClass {
	GTypeClass parent_class;
	void (*finalize) (SamsungModemState *self);
};

struct _SamsungParamSpecModemState {
	GParamSpec parent_instance;
};


static gpointer samsung_modem_state_parent_class = NULL;
extern guint8 samsung_modem_state_power_state;
guint8 samsung_modem_state_power_state = (guint8) 0;
extern guint8 samsung_modem_state_sim_icc_type;
guint8 samsung_modem_state_sim_icc_type = (guint8) 0;
extern gint8 samsung_modem_state_sim_status;
gint8 samsung_modem_state_sim_status = IPC_SEC_PIN_SIM_INITIALIZING;
extern gint32 samsung_modem_state_network_signal_strength;
gint32 samsung_modem_state_network_signal_strength = (gint32) 0;
static GType samsung_modem_state_type_id = 0;

gpointer samsung_modem_state_ref (gpointer instance);
void samsung_modem_state_unref (gpointer instance);
GParamSpec* samsung_param_spec_modem_state (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void samsung_value_set_modem_state (GValue* value, gpointer v_object);
void samsung_value_take_modem_state (GValue* value, gpointer v_object);
gpointer samsung_value_get_modem_state (const GValue* value);
GType samsung_modem_state_get_type (void) G_GNUC_CONST;
GType samsung_modem_state_register_type (GTypeModule * module);
enum  {
	SAMSUNG_MODEM_STATE_DUMMY_PROPERTY
};
void samsung_modem_state_reset_network_data (void);
SamsungModemState* samsung_modem_state_new (void);
SamsungModemState* samsung_modem_state_construct (GType object_type);
static void samsung_modem_state_finalize (SamsungModemState* obj);


void samsung_modem_state_reset_network_data (void) {
	samsung_modem_state_network_signal_strength = (gint32) 0;
}


SamsungModemState* samsung_modem_state_construct (GType object_type) {
	SamsungModemState* self = NULL;
	self = (SamsungModemState*) g_type_create_instance (object_type);
	return self;
}


SamsungModemState* samsung_modem_state_new (void) {
	return samsung_modem_state_construct (SAMSUNG_TYPE_MODEM_STATE);
}


static void samsung_value_modem_state_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void samsung_value_modem_state_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		samsung_modem_state_unref (value->data[0].v_pointer);
	}
}


static void samsung_value_modem_state_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = samsung_modem_state_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer samsung_value_modem_state_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* samsung_value_modem_state_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		SamsungModemState* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = samsung_modem_state_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* samsung_value_modem_state_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	SamsungModemState** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = samsung_modem_state_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* samsung_param_spec_modem_state (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	SamsungParamSpecModemState* spec;
	g_return_val_if_fail (g_type_is_a (object_type, SAMSUNG_TYPE_MODEM_STATE), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer samsung_value_get_modem_state (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SAMSUNG_TYPE_MODEM_STATE), NULL);
	return value->data[0].v_pointer;
}


void samsung_value_set_modem_state (GValue* value, gpointer v_object) {
	SamsungModemState* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SAMSUNG_TYPE_MODEM_STATE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SAMSUNG_TYPE_MODEM_STATE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		samsung_modem_state_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		samsung_modem_state_unref (old);
	}
}


void samsung_value_take_modem_state (GValue* value, gpointer v_object) {
	SamsungModemState* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, SAMSUNG_TYPE_MODEM_STATE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, SAMSUNG_TYPE_MODEM_STATE));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		samsung_modem_state_unref (old);
	}
}


static void samsung_modem_state_class_init (SamsungModemStateClass * klass) {
	samsung_modem_state_parent_class = g_type_class_peek_parent (klass);
	SAMSUNG_MODEM_STATE_CLASS (klass)->finalize = samsung_modem_state_finalize;
}


static void samsung_modem_state_instance_init (SamsungModemState * self) {
	self->ref_count = 1;
}


static void samsung_modem_state_finalize (SamsungModemState* obj) {
	SamsungModemState * self;
	self = SAMSUNG_MODEM_STATE (obj);
}


GType samsung_modem_state_get_type (void) {
	return samsung_modem_state_type_id;
}


GType samsung_modem_state_register_type (GTypeModule * module) {
	static const GTypeValueTable g_define_type_value_table = { samsung_value_modem_state_init, samsung_value_modem_state_free_value, samsung_value_modem_state_copy_value, samsung_value_modem_state_peek_pointer, "p", samsung_value_modem_state_collect_value, "p", samsung_value_modem_state_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (SamsungModemStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) samsung_modem_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SamsungModemState), 0, (GInstanceInitFunc) samsung_modem_state_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	samsung_modem_state_type_id = g_type_register_fundamental (g_type_fundamental_next (), "SamsungModemState", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return samsung_modem_state_type_id;
}


gpointer samsung_modem_state_ref (gpointer instance) {
	SamsungModemState* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void samsung_modem_state_unref (gpointer instance) {
	SamsungModemState* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		SAMSUNG_MODEM_STATE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}



