Improve last call dialed functionality and add memory dialing
cover Improve last call dialed functionality and add memory dialing
Hi!
Based on comments from my earlier patch series I made a new one to add memory/favourites dialing. This patch set re-uses parts of the common functionality of the earlier accepted "last call dialed" calling. It also has a fix for a small dbus bug that crept in and I only noticed later on while testing. This series also adds caller id support to the last call dialed functionality so that this is in line with the dial and dial favourites options.
Cheers and thank you for reviewing,
Philippe
Philippe De Swert (7):
voicecall: Support clir for last call dialing
voicecall: Rename callbacks/functions related to dialing the last
called number
include/voicecall.h : Add support for dialing number at a given memory
location
voicecall: Fix issue with invalid dbus path
voicecall.c : Add functionality to dial from a memory location.
hfpmodem: Add memory dialling support
doc: Document the new DialMemory method of the voicecallmanager-api
doc/voicecallmanager-api.txt | 13 ++++++- drivers/hfpmodem/voicecall.c | 30 ++++++++++++++- include/voicecall.h | 8 +++- src/voicecall.c | 88 +++++++++++++++++++++++++++++++++++++++----- 4 files changed, 126 insertions(+), 13 deletions(-)
Signature · 1 line
2.11.0
PATCH 1/7 voicecall: Support clir for last call dialing
When dialing the last called number we also want to use the caller id (clir) settings that are currently used.
--- doc/voicecallmanager-api.txt | 2 +- drivers/hfpmodem/voicecall.c | 4 ++-- include/voicecall.h | 3 ++- src/voicecall.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
doc/voicecallmanager-api.txt +1 -1
@@ -59,7 +59,7 @@ Methods dict GetProperties() [service].Error.NotImplemented [service].Error.Failed - object DialLast() + object DialLast(string hide_callerid) Initiates a new outgoing call to the last dialled number.
drivers/hfpmodem/voicecall.c +2 -2
@@ -405,8 +405,8 @@ static void hfp_dial(struct ofono_voicecall *vc,CALLBACK_WITH_FAILURE (cb, data); } -static void hfp_dial_last (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb, -void *data) +static void hfp_dial_last (struct ofono_voicecall *vc,enum ofono_clir_option clir, +ofono_voicecall_cb_t cb,void *data) {struct voicecall_data *vd =ofono_voicecall_get_data (vc);struct cb_data *cbd =cb_data_new (cb, data);
include/voicecall.h +2 -1
@@ -64,7 +64,8 @@ struct ofono_voicecall_driver {/* Dials the last number again, this handles the hfp profile last number * dialing with the +BLDN AT command */ -void (*dial_last)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); +void (*dial_last)(struct ofono_voicecall *vc,enum ofono_clir_option clir, +ofono_voicecall_cb_t cb,void *data);/* Answers an incoming call, this usually corresponds to ATA */ void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);
src/voicecall.c +14 -4
@@ -1605,7 +1605,7 @@ error: __ofono_error_failed(vc->pending)); } -static int voicecall_dial_last (struct ofono_voicecall *vc, +static int voicecall_dial_last (struct ofono_voicecall *vc,enum ofono_clir_option clir,ofono_voicecall_cb_t cb,void *data) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom);
@@ -1629,7 +1629,7 @@ static int voicecall_dial_last(struct ofono_voicecall *vc,if (voicecalls_have_active (vc) &&voicecalls_have_held (vc))return -EBUSY ; - vc->driver->dial_last (vc, cb, vc); + vc->driver->dial_last (vc, clir, cb, vc);return 0 ; }
@@ -1638,14 +1638,23 @@ static DBusMessage *manager_dial_last(DBusConnection *conn, DBusMessage *msg, void *data) {struct ofono_voicecall *vc = data; +const char *clirstr; +enum ofono_clir_option clir;int err;if (vc->pending || vc->dial_req || vc->pending_em)return __ofono_error_busy (msg); +if (dbus_message_get_args (msg,NULL ,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); - err =voicecall_dial_last (vc, manager_dial_last_callback, vc); + err =voicecall_dial_last (vc, clir, manager_dial_last_callback, vc);if (err >=0 )return NULL ;
@@ -2223,7 +2232,8 @@ static const GDBusMethodTable manager_methods[] = { GDBUS_ARGS({ "number", "s" }, { "hide_callerid", "s" }), GDBUS_ARGS({ "path", "o" }), manager_dial) }, - { GDBUS_ASYNC_METHOD("DialLast", NULL, NULL, manager_dial_last)}, + {GDBUS_ASYNC_METHOD ("DialLast" , + GDBUS_ARGS({ "hide_callerid", "s" }), NULL, manager_dial_last)}, { GDBUS_ASYNC_METHOD("Transfer", NULL, NULL, manager_transfer) }, { GDBUS_ASYNC_METHOD("SwapCalls", NULL, NULL, manager_swap_calls) }, { GDBUS_ASYNC_METHOD("ReleaseAndAnswer", NULL, NULL,
Signature · 1 line
2.11.0
PATCH 2/7 voicecall: Rename callbacks/functions related to dialing the last called number
In reply to Philippe De SwertCalling from memory index is very similar in functionality to dialing the last called number. So we rename the functions so we can reuse them, to deal with memory index calling.
--- src/voicecall.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
src/voicecall.c +3 -3
@@ -1577,7 +1577,7 @@ static DBusMessage *manager_dial(DBusConnection *conn,return __ofono_error_failed (msg); } -static void manager_dial_last_callback (const struct ofono_error *error, +static void manager_dial_shortcut_callback (const struct ofono_error *error,void *data) {struct ofono_voicecall *vc = data;
@@ -1605,7 +1605,7 @@ error: __ofono_error_failed(vc->pending)); } -static int voicecall_dial_last (struct ofono_voicecall *vc,enum ofono_clir_option clir, +static int voicecall_dial_shortcut (struct ofono_voicecall *vc,enum ofono_clir_option clir,ofono_voicecall_cb_t cb,void *data) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom);
@@ -1654,7 +1654,7 @@ static DBusMessage *manager_dial_last(DBusConnection *conn, vc->pending =dbus_message_ref (msg); - err =voicecall_dial_last (vc, clir, manager_dial_last_callback, vc); + err =voicecall_dial_shortcut (vc, clir, manager_dial_shortcut_callback, vc);if (err >=0 )return NULL ;
Signature · 1 line
2.11.0
PATCH 3/7 include/voicecall.h : Add support for dialing number at a given memory location
In reply to Philippe De SwertAdd a new function to be able to dial numbers from memory/favourites.
--- include/voicecall.h | 5 +++++ 1 file changed, 5 insertions(+)
include/voicecall.h +5 -0
@@ -61,6 +61,11 @@ struct ofono_voicecall_driver {const struct ofono_phone_number *number, enum ofono_clir_option clir, ofono_voicecall_cb_t cb, void *data); +/* dials a number at a given memory location */ +void (*dial_memory)(struct ofono_voicecall *vc, +long int memory_location, +enum ofono_clir_option clir,ofono_voicecall_cb_t cb, +void *data);/* Dials the last number again, this handles the hfp profile last number * dialing with the +BLDN AT command */
Signature · 1 line
2.11.0
PATCH 4/7 voicecall: Fix issue with invalid dbus path
In reply to Philippe De SwertFix an error message from dbus about the path supplied not being valid. Related to commit f58e7685b0078df470300b99cd89fb9b3c45d1c0
ofonod[19107]: src/voicecall.c:voicecall_dial_shortcut() check position
ofonod[19107]: src/voicecall.c:synthesize_outgoing_call() Registering new call: 1
process 19107: arguments to dbus_message_iter_append_basic() were incorrect, assertion "_dbus_check_is_valid_path (*string_p)" failed in file ../../../dbus/dbus-message.c line 2759. This is normally a bug in some application using the D-Bus library.
--- src/voicecall.c | 2 ++ 1 file changed, 2 insertions(+)
src/voicecall.c +2 -0
@@ -28,6 +28,7 @@#include <time.h> #include <errno.h> #include <stdint.h> +#include <stdlib.h> #include <glib.h> #include <gdbus.h>
@@ -1592,6 +1593,7 @@ static void manager_dial_shortcut_callback(const struct ofono_error *error,if (!v) goto error; + path =voicecall_build_path (vc, v->call); reply =dbus_message_new_method_return (vc->pending);dbus_message_append_args (reply,DBUS_TYPE_OBJECT_PATH , &path,DBUS_TYPE_INVALID );
Signature · 1 line
2.11.0
PATCH 5/7 voicecall.c : Add functionality to dial from a memory location.
In reply to Philippe De SwertNow we can also dial favourites/quick contacts over bluetooth.
--- src/voicecall.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 7 deletions(-)
src/voicecall.c +65 -7
@@ -1607,10 +1607,11 @@ error: __ofono_error_failed(vc->pending)); } -static int voicecall_dial_shortcut (struct ofono_voicecall *vc,enum ofono_clir_option clir, -ofono_voicecall_cb_t cb,void *data) +static int voicecall_dial_shortcut (struct ofono_voicecall *vc,const char *position, +enum ofono_clir_option clir,ofono_voicecall_cb_t cb,void *data) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); +long int memory_position;if (g_slist_length (vc->call_list) >=MAX_VOICE_CALLS )return -EPERM ;
@@ -1618,9 +1619,6 @@ static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_oif (ofono_modem_get_online (modem) == FALSE)return -ENETDOWN ; -if (vc->driver->dial_last ==NULL ) -return -ENOTSUP ; -if (voicecalls_have_incoming (vc))return -EBUSY ;
@@ -1631,7 +1629,19 @@ static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_oif (voicecalls_have_active (vc) &&voicecalls_have_held (vc))return -EBUSY ; - vc->driver->dial_last (vc, clir, cb, vc); +/* when position is not given we dial the last called number */ +if (position ==NULL ) { +if (vc->driver->dial_last ==NULL ) +return -ENOTSUP ; + + vc->driver->dial_last (vc, clir, cb, vc); + }else { + memory_position =strtol (position,NULL ,10 ); +if (vc->driver->dial_memory ==NULL ) +return -ENOTSUP ; + + vc->driver->dial_memory (vc, memory_position, clir, cb, vc); + }return 0 ; }
@@ -1656,7 +1666,7 @@ static DBusMessage *manager_dial_last(DBusConnection *conn, vc->pending =dbus_message_ref (msg); - err =voicecall_dial_shortcut (vc, clir, manager_dial_shortcut_callback, vc); + err =voicecall_dial_shortcut (vc,NULL , clir, manager_dial_shortcut_callback, vc);if (err >=0 )return NULL ;
@@ -1678,6 +1688,50 @@ static DBusMessage *manager_dial_last(DBusConnection *conn,return __ofono_error_failed (msg); } +static DBusMessage *manager_dial_memory (DBusConnection *conn, +DBusMessage *msg,void *data) +{ +struct ofono_voicecall *vc = data; +const char *memory_location; +const char *clirstr; +enum ofono_clir_option clir; +int err; + +if (vc->pending || vc->dial_req || vc->pending_em) +return __ofono_error_busy (msg); + +if (dbus_message_get_args (msg,NULL ,DBUS_TYPE_STRING , &memory_location, +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); + + err =voicecall_dial_shortcut (vc, memory_location, clir, manager_dial_shortcut_callback, vc); + +if (err >=0 ) +return NULL ; + + vc->pending =NULL ; +dbus_message_unref (msg); + +switch (err) { +case -EINVAL : +return __ofono_error_invalid_format (msg); + +case -ENETDOWN : +return __ofono_error_not_available (msg); + +case -ENOTSUP : +return __ofono_error_not_implemented (msg); + } + +return __ofono_error_failed (msg); +} +static DBusMessage *manager_transfer (DBusConnection *conn,DBusMessage *msg,void *data) {
@@ -2236,6 +2290,10 @@ static const GDBusMethodTable manager_methods[] = { manager_dial) }, {GDBUS_ASYNC_METHOD ("DialLast" , GDBUS_ARGS({ "hide_callerid", "s" }), NULL, manager_dial_last)}, + { GDBUS_ASYNC_METHOD("DialMemory", + GDBUS_ARGS({ "memory_location", "s" },{ "hide_callerid", "s" }), +NULL , + manager_dial_memory) }, { GDBUS_ASYNC_METHOD("Transfer", NULL, NULL, manager_transfer) }, { GDBUS_ASYNC_METHOD("SwapCalls", NULL, NULL, manager_swap_calls) }, { GDBUS_ASYNC_METHOD("ReleaseAndAnswer", NULL, NULL,
Signature · 1 line
2.11.0
PATCH 6/7 hfpmodem: Add memory dialling support
In reply to Philippe De SwertHandle the request to dial from a memory index and send the correct ATD> sequence
--- drivers/hfpmodem/voicecall.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/hfpmodem/voicecall.c +26 -0
@@ -422,6 +422,31 @@ static void hfp_dial_last(struct ofono_voicecall *vc, enum ofono_clir_option cliCALLBACK_WITH_FAILURE (cb, data); } + +static void hfp_dial_memory (struct ofono_voicecall *vc, +long int memory_location, +enum ofono_clir_option clir,ofono_voicecall_cb_t cb, +void *data) +{ +struct voicecall_data *vd =ofono_voicecall_get_data (vc); +struct cb_data *cbd =cb_data_new (cb, data); +char buf[256 ]; + + cbd->user = vc; +DBG ("Calling memory location %ld\n" , memory_location); +snprintf (buf,sizeof (buf),"ATD>%ld" , memory_location); + +strcat (buf,";" ); + +if (g_at_chat_send (vd->chat, buf, none_prefix, + atd_cb, cbd, g_free) >0 ) +return ; + +g_free (cbd); +DBG ("at_chat_failed" ); +CALLBACK_WITH_FAILURE (cb, data); +} +static void hfp_template (const char *cmd,struct ofono_voicecall *vc,GAtResultFunc result_cb,unsigned int affected_types,ofono_voicecall_cb_t cb,void *data)
@@ -1287,6 +1312,7 @@ static struct ofono_voicecall_driver driver = { .remove = hfp_voicecall_remove, .dial = hfp_dial, .dial_last = hfp_dial_last, + .dial_memory = hfp_dial_memory, .answer = hfp_answer, .hangup_active = hfp_hangup, .hold_all_active = hfp_hold_all_active,
Signature · 1 line
2.11.0
PATCH 7/7 doc: Document the new DialMemory method of the voicecallmanager-api
In reply to Philippe De SwertThe new DialMemory method call needs to be documented so it is clear how to use it.
--- doc/voicecallmanager-api.txt | 11 +++++++++++ 1 file changed, 11 insertions(+)
doc/voicecallmanager-api.txt +11 -0
@@ -69,6 +69,17 @@ Methods dict GetProperties() [service].Error.NotImplemented [service].Error.Failed + object DialMemory(string memory position, string hide_callerid) + + Initiates a new outgoing call to the number in the given memory + position/favourite. For callerid see the Dial method. + + Possible Errors: [service].Error.InProgress + [service].Error.InvalidArguments + [service].Error.InvalidFormat + [service].Error.NotImplemented + [service].Error.Failed + void Transfer() Joins the currently Active (or Outgoing, depending
Signature · 1 line
2.11.0
Re: [PATCH 1/7] voicecall: Support clir for last call dialing
In reply to Philippe De SwertHi Philippe,
Quoted 10 lines · Philippe De Swert
When dialing the last called number we also want to use the caller id (clir) settings that are currently used.
--- doc/voicecallmanager-api.txt | 2 +- drivers/hfpmodem/voicecall.c | 4 ++-- include/voicecall.h | 3 ++- src/voicecall.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
This patch really needs to be broken up into 4. See HACKING, 'Submitting patches'.
Quoted 18 lines
doc/voicecallmanager-api.txt +1
-1@@ -59,7 +59,7 @@ Methods dict GetProperties() [service].Error.NotImplemented [service].Error.Failed - object DialLast() + object DialLast(string hide_callerid) Initiates a new outgoing call to the last dialled number.drivers/hfpmodem/voicecall.c +0
-0
drivers/hfpmodem/voicecall.c static void hfp_dial(struct ofono_voicecall *vc, · line 412
Quoted 10 lines
drivers/hfpmodem/voicecall.c +2
-2@@ -405,8 +405,8 @@ static void hfp_dial(struct ofono_voicecall *vc,CALLBACK_WITH_FAILURE (cb, data); } -static void hfp_dial_last (struct ofono_voicecall *vc,ofono_voicecall_cb_t cb, -void *data) +static void hfp_dial_last (struct ofono_voicecall *vc,enum ofono_clir_option clir, +ofono_voicecall_cb_t cb,void *data) {struct voicecall_data *vd =ofono_voicecall_get_data (vc);struct cb_data *cbd =cb_data_new (cb, data);
It doesn't look like you actually implementing the CLIR modifier in the driver? E.g. the 'I' or 'i' suffix business.
I think last time I played with this half the AG implementations didn't support the CLIR parameter anyway.
Quoted 63 lines
include/voicecall.h +2
-1@@ -64,7 +64,8 @@ struct ofono_voicecall_driver {/* Dials the last number again, this handles the hfp profile last number * dialing with the +BLDN AT command */ -void (*dial_last)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data); +void (*dial_last)(struct ofono_voicecall *vc,enum ofono_clir_option clir, +ofono_voicecall_cb_t cb,void *data);/* Answers an incoming call, this usually corresponds to ATA */ void (*answer)(struct ofono_voicecall *vc,ofono_voicecall_cb_t cb,void *data);src/voicecall.c +12
-3@@ -1605,7 +1605,7 @@ error: __ofono_error_failed(vc->pending)); } -static int voicecall_dial_last (struct ofono_voicecall *vc, +static int voicecall_dial_last (struct ofono_voicecall *vc,enum ofono_clir_option clir,ofono_voicecall_cb_t cb,void *data) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom);@@ -1629,7 +1629,7 @@ static int voicecall_dial_last(struct ofono_voicecall *vc,if (voicecalls_have_active (vc) &&voicecalls_have_held (vc))return -EBUSY ; - vc->driver->dial_last (vc, cb, vc); + vc->driver->dial_last (vc, clir, cb, vc);return 0 ; }@@ -1638,14 +1638,23 @@ static DBusMessage *manager_dial_last(DBusConnection *conn, DBusMessage *msg, void *data) {struct ofono_voicecall *vc = data; +const char *clirstr; +enum ofono_clir_option clir;int err;if (vc->pending || vc->dial_req || vc->pending_em)return __ofono_error_busy (msg); +if (dbus_message_get_args (msg,NULL ,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); - err =voicecall_dial_last (vc, manager_dial_last_callback, vc); + err =voicecall_dial_last (vc, clir, manager_dial_last_callback, vc);if (err >=0 )return NULL ;
src/voicecall.c static const GDBusMethodTable manager_methods[] = { · line 2239
Quoted 9 lines
src/voicecall.c +2
-1@@ -2223,7 +2232,8 @@ static const GDBusMethodTable manager_methods[] = { GDBUS_ARGS({ "number", "s" }, { "hide_callerid", "s" }), GDBUS_ARGS({ "path", "o" }), manager_dial) }, - { GDBUS_ASYNC_METHOD("DialLast", NULL, NULL, manager_dial_last)}, + {GDBUS_ASYNC_METHOD ("DialLast" , + GDBUS_ARGS({ "hide_callerid", "s" }), NULL, manager_dial_last)}, { GDBUS_ASYNC_METHOD("Transfer", NULL, NULL, manager_transfer) }, { GDBUS_ASYNC_METHOD("SwapCalls", NULL, NULL, manager_swap_calls) }, { GDBUS_ASYNC_METHOD("ReleaseAndAnswer", NULL, NULL,
Regards,
-Denis
Re: [PATCH 3/7] include/voicecall.h : Add support for dialing number at a given memory location
In reply to Philippe De SwertHi Philippe,
Quoted 11 lines · Philippe De Swert
Add a new function to be able to dial numbers from memory/favourites.
--- include/voicecall.h | 5 +++++ 1 file changed, 5 insertions(+)include/voicecall.h +0
-0
include/voicecall.h struct ofono_voicecall_driver { · line 66
Quoted 6 lines
include/voicecall.h +3
-0@@ -61,6 +61,11 @@ struct ofono_voicecall_driver {const struct ofono_phone_number *number, enum ofono_clir_option clir, ofono_voicecall_cb_t cb, void *data); +/* dials a number at a given memory location */ + void (*dial_memory)(struct ofono_voicecall *vc, + long int memory_location,
Why a long int? Memory indexes are always positive, no?
Do note that size of long will be different between 32 bit and 64 bit architectures.
I would think an unsigned int would be sufficient here
include/voicecall.h struct ofono_voicecall_driver { · line 71
Quoted 6 lines
include/voicecall.h +2
-0+ enum ofono_clir_option clir, ofono_voicecall_cb_t cb, + void *data);/* Dials the last number again, this handles the hfp profile last number * dialing with the +BLDN AT command */
Regards,
-Denis
Re: [PATCH 4/7] voicecall: Fix issue with invalid dbus path
In reply to Philippe De SwertHi Philippe,
Quoted 17 lines · Philippe De Swert
Fix an error message from dbus about the path supplied not being valid. Related to commit
f58e7685b0078df470300b99cd89fb9b3c45d1c0ofonod[19107]: src/voicecall.c:voicecall_dial_shortcut() check position
ofonod[19107]: src/voicecall.c:synthesize_outgoing_call() Registering new call: 1
process 19107: arguments todbus_message_iter_append_basic()were incorrect, assertion "_dbus_check_is_valid_path(*string_p)" failed in file../../../dbus/dbus-message.cline 2759. This is normally a bug in some application using the D-Bus library.--- src/voicecall.c | 2 ++ 1 file changed, 2 insertions(+)src/voicecall.c +0
-0
src/voicecall.c line 31
Quoted 4 lines
src/voicecall.c +1
-0@@ -28,6 +28,7 @@#include <time.h> #include <errno.h> #include <stdint.h> +#include <stdlib.h>
This seems unrelated. I dropped this chunk
src/voicecall.c static void manager_dial_shortcut_callback(const struct ofono_error *error, · line 1599
Quoted 12 lines
src/voicecall.c +1
-0#include <glib.h> #include <gdbus.h> @@ -1592,6 +1593,7 @@ static void manager_dial_shortcut_callback(const struct ofono_error *error,if (!v) goto error; + path =voicecall_build_path (vc, v->call); reply =dbus_message_new_method_return (vc->pending);dbus_message_append_args (reply,DBUS_TYPE_OBJECT_PATH , &path,DBUS_TYPE_INVALID );
and applied this one.
Regards,
-Denis
Re: [PATCH 5/7] voicecall.c : Add functionality to dial from a memory location.
In reply to Philippe De SwertHi Philippe,
Quoted 35 lines · Philippe De Swert
Now we can also dial favourites/quick contacts over bluetooth.
--- src/voicecall.c | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 65 insertions(+), 7 deletions(-)src/voicecall.c +3
-5@@ -1607,10 +1607,11 @@ error: __ofono_error_failed(vc->pending)); } -static int voicecall_dial_shortcut (struct ofono_voicecall *vc,enum ofono_clir_option clir, -ofono_voicecall_cb_t cb,void *data) +static int voicecall_dial_shortcut (struct ofono_voicecall *vc,const char *position, +enum ofono_clir_option clir,ofono_voicecall_cb_t cb,void *data) {struct ofono_modem *modem =__ofono_atom_get_modem (vc->atom); +long int memory_position;if (g_slist_length (vc->call_list) >=MAX_VOICE_CALLS )return -EPERM ;@@ -1618,9 +1619,6 @@ static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_oif (ofono_modem_get_online (modem) == FALSE)return -ENETDOWN ; -if (vc->driver->dial_last ==NULL ) -return -ENOTSUP ; -if (voicecalls_have_incoming (vc))return -EBUSY ;
src/voicecall.c static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_o · line 1633
Quoted 6 lines
src/voicecall.c +2
-1@@ -1631,7 +1629,19 @@ static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_oif (voicecalls_have_active (vc) &&voicecalls_have_held (vc))return -EBUSY ; - vc->driver->dial_last (vc, clir, cb, vc); +/* when position is not given we dial the last called number */ +if (position ==NULL ) {
not our coding style
src/voicecall.c static int voicecall_dial_shortcut(struct ofono_voicecall *vc, enum ofono_clir_o · line 1639
Quoted 6 lines
src/voicecall.c +6
-0+if (vc->driver->dial_last ==NULL ) +return -ENOTSUP ; + + vc->driver->dial_last (vc, clir, cb, vc); + }else { + memory_position =strtol (position,NULL ,10 );
You need to make sure that strtol succeeds, it might be better to perform this checking in manager_dial_memory
Quoted 69 lines
src/voicecall.c +50
-1+if (vc->driver->dial_memory ==NULL ) +return -ENOTSUP ; + + vc->driver->dial_memory (vc, memory_position, clir, cb, vc); + }return 0 ; }@@ -1656,7 +1666,7 @@ static DBusMessage *manager_dial_last(DBusConnection *conn, vc->pending =dbus_message_ref (msg); - err =voicecall_dial_shortcut (vc, clir, manager_dial_shortcut_callback, vc); + err =voicecall_dial_shortcut (vc,NULL , clir, manager_dial_shortcut_callback, vc);if (err >=0 )return NULL ;@@ -1678,6 +1688,50 @@ static DBusMessage *manager_dial_last(DBusConnection *conn,return __ofono_error_failed (msg); } +static DBusMessage *manager_dial_memory (DBusConnection *conn, +DBusMessage *msg,void *data) +{ +struct ofono_voicecall *vc = data; +const char *memory_location; +const char *clirstr; +enum ofono_clir_option clir; +int err; + +if (vc->pending || vc->dial_req || vc->pending_em) +return __ofono_error_busy (msg); + +if (dbus_message_get_args (msg,NULL ,DBUS_TYPE_STRING , &memory_location, +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); + + err =voicecall_dial_shortcut (vc, memory_location, clir, manager_dial_shortcut_callback, vc); + +if (err >=0 ) +return NULL ; + + vc->pending =NULL ; +dbus_message_unref (msg); + +switch (err) { +case -EINVAL : +return __ofono_error_invalid_format (msg); + +case -ENETDOWN : +return __ofono_error_not_available (msg); + +case -ENOTSUP : +return __ofono_error_not_implemented (msg); + } + +return __ofono_error_failed (msg); +} +static DBusMessage *manager_transfer (DBusConnection *conn,DBusMessage *msg,void *data) {
src/voicecall.c static const GDBusMethodTable manager_methods[] = { · line 2294
Quoted 5 lines
src/voicecall.c +2
-0@@ -2236,6 +2290,10 @@ static const GDBusMethodTable manager_methods[] = { manager_dial) }, {GDBUS_ASYNC_METHOD ("DialLast" , GDBUS_ARGS({ "hide_callerid", "s" }), NULL, manager_dial_last)}, + { GDBUS_ASYNC_METHOD("DialMemory", + GDBUS_ARGS({ "memory_location", "s" },{ "hide_callerid", "s" }),
Why would memory location be a string? Why not just make it an unsigned int32 and make it easy?
src/voicecall.c static const GDBusMethodTable manager_methods[] = { · line 2299
Quoted 6 lines
src/voicecall.c +2
-0+ NULL, + manager_dial_memory) }, { GDBUS_ASYNC_METHOD("Transfer", NULL, NULL, manager_transfer) }, { GDBUS_ASYNC_METHOD("SwapCalls", NULL, NULL, manager_swap_calls) }, { GDBUS_ASYNC_METHOD("ReleaseAndAnswer", NULL, NULL,
Regards,
-Denis
Re: [PATCH 1/7] voicecall: Support clir for last call dialing
In reply to Denis KenziorHello Denis,
Thank you for your review. You raised a number of good points for things I missed or did not think about.
Quoted 15 lines · Denis Kenzior
Hi Philippe,
Quoted 11 lines · Philippe De Swert
When dialing the last called number we also want to use the caller id (clir)
settings that are currently used.--- doc/voicecallmanager-api.txt | 2 +- drivers/hfpmodem/voicecall.c | 4 ++-- include/voicecall.h | 3 ++- src/voicecall.c | 18 ++++++++++++++---- 4 files changed, 19 insertions(+), 8 deletions(-)
Quoted 2 lines
This patch really needs to be broken up into 4. See HACKING, 'Submitting patches'.
Was not sure on how to handle this as four commits would have to be pushed together to avoid build breakage. But sure I can do this in 4 commits if it turns out this patch makes sense (see the CLIR related stuff later)
Quoted 13 lines
drivers/hfpmodem/voicecall.c static void hfp_dial(struct ofono_voicecall *vc, · line 412
Quoted 9 lines
-static void hfp_dial_last(struct
ofono_voicecall*vc,ofono_voicecall_cb_tcb,(quoted diff) +1
-1- void *data) +static void hfp_dial_last(struct ofono_voicecall *vc, enum
ofono_clir_optionclir,drivers/hfpmodem/voicecall.c +1
-0+ ofono_voicecall_cb_t cb, void *data) { struct voicecall_data *vd = ofono_voicecall_get_data(vc);struct cb_data *cbd =cb_data_new (cb, data);It doesn't look like you actually implementing the CLIR modifier in the driver? E.g. the 'I' or 'i' suffix business.
Quoted 2 lines
I think last time I played with this half the AG implementations didn't support the CLIR parameter anyway.
Actually indeed I completely missed adding the CLIR modifier. Turns out the current dial method also doesn't. This got me digging. The Bluetooth spec for the HFP profile is rather ambigious if it is supported or not. Although from this:
"As a convention, if a parameter of an AT command or result code is
not “covered” in this
specification, it shall not be present in the corresponding AT command, and the HF shall ignore the parameter whenever it is received in a result code." (page 83, section 4.33.2 in the HFP profile spec v1.7.1)
I gather it is not supported at all, however I wonder if it is useful to pass the parameter to possibly re-use this code elsewhere easier (similar to the dial function). Then again I have no idea if some of these things would be used in any other situations than with a Bluetooth/HFP AG. This then also impacts the other patch (where I need to fix the long int situation).
So what would be the best thing? Keep the parameter but not implement the CLIR for either of the options as it might/should not work? Or drop it and do without as we do not expect the methods to be used for anything else than HFP/Bluetooth?
Thanks,
Philippe
Re: [PATCH 1/7] voicecall: Support clir for last call dialing
Hi Philippe,
Quoted 7 lines
Quoted 2 lines
This patch really needs to be broken up into 4. See HACKING, 'Submitting patches'.
Was not sure on how to handle this as four commits would have to be pushed together to avoid build breakage. But sure I can do this in 4 commits if it turns out this patch makes sense (see the CLIR related stuff later)
Build breakage is minimized since I will take all the patches or not as a transaction, so the build should be clean on any given git pull. It does make git bisect a bit trickier, but we don't use it often.
Quoted 14 lines
Quoted 14 lines
drivers/hfpmodem/voicecall.c static void hfp_dial(struct ofono_voicecall *vc, · line 412
Quoted 10 lines
-static void hfp_dial_last(struct
ofono_voicecall*vc,ofono_voicecall_cb_tcb,(quoted diff) +1
-1- void *data) +static void hfp_dial_last(struct ofono_voicecall *vc, enum
ofono_clir_optionclir,drivers/hfpmodem/voicecall.c +1
-0+ ofono_voicecall_cb_t cb, void *data) { struct voicecall_data *vd = ofono_voicecall_get_data(vc);struct cb_data *cbd =cb_data_new (cb, data);It doesn't look like you actually implementing the CLIR modifier in the driver? E.g. the 'I' or 'i' suffix business.
Quoted 5 lines
Quoted 2 lines
I think last time I played with this half the AG implementations didn't support the CLIR parameter anyway.
Actually indeed I completely missed adding the CLIR modifier. Turns out the current dial method also doesn't. This got me digging. The
The Dial method was re-used for HFP from fully featured modems. So it is present at the D-Bus API level, but the HFP driver simply ignores it.
I'm not sure that any AG implementations honor the 'I/i' modifier.
Might be something to check first.
Quoted 10 lines
Bluetooth spec for the HFP profile is rather ambigious if it is supported or not. Although from this:
"As a convention, if a parameter of an AT command or result code is
not “covered” in this
specification, it shall not be present in the corresponding AT command, and the HF shall ignore the parameter whenever it is received in a result code." (page 83, section 4.33.2 in the HFP profile spec v1.7.1)
Quoted 6 lines
I gather it is not supported at all, however I wonder if it is useful to pass the parameter to possibly re-use this code elsewhere easier (similar to the dial function). Then again I have no idea if some of these things would be used in any other situations than with a Bluetooth/HFP AG. This then also impacts the other patch (where I need to fix the long int situation).
In the case of BLDN, you definitely won't have a CLIR modifier. Since +BLDN is an extension command defined in HFP specification only and the syntax doesn't cover any modifiers. In fact +BLDN takes no arguments if I recall correctly. I would expect that besides HFP, nothing else will be using the DialLast API.
Quoted 6 lines
So what would be the best thing? Keep the parameter but not implement the CLIR for either of the options as it might/should not work? Or drop it and do without as we do not expect the methods to be used for anything else than HFP/Bluetooth?
In theory memory dialing via ATD _could_ support CLIR invocation/suppression syntax. Again I would expect that memory dialing only really makes sense on HFP. With real hardware & a smartphone type UI, memory dialing is not needed.
So unless you really need this feature and at least one well known AG implementation (e.g. iOS or Android) actually supports this, I would not worry about adding support for the CLIR modifier.
Regards,
-Denis
Quoted 4 lines
Thanks,
Philippe