Open Source Telephony
 help / color / mirror / Atom feed
From: Denis Kenzior <denkenz@gmail.com>
To: ofono@ofono.org
Subject: Re: [PATCH 2/4] voicecall: add ATD support for HFP emulator
Date: Tue, 17 May 2011 23:53:02 -0500	[thread overview]
Message-ID: <4DD350AE.6020809@gmail.com> (raw)
In-Reply-To: <1305211258-8189-3-git-send-email-frederic.danis@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 4082 bytes --]

Hi Frédéric,

On 05/12/2011 09:40 AM, Frédéric Danis wrote:
> ---
>  src/voicecall.c |   92 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  1 files changed, 92 insertions(+), 0 deletions(-)
> 
> diff --git a/src/voicecall.c b/src/voicecall.c
> index 037caac..b98c858 100644
> --- a/src/voicecall.c
> +++ b/src/voicecall.c
> @@ -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;
> +

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.

> +	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

> +
> +	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)

Regards,
-Denis

  reply	other threads:[~2011-05-18  4:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-12 14:40 [PATCH 0/4] Add dial support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-12 14:40 ` [PATCH 1/4] voicecall: create generic dial function =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-18  4:46   ` Denis Kenzior
2011-05-12 14:40 ` [PATCH 2/4] voicecall: add ATD support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-18  4:53   ` Denis Kenzior [this message]
2011-05-18 15:33     ` Frederic Danis
2011-05-18 16:13       ` Denis Kenzior
2011-05-19 16:16         ` Frederic Danis
2011-05-19 16:39           ` Denis Kenzior
2011-05-12 14:40 ` [PATCH 3/4] voicecall: save last dialed number =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis
2011-05-12 14:40 ` [PATCH 4/4] voicecall: add +BLDN support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Danis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4DD350AE.6020809@gmail.com \
    --to=denkenz@gmail.com \
    --cc=ofono@ofono.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox