gsm: rework registration handling

First, generically handle registration polling if the device does
not support unsolicited registration.  Second, using the new
creg/cgreg parsing functions from mm-modem-helpers.c, handle
CREG=2 unsolicited registration replies to capture the GSM LAC/CI
for the location information API.

Because of these changes we can simplify the registration polling
during connection as well by using the common registration parsing
code and the cached registration state.
This commit is contained in:
Dan Williams
2010-03-06 10:28:11 -08:00
parent 31fb97919c
commit 54c1d069eb
6 changed files with 334 additions and 106 deletions
-2
View File
@@ -647,8 +647,6 @@ grab_port (MMModem *modem,
if (ptype == MM_PORT_TYPE_PRIMARY) {
GRegex *regex;
mm_generic_gsm_set_unsolicited_registration (gsm, TRUE);
regex = g_regex_new ("_OWANCALL: (\\d),\\s*(\\d)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
mm_serial_port_add_unsolicited_msg_handler (MM_SERIAL_PORT (port), regex, connection_enabled, modem, NULL);
g_regex_unref (regex);
-2
View File
@@ -560,8 +560,6 @@ grab_port (MMModem *modem,
if (ptype == MM_PORT_TYPE_SECONDARY) {
GRegex *regex;
mm_generic_gsm_set_unsolicited_registration (MM_GENERIC_GSM (modem), TRUE);
regex = g_regex_new ("\\r\\n\\^RSSI:(\\d+)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
mm_serial_port_add_unsolicited_msg_handler (MM_SERIAL_PORT (port), regex, handle_signal_quality_change, modem, NULL);
g_regex_unref (regex);
-2
View File
@@ -747,8 +747,6 @@ grab_port (MMModem *modem,
if (port && MM_IS_SERIAL_PORT (port) && (ptype == MM_PORT_TYPE_PRIMARY)) {
GRegex *regex;
mm_generic_gsm_set_unsolicited_registration (MM_GENERIC_GSM (modem), TRUE);
regex = g_regex_new ("\\r\\n\\*EMRDY: \\d\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);
mm_serial_port_add_unsolicited_msg_handler (MM_SERIAL_PORT (port), regex, mbm_emrdy_received, modem, NULL);
g_regex_unref (regex);
-1
View File
@@ -211,7 +211,6 @@ grab_port (MMModem *modem,
if (port && MM_IS_SERIAL_PORT (port)) {
GRegex *regex;
mm_generic_gsm_set_unsolicited_registration (gsm, TRUE);
g_object_set (port, MM_PORT_CARRIER_DETECT, FALSE, NULL);
regex = g_regex_new ("\\r\\n\\+ZUSIMR:(.*)\\r\\n", G_REGEX_RAW | G_REGEX_OPTIMIZE, 0, NULL);