Commit c80d7faf authored by Chris T's avatar Chris T

Clean up MM Plugin

parent f9e02bb8
......@@ -127,7 +127,6 @@ static GDBusNodeInfo *introspection_data = NULL;
struct modem_data *modem;
static void pur_mm_state (int state);
static void pur_mm_disconnect (void);
static void mmsd_plugin_connect (void);
static void mmsd_plugin_disconnect (void);
static void free_device (PurMmDevice *device);
......@@ -524,13 +523,13 @@ pur_mm_get_modem_state (void)
mms_error("ModemManagerPlugin(): MM_MODEM_STATE_DISABLED");
mms_error("ModemManagerPlugin(): Turning on Modem....");
mm_modem_set_power_state_sync (modem->modem, MM_MODEM_POWER_STATE_ON, NULL, &error);
sleep(1);
if (error != NULL) {
g_warning ("Error setting power state: %s\n", error->message);
g_warning ("ModemManagerPlugin(): Error setting power state: %s\n", error->message);
}
}
mms_error("Modem is ready...");
} else {
mms_error("Done with While Loop: MM_MODEM_STATE_ENABLED");
mms_error("ModemManagerPlugin(): MM_MODEM_STATE_ENABLED");
}
return TRUE;
......@@ -562,7 +561,6 @@ pur_mm_state (int state)
break;
case PUR_MM_STATE_NO_MODEM:
if (modem->modem_available) {
pur_mm_disconnect ();
mmsd_plugin_disconnect();
mms_error("ModemManagerPlugin(): Modem vanished, Disabling plugin");
......@@ -575,7 +573,7 @@ pur_mm_state (int state)
case PUR_MM_STATE_NO_MESSAGING_MODEM:
if (modem->modem_available) {
pur_mm_disconnect ();
mmsd_plugin_disconnect();
mms_error("ModemManagerPlugin(): Modem has no messaging capabilities");
}
......@@ -610,7 +608,7 @@ pur_mm_state (int state)
case PUR_MM_STATE_NO_MANAGER:
if (modem->manager_available) {
pur_mm_disconnect ();
mmsd_plugin_disconnect();
g_clear_object (&modem->mm);
g_dbus_connection_unregister_object (modem->master_connection,
modem->registration_id);
......@@ -722,17 +720,6 @@ static void bearer_handler(mms_bool_t active, void *user_data)
}
}
static void
pur_mm_disconnect (void)
{
if (modem->device_arr && modem->device_arr->len) {
g_ptr_array_set_size (modem->device_arr, 0);
g_ptr_array_unref(modem->device_arr);
}
modem->modem_available = FALSE;
}
static int set_context (void) {
guint max_bearers, active_bearers;
......@@ -833,12 +820,18 @@ static void mmsd_plugin_connect (void) {
static void mmsd_plugin_disconnect (void) {
mms_error("ModemManagerPlugin(): Disabling Bearer Handler");
deactivate_bearer(modem->service);
mms_service_set_bearer_handler(modem->service, NULL, NULL);
g_free(modem->path);
g_clear_object (&modem->modem);
modem->object = NULL;
if (modem->device_arr && modem->device_arr->len) {
g_ptr_array_set_size (modem->device_arr, 0);
g_ptr_array_unref(modem->device_arr);
}
modem->modem_available = FALSE;
}
static int modemmanager_init(void)
......@@ -911,7 +904,6 @@ static void modemmanager_exit(void)
mms_service_unregister(modem->service);
}
if (modem->manager_available) {
pur_mm_disconnect();
mmsd_plugin_disconnect();
g_clear_object (&modem->mm);
g_dbus_connection_unregister_object (modem->master_connection,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment