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

/*
 * Copyright (C) 2009-2011 Michael 'Mickey' Lauer <mlauer@vanille-media.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 <stdlib.h>
#include <string.h>
#include <fsotransport.h>
#include <fsobasics.h>
#include <gio/gio.h>
#include <gobject/gvaluecollector.h>


#define FSO_GSM_TYPE_AT_COMMAND_QUEUE_COMMAND (fso_gsm_at_command_queue_command_get_type ())
#define FSO_GSM_AT_COMMAND_QUEUE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE_COMMAND, FsoGsmAtCommandQueueCommand))
#define FSO_GSM_IS_AT_COMMAND_QUEUE_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE_COMMAND))
#define FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE_COMMAND, FsoGsmAtCommandQueueCommandIface))

typedef struct _FsoGsmAtCommandQueueCommand FsoGsmAtCommandQueueCommand;
typedef struct _FsoGsmAtCommandQueueCommandIface FsoGsmAtCommandQueueCommandIface;

#define FSO_GSM_TYPE_AT_COMMAND_HANDLER (fso_gsm_at_command_handler_get_type ())
#define FSO_GSM_AT_COMMAND_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_AT_COMMAND_HANDLER, FsoGsmAtCommandHandler))
#define FSO_GSM_AT_COMMAND_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_AT_COMMAND_HANDLER, FsoGsmAtCommandHandlerClass))
#define FSO_GSM_IS_AT_COMMAND_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_AT_COMMAND_HANDLER))
#define FSO_GSM_IS_AT_COMMAND_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_AT_COMMAND_HANDLER))
#define FSO_GSM_AT_COMMAND_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_AT_COMMAND_HANDLER, FsoGsmAtCommandHandlerClass))

typedef struct _FsoGsmAtCommandHandler FsoGsmAtCommandHandler;
typedef struct _FsoGsmAtCommandHandlerClass FsoGsmAtCommandHandlerClass;
typedef struct _FsoGsmAtCommandHandlerPrivate FsoGsmAtCommandHandlerPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define FSO_GSM_TYPE_AT_COMMAND_QUEUE (fso_gsm_at_command_queue_get_type ())
#define FSO_GSM_AT_COMMAND_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE, FsoGsmAtCommandQueue))
#define FSO_GSM_AT_COMMAND_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_AT_COMMAND_QUEUE, FsoGsmAtCommandQueueClass))
#define FSO_GSM_IS_AT_COMMAND_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE))
#define FSO_GSM_IS_AT_COMMAND_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_AT_COMMAND_QUEUE))
#define FSO_GSM_AT_COMMAND_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_AT_COMMAND_QUEUE, FsoGsmAtCommandQueueClass))

typedef struct _FsoGsmAtCommandQueue FsoGsmAtCommandQueue;
typedef struct _FsoGsmAtCommandQueueClass FsoGsmAtCommandQueueClass;
typedef struct _FsoGsmAtCommandQueuePrivate FsoGsmAtCommandQueuePrivate;
#define _fso_framework_abstract_command_handler_unref0(var) ((var == NULL) ? NULL : (var = (fso_framework_abstract_command_handler_unref (var), NULL)))
typedef struct _fso_gsm_at_command_queue_enqueueAsyncData fso_gsm_at_command_queue_enqueueAsyncData;

#define FSO_GSM_TYPE_AT_COMMAND_SEQUENCE (fso_gsm_at_command_sequence_get_type ())
#define FSO_GSM_AT_COMMAND_SEQUENCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE, FsoGsmAtCommandSequence))
#define FSO_GSM_AT_COMMAND_SEQUENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE, FsoGsmAtCommandSequenceClass))
#define FSO_GSM_IS_AT_COMMAND_SEQUENCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE))
#define FSO_GSM_IS_AT_COMMAND_SEQUENCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE))
#define FSO_GSM_AT_COMMAND_SEQUENCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE, FsoGsmAtCommandSequenceClass))

typedef struct _FsoGsmAtCommandSequence FsoGsmAtCommandSequence;
typedef struct _FsoGsmAtCommandSequenceClass FsoGsmAtCommandSequenceClass;
typedef struct _FsoGsmAtCommandSequencePrivate FsoGsmAtCommandSequencePrivate;
#define _fso_gsm_at_command_sequence_unref0(var) ((var == NULL) ? NULL : (var = (fso_gsm_at_command_sequence_unref (var), NULL)))

#define FSO_GSM_TYPE_AT_CHANNEL (fso_gsm_at_channel_get_type ())
#define FSO_GSM_AT_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_AT_CHANNEL, FsoGsmAtChannel))
#define FSO_GSM_AT_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_AT_CHANNEL, FsoGsmAtChannelClass))
#define FSO_GSM_IS_AT_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_AT_CHANNEL))
#define FSO_GSM_IS_AT_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_AT_CHANNEL))
#define FSO_GSM_AT_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_AT_CHANNEL, FsoGsmAtChannelClass))

typedef struct _FsoGsmAtChannel FsoGsmAtChannel;
typedef struct _FsoGsmAtChannelClass FsoGsmAtChannelClass;

#define FSO_GSM_TYPE_ABSTRACT_AT_COMMAND (fso_gsm_abstract_at_command_get_type ())
#define FSO_GSM_ABSTRACT_AT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_ABSTRACT_AT_COMMAND, FsoGsmAbstractAtCommand))
#define FSO_GSM_ABSTRACT_AT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_ABSTRACT_AT_COMMAND, FsoGsmAbstractAtCommandClass))
#define FSO_GSM_IS_ABSTRACT_AT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_ABSTRACT_AT_COMMAND))
#define FSO_GSM_IS_ABSTRACT_AT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_ABSTRACT_AT_COMMAND))
#define FSO_GSM_ABSTRACT_AT_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_ABSTRACT_AT_COMMAND, FsoGsmAbstractAtCommandClass))

typedef struct _FsoGsmAbstractAtCommand FsoGsmAbstractAtCommand;
typedef struct _FsoGsmAbstractAtCommandClass FsoGsmAbstractAtCommandClass;

#define FSO_GSM_TYPE_CUSTOM_AT_COMMAND (fso_gsm_custom_at_command_get_type ())
#define FSO_GSM_CUSTOM_AT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), FSO_GSM_TYPE_CUSTOM_AT_COMMAND, FsoGsmCustomAtCommand))
#define FSO_GSM_CUSTOM_AT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), FSO_GSM_TYPE_CUSTOM_AT_COMMAND, FsoGsmCustomAtCommandClass))
#define FSO_GSM_IS_CUSTOM_AT_COMMAND(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), FSO_GSM_TYPE_CUSTOM_AT_COMMAND))
#define FSO_GSM_IS_CUSTOM_AT_COMMAND_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), FSO_GSM_TYPE_CUSTOM_AT_COMMAND))
#define FSO_GSM_CUSTOM_AT_COMMAND_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), FSO_GSM_TYPE_CUSTOM_AT_COMMAND, FsoGsmCustomAtCommandClass))

typedef struct _FsoGsmCustomAtCommand FsoGsmCustomAtCommand;
typedef struct _FsoGsmCustomAtCommandClass FsoGsmCustomAtCommandClass;
typedef struct _fso_gsm_at_command_sequence_performOnChannelData fso_gsm_at_command_sequence_performOnChannelData;
typedef struct _FsoGsmParamSpecAtCommandSequence FsoGsmParamSpecAtCommandSequence;

struct _FsoGsmAtCommandQueueCommandIface {
	GTypeInterface parent_iface;
	guint (*get_retry) (FsoGsmAtCommandQueueCommand* self);
	guint (*get_timeout) (FsoGsmAtCommandQueueCommand* self);
	gchar* (*get_prefix) (FsoGsmAtCommandQueueCommand* self);
	gchar* (*get_postfix) (FsoGsmAtCommandQueueCommand* self);
	gboolean (*is_valid_prefix) (FsoGsmAtCommandQueueCommand* self, const gchar* line);
};

struct _FsoGsmAtCommandHandler {
	FsoFrameworkAbstractCommandHandler parent_instance;
	FsoGsmAtCommandHandlerPrivate * priv;
	FsoGsmAtCommandQueueCommand* command;
	gchar** response;
	gint response_length1;
};

struct _FsoGsmAtCommandHandlerClass {
	FsoFrameworkAbstractCommandHandlerClass parent_class;
};

struct _FsoGsmAtCommandHandlerPrivate {
	gchar* request;
};

struct _FsoGsmAtCommandQueue {
	FsoFrameworkAbstractCommandQueue parent_instance;
	FsoGsmAtCommandQueuePrivate * priv;
	gchar* buffer;
	FsoFrameworkParser* parser;
};

struct _FsoGsmAtCommandQueueClass {
	FsoFrameworkAbstractCommandQueueClass parent_class;
};

struct _fso_gsm_at_command_queue_enqueueAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FsoGsmAtCommandQueue* self;
	FsoGsmAtCommandQueueCommand* command;
	gchar* request;
	gint retries;
	gint timeout;
	gchar** result;
	gint result_length1;
	FsoGsmAtCommandQueueCommand* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	FsoGsmAtCommandHandler* _tmp4_;
	FsoGsmAtCommandHandler* handler;
	gchar** _tmp5_;
	gint _tmp5__length1;
	gchar** _tmp6_;
	gint _tmp6__length1;
	gchar** _tmp7_;
	gint _tmp7__length1;
};

struct _FsoGsmAtCommandSequence {
	GTypeInstance parent_instance;
	volatile int ref_count;
	FsoGsmAtCommandSequencePrivate * priv;
};

struct _FsoGsmAtCommandSequenceClass {
	GTypeClass parent_class;
	void (*finalize) (FsoGsmAtCommandSequence *self);
};

struct _FsoGsmAtCommandSequencePrivate {
	gchar** commands;
	gint commands_length1;
	gint _commands_size_;
};

struct _fso_gsm_at_command_sequence_performOnChannelData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	FsoGsmAtCommandSequence* self;
	FsoGsmAtChannel* channel;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** element_collection;
	gint element_collection_length1;
	gint _element_collection_size_;
	gint element_it;
	gchar* _tmp1_;
	gchar* element;
	const gchar* _tmp2_;
	gchar** _tmp3_;
	gchar** _tmp4_;
	gchar** components;
	gint components_length1;
	gint _components_size_;
	gchar** _tmp5_;
	gint _tmp5__length1;
	const gchar* _tmp6_;
	FsoGsmCustomAtCommand* _tmp7_;
	FsoGsmCustomAtCommand* cmd;
	FsoGsmAtChannel* _tmp8_;
	FsoGsmCustomAtCommand* _tmp9_;
	const gchar* _tmp10_;
	gint _tmp11_;
	gchar** _tmp12_;
	gchar** _tmp13_;
	gint _tmp13__length1;
};

struct _FsoGsmParamSpecAtCommandSequence {
	GParamSpec parent_instance;
};


static gpointer fso_gsm_at_command_handler_parent_class = NULL;
static gpointer fso_gsm_at_command_queue_parent_class = NULL;
static gpointer fso_gsm_at_command_sequence_parent_class = NULL;

GType fso_gsm_at_command_queue_command_get_type (void) G_GNUC_CONST;
guint fso_gsm_at_command_queue_command_get_retry (FsoGsmAtCommandQueueCommand* self);
guint fso_gsm_at_command_queue_command_get_timeout (FsoGsmAtCommandQueueCommand* self);
gchar* fso_gsm_at_command_queue_command_get_prefix (FsoGsmAtCommandQueueCommand* self);
gchar* fso_gsm_at_command_queue_command_get_postfix (FsoGsmAtCommandQueueCommand* self);
gboolean fso_gsm_at_command_queue_command_is_valid_prefix (FsoGsmAtCommandQueueCommand* self, const gchar* line);
GType fso_gsm_at_command_handler_get_type (void) G_GNUC_CONST;
#define FSO_GSM_AT_COMMAND_HANDLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FSO_GSM_TYPE_AT_COMMAND_HANDLER, FsoGsmAtCommandHandlerPrivate))
enum  {
	FSO_GSM_AT_COMMAND_HANDLER_DUMMY_PROPERTY
};
FsoGsmAtCommandHandler* fso_gsm_at_command_handler_new (FsoGsmAtCommandQueueCommand* command, const gchar* request, guint retries, guint timeout);
FsoGsmAtCommandHandler* fso_gsm_at_command_handler_construct (GType object_type, FsoGsmAtCommandQueueCommand* command, const gchar* request, guint retries, guint timeout);
static void fso_gsm_at_command_handler_real_writeToTransport (FsoFrameworkAbstractCommandHandler* base, FsoFrameworkTransport* transport);
static gchar* fso_gsm_at_command_handler_real_to_string (FsoFrameworkAbstractCommandHandler* base);
static void fso_gsm_at_command_handler_finalize (FsoFrameworkAbstractCommandHandler* obj);
GType fso_gsm_at_command_queue_get_type (void) G_GNUC_CONST;
enum  {
	FSO_GSM_AT_COMMAND_QUEUE_DUMMY_PROPERTY
};
#define FSO_GSM_AT_COMMAND_QUEUE_COMMAND_QUEUE_BUFFER_SIZE 4096
FsoGsmAtCommandQueue* fso_gsm_at_command_queue_new (FsoFrameworkTransport* transport, FsoFrameworkParser* parser);
FsoGsmAtCommandQueue* fso_gsm_at_command_queue_construct (GType object_type, FsoFrameworkTransport* transport, FsoFrameworkParser* parser);
gboolean fso_gsm_at_command_queue_haveCommand (FsoGsmAtCommandQueue* self);
static gboolean _fso_gsm_at_command_queue_haveCommand_fso_framework_parser_have_command_func (gpointer self);
gboolean fso_gsm_at_command_queue_isExpectedPrefix (FsoGsmAtCommandQueue* self, const gchar* line);
static gboolean _fso_gsm_at_command_queue_isExpectedPrefix_fso_framework_parser_expected_prefix_func (const gchar* line, gpointer self);
void fso_gsm_at_command_queue_onParserCompletedSolicited (FsoGsmAtCommandQueue* self, gchar** response, int response_length1);
static void _fso_gsm_at_command_queue_onParserCompletedSolicited_fso_framework_parser_solicited_completed_func (gchar** response, int response_length1, gpointer self);
void fso_gsm_at_command_queue_onParserCompletedUnsolicited (FsoGsmAtCommandQueue* self, gchar** response, int response_length1);
static void _fso_gsm_at_command_queue_onParserCompletedUnsolicited_fso_framework_parser_unsolicited_completed_func (gchar** response, int response_length1, gpointer self);
static void fso_gsm_at_command_queue_real_onReadFromTransport (FsoFrameworkAbstractCommandQueue* base, FsoFrameworkTransport* t);
void fso_gsm_at_command_queue_onSolicitedResponse (FsoGsmAtCommandQueue* self, FsoGsmAtCommandHandler* bundle, gchar** response, int response_length1);
static gboolean _fso_framework_abstract_command_queue_checkRestartingQ_gsource_func (gpointer self);
static gchar** _vala_array_dup6 (gchar** self, int length);
static void fso_gsm_at_command_queue_real_onResponseTimeout (FsoFrameworkAbstractCommandQueue* base, FsoFrameworkAbstractCommandHandler* bundle);
void fso_gsm_at_command_queue_enqueue (FsoGsmAtCommandQueue* self, FsoGsmAtCommandQueueCommand* command, const gchar* request, gint retries);
static void fso_gsm_at_command_queue_enqueueAsync_data_free (gpointer _data);
void fso_gsm_at_command_queue_enqueueAsync (FsoGsmAtCommandQueue* self, FsoGsmAtCommandQueueCommand* command, const gchar* request, gint retries, gint timeout, GAsyncReadyCallback _callback_, gpointer _user_data_);
gchar** fso_gsm_at_command_queue_enqueueAsync_finish (FsoGsmAtCommandQueue* self, GAsyncResult* _res_, int* result_length1);
static gboolean fso_gsm_at_command_queue_enqueueAsync_co (fso_gsm_at_command_queue_enqueueAsyncData* _data_);
static gboolean _fso_gsm_at_command_queue_enqueueAsync_co_gsource_func (gpointer self);
static gchar** _vala_array_dup7 (gchar** self, int length);
static void fso_gsm_at_command_queue_finalize (GObject* obj);
gpointer fso_gsm_at_command_sequence_ref (gpointer instance);
void fso_gsm_at_command_sequence_unref (gpointer instance);
GParamSpec* fso_gsm_param_spec_at_command_sequence (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void fso_gsm_value_set_at_command_sequence (GValue* value, gpointer v_object);
void fso_gsm_value_take_at_command_sequence (GValue* value, gpointer v_object);
gpointer fso_gsm_value_get_at_command_sequence (const GValue* value);
GType fso_gsm_at_command_sequence_get_type (void) G_GNUC_CONST;
#define FSO_GSM_AT_COMMAND_SEQUENCE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), FSO_GSM_TYPE_AT_COMMAND_SEQUENCE, FsoGsmAtCommandSequencePrivate))
enum  {
	FSO_GSM_AT_COMMAND_SEQUENCE_DUMMY_PROPERTY
};
FsoGsmAtCommandSequence* fso_gsm_at_command_sequence_new (gchar** commands, int commands_length1);
FsoGsmAtCommandSequence* fso_gsm_at_command_sequence_construct (GType object_type, gchar** commands, int commands_length1);
static gchar** _vala_array_dup8 (gchar** self, int length);
void fso_gsm_at_command_sequence_append (FsoGsmAtCommandSequence* self, gchar** commands, int commands_length1);
static void _vala_array_add5 (gchar*** array, int* length, int* size, gchar* value);
static void fso_gsm_at_command_sequence_performOnChannel_data_free (gpointer _data);
GType fso_gsm_at_channel_get_type (void) G_GNUC_CONST;
void fso_gsm_at_command_sequence_performOnChannel (FsoGsmAtCommandSequence* self, FsoGsmAtChannel* channel, GAsyncReadyCallback _callback_, gpointer _user_data_);
void fso_gsm_at_command_sequence_performOnChannel_finish (FsoGsmAtCommandSequence* self, GAsyncResult* _res_);
static gboolean fso_gsm_at_command_sequence_performOnChannel_co (fso_gsm_at_command_sequence_performOnChannelData* _data_);
FsoGsmCustomAtCommand* fso_gsm_custom_at_command_new (const gchar* name, gboolean prefixoptional);
FsoGsmCustomAtCommand* fso_gsm_custom_at_command_construct (GType object_type, const gchar* name, gboolean prefixoptional);
GType fso_gsm_abstract_at_command_get_type (void) G_GNUC_CONST;
GType fso_gsm_custom_at_command_get_type (void) G_GNUC_CONST;
static void fso_gsm_at_command_sequence_performOnChannel_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void fso_gsm_at_command_sequence_finalize (FsoGsmAtCommandSequence* obj);
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);


guint fso_gsm_at_command_queue_command_get_retry (FsoGsmAtCommandQueueCommand* self) {
	g_return_val_if_fail (self != NULL, 0U);
	return FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE (self)->get_retry (self);
}


guint fso_gsm_at_command_queue_command_get_timeout (FsoGsmAtCommandQueueCommand* self) {
	g_return_val_if_fail (self != NULL, 0U);
	return FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE (self)->get_timeout (self);
}


gchar* fso_gsm_at_command_queue_command_get_prefix (FsoGsmAtCommandQueueCommand* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE (self)->get_prefix (self);
}


gchar* fso_gsm_at_command_queue_command_get_postfix (FsoGsmAtCommandQueueCommand* self) {
	g_return_val_if_fail (self != NULL, NULL);
	return FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE (self)->get_postfix (self);
}


gboolean fso_gsm_at_command_queue_command_is_valid_prefix (FsoGsmAtCommandQueueCommand* self, const gchar* line) {
	g_return_val_if_fail (self != NULL, FALSE);
	return FSO_GSM_AT_COMMAND_QUEUE_COMMAND_GET_INTERFACE (self)->is_valid_prefix (self, line);
}


static void fso_gsm_at_command_queue_command_base_init (FsoGsmAtCommandQueueCommandIface * iface) {
	static gboolean initialized = FALSE;
	if (!initialized) {
		initialized = TRUE;
	}
}


/**
 * @class FsoFramework.AtCommandQueueCommand
 **/
GType fso_gsm_at_command_queue_command_get_type (void) {
	static volatile gsize fso_gsm_at_command_queue_command_type_id__volatile = 0;
	if (g_once_init_enter (&fso_gsm_at_command_queue_command_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FsoGsmAtCommandQueueCommandIface), (GBaseInitFunc) fso_gsm_at_command_queue_command_base_init, (GBaseFinalizeFunc) NULL, (GClassInitFunc) NULL, (GClassFinalizeFunc) NULL, NULL, 0, 0, (GInstanceInitFunc) NULL, NULL };
		GType fso_gsm_at_command_queue_command_type_id;
		fso_gsm_at_command_queue_command_type_id = g_type_register_static (G_TYPE_INTERFACE, "FsoGsmAtCommandQueueCommand", &g_define_type_info, 0);
		g_type_interface_add_prerequisite (fso_gsm_at_command_queue_command_type_id, G_TYPE_OBJECT);
		g_once_init_leave (&fso_gsm_at_command_queue_command_type_id__volatile, fso_gsm_at_command_queue_command_type_id);
	}
	return fso_gsm_at_command_queue_command_type_id__volatile;
}


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


FsoGsmAtCommandHandler* fso_gsm_at_command_handler_construct (GType object_type, FsoGsmAtCommandQueueCommand* command, const gchar* request, guint retries, guint timeout) {
	FsoGsmAtCommandHandler* self = NULL;
	FsoGsmAtCommandQueueCommand* _tmp0_;
	FsoGsmAtCommandQueueCommand* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	guint _tmp4_ = 0U;
	guint _tmp5_;
	guint _tmp9_;
	guint _tmp10_ = 0U;
	guint _tmp11_;
	guint _tmp15_;
	g_return_val_if_fail (command != NULL, NULL);
	g_return_val_if_fail (request != NULL, NULL);
	self = (FsoGsmAtCommandHandler*) fso_framework_abstract_command_handler_construct (object_type);
	_tmp0_ = command;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->command);
	self->command = _tmp1_;
	_tmp2_ = request;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->priv->request);
	self->priv->request = _tmp3_;
	_tmp5_ = retries;
	if (_tmp5_ > ((guint) 0)) {
		guint _tmp6_;
		_tmp6_ = retries;
		_tmp4_ = _tmp6_;
	} else {
		FsoGsmAtCommandQueueCommand* _tmp7_;
		guint _tmp8_ = 0U;
		_tmp7_ = command;
		_tmp8_ = fso_gsm_at_command_queue_command_get_retry (_tmp7_);
		_tmp4_ = _tmp8_;
	}
	_tmp9_ = _tmp4_;
	((FsoFrameworkAbstractCommandHandler*) self)->retry = _tmp9_;
	_tmp11_ = timeout;
	if (_tmp11_ > ((guint) 0)) {
		guint _tmp12_;
		_tmp12_ = timeout;
		_tmp10_ = _tmp12_;
	} else {
		FsoGsmAtCommandQueueCommand* _tmp13_;
		guint _tmp14_ = 0U;
		_tmp13_ = command;
		_tmp14_ = fso_gsm_at_command_queue_command_get_timeout (_tmp13_);
		_tmp10_ = _tmp14_;
	}
	_tmp15_ = _tmp10_;
	((FsoFrameworkAbstractCommandHandler*) self)->timeout = _tmp15_;
	return self;
}


FsoGsmAtCommandHandler* fso_gsm_at_command_handler_new (FsoGsmAtCommandQueueCommand* command, const gchar* request, guint retries, guint timeout) {
	return fso_gsm_at_command_handler_construct (FSO_GSM_TYPE_AT_COMMAND_HANDLER, command, request, retries, timeout);
}


static void fso_gsm_at_command_handler_real_writeToTransport (FsoFrameworkAbstractCommandHandler* base, FsoFrameworkTransport* transport) {
	FsoGsmAtCommandHandler * self;
	FsoGsmAtCommandQueueCommand* _tmp0_;
	gchar* _tmp1_ = NULL;
	gchar* prefix;
	FsoGsmAtCommandQueueCommand* _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* postfix;
	const gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	const gchar* _tmp20_;
	gint _tmp21_;
	gint _tmp22_;
	self = (FsoGsmAtCommandHandler*) base;
	g_return_if_fail (transport != NULL);
	_tmp0_ = self->command;
	_tmp1_ = fso_gsm_at_command_queue_command_get_prefix (_tmp0_);
	prefix = _tmp1_;
	_tmp2_ = self->command;
	_tmp3_ = fso_gsm_at_command_queue_command_get_postfix (_tmp2_);
	postfix = _tmp3_;
	_tmp4_ = prefix;
	_tmp5_ = strlen (_tmp4_);
	_tmp6_ = _tmp5_;
	if (_tmp6_ > 0) {
		FsoFrameworkTransport* _tmp7_;
		const gchar* _tmp8_;
		const gchar* _tmp9_;
		gint _tmp10_;
		gint _tmp11_;
		_tmp7_ = transport;
		_tmp8_ = prefix;
		_tmp9_ = prefix;
		_tmp10_ = strlen (_tmp9_);
		_tmp11_ = _tmp10_;
		fso_framework_transport_write (_tmp7_, _tmp8_, (gint) _tmp11_);
	}
	_tmp12_ = self->priv->request;
	_tmp13_ = strlen (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ > 0) {
		FsoFrameworkTransport* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		_tmp15_ = transport;
		_tmp16_ = self->priv->request;
		_tmp17_ = self->priv->request;
		_tmp18_ = strlen (_tmp17_);
		_tmp19_ = _tmp18_;
		fso_framework_transport_write (_tmp15_, _tmp16_, (gint) _tmp19_);
	}
	_tmp20_ = postfix;
	_tmp21_ = strlen (_tmp20_);
	_tmp22_ = _tmp21_;
	if (_tmp22_ > 0) {
		FsoFrameworkTransport* _tmp23_;
		const gchar* _tmp24_;
		const gchar* _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		_tmp23_ = transport;
		_tmp24_ = postfix;
		_tmp25_ = postfix;
		_tmp26_ = strlen (_tmp25_);
		_tmp27_ = _tmp26_;
		fso_framework_transport_write (_tmp23_, _tmp24_, (gint) _tmp27_);
	}
	_g_free0 (postfix);
	_g_free0 (prefix);
}


static gchar* fso_gsm_at_command_handler_real_to_string (FsoFrameworkAbstractCommandHandler* base) {
	FsoGsmAtCommandHandler * self;
	gchar* result = NULL;
	gchar** _tmp0_;
	gint _tmp0__length1;
	self = (FsoGsmAtCommandHandler*) base;
	_tmp0_ = self->response;
	_tmp0__length1 = self->response_length1;
	if (_tmp0_ != NULL) {
		const gchar* _tmp1_;
		gchar** _tmp2_;
		gint _tmp2__length1;
		gchar* _tmp3_ = NULL;
		gchar* _tmp4_;
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_;
		_tmp1_ = self->priv->request;
		_tmp2_ = self->response;
		_tmp2__length1 = self->response_length1;
		_tmp3_ = fso_framework_string_handling_stringListToString (_tmp2_, _tmp2__length1);
		_tmp4_ = _tmp3_;
		_tmp5_ = g_strdup_printf ("\"%s\" -> %s", _tmp1_, _tmp4_);
		_tmp6_ = _tmp5_;
		_g_free0 (_tmp4_);
		result = _tmp6_;
		return result;
	} else {
		const gchar* _tmp7_;
		gchar* _tmp8_;
		_tmp7_ = self->priv->request;
		_tmp8_ = g_strdup (_tmp7_);
		result = _tmp8_;
		return result;
	}
}


static void fso_gsm_at_command_handler_class_init (FsoGsmAtCommandHandlerClass * klass) {
	fso_gsm_at_command_handler_parent_class = g_type_class_peek_parent (klass);
	FSO_FRAMEWORK_ABSTRACT_COMMAND_HANDLER_CLASS (klass)->finalize = fso_gsm_at_command_handler_finalize;
	g_type_class_add_private (klass, sizeof (FsoGsmAtCommandHandlerPrivate));
	FSO_FRAMEWORK_ABSTRACT_COMMAND_HANDLER_CLASS (klass)->writeToTransport = fso_gsm_at_command_handler_real_writeToTransport;
	FSO_FRAMEWORK_ABSTRACT_COMMAND_HANDLER_CLASS (klass)->to_string = fso_gsm_at_command_handler_real_to_string;
}


static void fso_gsm_at_command_handler_instance_init (FsoGsmAtCommandHandler * self) {
	self->priv = FSO_GSM_AT_COMMAND_HANDLER_GET_PRIVATE (self);
}


static void fso_gsm_at_command_handler_finalize (FsoFrameworkAbstractCommandHandler* obj) {
	FsoGsmAtCommandHandler * self;
	self = FSO_GSM_AT_COMMAND_HANDLER (obj);
	_g_object_unref0 (self->command);
	_g_free0 (self->priv->request);
	self->response = (_vala_array_free (self->response, self->response_length1, (GDestroyNotify) g_free), NULL);
	FSO_FRAMEWORK_ABSTRACT_COMMAND_HANDLER_CLASS (fso_gsm_at_command_handler_parent_class)->finalize (obj);
}


/**
 * @class FsoGsm.AtCommandHandler
 **/
GType fso_gsm_at_command_handler_get_type (void) {
	static volatile gsize fso_gsm_at_command_handler_type_id__volatile = 0;
	if (g_once_init_enter (&fso_gsm_at_command_handler_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FsoGsmAtCommandHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_gsm_at_command_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoGsmAtCommandHandler), 0, (GInstanceInitFunc) fso_gsm_at_command_handler_instance_init, NULL };
		GType fso_gsm_at_command_handler_type_id;
		fso_gsm_at_command_handler_type_id = g_type_register_static (FSO_FRAMEWORK_TYPE_ABSTRACT_COMMAND_HANDLER, "FsoGsmAtCommandHandler", &g_define_type_info, 0);
		g_once_init_leave (&fso_gsm_at_command_handler_type_id__volatile, fso_gsm_at_command_handler_type_id);
	}
	return fso_gsm_at_command_handler_type_id__volatile;
}


static gboolean _fso_gsm_at_command_queue_haveCommand_fso_framework_parser_have_command_func (gpointer self) {
	gboolean result;
	result = fso_gsm_at_command_queue_haveCommand (self);
	return result;
}


static gboolean _fso_gsm_at_command_queue_isExpectedPrefix_fso_framework_parser_expected_prefix_func (const gchar* line, gpointer self) {
	gboolean result;
	result = fso_gsm_at_command_queue_isExpectedPrefix (self, line);
	return result;
}


static void _fso_gsm_at_command_queue_onParserCompletedSolicited_fso_framework_parser_solicited_completed_func (gchar** response, int response_length1, gpointer self) {
	fso_gsm_at_command_queue_onParserCompletedSolicited (self, response, response_length1);
}


static void _fso_gsm_at_command_queue_onParserCompletedUnsolicited_fso_framework_parser_unsolicited_completed_func (gchar** response, int response_length1, gpointer self) {
	fso_gsm_at_command_queue_onParserCompletedUnsolicited (self, response, response_length1);
}


FsoGsmAtCommandQueue* fso_gsm_at_command_queue_construct (GType object_type, FsoFrameworkTransport* transport, FsoFrameworkParser* parser) {
	FsoGsmAtCommandQueue * self = NULL;
	FsoFrameworkTransport* _tmp0_;
	FsoFrameworkParser* _tmp1_;
	FsoFrameworkParser* _tmp2_;
	FsoFrameworkParser* _tmp3_;
	void* _tmp4_ = NULL;
	g_return_val_if_fail (transport != NULL, NULL);
	g_return_val_if_fail (parser != NULL, NULL);
	_tmp0_ = transport;
	self = (FsoGsmAtCommandQueue*) fso_framework_abstract_command_queue_construct (object_type, _tmp0_);
	_tmp1_ = parser;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (self->parser);
	self->parser = _tmp2_;
	_tmp3_ = parser;
	fso_framework_parser_setDelegates (_tmp3_, _fso_gsm_at_command_queue_haveCommand_fso_framework_parser_have_command_func, self, _fso_gsm_at_command_queue_isExpectedPrefix_fso_framework_parser_expected_prefix_func, self, _fso_gsm_at_command_queue_onParserCompletedSolicited_fso_framework_parser_solicited_completed_func, self, _fso_gsm_at_command_queue_onParserCompletedUnsolicited_fso_framework_parser_unsolicited_completed_func, self);
	_tmp4_ = g_malloc ((gsize) FSO_GSM_AT_COMMAND_QUEUE_COMMAND_QUEUE_BUFFER_SIZE);
	self->buffer = _tmp4_;
	return self;
}


FsoGsmAtCommandQueue* fso_gsm_at_command_queue_new (FsoFrameworkTransport* transport, FsoFrameworkParser* parser) {
	return fso_gsm_at_command_queue_construct (FSO_GSM_TYPE_AT_COMMAND_QUEUE, transport, parser);
}


static void fso_gsm_at_command_queue_real_onReadFromTransport (FsoFrameworkAbstractCommandQueue* base, FsoFrameworkTransport* t) {
	FsoGsmAtCommandQueue * self;
	FsoFrameworkTransport* _tmp0_;
	FsoFrameworkTransport* _tmp1_;
	gchar* _tmp2_;
	gint _tmp3_ = 0;
	gint bytesread;
	gint _tmp4_;
	gchar* _tmp5_;
	gint _tmp6_;
	gchar _tmp7_;
	FsoFrameworkParser* _tmp8_;
	gchar* _tmp9_;
	gint _tmp10_;
	self = (FsoGsmAtCommandQueue*) base;
	g_return_if_fail (t != NULL);
	_tmp0_ = fso_framework_command_queue_get_transport ((FsoFrameworkCommandQueue*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->buffer;
	_tmp3_ = fso_framework_transport_read (_tmp1_, _tmp2_, FSO_GSM_AT_COMMAND_QUEUE_COMMAND_QUEUE_BUFFER_SIZE);
	bytesread = _tmp3_;
	_tmp4_ = bytesread;
	if (_tmp4_ == 0) {
		return;
	}
	_tmp5_ = self->buffer;
	_tmp6_ = bytesread;
	_tmp5_[_tmp6_] = (gchar) 0;
	_tmp7_ = _tmp5_[_tmp6_];
	_tmp8_ = self->parser;
	_tmp9_ = self->buffer;
	_tmp10_ = bytesread;
	fso_framework_parser_feed (_tmp8_, (const gchar*) _tmp9_, _tmp10_);
}


gboolean fso_gsm_at_command_queue_haveCommand (FsoGsmAtCommandQueue* self) {
	gboolean result = FALSE;
	FsoFrameworkAbstractCommandHandler* _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = ((FsoFrameworkAbstractCommandQueue*) self)->current;
	result = _tmp0_ != NULL;
	return result;
}


gboolean fso_gsm_at_command_queue_isExpectedPrefix (FsoGsmAtCommandQueue* self, const gchar* line) {
	gboolean result = FALSE;
	FsoFrameworkAbstractCommandHandler* _tmp0_;
	FsoFrameworkAbstractCommandHandler* _tmp1_;
	FsoGsmAtCommandQueueCommand* _tmp2_;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (line != NULL, FALSE);
	_tmp0_ = ((FsoFrameworkAbstractCommandQueue*) self)->current;
	g_assert (_tmp0_ != NULL);
	_tmp1_ = ((FsoFrameworkAbstractCommandQueue*) self)->current;
	_tmp2_ = FSO_GSM_AT_COMMAND_HANDLER (_tmp1_)->command;
	_tmp3_ = line;
	_tmp4_ = fso_gsm_at_command_queue_command_is_valid_prefix (_tmp2_, _tmp3_);
	result = _tmp4_;
	return result;
}


static gboolean _fso_framework_abstract_command_queue_checkRestartingQ_gsource_func (gpointer self) {
	gboolean result;
	result = fso_framework_abstract_command_queue_checkRestartingQ (self);
	return result;
}


void fso_gsm_at_command_queue_onParserCompletedSolicited (FsoGsmAtCommandQueue* self, gchar** response, int response_length1) {
	FsoFrameworkAbstractCommandHandler* _tmp0_;
	FsoFrameworkAbstractCommandHandler* _tmp1_;
	gchar** _tmp2_;
	gint _tmp2__length1;
	g_return_if_fail (self != NULL);
	g_object_ref ((GObject*) self);
	_tmp0_ = ((FsoFrameworkAbstractCommandQueue*) self)->current;
	g_assert (_tmp0_ != NULL);
	_tmp1_ = ((FsoFrameworkAbstractCommandQueue*) self)->current;
	_tmp2_ = response;
	_tmp2__length1 = response_length1;
	fso_gsm_at_command_queue_onSolicitedResponse (self, FSO_GSM_AT_COMMAND_HANDLER (_tmp1_), _tmp2_, _tmp2__length1);
	_fso_framework_abstract_command_handler_unref0 (((FsoFrameworkAbstractCommandQueue*) self)->current);
	((FsoFrameworkAbstractCommandQueue*) self)->current = NULL;
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, _fso_framework_abstract_command_queue_checkRestartingQ_gsource_func, g_object_ref ((FsoFrameworkAbstractCommandQueue*) self), g_object_unref);
	g_object_unref ((GObject*) self);
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = needle;
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
	result = _tmp1_ != NULL;
	return result;
}


static gchar* string_strip (const gchar* self) {
	gchar* result = NULL;
	gchar* _tmp0_ = NULL;
	gchar* _result_;
	const gchar* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = g_strdup (self);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	g_strstrip (_tmp1_);
	result = _result_;
	return result;
}


void fso_gsm_at_command_queue_onParserCompletedUnsolicited (FsoGsmAtCommandQueue* self, gchar** response, int response_length1) {
	FsoFrameworkTransport* _tmp0_;
	FsoFrameworkTransport* _tmp1_;
	FsoFrameworkLogger* _tmp2_;
	gchar** _tmp3_;
	gint _tmp3__length1;
	gchar* _tmp4_ = NULL;
	gchar* _tmp5_;
	gchar* _tmp6_ = NULL;
	gchar* _tmp7_;
	gchar** _tmp8_;
	gint _tmp8__length1;
	const gchar* _tmp9_;
	gboolean _tmp10_ = FALSE;
	gchar** _tmp14_;
	gint _tmp14__length1;
	const gchar* _tmp15_;
	gchar** _tmp16_;
	gchar** _tmp17_ = NULL;
	gchar** strings;
	gint strings_length1;
	gint _strings_size_;
	gchar** _tmp18_;
	gint _tmp18__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = fso_framework_command_queue_get_transport ((FsoFrameworkCommandQueue*) self);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_->logger;
	_tmp3_ = response;
	_tmp3__length1 = response_length1;
	_tmp4_ = fso_framework_string_handling_stringListToString (_tmp3_, _tmp3__length1);
	_tmp5_ = _tmp4_;
	_tmp6_ = g_strdup_printf ("URC: %s", _tmp5_);
	_tmp7_ = _tmp6_;
	fso_framework_logger_info (_tmp2_, _tmp7_);
	_g_free0 (_tmp7_);
	_g_free0 (_tmp5_);
	_tmp8_ = response;
	_tmp8__length1 = response_length1;
	_tmp9_ = _tmp8_[0];
	_tmp10_ = string_contains (_tmp9_, ":");
	if (!_tmp10_) {
		FsoFrameworkCommandQueueUnsolicitedHandler _tmp11_;
		void* _tmp11__target;
		gchar** _tmp12_;
		gint _tmp12__length1;
		const gchar* _tmp13_;
		_tmp11_ = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler;
		_tmp11__target = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler_target;
		_tmp12_ = response;
		_tmp12__length1 = response_length1;
		_tmp13_ = _tmp12_[0];
		_tmp11_ (_tmp13_, "", NULL, _tmp11__target);
		return;
	}
	_tmp14_ = response;
	_tmp14__length1 = response_length1;
	_tmp15_ = _tmp14_[0];
	_tmp17_ = _tmp16_ = g_strsplit (_tmp15_, ":", 2);
	strings = _tmp17_;
	strings_length1 = _vala_array_length (_tmp16_);
	_strings_size_ = strings_length1;
	_tmp18_ = response;
	_tmp18__length1 = response_length1;
	if (_tmp18__length1 == 1) {
		FsoFrameworkCommandQueueUnsolicitedHandler _tmp19_;
		void* _tmp19__target;
		gchar** _tmp20_;
		gint _tmp20__length1;
		const gchar* _tmp21_;
		gchar** _tmp22_;
		gint _tmp22__length1;
		const gchar* _tmp23_;
		gchar* _tmp24_ = NULL;
		gchar* _tmp25_;
		_tmp19_ = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler;
		_tmp19__target = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler_target;
		_tmp20_ = strings;
		_tmp20__length1 = strings_length1;
		_tmp21_ = _tmp20_[0];
		_tmp22_ = strings;
		_tmp22__length1 = strings_length1;
		_tmp23_ = _tmp22_[1];
		_tmp24_ = string_strip (_tmp23_);
		_tmp25_ = _tmp24_;
		_tmp19_ (_tmp21_, _tmp25_, NULL, _tmp19__target);
		_g_free0 (_tmp25_);
	} else {
		gchar** _tmp26_;
		gint _tmp26__length1;
		_tmp26_ = response;
		_tmp26__length1 = response_length1;
		if (_tmp26__length1 == 2) {
			FsoFrameworkCommandQueueUnsolicitedHandler _tmp27_;
			void* _tmp27__target;
			gchar** _tmp28_;
			gint _tmp28__length1;
			const gchar* _tmp29_;
			gchar** _tmp30_;
			gint _tmp30__length1;
			const gchar* _tmp31_;
			gchar* _tmp32_ = NULL;
			gchar* _tmp33_;
			gchar** _tmp34_;
			gint _tmp34__length1;
			const gchar* _tmp35_;
			_tmp27_ = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler;
			_tmp27__target = ((FsoFrameworkAbstractCommandQueue*) self)->urchandler_target;
			_tmp28_ = strings;
			_tmp28__length1 = strings_length1;
			_tmp29_ = _tmp28_[0];
			_tmp30_ = strings;
			_tmp30__length1 = strings_length1;
			_tmp31_ = _tmp30_[1];
			_tmp32_ = string_strip (_tmp31_);
			_tmp33_ = _tmp32_;
			_tmp34_ = response;
			_tmp34__length1 = response_length1;
			_tmp35_ = _tmp34_[1];
			_tmp27_ (_tmp29_, _tmp33_, _tmp35_, _tmp27__target);
			_g_free0 (_tmp33_);
		} else {
			FsoFrameworkTransport* _tmp36_;
			FsoFrameworkTransport* _tmp37_;
			FsoFrameworkLogger* _tmp38_;
			gchar** _tmp39_;
			gint _tmp39__length1;
			gchar* _tmp40_ = NULL;
			gchar* _tmp41_;
			gchar* _tmp42_ = NULL;
			gchar* _tmp43_;
			_tmp36_ = fso_framework_command_queue_get_transport ((FsoFrameworkCommandQueue*) self);
			_tmp37_ = _tmp36_;
			_tmp38_ = _tmp37_->logger;
			_tmp39_ = response;
			_tmp39__length1 = response_length1;
			_tmp40_ = g_strdup_printf ("%i", _tmp39__length1);
			_tmp41_ = _tmp40_;
			_tmp42_ = g_strconcat ("Can't handle URC w/ ", _tmp41_, " lines (max 2) yet!", NULL);
			_tmp43_ = _tmp42_;
			fso_framework_logger_critical (_tmp38_, _tmp43_);
			_g_free0 (_tmp43_);
			_g_free0 (_tmp41_);
		}
	}
	strings = (_vala_array_free (strings, strings_length1, (GDestroyNotify) g_free), NULL);
}


static gchar** _vala_array_dup6 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


void fso_gsm_at_command_queue_onSolicitedResponse (FsoGsmAtCommandQueue* self, FsoGsmAtCommandHandler* bundle, gchar** response, int response_length1) {
	FsoGsmAtCommandHandler* _tmp0_;
	gchar** _tmp1_;
	gint _tmp1__length1;
	gchar** _tmp2_;
	gint _tmp2__length1;
	FsoFrameworkTransport* _tmp3_;
	FsoFrameworkTransport* _tmp4_;
	FsoFrameworkLogger* _tmp5_;
	FsoGsmAtCommandHandler* _tmp6_;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_;
	gboolean _tmp11_ = FALSE;
	FsoGsmAtCommandHandler* _tmp12_;
	GSourceFunc _tmp13_;
	void* _tmp13__target;
	FsoGsmAtCommandHandler* _tmp14_;
	GSourceFunc _tmp15_;
	void* _tmp15__target;
	g_return_if_fail (self != NULL);
	g_return_if_fail (bundle != NULL);
	fso_framework_abstract_command_queue_resetTimeout ((FsoFrameworkAbstractCommandQueue*) self);
	_tmp0_ = bundle;
	_tmp1_ = response;
	_tmp1__length1 = response_length1;
	_tmp2_ = (_tmp1_ != NULL) ? _vala_array_dup6 (_tmp1_, _tmp1__length1) : ((gpointer) _tmp1_);
	_tmp2__length1 = _tmp1__length1;
	_tmp0_->response = (_vala_array_free (_tmp0_->response, _tmp0_->response_length1, (GDestroyNotify) g_free), NULL);
	_tmp0_->response = _tmp2_;
	_tmp0_->response_length1 = _tmp2__length1;
	_tmp3_ = fso_framework_command_queue_get_transport ((FsoFrameworkCommandQueue*) self);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_->logger;
	_tmp6_ = bundle;
	_tmp7_ = fso_framework_abstract_command_handler_to_string ((FsoFrameworkAbstractCommandHandler*) _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = g_strconcat ("SRC: ", _tmp8_, NULL);
	_tmp10_ = _tmp9_;
	_tmp11_ = fso_framework_logger_debug (_tmp5_, _tmp10_);
	g_assert (_tmp11_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp8_);
	_tmp12_ = bundle;
	_tmp13_ = ((FsoFrameworkAbstractCommandHandler*) _tmp12_)->callback;
	_tmp13__target = ((FsoFrameworkAbstractCommandHandler*) _tmp12_)->callback_target;
	g_assert (_tmp13_ != NULL);
	_tmp14_ = bundle;
	_tmp15_ = ((FsoFrameworkAbstractCommandHandler*) _tmp14_)->callback;
	_tmp15__target = ((FsoFrameworkAbstractCommandHandler*) _tmp14_)->callback_target;
	_tmp15_ (_tmp15__target);
}


static void fso_gsm_at_command_queue_real_onResponseTimeout (FsoFrameworkAbstractCommandQueue* base, FsoFrameworkAbstractCommandHandler* bundle) {
	FsoGsmAtCommandQueue * self;
	FsoFrameworkAbstractCommandHandler* _tmp0_;
	FsoFrameworkAbstractCommandHandler* _tmp1_;
	guint _tmp2_;
	gchar* _tmp3_ = NULL;
	gchar* _tmp4_;
	gchar* _tmp5_ = NULL;
	gchar** _tmp6_ = NULL;
	gchar** _tmp7_;
	gint _tmp7__length1;
	self = (FsoGsmAtCommandQueue*) base;
	g_return_if_fail (bundle != NULL);
	_tmp0_ = bundle;
	_tmp1_ = bundle;
	_tmp2_ = _tmp1_->timeout;
	_tmp3_ = g_strdup_printf ("%u", _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strconcat ("+EXT: TIMEOUT ", _tmp4_, NULL);
	_tmp6_ = g_new0 (gchar*, 1 + 1);
	_tmp6_[0] = _tmp5_;
	_tmp7_ = _tmp6_;
	_tmp7__length1 = 1;
	fso_gsm_at_command_queue_onSolicitedResponse (self, FSO_GSM_AT_COMMAND_HANDLER (_tmp0_), _tmp7_, 1);
	_tmp7_ = (_vala_array_free (_tmp7_, _tmp7__length1, (GDestroyNotify) g_free), NULL);
	_g_free0 (_tmp4_);
}


void fso_gsm_at_command_queue_enqueue (FsoGsmAtCommandQueue* self, FsoGsmAtCommandQueueCommand* command, const gchar* request, gint retries) {
	FsoGsmAtCommandQueueCommand* _tmp0_;
	const gchar* _tmp1_;
	gint _tmp2_;
	FsoGsmAtCommandHandler* _tmp3_;
	FsoGsmAtCommandHandler* handler;
	g_return_if_fail (self != NULL);
	g_return_if_fail (command != NULL);
	g_return_if_fail (request != NULL);
	_tmp0_ = command;
	_tmp1_ = request;
	_tmp2_ = retries;
	_tmp3_ = fso_gsm_at_command_handler_new (_tmp0_, _tmp1_, (guint) _tmp2_, (guint) 0);
	handler = _tmp3_;
	fso_framework_abstract_command_queue_enqueueCommand ((FsoFrameworkAbstractCommandQueue*) self, (FsoFrameworkAbstractCommandHandler*) handler);
	_fso_framework_abstract_command_handler_unref0 (handler);
}


static void fso_gsm_at_command_queue_enqueueAsync_data_free (gpointer _data) {
	fso_gsm_at_command_queue_enqueueAsyncData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->command);
	_g_free0 (_data_->request);
	_data_->result = (_vala_array_free (_data_->result, _data_->result_length1, (GDestroyNotify) g_free), NULL);
	_g_object_unref0 (_data_->self);
	g_slice_free (fso_gsm_at_command_queue_enqueueAsyncData, _data_);
}


void fso_gsm_at_command_queue_enqueueAsync (FsoGsmAtCommandQueue* self, FsoGsmAtCommandQueueCommand* command, const gchar* request, gint retries, gint timeout, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	fso_gsm_at_command_queue_enqueueAsyncData* _data_;
	FsoGsmAtCommandQueue* _tmp0_;
	FsoGsmAtCommandQueueCommand* _tmp1_;
	FsoGsmAtCommandQueueCommand* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	_data_ = g_slice_new0 (fso_gsm_at_command_queue_enqueueAsyncData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, fso_gsm_at_command_queue_enqueueAsync);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fso_gsm_at_command_queue_enqueueAsync_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = command;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data_->command = _tmp2_;
	_tmp3_ = request;
	_tmp4_ = g_strdup (_tmp3_);
	_data_->request = _tmp4_;
	_tmp5_ = retries;
	_data_->retries = _tmp5_;
	_tmp6_ = timeout;
	_data_->timeout = _tmp6_;
	fso_gsm_at_command_queue_enqueueAsync_co (_data_);
}


gchar** fso_gsm_at_command_queue_enqueueAsync_finish (FsoGsmAtCommandQueue* self, GAsyncResult* _res_, int* result_length1) {
	gchar** result;
	fso_gsm_at_command_queue_enqueueAsyncData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	*result_length1 = _data_->result_length1;
	_data_->result = NULL;
	return result;
}


static gboolean _fso_gsm_at_command_queue_enqueueAsync_co_gsource_func (gpointer self) {
	gboolean result;
	result = fso_gsm_at_command_queue_enqueueAsync_co (self);
	return result;
}


static gchar** _vala_array_dup7 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


static gboolean fso_gsm_at_command_queue_enqueueAsync_co (fso_gsm_at_command_queue_enqueueAsyncData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->command;
	_data_->_tmp1_ = _data_->request;
	_data_->_tmp2_ = _data_->retries;
	_data_->_tmp3_ = _data_->timeout;
	_data_->_tmp4_ = fso_gsm_at_command_handler_new (_data_->_tmp0_, _data_->_tmp1_, (guint) _data_->_tmp2_, (guint) _data_->_tmp3_);
	_data_->handler = _data_->_tmp4_;
	(((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target_destroy_notify == NULL) ? NULL : (((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target_destroy_notify (((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target), NULL);
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback = NULL;
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target = NULL;
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target_destroy_notify = NULL;
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback = _fso_gsm_at_command_queue_enqueueAsync_co_gsource_func;
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target = _data_;
	((FsoFrameworkAbstractCommandHandler*) _data_->handler)->callback_target_destroy_notify = NULL;
	fso_framework_abstract_command_queue_enqueueCommand ((FsoFrameworkAbstractCommandQueue*) _data_->self, (FsoFrameworkAbstractCommandHandler*) _data_->handler);
	_data_->_state_ = 1;
	return FALSE;
	_state_1:
	;
	_data_->_tmp5_ = _data_->handler->response;
	_data_->_tmp5__length1 = _data_->handler->response_length1;
	_data_->_tmp6_ = (_data_->_tmp5_ != NULL) ? _vala_array_dup7 (_data_->_tmp5_, _data_->_tmp5__length1) : ((gpointer) _data_->_tmp5_);
	_data_->_tmp6__length1 = _data_->_tmp5__length1;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp7__length1 = _data_->_tmp6__length1;
	_data_->result_length1 = _data_->_tmp7__length1;
	_data_->result = _data_->_tmp7_;
	_fso_framework_abstract_command_handler_unref0 (_data_->handler);
	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;
	_fso_framework_abstract_command_handler_unref0 (_data_->handler);
	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 fso_gsm_at_command_queue_class_init (FsoGsmAtCommandQueueClass * klass) {
	fso_gsm_at_command_queue_parent_class = g_type_class_peek_parent (klass);
	FSO_FRAMEWORK_ABSTRACT_COMMAND_QUEUE_CLASS (klass)->onReadFromTransport = fso_gsm_at_command_queue_real_onReadFromTransport;
	FSO_FRAMEWORK_ABSTRACT_COMMAND_QUEUE_CLASS (klass)->onResponseTimeout = fso_gsm_at_command_queue_real_onResponseTimeout;
	G_OBJECT_CLASS (klass)->finalize = fso_gsm_at_command_queue_finalize;
}


static void fso_gsm_at_command_queue_instance_init (FsoGsmAtCommandQueue * self) {
}


static void fso_gsm_at_command_queue_finalize (GObject* obj) {
	FsoGsmAtCommandQueue * self;
	FsoFrameworkParser* _tmp0_;
	self = FSO_GSM_AT_COMMAND_QUEUE (obj);
	_tmp0_ = self->parser;
	fso_framework_parser_setDelegates (_tmp0_, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
	_g_object_unref0 (self->parser);
	G_OBJECT_CLASS (fso_gsm_at_command_queue_parent_class)->finalize (obj);
}


/**
 * @class FsoGsm.AtCommandQueue
 **/
GType fso_gsm_at_command_queue_get_type (void) {
	static volatile gsize fso_gsm_at_command_queue_type_id__volatile = 0;
	if (g_once_init_enter (&fso_gsm_at_command_queue_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (FsoGsmAtCommandQueueClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_gsm_at_command_queue_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoGsmAtCommandQueue), 0, (GInstanceInitFunc) fso_gsm_at_command_queue_instance_init, NULL };
		GType fso_gsm_at_command_queue_type_id;
		fso_gsm_at_command_queue_type_id = g_type_register_static (FSO_FRAMEWORK_TYPE_ABSTRACT_COMMAND_QUEUE, "FsoGsmAtCommandQueue", &g_define_type_info, 0);
		g_once_init_leave (&fso_gsm_at_command_queue_type_id__volatile, fso_gsm_at_command_queue_type_id);
	}
	return fso_gsm_at_command_queue_type_id__volatile;
}


static gchar** _vala_array_dup8 (gchar** self, int length) {
	gchar** result;
	int i;
	result = g_new0 (gchar*, length + 1);
	for (i = 0; i < length; i++) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (self[i]);
		result[i] = _tmp0_;
	}
	return result;
}


FsoGsmAtCommandSequence* fso_gsm_at_command_sequence_construct (GType object_type, gchar** commands, int commands_length1) {
	FsoGsmAtCommandSequence* self = NULL;
	gchar** _tmp0_;
	gint _tmp0__length1;
	gchar** _tmp1_;
	gint _tmp1__length1;
	self = (FsoGsmAtCommandSequence*) g_type_create_instance (object_type);
	_tmp0_ = commands;
	_tmp0__length1 = commands_length1;
	_tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup8 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
	_tmp1__length1 = _tmp0__length1;
	self->priv->commands = (_vala_array_free (self->priv->commands, self->priv->commands_length1, (GDestroyNotify) g_free), NULL);
	self->priv->commands = _tmp1_;
	self->priv->commands_length1 = _tmp1__length1;
	self->priv->_commands_size_ = self->priv->commands_length1;
	return self;
}


FsoGsmAtCommandSequence* fso_gsm_at_command_sequence_new (gchar** commands, int commands_length1) {
	return fso_gsm_at_command_sequence_construct (FSO_GSM_TYPE_AT_COMMAND_SEQUENCE, commands, commands_length1);
}


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


void fso_gsm_at_command_sequence_append (FsoGsmAtCommandSequence* self, gchar** commands, int commands_length1) {
	gchar** _tmp0_;
	gint _tmp0__length1;
	g_return_if_fail (self != NULL);
	_tmp0_ = commands;
	_tmp0__length1 = commands_length1;
	{
		gchar** cmd_collection = NULL;
		gint cmd_collection_length1 = 0;
		gint _cmd_collection_size_ = 0;
		gint cmd_it = 0;
		cmd_collection = _tmp0_;
		cmd_collection_length1 = _tmp0__length1;
		for (cmd_it = 0; cmd_it < _tmp0__length1; cmd_it = cmd_it + 1) {
			gchar* _tmp1_;
			gchar* cmd = NULL;
			_tmp1_ = g_strdup (cmd_collection[cmd_it]);
			cmd = _tmp1_;
			{
				gchar** _tmp2_;
				gint _tmp2__length1;
				const gchar* _tmp3_;
				gchar* _tmp4_;
				_tmp2_ = self->priv->commands;
				_tmp2__length1 = self->priv->commands_length1;
				_tmp3_ = cmd;
				_tmp4_ = g_strdup (_tmp3_);
				_vala_array_add5 (&self->priv->commands, &self->priv->commands_length1, &self->priv->_commands_size_, _tmp4_);
				_g_free0 (cmd);
			}
		}
	}
}


static void fso_gsm_at_command_sequence_performOnChannel_data_free (gpointer _data) {
	fso_gsm_at_command_sequence_performOnChannelData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->channel);
	_fso_gsm_at_command_sequence_unref0 (_data_->self);
	g_slice_free (fso_gsm_at_command_sequence_performOnChannelData, _data_);
}


static gpointer _fso_gsm_at_command_sequence_ref0 (gpointer self) {
	return self ? fso_gsm_at_command_sequence_ref (self) : NULL;
}


void fso_gsm_at_command_sequence_performOnChannel (FsoGsmAtCommandSequence* self, FsoGsmAtChannel* channel, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	fso_gsm_at_command_sequence_performOnChannelData* _data_;
	FsoGsmAtCommandSequence* _tmp0_;
	FsoGsmAtChannel* _tmp1_;
	FsoGsmAtChannel* _tmp2_;
	_data_ = g_slice_new0 (fso_gsm_at_command_sequence_performOnChannelData);
	_data_->_async_result = g_simple_async_result_new (g_object_newv (G_TYPE_OBJECT, 0, NULL), _callback_, _user_data_, fso_gsm_at_command_sequence_performOnChannel);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, fso_gsm_at_command_sequence_performOnChannel_data_free);
	_tmp0_ = _fso_gsm_at_command_sequence_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = channel;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_data_->channel = _tmp2_;
	fso_gsm_at_command_sequence_performOnChannel_co (_data_);
}


void fso_gsm_at_command_sequence_performOnChannel_finish (FsoGsmAtCommandSequence* self, GAsyncResult* _res_) {
	fso_gsm_at_command_sequence_performOnChannelData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void fso_gsm_at_command_sequence_performOnChannel_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	fso_gsm_at_command_sequence_performOnChannelData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	fso_gsm_at_command_sequence_performOnChannel_co (_data_);
}


static gboolean fso_gsm_at_command_sequence_performOnChannel_co (fso_gsm_at_command_sequence_performOnChannelData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->priv->commands;
	_data_->_tmp0__length1 = _data_->self->priv->commands_length1;
	{
		_data_->element_collection_length1 = 0;
		_data_->_element_collection_size_ = 0;
		_data_->element_collection = _data_->_tmp0_;
		_data_->element_collection_length1 = _data_->_tmp0__length1;
		_data_->element_it = 0;
		for (_data_->element_it = 0; _data_->element_it < _data_->_tmp0__length1; _data_->element_it = _data_->element_it + 1) {
			_data_->_tmp1_ = g_strdup (_data_->element_collection[_data_->element_it]);
			_data_->element = _data_->_tmp1_;
			{
				_data_->_tmp2_ = _data_->element;
				_data_->_tmp4_ = NULL;
				_data_->_tmp4_ = _data_->_tmp3_ = g_strsplit (_data_->_tmp2_, "=", 0);
				_data_->components = _data_->_tmp4_;
				_data_->components_length1 = _vala_array_length (_data_->_tmp3_);
				_data_->_components_size_ = _data_->components_length1;
				_data_->_tmp5_ = _data_->components;
				_data_->_tmp5__length1 = _data_->components_length1;
				_data_->_tmp6_ = _data_->_tmp5_[0];
				_data_->_tmp7_ = fso_gsm_custom_at_command_new (_data_->_tmp6_, FALSE);
				_data_->cmd = _data_->_tmp7_;
				_data_->_tmp8_ = _data_->channel;
				_data_->_tmp9_ = _data_->cmd;
				_data_->_tmp10_ = _data_->element;
				_data_->_tmp11_ = 0;
				_data_->_state_ = 1;
				fso_gsm_at_command_queue_enqueueAsync ((FsoGsmAtCommandQueue*) _data_->_tmp8_, (FsoGsmAtCommandQueueCommand*) _data_->_tmp9_, _data_->_tmp10_, 0, 0, fso_gsm_at_command_sequence_performOnChannel_ready, _data_);
				return FALSE;
				_state_1:
				_data_->_tmp12_ = NULL;
				_data_->_tmp12_ = fso_gsm_at_command_queue_enqueueAsync_finish ((FsoGsmAtCommandQueue*) _data_->_tmp8_, _data_->_res_, &_data_->_tmp11_);
				_data_->_tmp13_ = _data_->_tmp12_;
				_data_->_tmp13__length1 = _data_->_tmp11_;
				_data_->_tmp13_ = (_vala_array_free (_data_->_tmp13_, _data_->_tmp13__length1, (GDestroyNotify) g_free), NULL);
				_g_object_unref0 (_data_->cmd);
				_data_->components = (_vala_array_free (_data_->components, _data_->components_length1, (GDestroyNotify) g_free), NULL);
				_g_free0 (_data_->element);
			}
		}
	}
	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 fso_gsm_value_at_command_sequence_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


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


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


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


static gchar* fso_gsm_value_at_command_sequence_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		FsoGsmAtCommandSequence* 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 = fso_gsm_at_command_sequence_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* fso_gsm_value_at_command_sequence_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	FsoGsmAtCommandSequence** 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 = fso_gsm_at_command_sequence_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* fso_gsm_param_spec_at_command_sequence (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	FsoGsmParamSpecAtCommandSequence* spec;
	g_return_val_if_fail (g_type_is_a (object_type, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE), 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 fso_gsm_value_get_at_command_sequence (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE), NULL);
	return value->data[0].v_pointer;
}


void fso_gsm_value_set_at_command_sequence (GValue* value, gpointer v_object) {
	FsoGsmAtCommandSequence* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE));
		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;
		fso_gsm_at_command_sequence_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		fso_gsm_at_command_sequence_unref (old);
	}
}


void fso_gsm_value_take_at_command_sequence (GValue* value, gpointer v_object) {
	FsoGsmAtCommandSequence* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, FSO_GSM_TYPE_AT_COMMAND_SEQUENCE));
		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) {
		fso_gsm_at_command_sequence_unref (old);
	}
}


static void fso_gsm_at_command_sequence_class_init (FsoGsmAtCommandSequenceClass * klass) {
	fso_gsm_at_command_sequence_parent_class = g_type_class_peek_parent (klass);
	FSO_GSM_AT_COMMAND_SEQUENCE_CLASS (klass)->finalize = fso_gsm_at_command_sequence_finalize;
	g_type_class_add_private (klass, sizeof (FsoGsmAtCommandSequencePrivate));
}


static void fso_gsm_at_command_sequence_instance_init (FsoGsmAtCommandSequence * self) {
	self->priv = FSO_GSM_AT_COMMAND_SEQUENCE_GET_PRIVATE (self);
	self->ref_count = 1;
}


static void fso_gsm_at_command_sequence_finalize (FsoGsmAtCommandSequence* obj) {
	FsoGsmAtCommandSequence * self;
	self = FSO_GSM_AT_COMMAND_SEQUENCE (obj);
	self->priv->commands = (_vala_array_free (self->priv->commands, self->priv->commands_length1, (GDestroyNotify) g_free), NULL);
}


/**
 * @class AtCommandSequence
 **/
GType fso_gsm_at_command_sequence_get_type (void) {
	static volatile gsize fso_gsm_at_command_sequence_type_id__volatile = 0;
	if (g_once_init_enter (&fso_gsm_at_command_sequence_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { fso_gsm_value_at_command_sequence_init, fso_gsm_value_at_command_sequence_free_value, fso_gsm_value_at_command_sequence_copy_value, fso_gsm_value_at_command_sequence_peek_pointer, "p", fso_gsm_value_at_command_sequence_collect_value, "p", fso_gsm_value_at_command_sequence_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (FsoGsmAtCommandSequenceClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) fso_gsm_at_command_sequence_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (FsoGsmAtCommandSequence), 0, (GInstanceInitFunc) fso_gsm_at_command_sequence_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) };
		GType fso_gsm_at_command_sequence_type_id;
		fso_gsm_at_command_sequence_type_id = g_type_register_fundamental (g_type_fundamental_next (), "FsoGsmAtCommandSequence", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&fso_gsm_at_command_sequence_type_id__volatile, fso_gsm_at_command_sequence_type_id);
	}
	return fso_gsm_at_command_sequence_type_id__volatile;
}


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


void fso_gsm_at_command_sequence_unref (gpointer instance) {
	FsoGsmAtCommandSequence* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		FSO_GSM_AT_COMMAND_SEQUENCE_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


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



