Add dial support for HFP emulator
cover Add dial support for HFP emulator
Create a generic dial function that can be called by DBus or emulator Add support of ATD and AT+BLDN
Save last dialed number in /var/lib/ofono/<modem>/voicecall to be used by AT+BLDN
Frédéric Danis (4):
voicecall: create generic dial function
voicecall: add ATD support for HFP emulator
voicecall: save last dialed number
voicecall: add +BLDN support for HFP emulator
src/voicecall.c | 274 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 files changed, 247 insertions(+), 27 deletions(-)
PATCH 1/4 voicecall: create generic dial function
split manager_dial between generic and dbus parts
--- src/voicecall.c | 106 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 79 insertions(+), 27 deletions(-)
src/voicecall.c +79 -27
@@ -42,6 +42,17 @@#define VOICECALL_FLAG_SIM_ECC_READY 0x1 +enum dial_error { +DIAL_NO_ERROR , +DIAL_TOO_MANY_CALLS , +DIAL_INVALID_PHONE , +DIAL_NO_NETWORK , +DIAL_NOT_SUPPORTED , +DIAL_INCOMING , +DIAL_BUSY , +DIAL_ACTIVE +}; +GSList *g_drivers =NULL ;struct multi_release {
@@ -1437,59 +1448,100 @@ static void manager_dial_callback(const struct ofono_error *error, void *data)voicecalls_emit_call_added (vc, v); } -static DBusMessage *manager_dial (DBusConnection *conn, -DBusMessage *msg,void *data) +static enum dial_error voicecall_dial (struct ofono_voicecall *vc, +const char *number, +enum ofono_clir_option clir, +ofono_voicecall_cb_t cb,void *data) { -struct ofono_voicecall *vc = data;struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); -const char *number;struct ofono_phone_number ph; -const char *clirstr; -enum ofono_clir_option clir; - -if (vc->pending) -return __ofono_error_busy (msg);if (g_slist_length (vc->call_list) >=MAX_VOICE_CALLS ) -return __ofono_error_failed (msg); - -if (dbus_message_get_args (msg,NULL ,DBUS_TYPE_STRING , &number, -DBUS_TYPE_STRING , &clirstr, -DBUS_TYPE_INVALID ) == FALSE) -return __ofono_error_invalid_args (msg); +return DIAL_TOO_MANY_CALLS ;if (!valid_long_phone_number_format (number)) -return __ofono_error_invalid_format (msg); - -if (clir_string_to_clir (clirstr, &clir) == FALSE) -return __ofono_error_invalid_format (msg); +return DIAL_INVALID_PHONE ;if (ofono_modem_get_online (modem) == FALSE) -return __ofono_error_not_available (msg); +return DIAL_NO_NETWORK ;if (vc->driver->dial ==NULL ) -return __ofono_error_not_implemented (msg); +return DIAL_NOT_SUPPORTED ;if (voicecalls_have_incoming (vc)) -return __ofono_error_failed (msg); +return DIAL_INCOMING ;/* We can't have two dialing/alerting calls, reject outright */ if (voicecalls_num_connecting (vc) >0 ) -return __ofono_error_failed (msg); +return DIAL_BUSY ;if (voicecalls_have_active (vc) &&voicecalls_have_held (vc)) -return __ofono_error_failed (msg); +return DIAL_ACTIVE ;if (is_emergency_number (vc, number) == TRUE)__ofono_modem_inc_emergency_mode (modem); +string_to_phone_number (number, &ph); + + vc->driver->dial (vc, &ph, clir, cb, vc); + +return DIAL_NO_ERROR ; +} + +static DBusMessage *manager_dial (DBusConnection *conn, +DBusMessage *msg,void *data) +{ +struct ofono_voicecall *vc = data; +const char *number; +const char *clirstr; +enum ofono_clir_option clir; +enum dial_error err; +DBusMessage *reply =NULL ; + +if (vc->pending) +return __ofono_error_busy (msg); + +if (dbus_message_get_args (msg,NULL ,DBUS_TYPE_STRING , &number, +DBUS_TYPE_STRING , &clirstr, +DBUS_TYPE_INVALID ) == FALSE) +return __ofono_error_invalid_args (msg); + +if (clir_string_to_clir (clirstr, &clir) == FALSE) +return __ofono_error_invalid_format (msg); + vc->pending =dbus_message_ref (msg); -string_to_phone_number (number, &ph); + err =voicecall_dial (vc, number, clir, manager_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : +break ; + +case DIAL_INVALID_PHONE : + reply =__ofono_error_invalid_format (msg); +break ; - vc->driver->dial (vc, &ph, clir, manager_dial_callback, vc); +case DIAL_NO_NETWORK : + reply =__ofono_error_not_available (msg); +break ; -return NULL ; +case DIAL_NOT_SUPPORTED : + reply =__ofono_error_not_implemented (msg); +break ; + +case DIAL_TOO_MANY_CALLS : +case DIAL_INCOMING : +case DIAL_BUSY : +case DIAL_ACTIVE : + reply =__ofono_error_failed (msg); +break ; + } + +if (reply !=NULL ) { +dbus_message_unref (msg); + vc->pending =NULL ; + } + +return reply; } static DBusMessage *manager_transfer(DBusConnection *conn,
Signature · 1 line
1.7.1
Re: [PATCH 1/4] voicecall: create generic dial function
Hi Frédéric,
Quoted 14 lines · Frédéric Danis
split
manager_dialbetween generic and dbus parts--- src/voicecall.c | 106 +++++++++++++++++++++++++++++++++++++++++-------------- 1 files changed, 79 insertions(+), 27 deletions(-)src/voicecall.c +1
-0@@ -42,6 +42,17 @@#define VOICECALL_FLAG_SIM_ECC_READY 0x1 +enum dial_error {
src/voicecall.c line 55
Quoted 10 lines
src/voicecall.c +10
-0+DIAL_NO_ERROR , +DIAL_TOO_MANY_CALLS , +DIAL_INVALID_PHONE , +DIAL_NO_NETWORK , +DIAL_NOT_SUPPORTED , +DIAL_INCOMING , +DIAL_BUSY , + DIAL_ACTIVE +}; +
Lets try to re-use errno.h for this.
e.g. NO_ERROR -> 0
TOO_MANY_CALLS -> -EPERM
INVALID_PHONE -> -EINVAL
NO_NETWORK -> -ENETDOWN
NOT_SUPPORTED -> -ENOTSUP
INCOMING, BUSY, ACTIVE -> -EBUSY or -EPERM
Regards,
-Denis
PATCH 2/4 voicecall: add ATD support for HFP emulator
In reply to Frédéric Danis--- src/voicecall.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 92 insertions(+), 0 deletions(-)
src/voicecall.c +92 -0
@@ -2473,6 +2473,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)OFONO_ATOM_TYPE_EMULATOR_HFP , emulator_remove_handler, "+CHLD"); +__ofono_modem_foreach_registered_atom (modem, +OFONO_ATOM_TYPE_EMULATOR_HFP , + emulator_remove_handler, +"D" );__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); }
@@ -2918,6 +2922,93 @@ fail:ofono_emulator_send_final (em, &result); } +static void emulator_dial_callback (const struct ofono_error *error,void *data) +{ +struct ofono_voicecall *vc = data; +const char *number =NULL ; +gboolean need_to_emit; +struct voicecall *v; + + v =dial_handle_result (vc, error, number, &need_to_emit); + +if (v ==NULL ) { +struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); + +if (is_emergency_number (vc, number) == TRUE) +__ofono_modem_dec_emergency_mode (modem); + } + +if (need_to_emit) +voicecalls_emit_call_added (vc, v); +} + +static void emulator_dial (struct ofono_emulator *em,struct ofono_voicecall *vc, +const char *number) +{ +enum ofono_clir_option clir; +struct ofono_error result; +enum dial_error err; + + result.error =0 ; + +if (number ==NULL || number[0 ] =='\0' ) { + result.type =OFONO_ERROR_TYPE_FAILURE ; + goto send; + } + +if (!strncmp (number,"*31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_INVOCATION ; + }else if (!strncmp (number,"#31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_SUPPRESSION ; + }else + clir =OFONO_CLIR_OPTION_DEFAULT ; + + err =voicecall_dial (vc, number, clir, emulator_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : + result.type =OFONO_ERROR_TYPE_NO_ERROR ; +break ; + +case DIAL_NO_NETWORK : + result.error =30 ; + result.type =OFONO_ERROR_TYPE_CME ; +break ; + +case DIAL_INVALID_PHONE : +case DIAL_NOT_SUPPORTED : +case DIAL_TOO_MANY_CALLS : +case DIAL_INCOMING : +case DIAL_BUSY : +case DIAL_ACTIVE : + result.type =OFONO_ERROR_TYPE_FAILURE ; + } + +send: +ofono_emulator_send_final (em, &result); +} + +static void emulator_atd_cb (struct ofono_emulator *em, +struct ofono_emulator_request *req,void *userdata) +{ +struct ofono_voicecall *vc = userdata; +const char *str; +struct ofono_error result; + +switch (ofono_emulator_request_get_type (req)) { +case OFONO_EMULATOR_REQUEST_TYPE_SET : + str =ofono_emulator_request_get_raw (req); +emulator_dial (em, vc, str); +break ; + +default : + result.error =0 ; + result.type =OFONO_ERROR_TYPE_FAILURE ; +ofono_emulator_send_final (em, &result); + }; +} +static void emulator_hfp_watch (struct ofono_atom *atom,enum ofono_atom_watch_condition cond,void *data)
@@ -2933,6 +3024,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,ofono_emulator_add_handler (em,"+CHUP" , emulator_chup_cb, data,NULL );ofono_emulator_add_handler (em,"+CLCC" , emulator_clcc_cb, data,NULL );ofono_emulator_add_handler (em,"+CHLD" , emulator_chld_cb, data,NULL ); +ofono_emulator_add_handler (em,"D" , emulator_atd_cb, data,NULL ); }void ofono_voicecall_register (struct ofono_voicecall *vc)
Signature · 1 line
1.7.1
Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Hi Frédéric,
Quoted 56 lines · Frédéric Danis
--- src/voicecall.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 92 insertions(+), 0 deletions(-)src/voicecall.c +37
-0@@ -2473,6 +2473,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)OFONO_ATOM_TYPE_EMULATOR_HFP , emulator_remove_handler, "+CHLD"); +__ofono_modem_foreach_registered_atom (modem, +OFONO_ATOM_TYPE_EMULATOR_HFP , + emulator_remove_handler, +"D" );__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); }@@ -2918,6 +2922,93 @@ fail:ofono_emulator_send_final (em, &result); } +static void emulator_dial_callback (const struct ofono_error *error,void *data) +{ +struct ofono_voicecall *vc = data; +const char *number =NULL ; +gboolean need_to_emit; +struct voicecall *v; + + v =dial_handle_result (vc, error, number, &need_to_emit); + +if (v ==NULL ) { +struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); + +if (is_emergency_number (vc, number) == TRUE) +__ofono_modem_dec_emergency_mode (modem); + } + +if (need_to_emit) +voicecalls_emit_call_added (vc, v); +} + +static void emulator_dial (struct ofono_emulator *em,struct ofono_voicecall *vc, +const char *number) +{ +enum ofono_clir_option clir; +struct ofono_error result; +enum dial_error err; + + result.error =0 ; + +if (number ==NULL || number[0 ] =='\0' ) { + result.type =OFONO_ERROR_TYPE_FAILURE ; + goto send; + }
src/voicecall.c fail: · line 2967
Quoted 10 lines
src/voicecall.c +10
-0+ +if (!strncmp (number,"*31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_INVOCATION ; + }else if (!strncmp (number,"#31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_SUPPRESSION ; + }else + clir =OFONO_CLIR_OPTION_DEFAULT ; +
Actually this is not quite right. The clir option is determined by the presence of 'I'/'i' characters at the end of the dial string. Refer to 27.007 for more details.
oFono does not actually recognize temporary forms of *31/#31 invocation yet.
src/voicecall.c fail: · line 2977
Quoted 10 lines
src/voicecall.c +10
-0+ err =voicecall_dial (vc, number, clir, emulator_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : + result.type =OFONO_ERROR_TYPE_NO_ERROR ; +break ; + +case DIAL_NO_NETWORK : + result.error =30 ; + result.type =OFONO_ERROR_TYPE_CME ; +break ;
This might need to be NO CARRIER
Quoted 38 lines
src/voicecall.c +34
-0+ +case DIAL_INVALID_PHONE : +case DIAL_NOT_SUPPORTED : +case DIAL_TOO_MANY_CALLS : +case DIAL_INCOMING : +case DIAL_BUSY : +case DIAL_ACTIVE : + result.type =OFONO_ERROR_TYPE_FAILURE ; + } + +send: +ofono_emulator_send_final (em, &result); +} + +static void emulator_atd_cb (struct ofono_emulator *em, +struct ofono_emulator_request *req,void *userdata) +{ +struct ofono_voicecall *vc = userdata; +const char *str; +struct ofono_error result; + +switch (ofono_emulator_request_get_type (req)) { +case OFONO_EMULATOR_REQUEST_TYPE_SET : + str =ofono_emulator_request_get_raw (req); +emulator_dial (em, vc, str); +break ; + +default : + result.error =0 ; + result.type =OFONO_ERROR_TYPE_FAILURE ; +ofono_emulator_send_final (em, &result); + }; +} +static void emulator_hfp_watch (struct ofono_atom *atom,enum ofono_atom_watch_condition cond,void *data)
src/voicecall.c static void emulator_hfp_watch(struct ofono_atom *atom, · line 3030
Quoted 7 lines
src/voicecall.c +1
-0@@ -2933,6 +3024,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,ofono_emulator_add_handler (em,"+CHUP" , emulator_chup_cb, data,NULL );ofono_emulator_add_handler (em,"+CLCC" , emulator_clcc_cb, data,NULL );ofono_emulator_add_handler (em,"+CHLD" , emulator_chld_cb, data,NULL ); +ofono_emulator_add_handler (em,"D" , emulator_atd_cb, data,NULL ); }void ofono_voicecall_register (struct ofono_voicecall *vc)
Regards,
-Denis
Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Hello Denis,
Quoted 74 lines · Denis Kenzior
Hi Frédéric,
Quoted 56 lines · Frédéric Danis
--- src/voicecall.c | 92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 92 insertions(+), 0 deletions(-)src/voicecall.c +37
-0@@ -2473,6 +2473,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)OFONO_ATOM_TYPE_EMULATOR_HFP , emulator_remove_handler, "+CHLD"); +__ofono_modem_foreach_registered_atom (modem, +OFONO_ATOM_TYPE_EMULATOR_HFP , + emulator_remove_handler, +"D" );__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); }@@ -2918,6 +2922,93 @@ fail:ofono_emulator_send_final (em,&result); } +static void emulator_dial_callback (const struct ofono_error *error,void *data) +{ +struct ofono_voicecall *vc = data; +const char *number =NULL ; +gboolean need_to_emit; +struct voicecall *v; + + v =dial_handle_result (vc, error, number,&need_to_emit); + +if (v ==NULL ) { +struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); + +if (is_emergency_number (vc, number) == TRUE) +__ofono_modem_dec_emergency_mode (modem); + } + +if (need_to_emit) +voicecalls_emit_call_added (vc, v); +} + +static void emulator_dial (struct ofono_emulator *em,struct ofono_voicecall *vc, +const char *number) +{ +enum ofono_clir_option clir; +struct ofono_error result; +enum dial_error err; + + result.error =0 ; + +if (number ==NULL || number[0 ] =='\0' ) { + result.type =OFONO_ERROR_TYPE_FAILURE ; + goto send; + }src/voicecall.c fail: · line 2967
Quoted 10 lines
src/voicecall.c +10
-0+ +if (!strncmp (number,"*31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_INVOCATION ; + }else if (!strncmp (number,"#31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_SUPPRESSION ; + }else + clir =OFONO_CLIR_OPTION_DEFAULT ; +Actually this is not quite right. The clir option is determined by the presence of 'I'/'i' characters at the end of the dial string. Refer to 27.007 for more details.
Quoted 2 lines
oFono does not actually recognize temporary forms of *31/#31 invocation yet.
I added *31/#31 as I found them in telephony-ofono implementation of BlueZ HFP AG,
but 27.007 uses I/i,
and HFP 1.5 does not seem to support clir option (ATDdd...dd;)
Should I remove this part of code and only be compatible with HFP specs ?
Quoted 4 lines
Quoted 4 lines
src/voicecall.c +4
-0+ err =voicecall_dial (vc, number, clir, emulator_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : + result.type =OFONO_ERROR_TYPE_NO_ERROR ;
Quoted 9 lines
src/voicecall.c fail: · line 2977
Quoted 6 lines
src/voicecall.c +6
-0+break ; + +case DIAL_NO_NETWORK : + result.error =30 ; + result.type =OFONO_ERROR_TYPE_CME ; +break ;This might need to be NO CARRIER
As far as I understand, when there is no network, ATD should reply NO CARRIER if CMEE error mode is set to 0, or +CME ERROR: 30 if it is set to 1. So, I think that voicecall should return an OFONO_ERROR_TYPE_CME 30, and ofono_emulator_send_final should take care of replying the right string.
Something like :
void ofono_emulator_send_final(struct ofono_emulator *em,
const struct ofono_error *final)
{
char buf[256];
/*
* TODO: Handle various CMEE modes and report error strings from
* common.c
*/
switch (final->type) {
case OFONO_ERROR_TYPE_CMS:
sprintf(buf, "+CMS ERROR: %d", final->error);
g_at_server_send_ext_final(em->server, buf);
break;
case OFONO_ERROR_TYPE_CME:
switch (em->cmee_mode) {
case 1:
sprintf(buf, "+CME ERROR: %d", final->error);
break;
case 2:
sprintf(buf, "+CME ERROR: %s",
telephony_error_to_str(final));
break;
default:
if (final->error == 30) {
g_at_server_send_final(em->server,
G_AT_SERVER_RESULT_NO_CARRIER);
break;
}
goto failure;
}
g_at_server_send_ext_final(em->server, buf);
break;
case OFONO_ERROR_TYPE_NO_ERROR:
g_at_server_send_final(em->server,
G_AT_SERVER_RESULT_OK);
break;
case OFONO_ERROR_TYPE_CEER:
case OFONO_ERROR_TYPE_SIM:
case OFONO_ERROR_TYPE_FAILURE:
failure:
g_at_server_send_final(em->server,
G_AT_SERVER_RESULT_ERROR);
break;
};
}Is it Ok ?
Regards
Fred
Signature · 2 lines
Frederic Danis Open Source Technology Centre frederic.danis(a)intel.com Intel Corporation
Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Hi Frederic,
Quoted 17 lines
Quoted 10 lines
src/voicecall.c fail: · line 2967
Quoted 9 lines
src/voicecall.c +9
-0+if (!strncmp (number,"*31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_INVOCATION ; + }else if (!strncmp (number,"#31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_SUPPRESSION ; + }else + clir =OFONO_CLIR_OPTION_DEFAULT ; +Quoted 7 lines
Actually this is not quite right. The clir option is determined by the presence of 'I'/'i' characters at the end of the dial string. Refer to 27.007 for more details.
oFono does not actually recognize temporary forms of *31/#31 invocation yet.
Quoted 7 lines
I added *31/#31 as I found them in telephony-ofono implementation of BlueZ HFP AG,
but 27.007 uses I/i,
and HFP 1.5 does not seem to support clir option (ATDdd...dd;)Should I remove this part of code and only be compatible with HFP specs ?
Might as well handle the I/i and G/g part according to 27.007 since that is pretty easy and we'll have to do it anyway. *31/#31 is really an MMI code, it should never be sent to the modem, so please remove that for now.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
src/voicecall.c +10
-0+ err =voicecall_dial (vc, number, clir, emulator_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : + result.type =OFONO_ERROR_TYPE_NO_ERROR ; +break ; + +case DIAL_NO_NETWORK : + result.error =30 ; + result.type =OFONO_ERROR_TYPE_CME ; +break ;
Quoted 5 lines
Quoted 2 lines
This might need to be NO CARRIER
As far as I understand, when there is no network, ATD should reply NO CARRIER if CMEE error mode is set to 0, or +CME ERROR: 30 if it is set to 1.
Not quite. CMEE controls the presentation of 'extended' CME ERROR code.
Either as ERROR, CME ERROR: <num> or CME ERROR: <str>. NO CARRIER is
not an extended error code at all, and so is only affected by ATV setting, not CMEE.
Quoted 3 lines
So, I think that voicecall should return an
OFONO_ERROR_TYPE_CME30, andofono_emulator_send_finalshould take care of replying the right string.
Nope, you have to take your pick, either CME ERROR: 30, or NO CARRIER. I'd expect most implementations to reply with a NO CARRIER in this case, but can you check what other implementations do in reality?
Regards,
-Denis
Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Hello Denis,
Quoted 24 lines · Denis Kenzior
Hi Frederic,
Quoted 22 lines
Quoted 10 lines
src/voicecall.c fail: · line 2967
Quoted 9 lines
src/voicecall.c +9
-0+if (!strncmp (number,"*31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_INVOCATION ; + }else if (!strncmp (number,"#31#" ,4 )) { + number +=4 ; + clir =OFONO_CLIR_OPTION_SUPPRESSION ; + }else + clir =OFONO_CLIR_OPTION_DEFAULT ; +Quoted 7 lines
Actually this is not quite right. The clir option is determined by the presence of 'I'/'i' characters at the end of the dial string. Refer to 27.007 for more details.
oFono does not actually recognize temporary forms of *31/#31 invocation yet.
I added *31/#31 as I found them in telephony-ofono implementation of BlueZ HFP AG,
but 27.007 uses I/i,
and HFP 1.5 does not seem to support clir option (ATDdd...dd;)
Quoted 7 lines
Quoted 2 lines
Should I remove this part of code and only be compatible with HFP specs ?
Might as well handle the I/i and G/g part according to 27.007 since that is pretty easy and we'll have to do it anyway. *31/#31 is really an MMI code, it should never be sent to the modem, so please remove that for now.
OK, so I will remove this part and will send a patch on I/i,G/g support later.
Quoted 13 lines
Quoted 13 lines
Quoted 13 lines
src/voicecall.c fail: · line 2977
Quoted 10 lines
src/voicecall.c +10
-0+ err =voicecall_dial (vc, number, clir, emulator_dial_callback, vc); +switch (err) { +case DIAL_NO_ERROR : + result.type =OFONO_ERROR_TYPE_NO_ERROR ; +break ; + +case DIAL_NO_NETWORK : + result.error =30 ; + result.type =OFONO_ERROR_TYPE_CME ; +break ;This might need to be NO CARRIER
Quoted 9 lines
Quoted 3 lines
As far as I understand, when there is no network, ATD should reply NO CARRIER if CMEE error mode is set to 0, or +CME ERROR: 30 if it is set to 1.
Not quite. CMEE controls the presentation of 'extended' CME ERROR code.
Either as ERROR, CME ERROR:<num> or CME ERROR:<str>. NO CARRIER is
not an extended error code at all, and so is only affected by ATV setting, not CMEE.
OK, thanks for your explanation.
Quoted 8 lines
Quoted 3 lines
So, I think that voicecall should return an
OFONO_ERROR_TYPE_CME30, andofono_emulator_send_finalshould take care of replying the right string.Nope, you have to take your pick, either CME ERROR: 30, or NO CARRIER. I'd expect most implementations to reply with a NO CARRIER in this case, but can you check what other implementations do in reality?
In paragraph 6.2.13.11 of tr002v15, in reply to ATD command without network, the flowchart shows usage of +CME ERROR: 30 or ERROR reply (no usage of NO CARRIER).
Paragraph 4.33.2 of HFP 1.5 specification said that NO CARRIER (and BUSY, NO ANSWER, ...) "are in addition to the +CME ERROR: reponses".
My understanding of specs is that we should send the CME ERROR and, if we want, NO CARRIER in addition.
Regards
Fred
Signature · 2 lines
Frederic Danis Open Source Technology Centre frederic.danis(a)intel.com Intel Corporation
Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Hi Frederic,
Quoted 4 lines
Quoted 4 lines
Quoted 3 lines
So, I think that voicecall should return an
OFONO_ERROR_TYPE_CME30, andofono_emulator_send_finalshould take care of replying the right string.
Quoted 9 lines
Quoted 4 lines
Nope, you have to take your pick, either CME ERROR: 30, or NO CARRIER. I'd expect most implementations to reply with a NO CARRIER in this case, but can you check what other implementations do in reality?
In paragraph 6.2.13.11 of tr002v15, in reply to ATD command without network, the flowchart shows usage of +CME ERROR: 30 or ERROR reply (no usage of NO CARRIER).
If that is what tr002 recommends, then lets do that for now.
Quoted 5 lines
Paragraph 4.33.2 of HFP 1.5 specification said that NO CARRIER (and BUSY, NO ANSWER, ...) "are in addition to the +CME ERROR: reponses".
My understanding of specs is that we should send the CME ERROR and, if we want, NO CARRIER in addition.
Yeah, I never understood that particular statement. +CME ERROR and NO CARRIER are both final responses, you should not send both.
Regards,
-Denis
PATCH 3/4 voicecall: save last dialed number
In reply to Frédéric Danis--- src/voicecall.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 45 insertions(+), 0 deletions(-)
src/voicecall.c +45 -0
@@ -37,11 +37,15 @@#include "common.h" #include "simutil.h" #include "smsutil.h" +#include "storage.h" #define MAX_VOICE_CALLS 16#define VOICECALL_FLAG_SIM_ECC_READY 0x1 +#define VOICECALL_STORE "voicecall" +#define LASTDIAL_GROUP "LastDial" +enum dial_error {DIAL_NO_ERROR ,DIAL_TOO_MANY_CALLS ,
@@ -82,6 +86,8 @@ struct ofono_voicecall {GQueue *toneq;guint tone_source;unsigned int hfp_watch; +GKeyFile *settings; +char *imsi; };struct voicecall {
@@ -1485,6 +1491,12 @@ static enum dial_error voicecall_dial(struct ofono_voicecall *vc, vc->driver->dial (vc, &ph, clir, cb, vc); +if (vc->settings) { +g_key_file_set_string (vc->settings,LASTDIAL_GROUP , +"Number" , number); +storage_sync (vc->imsi,VOICECALL_STORE , vc->settings); + } +return DIAL_NO_ERROR ; }
@@ -2481,6 +2493,33 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); } +static void voicecall_load_settings (struct ofono_voicecall *vc) +{ +const char *imsi; + + imsi =ofono_sim_get_imsi (vc->sim); +if (imsi ==NULL ) +return ; + + vc->settings =storage_open (imsi,VOICECALL_STORE ); + +if (vc->settings ==NULL ) +return ; + + vc->imsi =g_strdup (imsi); +} + +static void voicecall_close_settings (struct ofono_voicecall *vc) +{ +if (vc->settings) { +storage_close (vc->imsi,VOICECALL_STORE , vc->settings, TRUE); + +g_free (vc->imsi); + vc->imsi =NULL ; + vc->settings =NULL ; + } +} +static void voicecall_unregister (struct ofono_atom *atom) {DBusConnection *conn =ofono_dbus_get_connection ();
@@ -2491,6 +2530,8 @@ static void voicecall_unregister(struct ofono_atom *atom)emulator_hfp_unregister (atom); +voicecall_close_settings (vc); +if (vc->sim_state_watch) {ofono_sim_remove_state_watch (vc->sim, vc->sim_state_watch); vc->sim_state_watch =0 ;
@@ -2630,6 +2671,9 @@ static void sim_state_watch(enum ofono_sim_state new_state, void *user)free_sim_ecc_numbers (vc, FALSE);set_new_ecc (vc); +case OFONO_SIM_STATE_READY : +voicecall_load_settings (vc); +break ;default :break ; }
@@ -2642,6 +2686,7 @@ static void sim_watch(struct ofono_atom *atom,struct ofono_sim *sim =__ofono_atom_get_data (atom);if (cond ==OFONO_ATOM_WATCH_CONDITION_UNREGISTERED ) { +voicecall_close_settings (vc); vc->sim_state_watch =0 ; vc->sim =NULL ;return ;
Signature · 1 line
1.7.1
PATCH 4/4 voicecall: add +BLDN support for HFP emulator
In reply to Frédéric Danis--- src/voicecall.c | 31 +++++++++++++++++++++++++++++++ 1 files changed, 31 insertions(+), 0 deletions(-)
src/voicecall.c +31 -0
@@ -2489,6 +2489,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom)OFONO_ATOM_TYPE_EMULATOR_HFP , emulator_remove_handler, "D"); +__ofono_modem_foreach_registered_atom (modem, +OFONO_ATOM_TYPE_EMULATOR_HFP , + emulator_remove_handler, +"+BLDN" );__ofono_modem_remove_atom_watch (modem, vc->hfp_watch); }
@@ -3054,6 +3058,32 @@ static void emulator_atd_cb(struct ofono_emulator *em, }; } +static void emulator_bldn_cb (struct ofono_emulator *em, +struct ofono_emulator_request *req,void *userdata) +{ +struct ofono_voicecall *vc = userdata; +const char *str; +struct ofono_error result; +GError *error =NULL ; + +switch (ofono_emulator_request_get_type (req)) { +case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY : +if (vc->settings ==NULL ) + goto fail; + + str =g_key_file_get_string (vc->settings,LASTDIAL_GROUP , +"Number" , &error); +emulator_dial (em, vc, str); +break ; + +default : +fail: + result.error =0 ; + result.type =OFONO_ERROR_TYPE_FAILURE ; +ofono_emulator_send_final (em, &result); + }; +} +static void emulator_hfp_watch (struct ofono_atom *atom,enum ofono_atom_watch_condition cond,void *data)
@@ -3070,6 +3100,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom,ofono_emulator_add_handler (em,"+CLCC" , emulator_clcc_cb, data,NULL );ofono_emulator_add_handler (em,"+CHLD" , emulator_chld_cb, data,NULL );ofono_emulator_add_handler (em,"D" , emulator_atd_cb, data,NULL ); +ofono_emulator_add_handler (em,"+BLDN" , emulator_bldn_cb, data,NULL ); }void ofono_voicecall_register (struct ofono_voicecall *vc)
Signature · 1 line
1.7.1