diff --git a/include/Phone/modem.h b/include/Phone/modem.h index 25d7b33..920f42d 100644 --- a/include/Phone/modem.h +++ b/include/Phone/modem.h @@ -33,7 +33,8 @@ typedef enum _ModemAuthenticationMethod typedef enum _ModemAuthenticationStatus { - MODEM_AUTHENTICATION_STATUS_OK = 0, + MODEM_AUTHENTICATION_STATUS_UNKNOWN = 0, + MODEM_AUTHENTICATION_STATUS_OK, MODEM_AUTHENTICATION_STATUS_REQUIRED, MODEM_AUTHENTICATION_STATUS_ERROR } ModemAuthenticationStatus; diff --git a/po/fr.po b/po/fr.po index d529775..bfd8ab1 100644 --- a/po/fr.po +++ b/po/fr.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: Phone 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-21 15:59+0200\n" +"POT-Creation-Date: 2011-08-22 03:22+0200\n" "PO-Revision-Date: 2010-04-24 02:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: DeforaOS development (French) \n" @@ -311,21 +311,21 @@ msgstr "Le numéro ne peut être vide" msgid "Message sent" msgstr "Message envoyé" -#: ../src/phone.c:3736 +#: ../src/phone.c:3728 #, c-format msgid "Wrong %s" msgstr "Mauvais %s" -#: ../src/phone.c:3743 +#: ../src/phone.c:3735 #, c-format msgid "%s is valid" msgstr "%s valide" -#: ../src/phone.c:3806 +#: ../src/phone.c:3800 msgid "Raw data (not shown)" msgstr "Données brutes (non affichées)" -#: ../src/phone.c:3839 +#: ../src/phone.c:3833 msgid "Message deleted" msgstr "Message effacé" diff --git a/src/modems/hayes.c b/src/modems/hayes.c index ed70945..76d88f2 100644 --- a/src/modems/hayes.c +++ b/src/modems/hayes.c @@ -262,7 +262,7 @@ static gboolean _on_watch_can_write(GIOChannel * source, GIOCondition condition, static gboolean _on_watch_can_write_ppp(GIOChannel * source, GIOCondition condition, gpointer data); -static HayesCommandStatus _on_request_authentication(HayesCommand * command, +static HayesCommandStatus _on_request_authenticate(HayesCommand * command, HayesCommandStatus status, void * priv); static HayesCommandStatus _on_request_battery_level(HayesCommand * command, HayesCommandStatus status, void * priv); @@ -294,6 +294,8 @@ static HayesCommandStatus _on_request_message_send(HayesCommand * command, HayesCommandStatus status, void * priv); static HayesCommandStatus _on_request_model(HayesCommand * command, HayesCommandStatus status, void * priv); +static HayesCommandStatus _on_request_sim_pin_valid(HayesCommand * command, + HayesCommandStatus status, void * priv); static HayesCommandStatus _on_request_unsupported(HayesCommand * command, HayesCommandStatus status, void * priv); @@ -475,7 +477,7 @@ static HayesRequestHandler _hayes_request_handlers[] = { HAYES_REQUEST_SIGNAL_LEVEL, "AT+CSQ", _on_request_generic }, { HAYES_REQUEST_SIM_PIN_VALID, "AT+CPIN?", - _on_request_authentication }, + _on_request_sim_pin_valid }, { HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_CANCEL,"AT+CUSD=2", _on_request_generic }, { HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_DISABLE,"AT+CUSD=0", @@ -491,7 +493,7 @@ static HayesRequestHandler _hayes_request_handlers[] = { HAYES_REQUEST_VERSION, "AT+CGMR", _on_request_model }, { MODEM_REQUEST_AUTHENTICATE, NULL, - _on_request_authentication }, + _on_request_authenticate }, { MODEM_REQUEST_CALL, NULL, _on_request_call_outgoing }, { MODEM_REQUEST_CALL_ANSWER, "ATA", @@ -801,11 +803,10 @@ static char * _request_attention_call_hangup(ModemPlugin * modem) event->connection.in = 0; event->connection.out = 0; modem->helper->event(modem->helper->modem, event); + _hayes_set_mode(modem, HAYES_MODE_INIT); + return NULL; } - else - return strdup("ATH"); - _hayes_set_mode(modem, HAYES_MODE_INIT); - return NULL; + return strdup("ATH"); } static char * _request_attention_contact_delete(ModemPlugin * modem, @@ -2186,8 +2187,8 @@ static gboolean _on_watch_can_write_ppp(GIOChannel * source, } -/* on_request_authentication */ -static HayesCommandStatus _on_request_authentication(HayesCommand * command, +/* on_request_authenticate */ +static HayesCommandStatus _on_request_authenticate(HayesCommand * command, HayesCommandStatus status, void * priv) { ModemPlugin * modem = priv; @@ -2209,31 +2210,9 @@ static HayesCommandStatus _on_request_authentication(HayesCommand * command, } if(event->authentication.name != NULL) modem->helper->event(modem->helper->modem, event); - if(event->authentication.status == MODEM_AUTHENTICATION_STATUS_OK) + if(status == HCS_SUCCESS) { - request.type = HAYES_REQUEST_OPERATOR_FORMAT_LONG; - _hayes_request(modem, &request); - request.type = HAYES_REQUEST_REGISTRATION_UNSOLLICITED_ENABLE; - _hayes_request(modem, &request); - request.type = MODEM_REQUEST_REGISTRATION; - request.registration.mode = MODEM_REGISTRATION_MODE_AUTOMATIC; - _hayes_request(modem, &request); - /* force a registration report */ - request.type = HAYES_REQUEST_REGISTRATION; - _hayes_request(modem, &request); - /* report new messages */ - request.type = HAYES_REQUEST_MESSAGE_UNSOLLICITED_ENABLE; - _hayes_request(modem, &request); - /* report new notifications */ - request.type = HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE; - _hayes_request(modem, &request); - /* refresh the current call status */ - _hayes_trigger(modem, MODEM_EVENT_TYPE_CALL); - /* refresh the contact list */ - request.type = MODEM_REQUEST_CONTACT_LIST; - _hayes_request(modem, &request); - /* refresh the message list */ - request.type = MODEM_REQUEST_MESSAGE_LIST; + request.type = HAYES_REQUEST_SIM_PIN_VALID; _hayes_request(modem, &request); } return status; @@ -2472,6 +2451,52 @@ static HayesCommandStatus _on_request_model(HayesCommand * command, } +/* on_request_sim_pin_valid */ +static HayesCommandStatus _on_request_sim_pin_valid(HayesCommand * command, + HayesCommandStatus status, void * priv) +{ + ModemPlugin * modem = priv; + Hayes * hayes = modem->priv; + ModemEvent * event = &hayes->events[MODEM_EVENT_TYPE_AUTHENTICATION]; + ModemRequest request; + + if((status = _on_request_generic(command, status, priv)) != HCS_SUCCESS) + return status; + modem->helper->event(modem->helper->modem, event); + /* return if not successful */ + if(event->authentication.status != MODEM_AUTHENTICATION_STATUS_OK) + return status; + /* automatically register */ + /* XXX should really wait for the telephony application for this */ + memset(&request, 0, sizeof(&request)); + request.type = HAYES_REQUEST_OPERATOR_FORMAT_LONG; + _hayes_request(modem, &request); + request.type = HAYES_REQUEST_REGISTRATION_UNSOLLICITED_ENABLE; + _hayes_request(modem, &request); + request.type = MODEM_REQUEST_REGISTRATION; + request.registration.mode = MODEM_REGISTRATION_MODE_AUTOMATIC; + _hayes_request(modem, &request); + /* force a registration report */ + request.type = HAYES_REQUEST_REGISTRATION; + _hayes_request(modem, &request); + /* report new messages */ + request.type = HAYES_REQUEST_MESSAGE_UNSOLLICITED_ENABLE; + _hayes_request(modem, &request); + /* report new notifications */ + request.type = HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE; + _hayes_request(modem, &request); + /* refresh the current call status */ + _hayes_trigger(modem, MODEM_EVENT_TYPE_CALL); + /* refresh the contact list */ + request.type = MODEM_REQUEST_CONTACT_LIST; + _hayes_request(modem, &request); + /* refresh the message list */ + request.type = MODEM_REQUEST_MESSAGE_LIST; + _hayes_request(modem, &request); + return status; +} + + /* on_request_unsupported */ static HayesCommandStatus _on_request_unsupported(HayesCommand * command, HayesCommandStatus status, void * priv) @@ -3177,6 +3202,12 @@ static void _on_trigger_cpas(ModemPlugin * modem, char const * answer) case 0: event->call.status = MODEM_CALL_STATUS_NONE; event->call.direction = MODEM_CALL_DIRECTION_NONE; + /* report connection status */ + event = &hayes->events[MODEM_EVENT_TYPE_CONNECTION]; + event->connection.connected = 0; + event->connection.in = 0; + event->connection.out = 0; + modem->helper->event(modem->helper->modem, event); break; case 3: event->call.status = MODEM_CALL_STATUS_RINGING; diff --git a/src/phone.c b/src/phone.c index 29afb58..62c1829 100644 --- a/src/phone.c +++ b/src/phone.c @@ -3700,14 +3700,6 @@ static void _phone_modem_event(void * priv, ModemEvent * event) _phone_info(phone, phone->wr_window, _("Message sent"), NULL); break; - case MODEM_EVENT_TYPE_MODEL: - modem_request_type(phone->modem, - MODEM_REQUEST_CONTACT_LIST); -#ifndef DEBUG - /* FIXME this is clearly out of place */ - _phone_track(phone, PHONE_TRACK_MESSAGE_LIST, TRUE); -#endif - break; case MODEM_EVENT_TYPE_STATUS: pevent.type = (event->status.online != 0) ? PHONE_EVENT_TYPE_ONLINE @@ -3748,6 +3740,8 @@ static void _modem_event_authentication(Phone * phone, ModemEvent * event) == MODEM_AUTHENTICATION_METHOD_PIN) phone_show_code(phone, TRUE, method, name); break; + case MODEM_AUTHENTICATION_STATUS_UNKNOWN: + break; } }