* [PATCH] Add CLCC support to HFP profile @ 2011-04-21 9:59 =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau 2011-04-21 9:59 ` [PATCH] voicecall: add +CLCC support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau 0 siblings, 1 reply; 3+ messages in thread From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-04-21 9:59 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 259 bytes --] This patch adds CLCC support to HFP profile. Frédéric Dalleau (1): voicecall: add +CLCC support for HFP emulator src/voicecall.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) ^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] voicecall: add +CLCC support for HFP emulator 2011-04-21 9:59 [PATCH] Add CLCC support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-04-21 9:59 ` =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau 2011-04-21 21:27 ` Denis Kenzior 0 siblings, 1 reply; 3+ messages in thread From: =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-04-21 9:59 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 2645 bytes --] --- src/voicecall.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 64 insertions(+), 0 deletions(-) diff --git a/src/voicecall.c b/src/voicecall.c index 2e20c80..49f190a 100644 --- a/src/voicecall.c +++ b/src/voicecall.c @@ -2390,6 +2390,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom) OFONO_ATOM_TYPE_EMULATOR_HFP, emulator_remove_handler, "A"); + __ofono_modem_foreach_registered_atom(modem, + OFONO_ATOM_TYPE_EMULATOR_HFP, + emulator_remove_handler, + "+CLCC"); __ofono_modem_remove_atom_watch(modem, vc->hfp_watch); } @@ -2604,6 +2608,65 @@ fail: }; } +static void emulator_clcc_cb(struct ofono_emulator *em, + struct ofono_emulator_request *req, void *userdata) +{ + struct ofono_voicecall *vc = userdata; + struct ofono_error result; + GSList *l; + struct voicecall *v; + const char *phone; + gboolean mpty; + /* + * '+CLCC: 123,1,1,0,1,"+",' + phone number + phone type on 3 digits + * + terminating null + */ + char buf[OFONO_MAX_PHONE_NUMBER_LENGTH + 26 + 1]; + + result.error = 0; + + switch (ofono_emulator_request_get_type(req)) { + case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY: + + for (l = vc->call_list; l; l = l->next) { + v = l->data; + + if (g_slist_find_custom(vc->multiparty_list, + GINT_TO_POINTER(v->call->id), + call_compare_by_id)) + mpty = TRUE; + else + mpty = FALSE; + + if (v->call->clip_validity != CLIP_VALIDITY_VALID) { + sprintf(buf, "+CLCC: %d,%d,%d,0,%d", + v->call->id, v->call->direction, + v->call->status, mpty); + goto send; + } + + phone = phone_number_to_string(&v->call->phone_number); + + sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"%s\",%d", + v->call->id, v->call->direction, + v->call->status, mpty, phone, + v->call->phone_number.type); + +send: + ofono_emulator_send_info(em, buf, l->next == NULL ? + TRUE : FALSE); + } + + result.type = OFONO_ERROR_TYPE_NO_ERROR; + break; + + default: + 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) @@ -2616,6 +2679,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom, notify_emulator_call_status(data); ofono_emulator_add_handler(em, "A", emulator_ata_cb, data, NULL); + ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL); } void ofono_voicecall_register(struct ofono_voicecall *vc) -- 1.7.1 ^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] voicecall: add +CLCC support for HFP emulator 2011-04-21 9:59 ` [PATCH] voicecall: add +CLCC support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau @ 2011-04-21 21:27 ` Denis Kenzior 0 siblings, 0 replies; 3+ messages in thread From: Denis Kenzior @ 2011-04-21 21:27 UTC (permalink / raw) To: ofono [-- Attachment #1: Type: text/plain, Size: 3225 bytes --] Hi Frédéric, On 04/21/2011 04:59 AM, Frédéric Dalleau wrote: > --- > src/voicecall.c | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 files changed, 64 insertions(+), 0 deletions(-) > > diff --git a/src/voicecall.c b/src/voicecall.c > index 2e20c80..49f190a 100644 > --- a/src/voicecall.c > +++ b/src/voicecall.c > @@ -2390,6 +2390,10 @@ static void emulator_hfp_unregister(struct ofono_atom *atom) > OFONO_ATOM_TYPE_EMULATOR_HFP, > emulator_remove_handler, > "A"); > + __ofono_modem_foreach_registered_atom(modem, > + OFONO_ATOM_TYPE_EMULATOR_HFP, > + emulator_remove_handler, > + "+CLCC"); > > __ofono_modem_remove_atom_watch(modem, vc->hfp_watch); > } > @@ -2604,6 +2608,65 @@ fail: > }; > } > > +static void emulator_clcc_cb(struct ofono_emulator *em, > + struct ofono_emulator_request *req, void *userdata) > +{ > + struct ofono_voicecall *vc = userdata; > + struct ofono_error result; > + GSList *l; > + struct voicecall *v; > + const char *phone; > + gboolean mpty; > + /* > + * '+CLCC: 123,1,1,0,1,"+",' + phone number + phone type on 3 digits > + * + terminating null > + */ > + char buf[OFONO_MAX_PHONE_NUMBER_LENGTH + 26 + 1]; > + > + result.error = 0; > + > + switch (ofono_emulator_request_get_type(req)) { > + case OFONO_EMULATOR_REQUEST_TYPE_COMMAND_ONLY: > + Can you remove this empty line here? > + for (l = vc->call_list; l; l = l->next) { > + v = l->data; > + > + if (g_slist_find_custom(vc->multiparty_list, > + GINT_TO_POINTER(v->call->id), > + call_compare_by_id)) > + mpty = TRUE; > + else > + mpty = FALSE; > + > + if (v->call->clip_validity != CLIP_VALIDITY_VALID) { > + sprintf(buf, "+CLCC: %d,%d,%d,0,%d", > + v->call->id, v->call->direction, > + v->call->status, mpty); I suggest you do not omit phone number and type, but use "",128 instead. > + goto send; > + } > + > + phone = phone_number_to_string(&v->call->phone_number); This is not quite what you want to do. The phone_number contents can be passed directly to CLCC. What phone_number_to_string does is potentially adds '+' prefix, which is not what you want. > + > + sprintf(buf, "+CLCC: %d,%d,%d,0,%d,\"%s\",%d", > + v->call->id, v->call->direction, > + v->call->status, mpty, phone, > + v->call->phone_number.type); > + > +send: > + ofono_emulator_send_info(em, buf, l->next == NULL ? > + TRUE : FALSE); > + } > + > + result.type = OFONO_ERROR_TYPE_NO_ERROR; > + break; > + > + default: > + 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) > @@ -2616,6 +2679,7 @@ static void emulator_hfp_watch(struct ofono_atom *atom, > notify_emulator_call_status(data); > > ofono_emulator_add_handler(em, "A", emulator_ata_cb, data, NULL); > + ofono_emulator_add_handler(em, "+CLCC", emulator_clcc_cb, data, NULL); > } > > void ofono_voicecall_register(struct ofono_voicecall *vc) Regards, -Denis ^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-21 21:27 UTC | newest] Thread overview: 3+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2011-04-21 9:59 [PATCH] Add CLCC support to HFP profile =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau 2011-04-21 9:59 ` [PATCH] voicecall: add +CLCC support for HFP emulator =?unknown-8bit?q?Fr=C3=A9d=C3=A9ric?= Dalleau 2011-04-21 21:27 ` Denis Kenzior
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.