r3305 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src
thomas at sita.openmoko.org
thomas at sita.openmoko.org
Tue Oct 30 12:59:57 CET 2007
Author: thomas
Date: 2007-10-30 12:59:56 +0100 (Tue, 30 Oct 2007)
New Revision: 3305
Modified:
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c
Log:
* src/moko-dialer.c: (on_keypad_dial_clicked),
(on_keypad_pin_entry), (on_network_registered), (moko_dialer_init):
Clean up registration code (don't assume gsmd is broken!)
Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog 2007-10-30 03:39:17 UTC (rev 3304)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog 2007-10-30 11:59:56 UTC (rev 3305)
@@ -1,3 +1,9 @@
+2007-10-30 Thomas Wood <thomas at openedhand.com>
+
+ * src/moko-dialer.c: (on_keypad_dial_clicked),
+ (on_keypad_pin_entry), (on_network_registered), (moko_dialer_init):
+ Clean up registration code (don't assume gsmd is broken!)
+
2007-10-29 Michael Lauer <mickey at openmoko.org>
* data/default_ringtone.ogg: REMOVED
Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c 2007-10-30 03:39:17 UTC (rev 3304)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-dialer.c 2007-10-30 11:59:56 UTC (rev 3305)
@@ -71,7 +71,6 @@
MokoTime *time;
/* Registration variables */
- guint reg_timeout;
MokoGsmdConnectionNetregType registered;
MokoGSMLocation gsm_location;
};
@@ -92,7 +91,6 @@
static void on_keypad_dial_clicked (MokoKeypad *keypad,
const gchar *number,
MokoDialer *dialer);
-static gboolean register_network_cb (MokoDialer *dialer);
/* DBus functions */
gboolean
@@ -271,14 +269,14 @@
gchar *strings[] = {
"None",
"Home network registered",
- "Waiting for network registration",
+ "Searching for network",
"Network registration denied",
"",
"Roaming network registered"
};
dlg = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
- "Not connected to network.\nCurrent status = %s ", strings[priv->registered]);
+ "Cannot dial number. %s", strings[priv->registered]);
gtk_dialog_run (GTK_DIALOG (dlg));
gtk_widget_destroy (dlg);
@@ -337,11 +335,6 @@
moko_gsmd_connection_send_pin (priv->connection, pin);
moko_keypad_set_pin_mode (MOKO_KEYPAD (priv->keypad), FALSE);
-
- priv->registered = MOKO_GSMD_CONNECTION_NETREG_NONE;
- priv->reg_timeout = g_timeout_add (GSM_REGISTER_TIMEOUT,
- (GSourceFunc)register_network_cb,
- dialer);
g_free (pin);
}
@@ -481,25 +474,21 @@
g_return_if_fail (MOKO_IS_DIALER (dialer));
priv = dialer->priv;
- g_warning ("on_network_registered: type is %d\n", type);
-
switch (type)
{
case MOKO_GSMD_CONNECTION_NETREG_NONE:
case MOKO_GSMD_CONNECTION_NETREG_SEARCHING:
/* Do nothing */
- g_debug ("NetReg: Searching for network");
+ g_debug ("Searching for network");
break;
case MOKO_GSMD_CONNECTION_NETREG_DENIED:
/* This may be a pin issue*/
break;
case MOKO_GSMD_CONNECTION_NETREG_HOME:
case MOKO_GSMD_CONNECTION_NETREG_ROAMING:
- g_debug ("NetReg: Network registered");
- g_debug ("\tLocationAreaCode = %x\n\tCellID = %x", lac, cell);
+ g_debug ("Network registered: LocationAreaCode: %x. CellID: %x.", lac, cell);
priv->gsm_location.lac = lac;
priv->gsm_location.cid = cell;
- g_source_remove (priv->reg_timeout);
break;
default:
g_warning ("Unhandled register event type = %d\n", type);
@@ -597,7 +586,6 @@
g_return_if_fail (MOKO_IS_DIALER (dialer));
priv = dialer->priv;
- g_source_remove (priv->reg_timeout);
moko_keypad_set_pin_mode (MOKO_KEYPAD (priv->keypad), TRUE);
moko_dialer_show_dialer (dialer, NULL);
g_debug ("Pin Requested");
@@ -688,45 +676,7 @@
break;
}
}
-static gboolean
-register_network_cb (MokoDialer *dialer)
-{
- MokoDialerPrivate *priv;
- g_return_val_if_fail (MOKO_DIALER (dialer), TRUE);
- priv = MOKO_DIALER_GET_PRIVATE (dialer);
-
- /* We check whether we've been registered yet, otherwise keep poking
- * gsmd
- */
- switch (priv->registered)
- {
- case MOKO_GSMD_CONNECTION_NETREG_NONE:
- /* We have yet to request registration, so lets do it */
- /* FIXME: do the pin stuff */
- g_debug ("Requesting registration");
- moko_gsmd_connection_network_register (priv->connection);
- priv->registered = MOKO_GSMD_CONNECTION_NETREG_SEARCHING;
- break;
- case MOKO_GSMD_CONNECTION_NETREG_SEARCHING:
- g_debug ("Waiting for registration");
- break;
- case MOKO_GSMD_CONNECTION_NETREG_DENIED:
- g_debug ("Registration denied, retrying");
- moko_gsmd_connection_network_register (priv->connection);
- priv->registered = MOKO_GSMD_CONNECTION_NETREG_SEARCHING;
- break;
- case MOKO_GSMD_CONNECTION_NETREG_HOME:
- case MOKO_GSMD_CONNECTION_NETREG_ROAMING:
- g_debug ("Network Registered");
- return FALSE;
- default:
- g_warning ("Unhandled register event type = %d\n", priv->registered);
- }
-
- return TRUE;
-}
-
/* GObject functions */
static void
moko_dialer_dispose (GObject *object)
@@ -854,13 +804,7 @@
if (err && err->code == MOKO_GSMD_ERROR_CONNECT)
exit (1); /* no point continuing if we can't connect to gsmd? */
- /* Handle network registration a few seconds after powering up the
- * antenna*/
- priv->registered = MOKO_GSMD_CONNECTION_NETREG_NONE;
- priv->reg_timeout = g_timeout_add (GSM_REGISTER_TIMEOUT * 2,
- (GSourceFunc)register_network_cb,
- dialer);
-
+
/* Connect to the gsmd signals */
g_signal_connect (G_OBJECT (conn), "network-registration",
G_CALLBACK (on_network_registered), (gpointer)dialer);
@@ -873,6 +817,11 @@
g_signal_connect (G_OBJECT (conn), "call-progress",
G_CALLBACK (on_call_progress_changed), (gpointer)dialer);
+ /* FIXME:
+ * moko_gsmd_connection_get_network_status always seems to return 0 here */
+ priv->registered = MOKO_GSMD_CONNECTION_NETREG_SEARCHING;
+ moko_gsmd_connection_network_register (conn);
+
/* Set up the journal */
priv->journal = moko_journal_open_default ();
if (!priv->journal || !moko_journal_load_from_storage (priv->journal))
More information about the commitlog
mailing list