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

/*
 * Copyright (C) 2011 Klaus 'mrmoku' Kurzmann   <mok@fluxnetz.de>
 *               2011 Lukas 'slyon' Märdian     <lukasmaerdian@gmail.com>
 *               2012 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 <fsogsm.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <freesmartphone.h>
#include <gee.h>


#define GTM601_TYPE_AT_CALL_SEND_DTMF (gtm601_at_call_send_dtmf_get_type ())
#define GTM601_AT_CALL_SEND_DTMF(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTM601_TYPE_AT_CALL_SEND_DTMF, Gtm601AtCallSendDtmf))
#define GTM601_AT_CALL_SEND_DTMF_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTM601_TYPE_AT_CALL_SEND_DTMF, Gtm601AtCallSendDtmfClass))
#define GTM601_IS_AT_CALL_SEND_DTMF(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTM601_TYPE_AT_CALL_SEND_DTMF))
#define GTM601_IS_AT_CALL_SEND_DTMF_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTM601_TYPE_AT_CALL_SEND_DTMF))
#define GTM601_AT_CALL_SEND_DTMF_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTM601_TYPE_AT_CALL_SEND_DTMF, Gtm601AtCallSendDtmfClass))

typedef struct _Gtm601AtCallSendDtmf Gtm601AtCallSendDtmf;
typedef struct _Gtm601AtCallSendDtmfClass Gtm601AtCallSendDtmfClass;
typedef struct _Gtm601AtCallSendDtmfPrivate Gtm601AtCallSendDtmfPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Gtm601AtCallSendDtmfRunData Gtm601AtCallSendDtmfRunData;

#define GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS (gtm601_at_network_list_providers_get_type ())
#define GTM601_AT_NETWORK_LIST_PROVIDERS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS, Gtm601AtNetworkListProviders))
#define GTM601_AT_NETWORK_LIST_PROVIDERS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS, Gtm601AtNetworkListProvidersClass))
#define GTM601_IS_AT_NETWORK_LIST_PROVIDERS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS))
#define GTM601_IS_AT_NETWORK_LIST_PROVIDERS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS))
#define GTM601_AT_NETWORK_LIST_PROVIDERS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS, Gtm601AtNetworkListProvidersClass))

typedef struct _Gtm601AtNetworkListProviders Gtm601AtNetworkListProviders;
typedef struct _Gtm601AtNetworkListProvidersClass Gtm601AtNetworkListProvidersClass;
typedef struct _Gtm601AtNetworkListProvidersPrivate Gtm601AtNetworkListProvidersPrivate;
typedef struct _Gtm601AtNetworkListProvidersRunData Gtm601AtNetworkListProvidersRunData;

#define GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER (gtm601_at_sim_get_service_center_number_get_type ())
#define GTM601_AT_SIM_GET_SERVICE_CENTER_NUMBER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER, Gtm601AtSimGetServiceCenterNumber))
#define GTM601_AT_SIM_GET_SERVICE_CENTER_NUMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER, Gtm601AtSimGetServiceCenterNumberClass))
#define GTM601_IS_AT_SIM_GET_SERVICE_CENTER_NUMBER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER))
#define GTM601_IS_AT_SIM_GET_SERVICE_CENTER_NUMBER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER))
#define GTM601_AT_SIM_GET_SERVICE_CENTER_NUMBER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER, Gtm601AtSimGetServiceCenterNumberClass))

typedef struct _Gtm601AtSimGetServiceCenterNumber Gtm601AtSimGetServiceCenterNumber;
typedef struct _Gtm601AtSimGetServiceCenterNumberClass Gtm601AtSimGetServiceCenterNumberClass;
typedef struct _Gtm601AtSimGetServiceCenterNumberPrivate Gtm601AtSimGetServiceCenterNumberPrivate;
typedef struct _Gtm601AtSimGetServiceCenterNumberRunData Gtm601AtSimGetServiceCenterNumberRunData;

struct _Gtm601AtCallSendDtmf {
	FsoGsmCallSendDtmf parent_instance;
	Gtm601AtCallSendDtmfPrivate * priv;
};

struct _Gtm601AtCallSendDtmfClass {
	FsoGsmCallSendDtmfClass parent_class;
};

struct _Gtm601AtCallSendDtmfRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Gtm601AtCallSendDtmf* self;
	gchar* tones;
	FsoGsmModem* _tmp0_;
	gpointer _tmp1_;
	FsoGsmPlusVTS* cmd;
	FsoGsmModem* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
};

struct _Gtm601AtNetworkListProviders {
	FsoGsmNetworkListProviders parent_instance;
	Gtm601AtNetworkListProvidersPrivate * priv;
};

struct _Gtm601AtNetworkListProvidersClass {
	FsoGsmNetworkListProvidersClass parent_class;
};

struct _Gtm601AtNetworkListProvidersRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Gtm601AtNetworkListProviders* self;
	FreeSmartphoneGSMNetworkProvider* _tmp0_;
	FreeSmartphoneGSMNetworkProvider* providers_tmp;
	gint providers_tmp_length1;
	gint _providers_tmp_size_;
	FsoGsmModem* _tmp1_;
	gpointer _tmp2_;
	FsoGsmPlusCOPS* cmd;
	FsoGsmModem* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gchar** _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	gchar** response;
	gint response_length1;
	gint _response_size_;
	FreeSmartphoneGSMNetworkProvider* _tmp9_;
	gint _tmp9__length1;
	FreeSmartphoneGSMNetworkProvider* p_collection;
	gint p_collection_length1;
	gint _p_collection_size_;
	gint p_it;
	FreeSmartphoneGSMNetworkProvider _tmp10_;
	FreeSmartphoneGSMNetworkProvider p;
	FreeSmartphoneGSMNetworkProvider* _tmp11_;
	gint _tmp11__length1;
	FreeSmartphoneGSMNetworkProvider _tmp12_;
	const gchar* _tmp13_;
	FreeSmartphoneGSMNetworkProvider _tmp14_;
	const gchar* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	FreeSmartphoneGSMNetworkProvider _tmp18_;
	const gchar* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	FreeSmartphoneGSMNetworkProvider _tmp22_;
	const gchar* _tmp23_;
	FreeSmartphoneGSMNetworkProvider _tmp24_;
	const gchar* _tmp25_;
	FreeSmartphoneGSMNetworkProvider _tmp26_;
	FreeSmartphoneGSMNetworkProvider* _tmp27_;
	gint _tmp27__length1;
	GError * _inner_error_;
};

struct _Gtm601AtSimGetServiceCenterNumber {
	FsoGsmSimGetServiceCenterNumber parent_instance;
	Gtm601AtSimGetServiceCenterNumberPrivate * priv;
};

struct _Gtm601AtSimGetServiceCenterNumberClass {
	FsoGsmSimGetServiceCenterNumberClass parent_class;
};

struct _Gtm601AtSimGetServiceCenterNumberRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	Gtm601AtSimGetServiceCenterNumber* self;
	FsoGsmModem* _tmp0_;
	gpointer _tmp1_;
	FsoGsmPlusCSCA* cmd;
	FsoGsmModem* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gint _tmp5_;
	gchar** _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar** response;
	gint response_length1;
	gint _response_size_;
	const gchar* _tmp8_;
	gchar* _tmp9_;
	GError * _inner_error_;
};


static gpointer gtm601_at_call_send_dtmf_parent_class = NULL;
static GType gtm601_at_call_send_dtmf_type_id = 0;
static gpointer gtm601_at_network_list_providers_parent_class = NULL;
static GType gtm601_at_network_list_providers_type_id = 0;
static gpointer gtm601_at_sim_get_service_center_number_parent_class = NULL;
static GType gtm601_at_sim_get_service_center_number_type_id = 0;

GType gtm601_at_call_send_dtmf_get_type (void) G_GNUC_CONST;
GType gtm601_at_call_send_dtmf_register_type (GTypeModule * module);
enum  {
	GTM601_AT_CALL_SEND_DTMF_DUMMY_PROPERTY
};
static void gtm601_at_call_send_dtmf_real_run_data_free (gpointer _data);
static void gtm601_at_call_send_dtmf_real_run (FsoGsmCallSendDtmf* base, const gchar* tones, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean gtm601_at_call_send_dtmf_real_run_co (Gtm601AtCallSendDtmfRunData* _data_);
Gtm601AtCallSendDtmf* gtm601_at_call_send_dtmf_new (void);
Gtm601AtCallSendDtmf* gtm601_at_call_send_dtmf_construct (GType object_type);
GType gtm601_at_network_list_providers_get_type (void) G_GNUC_CONST;
GType gtm601_at_network_list_providers_register_type (GTypeModule * module);
enum  {
	GTM601_AT_NETWORK_LIST_PROVIDERS_DUMMY_PROPERTY
};
static void gtm601_at_network_list_providers_real_run_data_free (gpointer _data);
static void gtm601_at_network_list_providers_real_run (FsoGsmNetworkListProviders* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean gtm601_at_network_list_providers_real_run_co (Gtm601AtNetworkListProvidersRunData* _data_);
static void gtm601_at_network_list_providers_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void _vala_FreeSmartphoneGSMNetworkProvider_array_free (FreeSmartphoneGSMNetworkProvider* array, gint array_length);
static void _vala_array_add1 (FreeSmartphoneGSMNetworkProvider** array, int* length, int* size, const FreeSmartphoneGSMNetworkProvider* value);
Gtm601AtNetworkListProviders* gtm601_at_network_list_providers_new (void);
Gtm601AtNetworkListProviders* gtm601_at_network_list_providers_construct (GType object_type);
GType gtm601_at_sim_get_service_center_number_get_type (void) G_GNUC_CONST;
GType gtm601_at_sim_get_service_center_number_register_type (GTypeModule * module);
enum  {
	GTM601_AT_SIM_GET_SERVICE_CENTER_NUMBER_DUMMY_PROPERTY
};
static void gtm601_at_sim_get_service_center_number_real_run_data_free (gpointer _data);
static void gtm601_at_sim_get_service_center_number_real_run (FsoGsmSimGetServiceCenterNumber* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean gtm601_at_sim_get_service_center_number_real_run_co (Gtm601AtSimGetServiceCenterNumberRunData* _data_);
static void gtm601_at_sim_get_service_center_number_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
Gtm601AtSimGetServiceCenterNumber* gtm601_at_sim_get_service_center_number_new (void);
Gtm601AtSimGetServiceCenterNumber* gtm601_at_sim_get_service_center_number_construct (GType object_type);
void gtm601_registerCustomMediators (GeeHashMap* mediators);
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 void gtm601_at_call_send_dtmf_real_run_data_free (gpointer _data) {
	Gtm601AtCallSendDtmfRunData* _data_;
	_data_ = _data;
	_g_free0 (_data_->tones);
	_g_object_unref0 (_data_->self);
	g_slice_free (Gtm601AtCallSendDtmfRunData, _data_);
}


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


static void gtm601_at_call_send_dtmf_real_run (FsoGsmCallSendDtmf* base, const gchar* tones, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Gtm601AtCallSendDtmf * self;
	Gtm601AtCallSendDtmfRunData* _data_;
	Gtm601AtCallSendDtmf* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	self = (Gtm601AtCallSendDtmf*) base;
	_data_ = g_slice_new0 (Gtm601AtCallSendDtmfRunData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, gtm601_at_call_send_dtmf_real_run);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gtm601_at_call_send_dtmf_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = tones;
	_tmp2_ = g_strdup (_tmp1_);
	_data_->tones = _tmp2_;
	gtm601_at_call_send_dtmf_real_run_co (_data_);
}


static void gtm601_at_call_send_dtmf_real_run_finish (FsoGsmCallSendDtmf* base, GAsyncResult* _res_, GError** error) {
	Gtm601AtCallSendDtmfRunData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean gtm601_at_call_send_dtmf_real_run_co (Gtm601AtCallSendDtmfRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_theModem;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = fso_gsm_modem_createAtCommand (_data_->_tmp0_, FSO_GSM_TYPE_PLUS_VTS, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+VTS");
	_data_->cmd = (FsoGsmPlusVTS*) _data_->_tmp1_;
	_data_->_tmp2_ = fso_gsm_theModem;
	_data_->_tmp3_ = _data_->tones;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = fso_gsm_plus_vts_issue (_data_->cmd, _data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	fso_gsm_modem_sendAtCommand (_data_->_tmp2_, (FsoGsmAtCommand*) _data_->cmd, _data_->_tmp5_, FSO_GSM_MODEM_DEFAULT_RETRIES);
	_g_free0 (_data_->_tmp5_);
	_g_object_unref0 (_data_->cmd);
	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;
}


Gtm601AtCallSendDtmf* gtm601_at_call_send_dtmf_construct (GType object_type) {
	Gtm601AtCallSendDtmf * self = NULL;
	self = (Gtm601AtCallSendDtmf*) fso_gsm_call_send_dtmf_construct (object_type);
	return self;
}


Gtm601AtCallSendDtmf* gtm601_at_call_send_dtmf_new (void) {
	return gtm601_at_call_send_dtmf_construct (GTM601_TYPE_AT_CALL_SEND_DTMF);
}


static void gtm601_at_call_send_dtmf_class_init (Gtm601AtCallSendDtmfClass * klass) {
	gtm601_at_call_send_dtmf_parent_class = g_type_class_peek_parent (klass);
	FSO_GSM_CALL_SEND_DTMF_CLASS (klass)->run = gtm601_at_call_send_dtmf_real_run;
	FSO_GSM_CALL_SEND_DTMF_CLASS (klass)->run_finish = gtm601_at_call_send_dtmf_real_run_finish;
}


static void gtm601_at_call_send_dtmf_instance_init (Gtm601AtCallSendDtmf * self) {
}


GType gtm601_at_call_send_dtmf_get_type (void) {
	return gtm601_at_call_send_dtmf_type_id;
}


GType gtm601_at_call_send_dtmf_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (Gtm601AtCallSendDtmfClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gtm601_at_call_send_dtmf_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Gtm601AtCallSendDtmf), 0, (GInstanceInitFunc) gtm601_at_call_send_dtmf_instance_init, NULL };
	gtm601_at_call_send_dtmf_type_id = g_type_module_register_type (module, FSO_GSM_TYPE_CALL_SEND_DTMF, "Gtm601AtCallSendDtmf", &g_define_type_info, 0);
	return gtm601_at_call_send_dtmf_type_id;
}


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


static void gtm601_at_network_list_providers_real_run (FsoGsmNetworkListProviders* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Gtm601AtNetworkListProviders * self;
	Gtm601AtNetworkListProvidersRunData* _data_;
	Gtm601AtNetworkListProviders* _tmp0_;
	self = (Gtm601AtNetworkListProviders*) base;
	_data_ = g_slice_new0 (Gtm601AtNetworkListProvidersRunData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, gtm601_at_network_list_providers_real_run);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gtm601_at_network_list_providers_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gtm601_at_network_list_providers_real_run_co (_data_);
}


static void gtm601_at_network_list_providers_real_run_finish (FsoGsmNetworkListProviders* base, GAsyncResult* _res_, GError** error) {
	Gtm601AtNetworkListProvidersRunData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void gtm601_at_network_list_providers_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	Gtm601AtNetworkListProvidersRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gtm601_at_network_list_providers_real_run_co (_data_);
}


static void _vala_FreeSmartphoneGSMNetworkProvider_array_free (FreeSmartphoneGSMNetworkProvider* array, gint array_length) {
	if (array != NULL) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			free_smartphone_gsm_network_provider_destroy (&array[i]);
		}
	}
	g_free (array);
}


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


static gboolean gtm601_at_network_list_providers_real_run_co (Gtm601AtNetworkListProvidersRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = g_new0 (FreeSmartphoneGSMNetworkProvider, 0);
	_data_->providers_tmp = _data_->_tmp0_;
	_data_->providers_tmp_length1 = 0;
	_data_->_providers_tmp_size_ = _data_->providers_tmp_length1;
	_data_->_tmp1_ = fso_gsm_theModem;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = fso_gsm_modem_createAtCommand (_data_->_tmp1_, FSO_GSM_TYPE_PLUS_COPS, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+COPS");
	_data_->cmd = (FsoGsmPlusCOPS*) _data_->_tmp2_;
	_data_->_tmp3_ = fso_gsm_theModem;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = fso_gsm_plus_cops_test (_data_->cmd);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = 0;
	_data_->_state_ = 1;
	fso_gsm_modem_processAtCommandAsync (_data_->_tmp3_, (FsoGsmAtCommand*) _data_->cmd, _data_->_tmp5_, FSO_GSM_MODEM_DEFAULT_RETRIES, gtm601_at_network_list_providers_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp3_, _data_->_res_, &_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp8__length1 = _data_->_tmp6_;
	_g_free0 (_data_->_tmp5_);
	_data_->response = _data_->_tmp8_;
	_data_->response_length1 = _data_->_tmp8__length1;
	_data_->_response_size_ = _data_->response_length1;
	fso_gsm_checkTestResponseValid ((FsoGsmAtCommand*) _data_->cmd, _data_->response, _data_->response_length1, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), NULL);
			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 {
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), NULL);
			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_->_tmp9_ = _data_->cmd->providers;
	_data_->_tmp9__length1 = _data_->cmd->providers_length1;
	{
		_data_->p_collection_length1 = 0;
		_data_->_p_collection_size_ = 0;
		_data_->p_collection = _data_->_tmp9_;
		_data_->p_collection_length1 = _data_->_tmp9__length1;
		_data_->p_it = 0;
		for (_data_->p_it = 0; _data_->p_it < _data_->_tmp9__length1; _data_->p_it = _data_->p_it + 1) {
			memset (&_data_->_tmp10_, 0, sizeof (FreeSmartphoneGSMNetworkProvider));
			free_smartphone_gsm_network_provider_copy (&_data_->p_collection[_data_->p_it], &_data_->_tmp10_);
			_data_->p = _data_->_tmp10_;
			{
				_data_->_tmp11_ = _data_->providers_tmp;
				_data_->_tmp11__length1 = _data_->providers_tmp_length1;
				_data_->_tmp12_ = _data_->p;
				_data_->_tmp13_ = _data_->_tmp12_.status;
				_data_->_tmp14_ = _data_->p;
				_data_->_tmp15_ = _data_->_tmp14_.shortname;
				_data_->_tmp16_ = NULL;
				_data_->_tmp16_ = codec_hexToString (_data_->_tmp15_, (guint) 0x20, (guint) 0x7f, NULL);
				_data_->_tmp17_ = _data_->_tmp16_;
				_data_->_tmp18_ = _data_->p;
				_data_->_tmp19_ = _data_->_tmp18_.longname;
				_data_->_tmp20_ = NULL;
				_data_->_tmp20_ = codec_hexToString (_data_->_tmp19_, (guint) 0x20, (guint) 0x7f, NULL);
				_data_->_tmp21_ = _data_->_tmp20_;
				_data_->_tmp22_ = _data_->p;
				_data_->_tmp23_ = _data_->_tmp22_.mccmnc;
				_data_->_tmp24_ = _data_->p;
				_data_->_tmp25_ = _data_->_tmp24_.act;
				memset (&_data_->_tmp26_, 0, sizeof (FreeSmartphoneGSMNetworkProvider));
				free_smartphone_gsm_network_provider_init (&_data_->_tmp26_, _data_->_tmp13_, _data_->_tmp17_, _data_->_tmp21_, _data_->_tmp23_, _data_->_tmp25_);
				_vala_array_add1 (&_data_->providers_tmp, &_data_->providers_tmp_length1, &_data_->_providers_tmp_size_, &_data_->_tmp26_);
				_g_free0 (_data_->_tmp21_);
				_g_free0 (_data_->_tmp17_);
				free_smartphone_gsm_network_provider_destroy (&_data_->p);
			}
		}
	}
	_data_->_tmp27_ = _data_->providers_tmp;
	_data_->_tmp27__length1 = _data_->providers_tmp_length1;
	fso_gsm_network_list_providers_set_providers ((FsoGsmNetworkListProviders*) _data_->self, _data_->_tmp27_, _data_->_tmp27__length1);
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cmd);
	_data_->providers_tmp = (_vala_FreeSmartphoneGSMNetworkProvider_array_free (_data_->providers_tmp, _data_->providers_tmp_length1), NULL);
	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;
}


Gtm601AtNetworkListProviders* gtm601_at_network_list_providers_construct (GType object_type) {
	Gtm601AtNetworkListProviders * self = NULL;
	self = (Gtm601AtNetworkListProviders*) fso_gsm_network_list_providers_construct (object_type);
	return self;
}


Gtm601AtNetworkListProviders* gtm601_at_network_list_providers_new (void) {
	return gtm601_at_network_list_providers_construct (GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS);
}


static void gtm601_at_network_list_providers_class_init (Gtm601AtNetworkListProvidersClass * klass) {
	gtm601_at_network_list_providers_parent_class = g_type_class_peek_parent (klass);
	FSO_GSM_NETWORK_LIST_PROVIDERS_CLASS (klass)->run = gtm601_at_network_list_providers_real_run;
	FSO_GSM_NETWORK_LIST_PROVIDERS_CLASS (klass)->run_finish = gtm601_at_network_list_providers_real_run_finish;
}


static void gtm601_at_network_list_providers_instance_init (Gtm601AtNetworkListProviders * self) {
}


/**
     * Sadly the Option GTM601 modem does not return the provider names a real strings.
     * Instead it returns the hexadecimal representation of each character concatenated as
     * a long string. To handle this and provider the correct provider names we override
     * the common NetworkListProviders mediator here and implement the conversion routine.
     **/
GType gtm601_at_network_list_providers_get_type (void) {
	return gtm601_at_network_list_providers_type_id;
}


GType gtm601_at_network_list_providers_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (Gtm601AtNetworkListProvidersClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gtm601_at_network_list_providers_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Gtm601AtNetworkListProviders), 0, (GInstanceInitFunc) gtm601_at_network_list_providers_instance_init, NULL };
	gtm601_at_network_list_providers_type_id = g_type_module_register_type (module, FSO_GSM_TYPE_NETWORK_LIST_PROVIDERS, "Gtm601AtNetworkListProviders", &g_define_type_info, 0);
	return gtm601_at_network_list_providers_type_id;
}


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


static void gtm601_at_sim_get_service_center_number_real_run (FsoGsmSimGetServiceCenterNumber* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	Gtm601AtSimGetServiceCenterNumber * self;
	Gtm601AtSimGetServiceCenterNumberRunData* _data_;
	Gtm601AtSimGetServiceCenterNumber* _tmp0_;
	self = (Gtm601AtSimGetServiceCenterNumber*) base;
	_data_ = g_slice_new0 (Gtm601AtSimGetServiceCenterNumberRunData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, gtm601_at_sim_get_service_center_number_real_run);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, gtm601_at_sim_get_service_center_number_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	gtm601_at_sim_get_service_center_number_real_run_co (_data_);
}


static void gtm601_at_sim_get_service_center_number_real_run_finish (FsoGsmSimGetServiceCenterNumber* base, GAsyncResult* _res_, GError** error) {
	Gtm601AtSimGetServiceCenterNumberRunData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void gtm601_at_sim_get_service_center_number_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	Gtm601AtSimGetServiceCenterNumberRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	gtm601_at_sim_get_service_center_number_real_run_co (_data_);
}


static gboolean gtm601_at_sim_get_service_center_number_real_run_co (Gtm601AtSimGetServiceCenterNumberRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_theModem;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = fso_gsm_modem_createAtCommand (_data_->_tmp0_, FSO_GSM_TYPE_PLUS_CSCA, (GBoxedCopyFunc) g_object_ref, g_object_unref, "+CSCA");
	_data_->cmd = (FsoGsmPlusCSCA*) _data_->_tmp1_;
	_data_->_tmp2_ = fso_gsm_theModem;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = fso_gsm_plus_csca_query (_data_->cmd);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = 0;
	_data_->_state_ = 1;
	fso_gsm_modem_processAtCommandAsync (_data_->_tmp2_, (FsoGsmAtCommand*) _data_->cmd, _data_->_tmp4_, FSO_GSM_MODEM_DEFAULT_RETRIES, gtm601_at_sim_get_service_center_number_run_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = fso_gsm_modem_processAtCommandAsync_finish (_data_->_tmp2_, _data_->_res_, &_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp7__length1 = _data_->_tmp5_;
	_g_free0 (_data_->_tmp4_);
	_data_->response = _data_->_tmp7_;
	_data_->response_length1 = _data_->_tmp7__length1;
	_data_->_response_size_ = _data_->response_length1;
	fso_gsm_checkResponseValid ((FsoGsmAtCommand*) _data_->cmd, _data_->response, _data_->response_length1, &_data_->_inner_error_);
	if (_data_->_inner_error_ != NULL) {
		if ((_data_->_inner_error_->domain == FREE_SMARTPHONE_GSM_ERROR) || (_data_->_inner_error_->domain == FREE_SMARTPHONE_ERROR)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			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 {
			_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
			_g_object_unref0 (_data_->cmd);
			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_ = _data_->cmd->number;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = codec_hexToString (_data_->_tmp8_, (guint) 0x20, (guint) 0x7f, NULL);
	_g_free0 (((FsoGsmSimGetServiceCenterNumber*) _data_->self)->number);
	((FsoGsmSimGetServiceCenterNumber*) _data_->self)->number = _data_->_tmp9_;
	_data_->response = (_vala_array_free (_data_->response, _data_->response_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->cmd);
	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;
}


Gtm601AtSimGetServiceCenterNumber* gtm601_at_sim_get_service_center_number_construct (GType object_type) {
	Gtm601AtSimGetServiceCenterNumber * self = NULL;
	self = (Gtm601AtSimGetServiceCenterNumber*) fso_gsm_sim_get_service_center_number_construct (object_type);
	return self;
}


Gtm601AtSimGetServiceCenterNumber* gtm601_at_sim_get_service_center_number_new (void) {
	return gtm601_at_sim_get_service_center_number_construct (GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER);
}


static void gtm601_at_sim_get_service_center_number_class_init (Gtm601AtSimGetServiceCenterNumberClass * klass) {
	gtm601_at_sim_get_service_center_number_parent_class = g_type_class_peek_parent (klass);
	FSO_GSM_SIM_GET_SERVICE_CENTER_NUMBER_CLASS (klass)->run = gtm601_at_sim_get_service_center_number_real_run;
	FSO_GSM_SIM_GET_SERVICE_CENTER_NUMBER_CLASS (klass)->run_finish = gtm601_at_sim_get_service_center_number_real_run_finish;
}


static void gtm601_at_sim_get_service_center_number_instance_init (Gtm601AtSimGetServiceCenterNumber * self) {
}


GType gtm601_at_sim_get_service_center_number_get_type (void) {
	return gtm601_at_sim_get_service_center_number_type_id;
}


GType gtm601_at_sim_get_service_center_number_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (Gtm601AtSimGetServiceCenterNumberClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) gtm601_at_sim_get_service_center_number_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Gtm601AtSimGetServiceCenterNumber), 0, (GInstanceInitFunc) gtm601_at_sim_get_service_center_number_instance_init, NULL };
	gtm601_at_sim_get_service_center_number_type_id = g_type_module_register_type (module, FSO_GSM_TYPE_SIM_GET_SERVICE_CENTER_NUMBER, "Gtm601AtSimGetServiceCenterNumber", &g_define_type_info, 0);
	return gtm601_at_sim_get_service_center_number_type_id;
}


void gtm601_registerCustomMediators (GeeHashMap* mediators) {
	GeeHashMap* _tmp0_;
	GeeHashMap* _tmp1_;
	GeeHashMap* _tmp2_;
	g_return_if_fail (mediators != NULL);
	_tmp0_ = mediators;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp0_, GINT_TO_POINTER (FSO_GSM_TYPE_CALL_SEND_DTMF), GINT_TO_POINTER (GTM601_TYPE_AT_CALL_SEND_DTMF));
	_tmp1_ = mediators;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp1_, GINT_TO_POINTER (FSO_GSM_TYPE_NETWORK_LIST_PROVIDERS), GINT_TO_POINTER (GTM601_TYPE_AT_NETWORK_LIST_PROVIDERS));
	_tmp2_ = mediators;
	gee_abstract_map_set ((GeeAbstractMap*) _tmp2_, GINT_TO_POINTER (FSO_GSM_TYPE_SIM_GET_SERVICE_CENTER_NUMBER), GINT_TO_POINTER (GTM601_TYPE_AT_SIM_GET_SERVICE_CENTER_NUMBER));
}


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);
}



