From 77d150299394064d4e5947af69f1849336b8b0c8 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Fri, 12 Aug 2011 23:22:57 +0000 Subject: [PATCH] Enable unsollicited service data messages by default --- include/Phone/modem.h | 1 - po/fr.po | 8 ++++---- src/modems/hayes.c | 28 +++++++++++++++++++++++++++- src/phone.c | 3 ++- 4 files changed, 33 insertions(+), 7 deletions(-) diff --git a/include/Phone/modem.h b/include/Phone/modem.h index c18103f..df30bd7 100644 --- a/include/Phone/modem.h +++ b/include/Phone/modem.h @@ -280,7 +280,6 @@ typedef enum _ModemRequestType MODEM_REQUEST_REGISTRATION, MODEM_REQUEST_REGISTRATION_REPORT, MODEM_REQUEST_SIGNAL_LEVEL, - MODEM_REQUEST_SUPPLEMENTARY_SERVICE_NOTIFICATIONS, MODEM_REQUEST_UNSUPPORTED } ModemRequestType; # define MODEM_REQUEST_LAST MODEM_REQUEST_UNSUPPORTED diff --git a/po/fr.po b/po/fr.po index 64f16c9..c405397 100644 --- a/po/fr.po +++ b/po/fr.po @@ -7,7 +7,7 @@ msgid "" msgstr "" "Project-Id-Version: Phone 0.0.0\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2011-08-12 01:44+0200\n" +"POT-Creation-Date: 2011-08-13 01:21+0200\n" "PO-Revision-Date: 2010-04-24 02:07+0200\n" "Last-Translator: Pierre Pronchery \n" "Language-Team: French\n" @@ -310,16 +310,16 @@ msgstr "Le numéro ne peut être vide" msgid "Message sent" msgstr "Message envoyé" -#: ../src/phone.c:3642 +#: ../src/phone.c:3643 #, c-format msgid "Wrong %s" msgstr "Mauvais %s" -#: ../src/phone.c:3649 +#: ../src/phone.c:3650 #, c-format msgid "%s is valid" msgstr "%s valide" -#: ../src/phone.c:3712 +#: ../src/phone.c:3713 msgid "Raw data (not shown)" msgstr "Données brutes (non affichées)" diff --git a/src/modems/hayes.c b/src/modems/hayes.c index 7aa1482..cf4242c 100644 --- a/src/modems/hayes.c +++ b/src/modems/hayes.c @@ -180,6 +180,9 @@ enum HAYES_REQUEST_REGISTRATION_UNSOLLICITED_ENABLE, HAYES_REQUEST_SIGNAL_LEVEL, HAYES_REQUEST_SIM_PIN_VALID, + HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_CANCEL, + HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE, + HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_DISABLE, HAYES_REQUEST_VENDOR, HAYES_REQUEST_VERBOSE, HAYES_REQUEST_VERSION @@ -308,6 +311,7 @@ static void _on_trigger_cpin(ModemPlugin * modem, char const * answer); static void _on_trigger_creg(ModemPlugin * modem, char const * answer); static void _on_trigger_cring(ModemPlugin * modem, char const * answer); static void _on_trigger_csq(ModemPlugin * modem, char const * answer); +static void _on_trigger_cusd(ModemPlugin * modem, char const * answer); /* helpers */ static int _is_figure(int c); @@ -462,6 +466,12 @@ static HayesRequestHandler _hayes_request_handlers[] = _on_request_generic }, { HAYES_REQUEST_SIM_PIN_VALID, "AT+CPIN?", _on_request_authentication }, + { HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_CANCEL,"AT+CUSD=2", + _on_request_generic }, + { HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_DISABLE,"AT+CUSD=0", + _on_request_generic }, + { HAYES_REQUEST_SUPPLEMENTARY_SERVICE_DATA_ENABLE,"AT+CUSD=1", + _on_request_generic }, { HAYES_REQUEST_VENDOR, "AT+CGMI", _on_request_model }, { HAYES_REQUEST_VERBOSE, "ATV1", @@ -515,6 +525,7 @@ static HayesTriggerHandler _hayes_trigger_handlers[] = { "+CREG", _on_trigger_creg }, { "+CRING", _on_trigger_cring }, { "+CSQ", _on_trigger_csq }, + { "+CUSD", _on_trigger_cusd }, { "BUSY", _on_trigger_call_error }, { "CONNECT", _on_trigger_connect }, { "NO CARRIER", _on_trigger_call_error }, @@ -756,7 +767,7 @@ static char * _request_attention_call_hangup(ModemPlugin * modem) ModemEvent * event = &hayes->events[MODEM_EVENT_TYPE_CONNECTION]; /* FIXME check that this works on all phones, including: - * - while calling (still ringing) + * - while calling (still ringing) => simply inject "\r\n"? * - while ringing (incoming) */ if(hayes->mode == HAYES_MODE_DATA) { @@ -2154,8 +2165,12 @@ static HayesCommandStatus _on_request_authentication(HayesCommand * command, /* 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 */ @@ -3226,6 +3241,17 @@ static void _on_trigger_csq(ModemPlugin * modem, char const * answer) } +/* on_trigger_cusd */ +static void _on_trigger_cusd(ModemPlugin * modem, char const * answer) +{ + unsigned int u; + + /* FIXME really implement */ + if(sscanf(answer, "%u", &u) != 1) + return; +} + + /* helpers */ /* is_figure */ static int _is_figure(int c) diff --git a/src/phone.c b/src/phone.c index 777113a..56e805b 100644 --- a/src/phone.c +++ b/src/phone.c @@ -326,7 +326,7 @@ static const struct GtkTreeModelFilterVisibleFunc filter; } _phone_message_filters[5] = { - /* FIXME provide the icons ourselves */ + /* FIXME provide the icon ourselves */ { "stock_all", N_("All"), _phone_messages_filter_all }, { "phone-inbox", N_("Inbox"), _phone_messages_filter_inbox }, { "phone-sent", N_("Outbox"), _phone_messages_filter_outbox }, @@ -3611,6 +3611,7 @@ static void _phone_modem_event(void * priv, ModemEvent * event) 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;