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

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

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

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

#include <glib.h>
#include <glib-object.h>
#include <fsogsm.h>
#include <fsobasics.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <freesmartphone.h>
#include <fsotransport.h>
#include <radio.h>


#define SAMSUNG_TYPE_CALL_HANDLER (samsung_call_handler_get_type ())
#define SAMSUNG_CALL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SAMSUNG_TYPE_CALL_HANDLER, SamsungCallHandler))
#define SAMSUNG_CALL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SAMSUNG_TYPE_CALL_HANDLER, SamsungCallHandlerClass))
#define SAMSUNG_IS_CALL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SAMSUNG_TYPE_CALL_HANDLER))
#define SAMSUNG_IS_CALL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SAMSUNG_TYPE_CALL_HANDLER))
#define SAMSUNG_CALL_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SAMSUNG_TYPE_CALL_HANDLER, SamsungCallHandlerClass))

typedef struct _SamsungCallHandler SamsungCallHandler;
typedef struct _SamsungCallHandlerClass SamsungCallHandlerClass;
typedef struct _SamsungCallHandlerPrivate SamsungCallHandlerPrivate;

#define SAMSUNG_TYPE_SOUND_HANDLER (samsung_sound_handler_get_type ())
#define SAMSUNG_SOUND_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SAMSUNG_TYPE_SOUND_HANDLER, SamsungSoundHandler))
#define SAMSUNG_SOUND_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SAMSUNG_TYPE_SOUND_HANDLER, SamsungSoundHandlerClass))
#define SAMSUNG_IS_SOUND_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SAMSUNG_TYPE_SOUND_HANDLER))
#define SAMSUNG_IS_SOUND_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SAMSUNG_TYPE_SOUND_HANDLER))
#define SAMSUNG_SOUND_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SAMSUNG_TYPE_SOUND_HANDLER, SamsungSoundHandlerClass))

typedef struct _SamsungSoundHandler SamsungSoundHandler;
typedef struct _SamsungSoundHandlerClass SamsungSoundHandlerClass;
#define _fso_framework_pair_unref0(var) ((var == NULL) ? NULL : (var = (fso_framework_pair_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))

#define SAMSUNG_TYPE_IPC_CHANNEL (samsung_ipc_channel_get_type ())
#define SAMSUNG_IPC_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SAMSUNG_TYPE_IPC_CHANNEL, SamsungIpcChannel))
#define SAMSUNG_IPC_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SAMSUNG_TYPE_IPC_CHANNEL, SamsungIpcChannelClass))
#define SAMSUNG_IS_IPC_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SAMSUNG_TYPE_IPC_CHANNEL))
#define SAMSUNG_IS_IPC_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SAMSUNG_TYPE_IPC_CHANNEL))
#define SAMSUNG_IPC_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SAMSUNG_TYPE_IPC_CHANNEL, SamsungIpcChannelClass))

typedef struct _SamsungIpcChannel SamsungIpcChannel;
typedef struct _SamsungIpcChannelClass SamsungIpcChannelClass;
typedef struct _SamsungCallHandlerInitiateData SamsungCallHandlerInitiateData;
typedef struct _SamsungCallHandlerActivateData SamsungCallHandlerActivateData;
typedef struct _SamsungCallHandlerHoldData SamsungCallHandlerHoldData;
typedef struct _SamsungCallHandlerReleaseData SamsungCallHandlerReleaseData;
typedef struct _samsung_call_handler_releaseAllData samsung_call_handler_releaseAllData;
typedef struct _samsung_call_handler_syncCallStatusAsyncData samsung_call_handler_syncCallStatusAsyncData;
#define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _samsung_call_handler_syncCallStatusData samsung_call_handler_syncCallStatusData;
typedef struct _samsung_call_handler_cancelOutgoingWithIdData samsung_call_handler_cancelOutgoingWithIdData;
typedef struct _samsung_call_handler_rejectIncomingWithIdData samsung_call_handler_rejectIncomingWithIdData;
#define _fso_gsm_call_unref0(var) ((var == NULL) ? NULL : (var = (fso_gsm_call_unref (var), NULL)))

struct _SamsungCallHandler {
	FsoGsmAbstractCallHandler parent_instance;
	SamsungCallHandlerPrivate * priv;
	guint timeout;
	FsoGsmCall** calls;
	gint calls_length1;
	FsoFrameworkPair* supplementary;
};

struct _SamsungCallHandlerClass {
	FsoGsmAbstractCallHandlerClass parent_class;
};

struct _SamsungCallHandlerPrivate {
	gboolean inSyncCallStatus;
	SamsungSoundHandler* _soundhandler;
};

struct _SamsungCallHandlerInitiateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gchar* number;
	gchar* ctype;
	gint result;
	FsoGsmModem* _tmp0_;
	FsoGsmChannel* _tmp1_;
	SamsungIpcChannel* channel;
	gint _tmp2_;
	gint num;
	struct ipc_message_info* response;
	const gchar* _tmp3_;
	gint _tmp4_;
	GError* _tmp5_;
	SamsungSoundHandler* _tmp6_;
	struct ipc_call_outgoing initiateMessage;
	int _tmp7_;
	const gchar* _tmp8_;
	int _tmp9_;
	int callType;
	gint8 _tmp10_;
	gboolean _tmp11_;
	const gchar* _tmp12_;
	gint _tmp13_;
	gint _tmp14_;
	const gchar* _tmp15_;
	gchar _tmp16_;
	gboolean _tmp17_;
	gint8 _tmp18_;
	gint8 callPrefix;
	int _tmp19_;
	gint8 _tmp20_;
	const gchar* _tmp21_;
	SamsungIpcChannel* _tmp22_;
	struct ipc_call_outgoing _tmp23_;
	guint8* _tmp24_;
	gint _tmp24__length1;
	guint8* _tmp25_;
	gint _tmp25__length1;
	struct ipc_message_info* _tmp26_;
	struct ipc_message_info* _tmp27_;
	const gchar* _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	GError* _tmp32_;
	GError* _tmp33_;
	struct ipc_message_info* _tmp34_;
	guint8* _tmp35_;
	gint _tmp35__length1;
	struct ipc_gen_phone_res* gr;
	struct ipc_gen_phone_res* _tmp36_;
	guint16 _tmp37_;
	const gchar* _tmp38_;
	const gchar* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	GError* _tmp42_;
	GError* _tmp43_;
	SamsungSoundHandler* _tmp44_;
	SamsungSoundHandler* _tmp45_;
	SamsungSoundHandler* _tmp46_;
	GError * _inner_error_;
};

struct _SamsungCallHandlerActivateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint id;
	FsoGsmModem* _tmp0_;
	FsoGsmChannel* _tmp1_;
	SamsungIpcChannel* channel;
	struct ipc_message_info* response;
	gboolean _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _tmp8_;
	GError* _tmp9_;
	gboolean _tmp10_;
	FsoGsmCall** _tmp11_;
	gint _tmp11__length1;
	gint _tmp12_;
	FsoGsmCall* _tmp13_;
	FreeSmartphoneGSMCallDetail _tmp14_;
	FreeSmartphoneGSMCallStatus _tmp15_;
	FsoGsmCall** _tmp16_;
	gint _tmp16__length1;
	gint _tmp17_;
	FsoGsmCall* _tmp18_;
	FreeSmartphoneGSMCallDetail _tmp19_;
	FreeSmartphoneGSMCallStatus _tmp20_;
	gboolean _tmp21_;
	GError* _tmp22_;
	gint _tmp23_;
	SamsungSoundHandler* _tmp24_;
	SamsungIpcChannel* _tmp25_;
	guint8* _tmp26_;
	guint8* _tmp27_;
	gint _tmp27__length1;
	struct ipc_message_info* _tmp28_;
	struct ipc_message_info* _tmp29_;
	GError* _tmp30_;
	struct ipc_message_info* _tmp31_;
	guint8* _tmp32_;
	gint _tmp32__length1;
	struct ipc_gen_phone_res* gr;
	struct ipc_gen_phone_res* _tmp33_;
	guint16 _tmp34_;
	GError* _tmp35_;
	SamsungSoundHandler* _tmp36_;
	GError * _inner_error_;
};

struct _SamsungCallHandlerHoldData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint _tmp0_;
	GError* _tmp1_;
	gint _tmp2_;
	GError* _tmp3_;
	GError * _inner_error_;
};

struct _SamsungCallHandlerReleaseData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint id;
	FsoGsmModem* _tmp0_;
	FsoGsmChannel* _tmp1_;
	SamsungIpcChannel* channel;
	struct ipc_message_info* response;
	gboolean _tmp2_;
	gint _tmp3_;
	gint _tmp4_;
	gboolean _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GError* _tmp8_;
	GError* _tmp9_;
	FsoGsmCall** _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_;
	FsoGsmCall* _tmp12_;
	FreeSmartphoneGSMCallDetail _tmp13_;
	FreeSmartphoneGSMCallStatus _tmp14_;
	GError* _tmp15_;
	SamsungIpcChannel* _tmp16_;
	guint8* _tmp17_;
	guint8* _tmp18_;
	gint _tmp18__length1;
	struct ipc_message_info* _tmp19_;
	struct ipc_message_info* _tmp20_;
	GError* _tmp21_;
	struct ipc_message_info* _tmp22_;
	guint8* _tmp23_;
	gint _tmp23__length1;
	struct ipc_gen_phone_res* gr;
	struct ipc_gen_phone_res* _tmp24_;
	guint16 _tmp25_;
	gint _tmp26_;
	gchar* _tmp27_;
	gchar* _tmp28_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	GError* _tmp31_;
	GError* _tmp32_;
	GError * _inner_error_;
};

struct _samsung_call_handler_releaseAllData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint i;
	gboolean _tmp0_;
	gboolean _tmp1_;
	gint _tmp2_;
	gint _tmp3_;
	gboolean _tmp4_;
	FsoGsmCall** _tmp5_;
	gint _tmp5__length1;
	gint _tmp6_;
	FsoGsmCall* _tmp7_;
	FreeSmartphoneGSMCallDetail _tmp8_;
	FreeSmartphoneGSMCallStatus _tmp9_;
	FsoGsmCall** _tmp10_;
	gint _tmp10__length1;
	gint _tmp11_;
	FsoGsmCall* _tmp12_;
	FreeSmartphoneGSMCallDetail _tmp13_;
	FreeSmartphoneGSMCallStatus _tmp14_;
	gboolean _tmp15_;
	gint _tmp16_;
};

struct _samsung_call_handler_syncCallStatusAsyncData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
};

struct _samsung_call_handler_syncCallStatusData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	FsoFrameworkLogger* _tmp0_;
	gboolean _tmp1_;
	FsoGsmModem* _tmp2_;
	gpointer _tmp3_;
	FsoGsmCallListCalls* m;
	FsoGsmCallListCalls* _tmp4_;
	gint length;
	FsoGsmCallListCalls* _tmp5_;
	FreeSmartphoneGSMCallDetail* _tmp6_;
	gint _tmp6__length1;
	FreeSmartphoneGSMCallDetail* _tmp7_;
	gint _tmp7__length1;
	FreeSmartphoneGSMCallDetail* c_collection;
	gint c_collection_length1;
	gint _c_collection_size_;
	gint c_it;
	FreeSmartphoneGSMCallDetail _tmp8_;
	FreeSmartphoneGSMCallDetail c;
	gint _tmp9_;
	FsoFrameworkLogger* _tmp10_;
	gint _tmp11_;
	gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	gchar* _tmp15_;
	gboolean _tmp16_;
	gint _tmp17_;
	FsoFrameworkLogger* _tmp18_;
	gboolean _tmp19_;
	guint _tmp20_;
	FsoFrameworkPair* _tmp21_;
	FsoGsmCallListCalls* _tmp22_;
	FreeSmartphoneGSMCallDetail* _tmp23_;
	gint _tmp23__length1;
	FreeSmartphoneGSMCallDetail* _tmp24_;
	gint _tmp24__length1;
	FreeSmartphoneGSMCallDetail* ca_collection;
	gint ca_collection_length1;
	gint _ca_collection_size_;
	gint ca_it;
	FreeSmartphoneGSMCallDetail _tmp25_;
	FreeSmartphoneGSMCallDetail ca;
	FreeSmartphoneGSMCallDetail _tmp26_;
	GHashTable* _tmp27_;
	gconstpointer _tmp28_;
	const gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* direction;
	const gchar* _tmp31_;
	FsoFrameworkPair* _tmp32_;
	gconstpointer _tmp33_;
	FreeSmartphoneGSMCallDetail _tmp34_;
	GHashTable* _tmp35_;
	gchar* _tmp36_;
	FsoFrameworkPair* _tmp37_;
	gconstpointer _tmp38_;
	GVariant* _tmp39_;
	gboolean* _tmp40_;
	gboolean* visited;
	gint visited_length1;
	gint _visited_size_;
	FsoGsmCallListCalls* _tmp41_;
	FreeSmartphoneGSMCallDetail* _tmp42_;
	gint _tmp42__length1;
	FreeSmartphoneGSMCallDetail* _tmp43_;
	gint _tmp43__length1;
	FreeSmartphoneGSMCallDetail* call_collection;
	gint call_collection_length1;
	gint _call_collection_size_;
	gint call_it;
	FreeSmartphoneGSMCallDetail _tmp44_;
	FreeSmartphoneGSMCallDetail call;
	FsoFrameworkLogger* _tmp45_;
	FreeSmartphoneGSMCallDetail _tmp46_;
	gint _tmp47_;
	gchar* _tmp48_;
	gchar* _tmp49_;
	gchar* _tmp50_;
	gchar* _tmp51_;
	gboolean _tmp52_;
	gboolean _tmp53_;
	FreeSmartphoneGSMCallDetail _tmp54_;
	gint _tmp55_;
	FreeSmartphoneGSMCallDetail _tmp56_;
	gint _tmp57_;
	gboolean _tmp58_;
	FsoFrameworkLogger* _tmp59_;
	FreeSmartphoneGSMCallDetail _tmp60_;
	gint _tmp61_;
	gchar* _tmp62_;
	gchar* _tmp63_;
	gchar* _tmp64_;
	gchar* _tmp65_;
	FsoGsmCall** _tmp66_;
	gint _tmp66__length1;
	FreeSmartphoneGSMCallDetail _tmp67_;
	gint _tmp68_;
	FsoGsmCall* _tmp69_;
	FreeSmartphoneGSMCallDetail _tmp70_;
	gboolean* _tmp71_;
	gint _tmp71__length1;
	FreeSmartphoneGSMCallDetail _tmp72_;
	gint _tmp73_;
	gboolean _tmp74_;
	gint i;
	gboolean _tmp75_;
	gboolean _tmp76_;
	gint _tmp77_;
	gint _tmp78_;
	gboolean _tmp79_;
	gboolean* _tmp80_;
	gint _tmp80__length1;
	gint _tmp81_;
	gboolean _tmp82_;
	FsoGsmCall** _tmp83_;
	gint _tmp83__length1;
	gint _tmp84_;
	FsoGsmCall* _tmp85_;
	FreeSmartphoneGSMCallDetail _tmp86_;
	FreeSmartphoneGSMCallStatus _tmp87_;
	gboolean _tmp88_;
	gint _tmp89_;
	GHashFunc _tmp90_;
	GEqualFunc _tmp91_;
	GHashTable* _tmp92_;
	GHashTable* _tmp93_;
	FreeSmartphoneGSMCallDetail detail;
	FsoGsmCall** _tmp94_;
	gint _tmp94__length1;
	gint _tmp95_;
	FsoGsmCall* _tmp96_;
	FreeSmartphoneGSMCallDetail _tmp97_;
	GError* e;
	FsoFrameworkLogger* _tmp98_;
	GError* _tmp99_;
	const gchar* _tmp100_;
	const gchar* _tmp101_;
	gchar* _tmp102_;
	gchar* _tmp103_;
	GError * _inner_error_;
};

struct _samsung_call_handler_cancelOutgoingWithIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint id;
	FsoFrameworkLogger* _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	GError* _tmp7_;
	GError * _inner_error_;
};

struct _samsung_call_handler_rejectIncomingWithIdData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	SamsungCallHandler* self;
	gint id;
	FsoFrameworkLogger* _tmp0_;
	gint _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	GError* _tmp7_;
	GError * _inner_error_;
};


static gpointer samsung_call_handler_parent_class = NULL;
static GType samsung_call_handler_type_id = 0;

#define CALL_STATUS_REFRESH_TIMEOUT 3
GType samsung_call_handler_get_type (void) G_GNUC_CONST;
GType samsung_call_handler_register_type (GTypeModule * module);
GType samsung_sound_handler_get_type (void) G_GNUC_CONST;
GType samsung_sound_handler_register_type (GTypeModule * module);
#define SAMSUNG_CALL_HANDLER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SAMSUNG_TYPE_CALL_HANDLER, SamsungCallHandlerPrivate))
enum  {
	SAMSUNG_CALL_HANDLER_DUMMY_PROPERTY
};
static void samsung_call_handler_real_initiate_data_free (gpointer _data);
static void samsung_call_handler_real_initiate (FsoGsmAbstractCallHandler* base, const gchar* number, const gchar* ctype, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_initiate_co (SamsungCallHandlerInitiateData* _data_);
GType samsung_ipc_channel_get_type (void) G_GNUC_CONST;
GType samsung_ipc_channel_register_type (GTypeModule * module);
static gint samsung_call_handler_lowestOfCallsWithStatus (SamsungCallHandler* self, FreeSmartphoneGSMCallStatus status);
void samsung_sound_handler_mute_microphone (SamsungSoundHandler* self, gboolean mute, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_sound_handler_mute_microphone_finish (SamsungSoundHandler* self, GAsyncResult* _res_, GError** error);
static void samsung_call_handler_initiate_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void samsung_ipc_channel_enqueue_async (SamsungIpcChannel* self, int type, unsigned short command, guint8* data, int data_length1, gint retry, gint timeout, GAsyncReadyCallback _callback_, gpointer _user_data_);
struct ipc_message_info* samsung_ipc_channel_enqueue_finish (SamsungIpcChannel* self, GAsyncResult* _res_);
void samsung_sound_handler_set_speaker_volume (SamsungSoundHandler* self, gint8 type, guint8 volume, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_sound_handler_set_speaker_volume_finish (SamsungSoundHandler* self, GAsyncResult* _res_, GError** error);
void samsung_sound_handler_set_audio_path (SamsungSoundHandler* self, gint8 path, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_sound_handler_set_audio_path_finish (SamsungSoundHandler* self, GAsyncResult* _res_, GError** error);
static void samsung_call_handler_real_addSupplementaryInformation (FsoGsmAbstractCallHandler* base, const gchar* direction, const gchar* info);
static void samsung_call_handler_real_activate_data_free (gpointer _data);
static void samsung_call_handler_real_activate (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_activate_co (SamsungCallHandlerActivateData* _data_);
static gint samsung_call_handler_numberOfBusyCalls (SamsungCallHandler* self);
void samsung_sound_handler_execute_clock_control (SamsungSoundHandler* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_sound_handler_execute_clock_control_finish (SamsungSoundHandler* self, GAsyncResult* _res_, GError** error);
static void samsung_call_handler_activate_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void samsung_call_handler_real_hold_data_free (gpointer _data);
static void samsung_call_handler_real_hold (FsoGsmAbstractCallHandler* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_hold_co (SamsungCallHandlerHoldData* _data_);
static gint samsung_call_handler_numberOfCallsWithStatus (SamsungCallHandler* self, FreeSmartphoneGSMCallStatus status);
static void samsung_call_handler_real_release_data_free (gpointer _data);
static void samsung_call_handler_real_release (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_release_co (SamsungCallHandlerReleaseData* _data_);
static void samsung_call_handler_release_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void samsung_call_handler_real_releaseAll_data_free (gpointer _data);
static void samsung_call_handler_real_releaseAll (FsoGsmAbstractCallHandler* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_releaseAll_co (samsung_call_handler_releaseAllData* _data_);
static gchar* samsung_call_handler_real_repr (FsoFrameworkAbstractObject* base);
static void samsung_call_handler_syncCallStatusAsync_data_free (gpointer _data);
void samsung_call_handler_syncCallStatusAsync (SamsungCallHandler* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_call_handler_syncCallStatusAsync_finish (SamsungCallHandler* self, GAsyncResult* _res_);
static gboolean samsung_call_handler_syncCallStatusAsync_co (samsung_call_handler_syncCallStatusAsyncData* _data_);
static void samsung_call_handler_syncCallStatus_data_free (gpointer _data);
void samsung_call_handler_syncCallStatus (SamsungCallHandler* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void samsung_call_handler_syncCallStatus_finish (SamsungCallHandler* self, GAsyncResult* _res_);
static gboolean samsung_call_handler_syncCallStatus_co (samsung_call_handler_syncCallStatusData* _data_);
static void samsung_call_handler_syncCallStatus_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static GVariant* _variant_new30 (const gchar* value);
static void _g_free0_ (gpointer var);
static void _g_variant_unref0_ (gpointer var);
static void samsung_call_handler_real_startTimeoutIfNecessary (FsoGsmAbstractCallHandler* base);
gboolean samsung_call_handler_onTimeout (SamsungCallHandler* self);
static gboolean _samsung_call_handler_onTimeout_gsource_func (gpointer self);
static void samsung_call_handler_real_cancelOutgoingWithId_data_free (gpointer _data);
static void samsung_call_handler_real_cancelOutgoingWithId (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_cancelOutgoingWithId_co (samsung_call_handler_cancelOutgoingWithIdData* _data_);
static void samsung_call_handler_real_rejectIncomingWithId_data_free (gpointer _data);
static void samsung_call_handler_real_rejectIncomingWithId (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean samsung_call_handler_real_rejectIncomingWithId_co (samsung_call_handler_rejectIncomingWithIdData* _data_);
SamsungCallHandler* samsung_call_handler_new (void);
SamsungCallHandler* samsung_call_handler_construct (GType object_type);
static GObject * samsung_call_handler_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
SamsungSoundHandler* samsung_sound_handler_new (void);
SamsungSoundHandler* samsung_sound_handler_construct (GType object_type);
static void samsung_call_handler_finalize (GObject* 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 void samsung_call_handler_real_initiate_data_free (gpointer _data) {
	SamsungCallHandlerInitiateData* _data_;
	_data_ = _data;
	_g_free0 (_data_->number);
	_g_free0 (_data_->ctype);
	_g_object_unref0 (_data_->self);
	g_slice_free (SamsungCallHandlerInitiateData, _data_);
}


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


static void samsung_call_handler_real_initiate (FsoGsmAbstractCallHandler* base, const gchar* number, const gchar* ctype, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	SamsungCallHandlerInitiateData* _data_;
	SamsungCallHandler* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	gchar* _tmp4_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (SamsungCallHandlerInitiateData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_initiate);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_initiate_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = number;
	_tmp2_ = g_strdup (_tmp1_);
	_data_->number = _tmp2_;
	_tmp3_ = ctype;
	_tmp4_ = g_strdup (_tmp3_);
	_data_->ctype = _tmp4_;
	samsung_call_handler_real_initiate_co (_data_);
}


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


static void samsung_call_handler_initiate_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	SamsungCallHandlerInitiateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	samsung_call_handler_real_initiate_co (_data_);
}


static gchar string_get (const gchar* self, glong index) {
	gchar result = '\0';
	glong _tmp0_;
	gchar _tmp1_;
	g_return_val_if_fail (self != NULL, '\0');
	_tmp0_ = index;
	_tmp1_ = ((gchar*) self)[_tmp0_];
	result = _tmp1_;
	return result;
}


static guint8* samsung_ipc_call_outgoing_message_get_data (struct ipc_call_outgoing* self, int* result_length1) {
	guint8* result;
	guint8* res;
	gint res_length1;
	gint _res_size_;
	gint _tmp0_;
	guint8* _tmp1_;
	gint _tmp1__length1;
	guint8* _tmp2_;
	gint _tmp2__length1;
	g_return_val_if_fail (self != NULL, NULL);
	res = (guint8*) (&(*self));
	res_length1 = -1;
	_res_size_ = res_length1;
	res_length1 = (gint) sizeof (struct ipc_call_outgoing);
	_tmp0_ = res_length1;
	_tmp1_ = res;
	_tmp1__length1 = res_length1;
	_tmp2_ = _tmp1_;
	_tmp2__length1 = _tmp1__length1;
	if (result_length1) {
		*result_length1 = _tmp2__length1;
	}
	result = _tmp2_;
	return result;
}


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


static gboolean samsung_call_handler_real_initiate_co (SamsungCallHandlerInitiateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_theModem;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = fso_gsm_modem_channel (_data_->_tmp0_, "main");
	_data_->channel = SAMSUNG_IS_IPC_CHANNEL (_data_->_tmp1_) ? ((SamsungIpcChannel*) _data_->_tmp1_) : NULL;
	_data_->_tmp2_ = 0;
	_data_->_tmp2_ = samsung_call_handler_lowestOfCallsWithStatus (_data_->self, FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE);
	_data_->num = _data_->_tmp2_;
	_data_->response = NULL;
	_data_->_tmp3_ = _data_->number;
	fso_gsm_validatePhoneNumber (_data_->_tmp3_, &_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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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_->_tmp4_ = _data_->num;
	if (_data_->_tmp4_ == 0) {
		_data_->_tmp5_ = g_error_new_literal (FREE_SMARTPHONE_GSM_ERROR, FREE_SMARTPHONE_GSM_ERROR_CALL_NOT_FOUND, "System busy");
		_data_->_inner_error_ = _data_->_tmp5_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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_->_tmp6_ = _data_->self->priv->_soundhandler;
	_data_->_state_ = 1;
	samsung_sound_handler_mute_microphone (_data_->_tmp6_, FALSE, samsung_call_handler_initiate_ready, _data_);
	return FALSE;
	_state_1:
	samsung_sound_handler_mute_microphone_finish (_data_->_tmp6_, _data_->_res_, &_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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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;
		}
	}
	memset (&_data_->initiateMessage, 0, sizeof (struct ipc_call_outgoing));
	_data_->_tmp8_ = _data_->ctype;
	if (g_strcmp0 (_data_->_tmp8_, "voice") == 0) {
		_data_->_tmp7_ = IPC_CALL_TYPE_VOICE;
	} else {
		_data_->_tmp7_ = IPC_CALL_TYPE_DATA;
	}
	_data_->_tmp9_ = _data_->_tmp7_;
	_data_->callType = _data_->_tmp9_;
	_data_->_tmp12_ = _data_->number;
	_data_->_tmp13_ = strlen (_data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	if (_data_->_tmp14_ >= 1) {
		_data_->_tmp15_ = _data_->number;
		_data_->_tmp16_ = '\0';
		_data_->_tmp16_ = string_get (_data_->_tmp15_, (glong) 0);
		_data_->_tmp11_ = _data_->_tmp16_ == '+';
	} else {
		_data_->_tmp11_ = FALSE;
	}
	_data_->_tmp17_ = _data_->_tmp11_;
	if (_data_->_tmp17_) {
		_data_->_tmp10_ = IPC_CALL_PREFIX_INTL;
	} else {
		_data_->_tmp10_ = IPC_CALL_PREFIX_NONE;
	}
	_data_->_tmp18_ = _data_->_tmp10_;
	_data_->callPrefix = _data_->_tmp18_;
	_data_->_tmp19_ = _data_->callType;
	_data_->_tmp20_ = _data_->callPrefix;
	_data_->_tmp21_ = _data_->number;
	ipc_call_outgoing_setup (&_data_->initiateMessage, _data_->_tmp19_, IPC_CALL_IDENTITY_DEFAULT, _data_->_tmp20_, _data_->_tmp21_);
	_data_->_tmp22_ = _data_->channel;
	_data_->_tmp23_ = _data_->initiateMessage;
	_data_->_tmp24_ = samsung_ipc_call_outgoing_message_get_data (&_data_->_tmp23_, &_data_->_tmp24__length1);
	_data_->_tmp25_ = _data_->_tmp24_;
	_data_->_tmp25__length1 = _data_->_tmp24__length1;
	_data_->_state_ = 2;
	samsung_ipc_channel_enqueue_async (_data_->_tmp22_, IPC_TYPE_EXEC, IPC_CALL_OUTGOING, _data_->_tmp25_, _data_->_tmp25__length1, 0, 5, samsung_call_handler_initiate_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp26_ = NULL;
	_data_->_tmp26_ = samsung_ipc_channel_enqueue_finish (_data_->_tmp22_, _data_->_res_);
	_data_->response = _data_->_tmp26_;
	_data_->_tmp27_ = _data_->response;
	if (_data_->_tmp27_ == NULL) {
		_data_->_tmp28_ = _data_->number;
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = string_to_string (_data_->_tmp28_);
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = g_strconcat ("The modem failed to initiate a call with number ", _data_->_tmp29_, NULL);
		_data_->_tmp31_ = _data_->_tmp30_;
		_data_->_tmp32_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, _data_->_tmp31_);
		_data_->_tmp33_ = _data_->_tmp32_;
		_g_free0 (_data_->_tmp31_);
		_data_->_inner_error_ = _data_->_tmp33_;
		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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->_tmp34_ = _data_->response;
	_data_->_tmp35_ = (*_data_->_tmp34_).data;
	_data_->_tmp35__length1 = (*_data_->_tmp34_).length;
	_data_->gr = (struct ipc_gen_phone_res*) _data_->_tmp35_;
	_data_->_tmp36_ = _data_->gr;
	_data_->_tmp37_ = (*_data_->_tmp36_).code;
	if (((gint) _data_->_tmp37_) != 0x8000) {
		_data_->_tmp38_ = _data_->number;
		_data_->_tmp39_ = NULL;
		_data_->_tmp39_ = string_to_string (_data_->_tmp38_);
		_data_->_tmp40_ = NULL;
		_data_->_tmp40_ = g_strconcat ("Modem told us it can not initialize call with number ", _data_->_tmp39_, NULL);
		_data_->_tmp41_ = _data_->_tmp40_;
		_data_->_tmp42_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, _data_->_tmp41_);
		_data_->_tmp43_ = _data_->_tmp42_;
		_g_free0 (_data_->_tmp41_);
		_data_->_inner_error_ = _data_->_tmp43_;
		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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->_tmp44_ = _data_->self->priv->_soundhandler;
	_data_->_state_ = 3;
	samsung_sound_handler_mute_microphone (_data_->_tmp44_, FALSE, samsung_call_handler_initiate_ready, _data_);
	return FALSE;
	_state_3:
	samsung_sound_handler_mute_microphone_finish (_data_->_tmp44_, _data_->_res_, &_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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->_tmp45_ = _data_->self->priv->_soundhandler;
	_data_->_state_ = 4;
	samsung_sound_handler_set_speaker_volume (_data_->_tmp45_, IPC_SND_VOLUME_TYPE_SPEAKER, (guint8) 0x4, samsung_call_handler_initiate_ready, _data_);
	return FALSE;
	_state_4:
	samsung_sound_handler_set_speaker_volume_finish (_data_->_tmp45_, _data_->_res_, &_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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->_tmp46_ = _data_->self->priv->_soundhandler;
	_data_->_state_ = 5;
	samsung_sound_handler_set_audio_path (_data_->_tmp46_, IPC_SND_AUDIO_PATH_HANDSET, samsung_call_handler_initiate_ready, _data_);
	return FALSE;
	_state_5:
	samsung_sound_handler_set_audio_path_finish (_data_->_tmp46_, _data_->_res_, &_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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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_->initiateMessage);
			_g_object_unref0 (_data_->channel);
			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;
		}
	}
	fso_gsm_abstract_call_handler_startTimeoutIfNecessary ((FsoGsmAbstractCallHandler*) _data_->self);
	_data_->result = _data_->num;
	 (&_data_->initiateMessage);
	_g_object_unref0 (_data_->channel);
	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;
	 (&_data_->initiateMessage);
	_g_object_unref0 (_data_->channel);
	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 samsung_call_handler_real_addSupplementaryInformation (FsoGsmAbstractCallHandler* base, const gchar* direction, const gchar* info) {
	SamsungCallHandler * self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	FsoFrameworkPair* _tmp2_;
	self = (SamsungCallHandler*) base;
	g_return_if_fail (direction != NULL);
	g_return_if_fail (info != NULL);
	_tmp0_ = direction;
	_tmp1_ = info;
	_tmp2_ = fso_framework_pair_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, _tmp0_, _tmp1_);
	_fso_framework_pair_unref0 (self->supplementary);
	self->supplementary = _tmp2_;
}


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


static void samsung_call_handler_real_activate (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	SamsungCallHandlerActivateData* _data_;
	SamsungCallHandler* _tmp0_;
	gint _tmp1_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (SamsungCallHandlerActivateData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_activate);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_activate_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_data_->id = _tmp1_;
	samsung_call_handler_real_activate_co (_data_);
}


static void samsung_call_handler_real_activate_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	SamsungCallHandlerActivateData* _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 samsung_call_handler_activate_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	SamsungCallHandlerActivateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	samsung_call_handler_real_activate_co (_data_);
}


static gboolean samsung_call_handler_real_activate_co (SamsungCallHandlerActivateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = fso_gsm_theModem;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = fso_gsm_modem_channel (_data_->_tmp0_, "main");
	_data_->channel = SAMSUNG_IS_IPC_CHANNEL (_data_->_tmp1_) ? ((SamsungIpcChannel*) _data_->_tmp1_) : NULL;
	_data_->response = NULL;
	_data_->_tmp3_ = _data_->id;
	if (_data_->_tmp3_ < 1) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp4_ = _data_->id;
		_data_->_tmp2_ = ((guint) _data_->_tmp4_) > FSO_GSM_CONSTANTS_CALL_INDEX_MAX;
	}
	_data_->_tmp5_ = _data_->_tmp2_;
	if (_data_->_tmp5_) {
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = g_strdup_printf ("Call index needs to be within [ 1, %d ]", (gint) FSO_GSM_CONSTANTS_CALL_INDEX_MAX);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INVALID_PARAMETER, _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_g_free0 (_data_->_tmp7_);
		_data_->_inner_error_ = _data_->_tmp9_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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_->_tmp11_ = _data_->self->calls;
	_data_->_tmp11__length1 = _data_->self->calls_length1;
	_data_->_tmp12_ = _data_->id;
	_data_->_tmp13_ = _data_->_tmp11_[_data_->_tmp12_];
	_data_->_tmp14_ = _data_->_tmp13_->detail;
	_data_->_tmp15_ = _data_->_tmp14_.status;
	if (_data_->_tmp15_ != FREE_SMARTPHONE_GSM_CALL_STATUS_INCOMING) {
		_data_->_tmp16_ = _data_->self->calls;
		_data_->_tmp16__length1 = _data_->self->calls_length1;
		_data_->_tmp17_ = _data_->id;
		_data_->_tmp18_ = _data_->_tmp16_[_data_->_tmp17_];
		_data_->_tmp19_ = _data_->_tmp18_->detail;
		_data_->_tmp20_ = _data_->_tmp19_.status;
		_data_->_tmp10_ = _data_->_tmp20_ != FREE_SMARTPHONE_GSM_CALL_STATUS_HELD;
	} else {
		_data_->_tmp10_ = FALSE;
	}
	_data_->_tmp21_ = _data_->_tmp10_;
	if (_data_->_tmp21_) {
		_data_->_tmp22_ = g_error_new_literal (FREE_SMARTPHONE_GSM_ERROR, FREE_SMARTPHONE_GSM_ERROR_CALL_NOT_FOUND, "No suitable call to activate found");
		_data_->_inner_error_ = _data_->_tmp22_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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_->_tmp23_ = 0;
	_data_->_tmp23_ = samsung_call_handler_numberOfBusyCalls (_data_->self);
	if (_data_->_tmp23_ == 0) {
		_data_->_tmp24_ = _data_->self->priv->_soundhandler;
		_data_->_state_ = 1;
		samsung_sound_handler_execute_clock_control (_data_->_tmp24_, samsung_call_handler_activate_ready, _data_);
		return FALSE;
		_state_1:
		samsung_sound_handler_execute_clock_control_finish (_data_->_tmp24_, _data_->_res_, &_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_);
				_g_object_unref0 (_data_->channel);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->channel);
				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_->_tmp25_ = _data_->channel;
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = g_new0 (guint8, 0);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_tmp27__length1 = 0;
		_data_->_state_ = 2;
		samsung_ipc_channel_enqueue_async (_data_->_tmp25_, IPC_TYPE_EXEC, IPC_CALL_ANSWER, _data_->_tmp27_, 0, 0, 5, samsung_call_handler_activate_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = samsung_ipc_channel_enqueue_finish (_data_->_tmp25_, _data_->_res_);
		_data_->response = _data_->_tmp28_;
		_data_->_tmp27_ = (g_free (_data_->_tmp27_), NULL);
		_data_->_tmp29_ = _data_->response;
		if (_data_->_tmp29_ == NULL) {
			_data_->_tmp30_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, "Didn't receive a response for our request from the modem!");
			_data_->_inner_error_ = _data_->_tmp30_;
			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_);
				_g_object_unref0 (_data_->channel);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->channel);
				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_->_tmp31_ = _data_->response;
		_data_->_tmp32_ = (*_data_->_tmp31_).data;
		_data_->_tmp32__length1 = (*_data_->_tmp31_).length;
		_data_->gr = (struct ipc_gen_phone_res*) _data_->_tmp32_;
		_data_->_tmp33_ = _data_->gr;
		_data_->_tmp34_ = (*_data_->_tmp33_).code;
		if (((gint) _data_->_tmp34_) != 0x8000) {
			_data_->_tmp35_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, "Something went wrong when trying to answer an incoming call");
			_data_->_inner_error_ = _data_->_tmp35_;
			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_);
				_g_object_unref0 (_data_->channel);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->channel);
				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_->_tmp36_ = _data_->self->priv->_soundhandler;
		_data_->_state_ = 3;
		samsung_sound_handler_mute_microphone (_data_->_tmp36_, FALSE, samsung_call_handler_activate_ready, _data_);
		return FALSE;
		_state_3:
		samsung_sound_handler_mute_microphone_finish (_data_->_tmp36_, _data_->_res_, &_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_);
				_g_object_unref0 (_data_->channel);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->channel);
				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;
			}
		}
	}
	_g_object_unref0 (_data_->channel);
	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 samsung_call_handler_real_hold_data_free (gpointer _data) {
	SamsungCallHandlerHoldData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SamsungCallHandlerHoldData, _data_);
}


static void samsung_call_handler_real_hold (FsoGsmAbstractCallHandler* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	SamsungCallHandlerHoldData* _data_;
	SamsungCallHandler* _tmp0_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (SamsungCallHandlerHoldData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_hold);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_hold_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	samsung_call_handler_real_hold_co (_data_);
}


static void samsung_call_handler_real_hold_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	SamsungCallHandlerHoldData* _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 samsung_call_handler_real_hold_co (SamsungCallHandlerHoldData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = 0;
	_data_->_tmp0_ = samsung_call_handler_numberOfCallsWithStatus (_data_->self, FREE_SMARTPHONE_GSM_CALL_STATUS_ACTIVE);
	if (_data_->_tmp0_ == 0) {
		_data_->_tmp1_ = g_error_new_literal (FREE_SMARTPHONE_GSM_ERROR, FREE_SMARTPHONE_GSM_ERROR_CALL_NOT_FOUND, "No active call present");
		_data_->_inner_error_ = _data_->_tmp1_;
		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_);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			g_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_->_tmp2_ = 0;
	_data_->_tmp2_ = samsung_call_handler_numberOfCallsWithStatus (_data_->self, FREE_SMARTPHONE_GSM_CALL_STATUS_INCOMING);
	if (_data_->_tmp2_ > 0) {
		_data_->_tmp3_ = g_error_new_literal (FREE_SMARTPHONE_GSM_ERROR, FREE_SMARTPHONE_GSM_ERROR_CALL_NOT_FOUND, "Call incoming. Can't hold active calls without activating");
		_data_->_inner_error_ = _data_->_tmp3_;
		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_);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			g_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;
		}
	}
	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 samsung_call_handler_real_release_data_free (gpointer _data) {
	SamsungCallHandlerReleaseData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (SamsungCallHandlerReleaseData, _data_);
}


static void samsung_call_handler_real_release (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	SamsungCallHandlerReleaseData* _data_;
	SamsungCallHandler* _tmp0_;
	gint _tmp1_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (SamsungCallHandlerReleaseData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_release);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_release_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_data_->id = _tmp1_;
	samsung_call_handler_real_release_co (_data_);
}


static void samsung_call_handler_real_release_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	SamsungCallHandlerReleaseData* _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 samsung_call_handler_release_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	SamsungCallHandlerReleaseData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	samsung_call_handler_real_release_co (_data_);
}


static gboolean samsung_call_handler_real_release_co (SamsungCallHandlerReleaseData* _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_channel (_data_->_tmp0_, "main");
	_data_->channel = SAMSUNG_IS_IPC_CHANNEL (_data_->_tmp1_) ? ((SamsungIpcChannel*) _data_->_tmp1_) : NULL;
	_data_->response = NULL;
	_data_->_tmp3_ = _data_->id;
	if (_data_->_tmp3_ < 1) {
		_data_->_tmp2_ = TRUE;
	} else {
		_data_->_tmp4_ = _data_->id;
		_data_->_tmp2_ = ((guint) _data_->_tmp4_) > FSO_GSM_CONSTANTS_CALL_INDEX_MAX;
	}
	_data_->_tmp5_ = _data_->_tmp2_;
	if (_data_->_tmp5_) {
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = g_strdup_printf ("Call index needs to be within [ 1, %d ]", (gint) FSO_GSM_CONSTANTS_CALL_INDEX_MAX);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp8_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INVALID_PARAMETER, _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_g_free0 (_data_->_tmp7_);
		_data_->_inner_error_ = _data_->_tmp9_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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;
		}
	} else {
		_data_->_tmp10_ = _data_->self->calls;
		_data_->_tmp10__length1 = _data_->self->calls_length1;
		_data_->_tmp11_ = _data_->id;
		_data_->_tmp12_ = _data_->_tmp10_[_data_->_tmp11_];
		_data_->_tmp13_ = _data_->_tmp12_->detail;
		_data_->_tmp14_ = _data_->_tmp13_.status;
		if (_data_->_tmp14_ == FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE) {
			_data_->_tmp15_ = g_error_new_literal (FREE_SMARTPHONE_GSM_ERROR, FREE_SMARTPHONE_GSM_ERROR_CALL_NOT_FOUND, "No suitable call to release found");
			_data_->_inner_error_ = _data_->_tmp15_;
			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_);
				_g_object_unref0 (_data_->channel);
				if (_data_->_state_ == 0) {
					g_simple_async_result_complete_in_idle (_data_->_async_result);
				} else {
					g_simple_async_result_complete (_data_->_async_result);
				}
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->channel);
				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_->_tmp16_ = _data_->channel;
	_data_->_tmp17_ = NULL;
	_data_->_tmp17_ = g_new0 (guint8, 0);
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_tmp18__length1 = 0;
	_data_->_state_ = 1;
	samsung_ipc_channel_enqueue_async (_data_->_tmp16_, IPC_TYPE_EXEC, IPC_CALL_RELEASE, _data_->_tmp18_, 0, 0, 5, samsung_call_handler_release_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp19_ = NULL;
	_data_->_tmp19_ = samsung_ipc_channel_enqueue_finish (_data_->_tmp16_, _data_->_res_);
	_data_->response = _data_->_tmp19_;
	_data_->_tmp18_ = (g_free (_data_->_tmp18_), NULL);
	_data_->_tmp20_ = _data_->response;
	if (_data_->_tmp20_ == NULL) {
		_data_->_tmp21_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, "Didn't receive a response for our request from the modem!");
		_data_->_inner_error_ = _data_->_tmp21_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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_->_tmp22_ = _data_->response;
	_data_->_tmp23_ = (*_data_->_tmp22_).data;
	_data_->_tmp23__length1 = (*_data_->_tmp22_).length;
	_data_->gr = (struct ipc_gen_phone_res*) _data_->_tmp23_;
	_data_->_tmp24_ = _data_->gr;
	_data_->_tmp25_ = (*_data_->_tmp24_).code;
	if (((gint) _data_->_tmp25_) != 0x8000) {
		_data_->_tmp26_ = _data_->id;
		_data_->_tmp27_ = NULL;
		_data_->_tmp27_ = g_strdup_printf ("%i", _data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = g_strconcat ("Could not release call with id = ", _data_->_tmp28_, NULL);
		_data_->_tmp30_ = _data_->_tmp29_;
		_data_->_tmp31_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_INTERNAL_ERROR, _data_->_tmp30_);
		_data_->_tmp32_ = _data_->_tmp31_;
		_g_free0 (_data_->_tmp30_);
		_g_free0 (_data_->_tmp28_);
		_data_->_inner_error_ = _data_->_tmp32_;
		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_);
			_g_object_unref0 (_data_->channel);
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->channel);
			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;
		}
	}
	_g_object_unref0 (_data_->channel);
	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 samsung_call_handler_real_releaseAll_data_free (gpointer _data) {
	samsung_call_handler_releaseAllData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (samsung_call_handler_releaseAllData, _data_);
}


static void samsung_call_handler_real_releaseAll (FsoGsmAbstractCallHandler* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	samsung_call_handler_releaseAllData* _data_;
	SamsungCallHandler* _tmp0_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (samsung_call_handler_releaseAllData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_releaseAll);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_releaseAll_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	samsung_call_handler_real_releaseAll_co (_data_);
}


static void samsung_call_handler_real_releaseAll_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	samsung_call_handler_releaseAllData* _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 samsung_call_handler_real_releaseAll_co (samsung_call_handler_releaseAllData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		_data_->i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
		{
			_data_->_tmp0_ = TRUE;
			while (TRUE) {
				_data_->_tmp1_ = _data_->_tmp0_;
				if (!_data_->_tmp1_) {
					_data_->_tmp2_ = _data_->i;
					_data_->i = _data_->_tmp2_ + 1;
				}
				_data_->_tmp0_ = FALSE;
				_data_->_tmp3_ = _data_->i;
				if (!(((guint) _data_->_tmp3_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
					break;
				}
				_data_->_tmp5_ = _data_->self->calls;
				_data_->_tmp5__length1 = _data_->self->calls_length1;
				_data_->_tmp6_ = _data_->i;
				_data_->_tmp7_ = _data_->_tmp5_[_data_->_tmp6_];
				_data_->_tmp8_ = _data_->_tmp7_->detail;
				_data_->_tmp9_ = _data_->_tmp8_.status;
				if (_data_->_tmp9_ != FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE) {
					_data_->_tmp10_ = _data_->self->calls;
					_data_->_tmp10__length1 = _data_->self->calls_length1;
					_data_->_tmp11_ = _data_->i;
					_data_->_tmp12_ = _data_->_tmp10_[_data_->_tmp11_];
					_data_->_tmp13_ = _data_->_tmp12_->detail;
					_data_->_tmp14_ = _data_->_tmp13_.status;
					_data_->_tmp4_ = _data_->_tmp14_ != FREE_SMARTPHONE_GSM_CALL_STATUS_INCOMING;
				} else {
					_data_->_tmp4_ = FALSE;
				}
				_data_->_tmp15_ = _data_->_tmp4_;
				if (_data_->_tmp15_) {
					_data_->_tmp16_ = _data_->i;
					fso_gsm_abstract_call_handler_release ((FsoGsmAbstractCallHandler*) _data_->self, _data_->_tmp16_, NULL, 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;
}


static gchar* samsung_call_handler_real_repr (FsoFrameworkAbstractObject* base) {
	SamsungCallHandler * self;
	gchar* result = NULL;
	gchar* _tmp0_;
	self = (SamsungCallHandler*) base;
	_tmp0_ = g_strdup ("<>");
	result = _tmp0_;
	return result;
}


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


void samsung_call_handler_syncCallStatusAsync (SamsungCallHandler* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	samsung_call_handler_syncCallStatusAsyncData* _data_;
	SamsungCallHandler* _tmp0_;
	_data_ = g_slice_new0 (samsung_call_handler_syncCallStatusAsyncData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_syncCallStatusAsync);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_syncCallStatusAsync_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	samsung_call_handler_syncCallStatusAsync_co (_data_);
}


void samsung_call_handler_syncCallStatusAsync_finish (SamsungCallHandler* self, GAsyncResult* _res_) {
	samsung_call_handler_syncCallStatusAsyncData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static gboolean samsung_call_handler_syncCallStatusAsync_co (samsung_call_handler_syncCallStatusAsyncData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	fso_gsm_abstract_call_handler_startTimeoutIfNecessary ((FsoGsmAbstractCallHandler*) _data_->self);
	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 samsung_call_handler_syncCallStatus_data_free (gpointer _data) {
	samsung_call_handler_syncCallStatusData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (samsung_call_handler_syncCallStatusData, _data_);
}


void samsung_call_handler_syncCallStatus (SamsungCallHandler* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	samsung_call_handler_syncCallStatusData* _data_;
	SamsungCallHandler* _tmp0_;
	_data_ = g_slice_new0 (samsung_call_handler_syncCallStatusData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_syncCallStatus);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_syncCallStatus_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	samsung_call_handler_syncCallStatus_co (_data_);
}


void samsung_call_handler_syncCallStatus_finish (SamsungCallHandler* self, GAsyncResult* _res_) {
	samsung_call_handler_syncCallStatusData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void samsung_call_handler_syncCallStatus_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	samsung_call_handler_syncCallStatusData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	samsung_call_handler_syncCallStatus_co (_data_);
}


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


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


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


static gboolean samsung_call_handler_syncCallStatus_co (samsung_call_handler_syncCallStatusData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->self->priv->inSyncCallStatus = TRUE;
	{
		_data_->_tmp0_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
		_data_->_tmp1_ = FALSE;
		_data_->_tmp1_ = fso_framework_logger_debug (_data_->_tmp0_, "Synchronizing call status");
		g_assert (_data_->_tmp1_);
		_data_->_tmp2_ = fso_gsm_theModem;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = fso_gsm_modem_createMediator (_data_->_tmp2_, FSO_GSM_TYPE_CALL_LIST_CALLS, (GBoxedCopyFunc) g_object_ref, g_object_unref, &_data_->_inner_error_);
		_data_->m = (FsoGsmCallListCalls*) _data_->_tmp3_;
		if (_data_->_inner_error_ != NULL) {
			goto __catch2_g_error;
		}
		_data_->_tmp4_ = _data_->m;
		_data_->_state_ = 1;
		fso_gsm_call_list_calls_run (_data_->_tmp4_, samsung_call_handler_syncCallStatus_ready, _data_);
		return FALSE;
		_state_1:
		fso_gsm_call_list_calls_run_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error_);
		if (_data_->_inner_error_ != NULL) {
			_g_object_unref0 (_data_->m);
			goto __catch2_g_error;
		}
		_data_->length = 0;
		_data_->_tmp5_ = _data_->m;
		_data_->_tmp6_ = fso_gsm_call_list_calls_get_calls (_data_->_tmp5_, &_data_->_tmp6__length1);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_tmp7__length1 = _data_->_tmp6__length1;
		{
			_data_->c_collection_length1 = 0;
			_data_->_c_collection_size_ = 0;
			_data_->c_collection = _data_->_tmp7_;
			_data_->c_collection_length1 = _data_->_tmp7__length1;
			_data_->c_it = 0;
			for (_data_->c_it = 0; _data_->c_it < _data_->_tmp7__length1; _data_->c_it = _data_->c_it + 1) {
				memset (&_data_->_tmp8_, 0, sizeof (FreeSmartphoneGSMCallDetail));
				free_smartphone_gsm_call_detail_copy (&_data_->c_collection[_data_->c_it], &_data_->_tmp8_);
				_data_->c = _data_->_tmp8_;
				{
					_data_->_tmp9_ = _data_->length;
					_data_->length = _data_->_tmp9_ + 1;
					free_smartphone_gsm_call_detail_destroy (&_data_->c);
				}
			}
		}
		_data_->_tmp10_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
		_data_->_tmp11_ = _data_->length;
		_data_->_tmp12_ = NULL;
		_data_->_tmp12_ = g_strdup_printf ("%i", _data_->_tmp11_);
		_data_->_tmp13_ = _data_->_tmp12_;
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = g_strconcat (_data_->_tmp13_, " calls known in the system", NULL);
		_data_->_tmp15_ = _data_->_tmp14_;
		_data_->_tmp16_ = FALSE;
		_data_->_tmp16_ = fso_framework_logger_debug (_data_->_tmp10_, _data_->_tmp15_);
		g_assert (_data_->_tmp16_);
		_g_free0 (_data_->_tmp15_);
		_g_free0 (_data_->_tmp13_);
		_data_->_tmp17_ = _data_->length;
		if (_data_->_tmp17_ == 0) {
			_data_->_tmp18_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
			_data_->_tmp19_ = FALSE;
			_data_->_tmp19_ = fso_framework_logger_debug (_data_->_tmp18_, "call status idle -> stopping updater");
			g_assert (_data_->_tmp19_);
			_data_->_tmp20_ = _data_->self->timeout;
			g_source_remove (_data_->_tmp20_);
			_data_->self->timeout = (guint) 0;
		}
		_data_->_tmp21_ = _data_->self->supplementary;
		if (_data_->_tmp21_ != NULL) {
			_data_->_tmp22_ = _data_->m;
			_data_->_tmp23_ = fso_gsm_call_list_calls_get_calls (_data_->_tmp22_, &_data_->_tmp23__length1);
			_data_->_tmp24_ = _data_->_tmp23_;
			_data_->_tmp24__length1 = _data_->_tmp23__length1;
			{
				_data_->ca_collection_length1 = 0;
				_data_->_ca_collection_size_ = 0;
				_data_->ca_collection = _data_->_tmp24_;
				_data_->ca_collection_length1 = _data_->_tmp24__length1;
				_data_->ca_it = 0;
				for (_data_->ca_it = 0; _data_->ca_it < _data_->_tmp24__length1; _data_->ca_it = _data_->ca_it + 1) {
					memset (&_data_->_tmp25_, 0, sizeof (FreeSmartphoneGSMCallDetail));
					free_smartphone_gsm_call_detail_copy (&_data_->ca_collection[_data_->ca_it], &_data_->_tmp25_);
					_data_->ca = _data_->_tmp25_;
					{
						_data_->_tmp26_ = _data_->ca;
						_data_->_tmp27_ = _data_->_tmp26_.properties;
						_data_->_tmp28_ = NULL;
						_data_->_tmp28_ = g_hash_table_lookup (_data_->_tmp27_, "direction");
						_data_->_tmp29_ = NULL;
						_data_->_tmp29_ = g_variant_get_string ((GVariant*) _data_->_tmp28_, NULL);
						_data_->_tmp30_ = g_strdup (_data_->_tmp29_);
						_data_->direction = _data_->_tmp30_;
						_data_->_tmp31_ = _data_->direction;
						_data_->_tmp32_ = _data_->self->supplementary;
						_data_->_tmp33_ = _data_->_tmp32_->first;
						if (g_strcmp0 (_data_->_tmp31_, (const gchar*) _data_->_tmp33_) == 0) {
							_data_->_tmp34_ = _data_->ca;
							_data_->_tmp35_ = _data_->_tmp34_.properties;
							_data_->_tmp36_ = g_strdup ("service");
							_data_->_tmp37_ = _data_->self->supplementary;
							_data_->_tmp38_ = _data_->_tmp37_->second;
							_data_->_tmp39_ = _variant_new30 ((const gchar*) _data_->_tmp38_);
							g_hash_table_insert (_data_->_tmp35_, _data_->_tmp36_, _data_->_tmp39_);
						}
						_g_free0 (_data_->direction);
						free_smartphone_gsm_call_detail_destroy (&_data_->ca);
					}
				}
			}
			_fso_framework_pair_unref0 (_data_->self->supplementary);
			_data_->self->supplementary = NULL;
		}
		_data_->_tmp40_ = NULL;
		_data_->_tmp40_ = g_new0 (gboolean, FSO_GSM_CONSTANTS_CALL_INDEX_MAX + 1);
		_data_->visited = _data_->_tmp40_;
		_data_->visited_length1 = FSO_GSM_CONSTANTS_CALL_INDEX_MAX + 1;
		_data_->_visited_size_ = _data_->visited_length1;
		_data_->_tmp41_ = _data_->m;
		_data_->_tmp42_ = fso_gsm_call_list_calls_get_calls (_data_->_tmp41_, &_data_->_tmp42__length1);
		_data_->_tmp43_ = _data_->_tmp42_;
		_data_->_tmp43__length1 = _data_->_tmp42__length1;
		{
			_data_->call_collection_length1 = 0;
			_data_->_call_collection_size_ = 0;
			_data_->call_collection = _data_->_tmp43_;
			_data_->call_collection_length1 = _data_->_tmp43__length1;
			_data_->call_it = 0;
			for (_data_->call_it = 0; _data_->call_it < _data_->_tmp43__length1; _data_->call_it = _data_->call_it + 1) {
				memset (&_data_->_tmp44_, 0, sizeof (FreeSmartphoneGSMCallDetail));
				free_smartphone_gsm_call_detail_copy (&_data_->call_collection[_data_->call_it], &_data_->_tmp44_);
				_data_->call = _data_->_tmp44_;
				{
					_data_->_tmp45_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
					_data_->_tmp46_ = _data_->call;
					_data_->_tmp47_ = _data_->_tmp46_.id;
					_data_->_tmp48_ = NULL;
					_data_->_tmp48_ = g_strdup_printf ("%i", _data_->_tmp47_);
					_data_->_tmp49_ = _data_->_tmp48_;
					_data_->_tmp50_ = NULL;
					_data_->_tmp50_ = g_strconcat ("Updating call with id = ", _data_->_tmp49_, " ...", NULL);
					_data_->_tmp51_ = _data_->_tmp50_;
					_data_->_tmp52_ = FALSE;
					_data_->_tmp52_ = fso_framework_logger_debug (_data_->_tmp45_, _data_->_tmp51_);
					g_assert (_data_->_tmp52_);
					_g_free0 (_data_->_tmp51_);
					_g_free0 (_data_->_tmp49_);
					_data_->_tmp54_ = _data_->call;
					_data_->_tmp55_ = _data_->_tmp54_.id;
					if (_data_->_tmp55_ < 0) {
						_data_->_tmp53_ = TRUE;
					} else {
						_data_->_tmp56_ = _data_->call;
						_data_->_tmp57_ = _data_->_tmp56_.id;
						_data_->_tmp53_ = ((guint) _data_->_tmp57_) > FSO_GSM_CONSTANTS_CALL_INDEX_MAX;
					}
					_data_->_tmp58_ = _data_->_tmp53_;
					if (_data_->_tmp58_) {
						_data_->_tmp59_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
						_data_->_tmp60_ = _data_->call;
						_data_->_tmp61_ = _data_->_tmp60_.id;
						_data_->_tmp62_ = NULL;
						_data_->_tmp62_ = g_strdup_printf ("%i", _data_->_tmp61_);
						_data_->_tmp63_ = _data_->_tmp62_;
						_data_->_tmp64_ = NULL;
						_data_->_tmp64_ = g_strconcat ("Got call with invalid id = ", _data_->_tmp63_, "; discarding this one!", NULL);
						_data_->_tmp65_ = _data_->_tmp64_;
						fso_framework_logger_warning (_data_->_tmp59_, _data_->_tmp65_);
						_g_free0 (_data_->_tmp65_);
						_g_free0 (_data_->_tmp63_);
						free_smartphone_gsm_call_detail_destroy (&_data_->call);
						continue;
					}
					_data_->_tmp66_ = _data_->self->calls;
					_data_->_tmp66__length1 = _data_->self->calls_length1;
					_data_->_tmp67_ = _data_->call;
					_data_->_tmp68_ = _data_->_tmp67_.id;
					_data_->_tmp69_ = _data_->_tmp66_[_data_->_tmp68_];
					_data_->_tmp70_ = _data_->call;
					fso_gsm_call_update (_data_->_tmp69_, &_data_->_tmp70_);
					_data_->_tmp71_ = _data_->visited;
					_data_->_tmp71__length1 = _data_->visited_length1;
					_data_->_tmp72_ = _data_->call;
					_data_->_tmp73_ = _data_->_tmp72_.id;
					_data_->_tmp71_[_data_->_tmp73_] = TRUE;
					_data_->_tmp74_ = _data_->_tmp71_[_data_->_tmp73_];
					free_smartphone_gsm_call_detail_destroy (&_data_->call);
				}
			}
		}
		{
			_data_->i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
			{
				_data_->_tmp75_ = TRUE;
				while (TRUE) {
					_data_->_tmp76_ = _data_->_tmp75_;
					if (!_data_->_tmp76_) {
						_data_->_tmp77_ = _data_->i;
						_data_->i = _data_->_tmp77_ + 1;
					}
					_data_->_tmp75_ = FALSE;
					_data_->_tmp78_ = _data_->i;
					if (!(((guint) _data_->_tmp78_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
						break;
					}
					_data_->_tmp80_ = _data_->visited;
					_data_->_tmp80__length1 = _data_->visited_length1;
					_data_->_tmp81_ = _data_->i;
					_data_->_tmp82_ = _data_->_tmp80_[_data_->_tmp81_];
					if (!_data_->_tmp82_) {
						_data_->_tmp83_ = _data_->self->calls;
						_data_->_tmp83__length1 = _data_->self->calls_length1;
						_data_->_tmp84_ = _data_->i;
						_data_->_tmp85_ = _data_->_tmp83_[_data_->_tmp84_];
						_data_->_tmp86_ = _data_->_tmp85_->detail;
						_data_->_tmp87_ = _data_->_tmp86_.status;
						_data_->_tmp79_ = _data_->_tmp87_ != FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE;
					} else {
						_data_->_tmp79_ = FALSE;
					}
					_data_->_tmp88_ = _data_->_tmp79_;
					if (_data_->_tmp88_) {
						_data_->_tmp89_ = _data_->i;
						_data_->_tmp90_ = g_str_hash;
						_data_->_tmp91_ = g_str_equal;
						_data_->_tmp92_ = g_hash_table_new_full (_data_->_tmp90_, _data_->_tmp91_, _g_free0_, _g_variant_unref0_);
						_data_->_tmp93_ = _data_->_tmp92_;
						free_smartphone_gsm_call_detail_init (&_data_->detail, _data_->_tmp89_, FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE, _data_->_tmp93_);
						_g_hash_table_unref0 (_data_->_tmp93_);
						_data_->_tmp94_ = _data_->self->calls;
						_data_->_tmp94__length1 = _data_->self->calls_length1;
						_data_->_tmp95_ = _data_->i;
						_data_->_tmp96_ = _data_->_tmp94_[_data_->_tmp95_];
						_data_->_tmp97_ = _data_->detail;
						fso_gsm_call_update (_data_->_tmp96_, &_data_->_tmp97_);
						free_smartphone_gsm_call_detail_destroy (&_data_->detail);
					}
				}
			}
		}
		_data_->visited = (g_free (_data_->visited), NULL);
		_g_object_unref0 (_data_->m);
	}
	goto __finally2;
	__catch2_g_error:
	{
		_data_->e = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp98_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
		_data_->_tmp99_ = _data_->e;
		_data_->_tmp100_ = _data_->_tmp99_->message;
		_data_->_tmp101_ = NULL;
		_data_->_tmp101_ = string_to_string (_data_->_tmp100_);
		_data_->_tmp102_ = NULL;
		_data_->_tmp102_ = g_strconcat ("Can't synchronize call status: ", _data_->_tmp101_, NULL);
		_data_->_tmp103_ = _data_->_tmp102_;
		fso_framework_logger_error (_data_->_tmp98_, _data_->_tmp103_);
		_g_free0 (_data_->_tmp103_);
		_g_error_free0 (_data_->e);
	}
	__finally2:
	if (_data_->_inner_error_ != 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_->self->priv->inSyncCallStatus = FALSE;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static gboolean _samsung_call_handler_onTimeout_gsource_func (gpointer self) {
	gboolean result;
	result = samsung_call_handler_onTimeout (self);
	return result;
}


static void samsung_call_handler_real_startTimeoutIfNecessary (FsoGsmAbstractCallHandler* base) {
	SamsungCallHandler * self;
	guint _tmp0_;
	self = (SamsungCallHandler*) base;
	samsung_call_handler_onTimeout (self);
	_tmp0_ = self->timeout;
	if (_tmp0_ == ((guint) 0)) {
		guint _tmp1_ = 0U;
		_tmp1_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) CALL_STATUS_REFRESH_TIMEOUT, _samsung_call_handler_onTimeout_gsource_func, g_object_ref (self), g_object_unref);
		self->timeout = _tmp1_;
	}
}


gboolean samsung_call_handler_onTimeout (SamsungCallHandler* self) {
	gboolean result = FALSE;
	gboolean _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->inSyncCallStatus;
	if (_tmp0_) {
		FsoFrameworkLogger* _tmp1_;
		gboolean _tmp2_ = FALSE;
		_tmp1_ = ((FsoFrameworkAbstractObject*) self)->logger;
		_tmp2_ = fso_framework_logger_debug (_tmp1_, "Synchronizing call status not done yet... ignoring");
		g_assert (_tmp2_);
	} else {
		samsung_call_handler_syncCallStatus (self, NULL, NULL);
	}
	result = TRUE;
	return result;
}


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


static void samsung_call_handler_real_cancelOutgoingWithId (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	samsung_call_handler_cancelOutgoingWithIdData* _data_;
	SamsungCallHandler* _tmp0_;
	gint _tmp1_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (samsung_call_handler_cancelOutgoingWithIdData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_cancelOutgoingWithId);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_cancelOutgoingWithId_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_data_->id = _tmp1_;
	samsung_call_handler_real_cancelOutgoingWithId_co (_data_);
}


static void samsung_call_handler_real_cancelOutgoingWithId_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	samsung_call_handler_cancelOutgoingWithIdData* _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 samsung_call_handler_real_cancelOutgoingWithId_co (samsung_call_handler_cancelOutgoingWithIdData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
	_data_->_tmp1_ = _data_->id;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = g_strdup_printf ("%i", _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = g_strconcat ("Cancelling outgoing call with ID ", _data_->_tmp3_, NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = FALSE;
	_data_->_tmp6_ = fso_framework_logger_debug (_data_->_tmp0_, _data_->_tmp5_);
	g_assert (_data_->_tmp6_);
	_g_free0 (_data_->_tmp5_);
	_g_free0 (_data_->_tmp3_);
	_data_->_tmp7_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_UNSUPPORTED, "Not yet implemented!");
	_data_->_inner_error_ = _data_->_tmp7_;
	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_);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		g_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;
	}
	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 samsung_call_handler_real_rejectIncomingWithId_data_free (gpointer _data) {
	samsung_call_handler_rejectIncomingWithIdData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (samsung_call_handler_rejectIncomingWithIdData, _data_);
}


static void samsung_call_handler_real_rejectIncomingWithId (FsoGsmAbstractCallHandler* base, gint id, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	SamsungCallHandler * self;
	samsung_call_handler_rejectIncomingWithIdData* _data_;
	SamsungCallHandler* _tmp0_;
	gint _tmp1_;
	self = (SamsungCallHandler*) base;
	_data_ = g_slice_new0 (samsung_call_handler_rejectIncomingWithIdData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, samsung_call_handler_real_rejectIncomingWithId);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, samsung_call_handler_real_rejectIncomingWithId_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_data_->id = _tmp1_;
	samsung_call_handler_real_rejectIncomingWithId_co (_data_);
}


static void samsung_call_handler_real_rejectIncomingWithId_finish (FsoGsmAbstractCallHandler* base, GAsyncResult* _res_, GError** error) {
	samsung_call_handler_rejectIncomingWithIdData* _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 samsung_call_handler_real_rejectIncomingWithId_co (samsung_call_handler_rejectIncomingWithIdData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = ((FsoFrameworkAbstractObject*) _data_->self)->logger;
	_data_->_tmp1_ = _data_->id;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = g_strdup_printf ("%i", _data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = g_strconcat ("Rejecting incoming call with ID ", _data_->_tmp3_, NULL);
	_data_->_tmp5_ = _data_->_tmp4_;
	_data_->_tmp6_ = FALSE;
	_data_->_tmp6_ = fso_framework_logger_debug (_data_->_tmp0_, _data_->_tmp5_);
	g_assert (_data_->_tmp6_);
	_g_free0 (_data_->_tmp5_);
	_g_free0 (_data_->_tmp3_);
	_data_->_tmp7_ = g_error_new_literal (FREE_SMARTPHONE_ERROR, FREE_SMARTPHONE_ERROR_UNSUPPORTED, "Not yet implemented!");
	_data_->_inner_error_ = _data_->_tmp7_;
	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_);
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		g_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;
	}
	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 gint samsung_call_handler_numberOfBusyCalls (SamsungCallHandler* self) {
	gint result = 0;
	gint num;
	g_return_val_if_fail (self != NULL, 0);
	num = 0;
	{
		gint i;
		i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean _tmp1_;
				gint _tmp3_;
				gboolean _tmp4_ = FALSE;
				FsoGsmCall** _tmp5_;
				gint _tmp5__length1;
				gint _tmp6_;
				FsoGsmCall* _tmp7_;
				FreeSmartphoneGSMCallDetail _tmp8_;
				FreeSmartphoneGSMCallStatus _tmp9_;
				gboolean _tmp15_;
				_tmp1_ = _tmp0_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp3_ = i;
				if (!(((guint) _tmp3_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
					break;
				}
				_tmp5_ = self->calls;
				_tmp5__length1 = self->calls_length1;
				_tmp6_ = i;
				_tmp7_ = _tmp5_[_tmp6_];
				_tmp8_ = _tmp7_->detail;
				_tmp9_ = _tmp8_.status;
				if (_tmp9_ != FREE_SMARTPHONE_GSM_CALL_STATUS_RELEASE) {
					FsoGsmCall** _tmp10_;
					gint _tmp10__length1;
					gint _tmp11_;
					FsoGsmCall* _tmp12_;
					FreeSmartphoneGSMCallDetail _tmp13_;
					FreeSmartphoneGSMCallStatus _tmp14_;
					_tmp10_ = self->calls;
					_tmp10__length1 = self->calls_length1;
					_tmp11_ = i;
					_tmp12_ = _tmp10_[_tmp11_];
					_tmp13_ = _tmp12_->detail;
					_tmp14_ = _tmp13_.status;
					_tmp4_ = _tmp14_ != FREE_SMARTPHONE_GSM_CALL_STATUS_INCOMING;
				} else {
					_tmp4_ = FALSE;
				}
				_tmp15_ = _tmp4_;
				if (_tmp15_) {
					gint _tmp16_;
					_tmp16_ = num;
					num = _tmp16_ + 1;
				}
			}
		}
	}
	result = num;
	return result;
}


static gint samsung_call_handler_numberOfCallsWithStatus (SamsungCallHandler* self, FreeSmartphoneGSMCallStatus status) {
	gint result = 0;
	gint num;
	g_return_val_if_fail (self != NULL, 0);
	num = 0;
	{
		gint i;
		i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean _tmp1_;
				gint _tmp3_;
				FsoGsmCall** _tmp4_;
				gint _tmp4__length1;
				gint _tmp5_;
				FsoGsmCall* _tmp6_;
				FreeSmartphoneGSMCallDetail _tmp7_;
				FreeSmartphoneGSMCallStatus _tmp8_;
				FreeSmartphoneGSMCallStatus _tmp9_;
				_tmp1_ = _tmp0_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp3_ = i;
				if (!(((guint) _tmp3_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
					break;
				}
				_tmp4_ = self->calls;
				_tmp4__length1 = self->calls_length1;
				_tmp5_ = i;
				_tmp6_ = _tmp4_[_tmp5_];
				_tmp7_ = _tmp6_->detail;
				_tmp8_ = _tmp7_.status;
				_tmp9_ = status;
				if (_tmp8_ == _tmp9_) {
					gint _tmp10_;
					_tmp10_ = num;
					num = _tmp10_ + 1;
				}
			}
		}
	}
	result = num;
	return result;
}


static gint samsung_call_handler_lowestOfCallsWithStatus (SamsungCallHandler* self, FreeSmartphoneGSMCallStatus status) {
	gint result = 0;
	g_return_val_if_fail (self != NULL, 0);
	{
		gint i;
		i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
		{
			gboolean _tmp0_;
			_tmp0_ = TRUE;
			while (TRUE) {
				gboolean _tmp1_;
				gint _tmp3_;
				FsoGsmCall** _tmp4_;
				gint _tmp4__length1;
				gint _tmp5_;
				FsoGsmCall* _tmp6_;
				FreeSmartphoneGSMCallDetail _tmp7_;
				FreeSmartphoneGSMCallStatus _tmp8_;
				FreeSmartphoneGSMCallStatus _tmp9_;
				_tmp1_ = _tmp0_;
				if (!_tmp1_) {
					gint _tmp2_;
					_tmp2_ = i;
					i = _tmp2_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp3_ = i;
				if (!(((guint) _tmp3_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
					break;
				}
				_tmp4_ = self->calls;
				_tmp4__length1 = self->calls_length1;
				_tmp5_ = i;
				_tmp6_ = _tmp4_[_tmp5_];
				_tmp7_ = _tmp6_->detail;
				_tmp8_ = _tmp7_.status;
				_tmp9_ = status;
				if (_tmp8_ == _tmp9_) {
					result = i;
					return result;
				}
			}
		}
	}
	result = 0;
	return result;
}


SamsungCallHandler* samsung_call_handler_construct (GType object_type) {
	SamsungCallHandler * self = NULL;
	self = (SamsungCallHandler*) fso_gsm_abstract_call_handler_construct (object_type);
	return self;
}


SamsungCallHandler* samsung_call_handler_new (void) {
	return samsung_call_handler_construct (SAMSUNG_TYPE_CALL_HANDLER);
}


static GObject * samsung_call_handler_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
	GObject * obj;
	GObjectClass * parent_class;
	SamsungCallHandler * self;
	FsoGsmCall** _tmp0_ = NULL;
	SamsungSoundHandler* _tmp10_;
	parent_class = G_OBJECT_CLASS (samsung_call_handler_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = SAMSUNG_CALL_HANDLER (obj);
	_tmp0_ = g_new0 (FsoGsmCall*, (FSO_GSM_CONSTANTS_CALL_INDEX_MAX + 1) + 1);
	self->calls = (_vala_array_free (self->calls, self->calls_length1, (GDestroyNotify) fso_gsm_call_unref), NULL);
	self->calls = _tmp0_;
	self->calls_length1 = FSO_GSM_CONSTANTS_CALL_INDEX_MAX + 1;
	{
		gint i;
		i = FSO_GSM_CONSTANTS_CALL_INDEX_MIN;
		{
			gboolean _tmp1_;
			_tmp1_ = TRUE;
			while (TRUE) {
				gboolean _tmp2_;
				gint _tmp4_;
				FsoGsmCall** _tmp5_;
				gint _tmp5__length1;
				gint _tmp6_;
				gint _tmp7_;
				FsoGsmCall* _tmp8_;
				FsoGsmCall* _tmp9_;
				_tmp2_ = _tmp1_;
				if (!_tmp2_) {
					gint _tmp3_;
					_tmp3_ = i;
					i = _tmp3_ + 1;
				}
				_tmp1_ = FALSE;
				_tmp4_ = i;
				if (!(((guint) _tmp4_) != FSO_GSM_CONSTANTS_CALL_INDEX_MAX)) {
					break;
				}
				_tmp5_ = self->calls;
				_tmp5__length1 = self->calls_length1;
				_tmp6_ = i;
				_tmp7_ = i;
				_tmp8_ = fso_gsm_call_new_newFromId (_tmp7_);
				_fso_gsm_call_unref0 (_tmp5_[_tmp6_]);
				_tmp5_[_tmp6_] = _tmp8_;
				_tmp9_ = _tmp5_[_tmp6_];
			}
		}
	}
	_tmp10_ = samsung_sound_handler_new ();
	_g_object_unref0 (self->priv->_soundhandler);
	self->priv->_soundhandler = _tmp10_;
	return obj;
}


static void samsung_call_handler_class_init (SamsungCallHandlerClass * klass) {
	samsung_call_handler_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (SamsungCallHandlerPrivate));
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->initiate = samsung_call_handler_real_initiate;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->initiate_finish = samsung_call_handler_real_initiate_finish;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->addSupplementaryInformation = samsung_call_handler_real_addSupplementaryInformation;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->activate = samsung_call_handler_real_activate;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->activate_finish = samsung_call_handler_real_activate_finish;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->hold = samsung_call_handler_real_hold;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->hold_finish = samsung_call_handler_real_hold_finish;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->release = samsung_call_handler_real_release;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->release_finish = samsung_call_handler_real_release_finish;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->releaseAll = samsung_call_handler_real_releaseAll;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->releaseAll_finish = samsung_call_handler_real_releaseAll_finish;
	FSO_FRAMEWORK_ABSTRACT_OBJECT_CLASS (klass)->repr = samsung_call_handler_real_repr;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->startTimeoutIfNecessary = samsung_call_handler_real_startTimeoutIfNecessary;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->cancelOutgoingWithId = samsung_call_handler_real_cancelOutgoingWithId;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->cancelOutgoingWithId_finish = samsung_call_handler_real_cancelOutgoingWithId_finish;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->rejectIncomingWithId = samsung_call_handler_real_rejectIncomingWithId;
	FSO_GSM_ABSTRACT_CALL_HANDLER_CLASS (klass)->rejectIncomingWithId_finish = samsung_call_handler_real_rejectIncomingWithId_finish;
	G_OBJECT_CLASS (klass)->constructor = samsung_call_handler_constructor;
	G_OBJECT_CLASS (klass)->finalize = samsung_call_handler_finalize;
}


static void samsung_call_handler_instance_init (SamsungCallHandler * self) {
	self->priv = SAMSUNG_CALL_HANDLER_GET_PRIVATE (self);
}


static void samsung_call_handler_finalize (GObject* obj) {
	SamsungCallHandler * self;
	self = SAMSUNG_CALL_HANDLER (obj);
	self->calls = (_vala_array_free (self->calls, self->calls_length1, (GDestroyNotify) fso_gsm_call_unref), NULL);
	_fso_framework_pair_unref0 (self->supplementary);
	_g_object_unref0 (self->priv->_soundhandler);
	G_OBJECT_CLASS (samsung_call_handler_parent_class)->finalize (obj);
}


/**
 * @class Samsung.CallHandler
 */
GType samsung_call_handler_get_type (void) {
	return samsung_call_handler_type_id;
}


GType samsung_call_handler_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (SamsungCallHandlerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) samsung_call_handler_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (SamsungCallHandler), 0, (GInstanceInitFunc) samsung_call_handler_instance_init, NULL };
	samsung_call_handler_type_id = g_type_module_register_type (module, FSO_GSM_TYPE_ABSTRACT_CALL_HANDLER, "SamsungCallHandler", &g_define_type_info, 0);
	return samsung_call_handler_type_id;
}


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



