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

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


#define QUALCOMM_PALM_TYPE_MODEM (qualcomm_palm_modem_get_type ())
#define QUALCOMM_PALM_MODEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), QUALCOMM_PALM_TYPE_MODEM, QualcommPalmModem))
#define QUALCOMM_PALM_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), QUALCOMM_PALM_TYPE_MODEM, QualcommPalmModemClass))
#define QUALCOMM_PALM_IS_MODEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), QUALCOMM_PALM_TYPE_MODEM))
#define QUALCOMM_PALM_IS_MODEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), QUALCOMM_PALM_TYPE_MODEM))
#define QUALCOMM_PALM_MODEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), QUALCOMM_PALM_TYPE_MODEM, QualcommPalmModemClass))

typedef struct _QualcommPalmModem QualcommPalmModem;
typedef struct _QualcommPalmModemClass QualcommPalmModemClass;
typedef struct _QualcommPalmModemPrivate QualcommPalmModemPrivate;

#define TYPE_MSM_CALL_HANDLER (msm_call_handler_get_type ())
#define MSM_CALL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MSM_CALL_HANDLER, MsmCallHandler))
#define MSM_CALL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MSM_CALL_HANDLER, MsmCallHandlerClass))
#define IS_MSM_CALL_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MSM_CALL_HANDLER))
#define IS_MSM_CALL_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MSM_CALL_HANDLER))
#define MSM_CALL_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MSM_CALL_HANDLER, MsmCallHandlerClass))

typedef struct _MsmCallHandler MsmCallHandler;
typedef struct _MsmCallHandlerClass MsmCallHandlerClass;

#define TYPE_MSM_SMS_HANDLER (msm_sms_handler_get_type ())
#define MSM_SMS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MSM_SMS_HANDLER, MsmSmsHandler))
#define MSM_SMS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MSM_SMS_HANDLER, MsmSmsHandlerClass))
#define IS_MSM_SMS_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MSM_SMS_HANDLER))
#define IS_MSM_SMS_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MSM_SMS_HANDLER))
#define MSM_SMS_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MSM_SMS_HANDLER, MsmSmsHandlerClass))

typedef struct _MsmSmsHandler MsmSmsHandler;
typedef struct _MsmSmsHandlerClass MsmSmsHandlerClass;

#define TYPE_MSM_PHONEBOOK_HANDLER (msm_phonebook_handler_get_type ())
#define MSM_PHONEBOOK_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MSM_PHONEBOOK_HANDLER, MsmPhonebookHandler))
#define MSM_PHONEBOOK_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MSM_PHONEBOOK_HANDLER, MsmPhonebookHandlerClass))
#define IS_MSM_PHONEBOOK_HANDLER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MSM_PHONEBOOK_HANDLER))
#define IS_MSM_PHONEBOOK_HANDLER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MSM_PHONEBOOK_HANDLER))
#define MSM_PHONEBOOK_HANDLER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MSM_PHONEBOOK_HANDLER, MsmPhonebookHandlerClass))

typedef struct _MsmPhonebookHandler MsmPhonebookHandler;
typedef struct _MsmPhonebookHandlerClass MsmPhonebookHandlerClass;

#define TYPE_MSM_CHANNEL (msm_channel_get_type ())
#define MSM_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MSM_CHANNEL, MsmChannel))
#define MSM_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MSM_CHANNEL, MsmChannelClass))
#define IS_MSM_CHANNEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MSM_CHANNEL))
#define IS_MSM_CHANNEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MSM_CHANNEL))
#define MSM_CHANNEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MSM_CHANNEL, MsmChannelClass))

typedef struct _MsmChannel MsmChannel;
typedef struct _MsmChannelClass MsmChannelClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _QualcommPalmModem {
	FsoGsmAbstractModem parent_instance;
	QualcommPalmModemPrivate * priv;
};

struct _QualcommPalmModemClass {
	FsoGsmAbstractModemClass parent_class;
};


static gpointer qualcomm_palm_modem_parent_class = NULL;
static GType qualcomm_palm_modem_type_id = 0;

GType qualcomm_palm_modem_get_type (void) G_GNUC_CONST;
GType qualcomm_palm_modem_register_type (GTypeModule * module);
enum  {
	QUALCOMM_PALM_MODEM_DUMMY_PROPERTY
};
#define QUALCOMM_PALM_MODEM_MSM_CHANNEL_NAME "main"
static gchar* qualcomm_palm_modem_real_repr (FsoFrameworkAbstractObject* base);
static gboolean qualcomm_palm_modem_real_powerOn (FsoGsmAbstractModem* base);
static void qualcomm_palm_modem_real_powerOff (FsoGsmAbstractModem* base);
static FsoGsmUnsolicitedResponseHandler* qualcomm_palm_modem_real_createUnsolicitedHandler (FsoGsmAbstractModem* base);
static FsoGsmCallHandler* qualcomm_palm_modem_real_createCallHandler (FsoGsmAbstractModem* base);
MsmCallHandler* msm_call_handler_new (void);
MsmCallHandler* msm_call_handler_construct (GType object_type);
GType msm_call_handler_get_type (void) G_GNUC_CONST;
GType msm_call_handler_register_type (GTypeModule * module);
static FsoGsmSmsHandler* qualcomm_palm_modem_real_createSmsHandler (FsoGsmAbstractModem* base);
MsmSmsHandler* msm_sms_handler_new (void);
MsmSmsHandler* msm_sms_handler_construct (GType object_type);
GType msm_sms_handler_get_type (void) G_GNUC_CONST;
GType msm_sms_handler_register_type (GTypeModule * module);
static FsoGsmPhonebookHandler* qualcomm_palm_modem_real_createPhonebookHandler (FsoGsmAbstractModem* base);
MsmPhonebookHandler* msm_phonebook_handler_new (void);
MsmPhonebookHandler* msm_phonebook_handler_construct (GType object_type);
GType msm_phonebook_handler_get_type (void) G_GNUC_CONST;
GType msm_phonebook_handler_register_type (GTypeModule * module);
static FsoGsmWatchDog* qualcomm_palm_modem_real_createWatchDog (FsoGsmAbstractModem* base);
static void qualcomm_palm_modem_real_createChannels (FsoGsmAbstractModem* base);
MsmChannel* msm_channel_new (const gchar* name);
MsmChannel* msm_channel_construct (GType object_type, const gchar* name);
GType msm_channel_get_type (void) G_GNUC_CONST;
GType msm_channel_register_type (GTypeModule * module);
static FsoGsmChannel* qualcomm_palm_modem_real_channelForCommand (FsoGsmAbstractModem* base, FsoGsmAtCommand* command, const gchar* query);
static void qualcomm_palm_modem_real_registerCustomMediators (FsoGsmAbstractModem* base, GeeHashMap* mediators);
void registerMsmMediators (GeeHashMap* table);
QualcommPalmModem* qualcomm_palm_modem_new (void);
QualcommPalmModem* qualcomm_palm_modem_construct (GType object_type);
gchar* fso_factory_function (FsoFrameworkSubsystem* subsystem, GError** error);
void fso_register_function (GTypeModule* module);


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


static gboolean qualcomm_palm_modem_real_powerOn (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	gboolean result = FALSE;
	self = (QualcommPalmModem*) base;
	result = TRUE;
	return result;
}


static void qualcomm_palm_modem_real_powerOff (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	self = (QualcommPalmModem*) base;
}


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


static FsoGsmUnsolicitedResponseHandler* qualcomm_palm_modem_real_createUnsolicitedHandler (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	FsoGsmUnsolicitedResponseHandler* result = NULL;
	FsoGsmUnsolicitedResponseHandler* _tmp0_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = _g_object_ref0 (FSO_GSM_UNSOLICITED_RESPONSE_HANDLER (NULL));
	result = _tmp0_;
	return result;
}


static FsoGsmCallHandler* qualcomm_palm_modem_real_createCallHandler (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	FsoGsmCallHandler* result = NULL;
	MsmCallHandler* _tmp0_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = msm_call_handler_new ();
	result = (FsoGsmCallHandler*) _tmp0_;
	return result;
}


static FsoGsmSmsHandler* qualcomm_palm_modem_real_createSmsHandler (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	FsoGsmSmsHandler* result = NULL;
	MsmSmsHandler* _tmp0_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = msm_sms_handler_new ();
	result = (FsoGsmSmsHandler*) _tmp0_;
	return result;
}


static FsoGsmPhonebookHandler* qualcomm_palm_modem_real_createPhonebookHandler (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	FsoGsmPhonebookHandler* result = NULL;
	MsmPhonebookHandler* _tmp0_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = msm_phonebook_handler_new ();
	result = (FsoGsmPhonebookHandler*) _tmp0_;
	return result;
}


static FsoGsmWatchDog* qualcomm_palm_modem_real_createWatchDog (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	FsoGsmWatchDog* result = NULL;
	FsoGsmGenericWatchDog* _tmp0_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = fso_gsm_generic_watch_dog_new ();
	result = (FsoGsmWatchDog*) _tmp0_;
	return result;
}


static void qualcomm_palm_modem_real_createChannels (FsoGsmAbstractModem* base) {
	QualcommPalmModem * self;
	MsmChannel* _tmp0_;
	MsmChannel* _tmp1_;
	self = (QualcommPalmModem*) base;
	_tmp0_ = msm_channel_new (QUALCOMM_PALM_MODEM_MSM_CHANNEL_NAME);
	_tmp1_ = _tmp0_;
	_g_object_unref0 (_tmp1_);
}


static FsoGsmChannel* qualcomm_palm_modem_real_channelForCommand (FsoGsmAbstractModem* base, FsoGsmAtCommand* command, const gchar* query) {
	QualcommPalmModem * self;
	FsoGsmChannel* result = NULL;
	self = (QualcommPalmModem*) base;
	g_return_val_if_fail (command != NULL, NULL);
	g_return_val_if_fail (query != NULL, NULL);
	g_assert_not_reached ();
	return result;
}


static void qualcomm_palm_modem_real_registerCustomMediators (FsoGsmAbstractModem* base, GeeHashMap* mediators) {
	QualcommPalmModem * self;
	GeeHashMap* _tmp0_;
	self = (QualcommPalmModem*) base;
	g_return_if_fail (mediators != NULL);
	_tmp0_ = mediators;
	registerMsmMediators (_tmp0_);
}


QualcommPalmModem* qualcomm_palm_modem_construct (GType object_type) {
	QualcommPalmModem * self = NULL;
	self = (QualcommPalmModem*) fso_gsm_abstract_modem_construct (object_type);
	return self;
}


QualcommPalmModem* qualcomm_palm_modem_new (void) {
	return qualcomm_palm_modem_construct (QUALCOMM_PALM_TYPE_MODEM);
}


static void qualcomm_palm_modem_class_init (QualcommPalmModemClass * klass) {
	qualcomm_palm_modem_parent_class = g_type_class_peek_parent (klass);
	FSO_FRAMEWORK_ABSTRACT_OBJECT_CLASS (klass)->repr = qualcomm_palm_modem_real_repr;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->powerOn = qualcomm_palm_modem_real_powerOn;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->powerOff = qualcomm_palm_modem_real_powerOff;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createUnsolicitedHandler = qualcomm_palm_modem_real_createUnsolicitedHandler;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createCallHandler = qualcomm_palm_modem_real_createCallHandler;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createSmsHandler = qualcomm_palm_modem_real_createSmsHandler;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createPhonebookHandler = qualcomm_palm_modem_real_createPhonebookHandler;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createWatchDog = qualcomm_palm_modem_real_createWatchDog;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->createChannels = qualcomm_palm_modem_real_createChannels;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->channelForCommand = qualcomm_palm_modem_real_channelForCommand;
	FSO_GSM_ABSTRACT_MODEM_CLASS (klass)->registerCustomMediators = qualcomm_palm_modem_real_registerCustomMediators;
}


static void qualcomm_palm_modem_instance_init (QualcommPalmModem * self) {
}


/**
 * @class QualcommPalm.Modem
 *
 * This modem plugin supports the Qualcomm MSM chipset used on Palm Pre (Plus).
 *
 * The modem uses a binary protocol which has been implemented in libmsmcomm.
 **/
GType qualcomm_palm_modem_get_type (void) {
	return qualcomm_palm_modem_type_id;
}


GType qualcomm_palm_modem_register_type (GTypeModule * module) {
	static const GTypeInfo g_define_type_info = { sizeof (QualcommPalmModemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) qualcomm_palm_modem_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QualcommPalmModem), 0, (GInstanceInitFunc) qualcomm_palm_modem_instance_init, NULL };
	qualcomm_palm_modem_type_id = g_type_module_register_type (module, FSO_GSM_TYPE_ABSTRACT_MODEM, "QualcommPalmModem", &g_define_type_info, 0);
	return qualcomm_palm_modem_type_id;
}


/**
 * This function gets called on plugin initialization time.
 * @return the name of your plugin here
 * @note that it needs to be a name in the format <subsystem>.<plugin>
 * else your module will be unloaded immediately.
 **/
gchar* fso_factory_function (FsoFrameworkSubsystem* subsystem, GError** error) {
	gchar* result = NULL;
	FsoFrameworkLogger* _tmp0_;
	gchar* _tmp1_;
	g_return_val_if_fail (subsystem != NULL, NULL);
	_tmp0_ = fso_framework_theLogger;
	fso_framework_logger_debug (_tmp0_, "qualcomm_palm fso_factory_function");
	_tmp1_ = g_strdup ("fsogsm.modem_qualcomm_palm");
	result = _tmp1_;
	return result;
}


void fso_register_function (GTypeModule* module) {
	g_return_if_fail (module != NULL);
	qualcomm_palm_modem_register_type (module);
	msm_channel_register_type (module);
	wait_for_unsolicited_response_data_register_type (module);
	msm_unsolicited_response_handler_register_type (module);
	msm_call_handler_register_type (module);
	msm_data_register_type (module);
	msm_phonebook_handler_register_type (module);
	msm_sms_handler_register_type (module);
	msm_debug_ping_register_type (module);
	msm_debug_command_register_type (module);
	msm_debug_inject_response_register_type (module);
	msm_device_get_functionality_register_type (module);
	msm_device_get_features_register_type (module);
	msm_device_get_information_register_type (module);
	msm_device_get_power_status_register_type (module);
	msm_device_set_functionality_register_type (module);
	msm_device_get_current_time_register_type (module);
	msm_device_set_current_time_register_type (module);
	msm_device_get_alarm_time_register_type (module);
	msm_device_get_microphone_muted_register_type (module);
	msm_device_get_sim_buffers_sms_register_type (module);
	msm_device_get_speaker_volume_register_type (module);
	msm_device_set_alarm_time_register_type (module);
	msm_device_set_microphone_muted_register_type (module);
	msm_device_set_speaker_volume_register_type (module);
	msm_sim_change_auth_code_register_type (module);
	msm_sim_get_auth_status_register_type (module);
	msm_sim_get_information_register_type (module);
	msm_sim_get_auth_code_required_register_type (module);
	msm_sim_send_auth_code_register_type (module);
	msm_sim_delete_entry_register_type (module);
	msm_sim_get_phonebook_info_register_type (module);
	msm_sim_retrieve_phonebook_register_type (module);
	msm_sim_write_entry_register_type (module);
	msm_sim_delete_message_register_type (module);
	msm_sim_get_service_center_number_register_type (module);
	msm_sim_get_unlock_counters_register_type (module);
	msm_sim_retrieve_message_register_type (module);
	msm_sim_send_stored_message_register_type (module);
	msm_sim_set_service_center_number_register_type (module);
	msm_sim_store_message_register_type (module);
	msm_sim_unlock_register_type (module);
	msm_sms_retrieve_text_messages_register_type (module);
	msm_sms_send_text_message_register_type (module);
	msm_network_register_register_type (module);
	msm_network_unregister_register_type (module);
	msm_network_get_signal_strength_register_type (module);
	msm_network_get_status_register_type (module);
	msm_network_list_providers_register_type (module);
	msm_network_send_ussd_request_register_type (module);
	msm_network_get_calling_id_register_type (module);
	msm_network_set_calling_id_register_type (module);
	msm_call_activate_register_type (module);
	msm_call_hold_active_register_type (module);
	msm_call_initiate_register_type (module);
	msm_call_list_calls_register_type (module);
	msm_call_send_dtmf_register_type (module);
	msm_call_release_register_type (module);
	msm_call_release_all_register_type (module);
	msm_cb_set_cell_broadcast_subscriptions_register_type (module);
	msm_cb_get_cell_broadcast_subscriptions_register_type (module);
	msm_monitor_get_serving_cell_information_register_type (module);
	msm_monitor_get_neighbour_cell_information_register_type (module);
	msm_voice_mailbox_get_number_register_type (module);
	msm_voice_mailbox_set_number_register_type (module);
	msm_pdp_activate_context_register_type (module);
	msm_pdp_deactivate_context_register_type (module);
	msm_pdp_get_credentials_register_type (module);
	msm_pdp_set_credentials_register_type (module);
}



