All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add Bluetooth HFP memory index dialing V3
@ 2018-02-12 18:37 philippedeswert
  2018-02-12 18:37 ` [PATCH 1/5] voicecall: Rename callbacks/functions related to dialing the last called number philippedeswert
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

Hi,

Finally got some time to redo the patches from last time after all the comments.
So I renamed the functions to reflect clearly what they are for and avoid functionality
duplication, used an unsigned int as suggested for the memory index, ditched callerid/CLIR
(as it is not supported for bluetooth/hfp) and avoided mixing in different files in one
patch as in the coding guidelines. 

Hopefully third time is the charm ;)

Philippe

Philippe De Swert (5):
  voicecall: Rename callbacks/functions related to dialing the last
    called number
  voicecall: Add support for dialing number at a given memory location
  voicecall: Add functionality to manager 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 | 11 ++++++++
 drivers/hfpmodem/voicecall.c | 25 ++++++++++++++++++
 include/voicecall.h          |  4 +++
 src/voicecall.c              | 62 +++++++++++++++++++++++++++++++++++++++-----
 4 files changed, 95 insertions(+), 7 deletions(-)

-- 
2.11.0


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [PATCH 1/5] voicecall: Rename callbacks/functions related to dialing the last called number
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
@ 2018-02-12 18:37 ` philippedeswert
  2018-02-12 18:37 ` [PATCH 2/5] voicecall: Add support for dialing number at a given memory location philippedeswert
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

Calling 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. Function names now also reflect this is for hfp.
---
 src/voicecall.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index 4c2f71f8..eae4b904 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -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_hfp_callback(const struct ofono_error *error,
 								void *data)
 {
 	struct ofono_voicecall *vc = data;
@@ -1606,7 +1606,7 @@ error:
 					__ofono_error_failed(vc->pending));
 }
 
-static int voicecall_dial_last(struct ofono_voicecall *vc,
+static int voicecall_dial_hfp(struct ofono_voicecall *vc,
 					ofono_voicecall_cb_t cb, void *data)
 {
 	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
@@ -1646,7 +1646,7 @@ static DBusMessage *manager_dial_last(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
-	err = voicecall_dial_last(vc, manager_dial_last_callback, vc);
+	err = voicecall_dial_hfp(vc, manager_dial_hfp_callback, vc);
 
 	if (err >= 0)
 		return NULL;
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/5] voicecall: Add support for dialing number at a given memory location
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
  2018-02-12 18:37 ` [PATCH 1/5] voicecall: Rename callbacks/functions related to dialing the last called number philippedeswert
@ 2018-02-12 18:37 ` philippedeswert
  2018-02-12 18:37 ` [PATCH 3/5] voicecall: Add functionality to manager to dial from a " philippedeswert
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

Add a new function to be able to dial numbers from memory/favourites.
---
 include/voicecall.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/include/voicecall.h b/include/voicecall.h
index 6871a6b5..5b3da6a6 100644
--- a/include/voicecall.h
+++ b/include/voicecall.h
@@ -61,6 +61,10 @@ 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,
+			unsigned int memory_location, 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
          */
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 3/5] voicecall: Add functionality to manager to dial from a memory location.
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
  2018-02-12 18:37 ` [PATCH 1/5] voicecall: Rename callbacks/functions related to dialing the last called number philippedeswert
  2018-02-12 18:37 ` [PATCH 2/5] voicecall: Add support for dialing number at a given memory location philippedeswert
@ 2018-02-12 18:37 ` philippedeswert
  2018-02-12 18:37 ` [PATCH 4/5] hfpmodem: Add memory dialling support philippedeswert
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

Implement functionality to allow to  dial favourites/quick contacts over
bluetooth.
---
 src/voicecall.c | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 54 insertions(+), 6 deletions(-)

diff --git a/src/voicecall.c b/src/voicecall.c
index eae4b904..d45b3aa2 100644
--- a/src/voicecall.c
+++ b/src/voicecall.c
@@ -1606,7 +1606,7 @@ error:
 					__ofono_error_failed(vc->pending));
 }
 
-static int voicecall_dial_hfp(struct ofono_voicecall *vc,
+static int voicecall_dial_hfp(struct ofono_voicecall *vc, unsigned int position,
 					ofono_voicecall_cb_t cb, void *data)
 {
 	struct ofono_modem *modem = __ofono_atom_get_modem(vc->atom);
@@ -1617,9 +1617,6 @@ static int voicecall_dial_hfp(struct ofono_voicecall *vc,
 	if (ofono_modem_get_online(modem) == FALSE)
 		return -ENETDOWN;
 
-	if (vc->driver->dial_last == NULL)
-		return -ENOTSUP;
-
 	if (voicecalls_have_incoming(vc))
 		return -EBUSY;
 
@@ -1630,7 +1627,18 @@ static int voicecall_dial_hfp(struct ofono_voicecall *vc,
 	if (voicecalls_have_active(vc) && voicecalls_have_held(vc))
 		return -EBUSY;
 
-	vc->driver->dial_last(vc, cb, vc);
+	/* when position is not given we dial the last called number */
+	if(position == 0) {
+		if (vc->driver->dial_last == NULL)
+			return -ENOTSUP;
+
+		vc->driver->dial_last(vc, cb, vc);
+	} else {
+		if(vc->driver->dial_memory == NULL )
+		return -ENOTSUP;
+
+		vc->driver->dial_memory(vc, position, cb, vc);
+       }
 
 	return 0;
 }
@@ -1646,7 +1654,7 @@ static DBusMessage *manager_dial_last(DBusConnection *conn,
 
 	vc->pending = dbus_message_ref(msg);
 
-	err = voicecall_dial_hfp(vc, manager_dial_hfp_callback, vc);
+	err = voicecall_dial_hfp(vc, 0, manager_dial_hfp_callback, vc);
 
 	if (err >= 0)
 		return NULL;
@@ -1668,6 +1676,44 @@ 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;
+       int memory_location;
+       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_UINT32, &memory_location,
+                                       DBUS_TYPE_INVALID) == FALSE)
+               return __ofono_error_invalid_args(msg);
+
+       vc->pending = dbus_message_ref(msg);
+
+       err = voicecall_dial_hfp(vc, memory_location, manager_dial_hfp_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)
 {
@@ -2225,6 +2271,8 @@ static const GDBusMethodTable manager_methods[] = {
 		GDBUS_ARGS({ "path", "o" }),
 		manager_dial) },
 	{ GDBUS_ASYNC_METHOD("DialLast", NULL, NULL, manager_dial_last)},
+	{ GDBUS_ASYNC_METHOD("DialMemory",
+		GDBUS_ARGS({"memory_location", "u" }), 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,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 4/5] hfpmodem: Add memory dialling support
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
                   ` (2 preceding siblings ...)
  2018-02-12 18:37 ` [PATCH 3/5] voicecall: Add functionality to manager to dial from a " philippedeswert
@ 2018-02-12 18:37 ` philippedeswert
  2018-02-12 18:37 ` [PATCH 5/5] doc: Document the new DialMemory method of the voicecallmanager-api philippedeswert
  2018-02-13 19:10 ` [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 Denis Kenzior
  5 siblings, 0 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

Handle the request to dial from a memory index and send the
correct ATD> sequence to make it happen.
---
 drivers/hfpmodem/voicecall.c | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)

diff --git a/drivers/hfpmodem/voicecall.c b/drivers/hfpmodem/voicecall.c
index 1e0489c2..1254f235 100644
--- a/drivers/hfpmodem/voicecall.c
+++ b/drivers/hfpmodem/voicecall.c
@@ -422,6 +422,30 @@ static void hfp_dial_last(struct ofono_voicecall *vc, ofono_voicecall_cb_t cb,
 	CALLBACK_WITH_FAILURE(cb, data);
 
 }
+
+static void hfp_dial_memory(struct ofono_voicecall *vc,
+			unsigned int memory_location, 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 %d\n", memory_location);
+	snprintf(buf, sizeof(buf), "ATD>%d", 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 +1311,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,
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 5/5] doc: Document the new DialMemory method of the voicecallmanager-api
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
                   ` (3 preceding siblings ...)
  2018-02-12 18:37 ` [PATCH 4/5] hfpmodem: Add memory dialling support philippedeswert
@ 2018-02-12 18:37 ` philippedeswert
  2018-02-13 19:10 ` [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 Denis Kenzior
  5 siblings, 0 replies; 8+ messages in thread
From: philippedeswert @ 2018-02-12 18:37 UTC (permalink / raw)
  To: ofono

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

From: Philippe De Swert <philippedeswert@gmail.com>

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

diff --git a/doc/voicecallmanager-api.txt b/doc/voicecallmanager-api.txt
index 7aeb81f7..5c4ce11b 100644
--- a/doc/voicecallmanager-api.txt
+++ b/doc/voicecallmanager-api.txt
@@ -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
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/5] Add Bluetooth HFP memory index dialing V3
  2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
                   ` (4 preceding siblings ...)
  2018-02-12 18:37 ` [PATCH 5/5] doc: Document the new DialMemory method of the voicecallmanager-api philippedeswert
@ 2018-02-13 19:10 ` Denis Kenzior
  2018-02-14  9:35   ` Philippe De Swert
  5 siblings, 1 reply; 8+ messages in thread
From: Denis Kenzior @ 2018-02-13 19:10 UTC (permalink / raw)
  To: ofono

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

Hi Philippe,

On 02/12/2018 12:37 PM, philippedeswert(a)gmail.com wrote:
> From: Philippe De Swert <philippedeswert@gmail.com>
> 
> Hi,
> 
> Finally got some time to redo the patches from last time after all the comments.
> So I renamed the functions to reflect clearly what they are for and avoid functionality
> duplication, used an unsigned int as suggested for the memory index, ditched callerid/CLIR
> (as it is not supported for bluetooth/hfp) and avoided mixing in different files in one
> patch as in the coding guidelines.
> 
> Hopefully third time is the charm ;)
> 
> Philippe
> 
> Philippe De Swert (5):
>    voicecall: Rename callbacks/functions related to dialing the last
>      called number
>    voicecall: Add support for dialing number at a given memory location
>    voicecall: Add functionality to manager 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 | 11 ++++++++
>   drivers/hfpmodem/voicecall.c | 25 ++++++++++++++++++
>   include/voicecall.h          |  4 +++
>   src/voicecall.c              | 62 +++++++++++++++++++++++++++++++++++++++-----
>   4 files changed, 95 insertions(+), 7 deletions(-)
> 

I went ahead and applied the entire series.  I did fix up a few minor 
style & whitespace issues.

Thanks!

Regards,
-Denis

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 0/5] Add Bluetooth HFP memory index dialing V3
  2018-02-13 19:10 ` [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 Denis Kenzior
@ 2018-02-14  9:35   ` Philippe De Swert
  0 siblings, 0 replies; 8+ messages in thread
From: Philippe De Swert @ 2018-02-14  9:35 UTC (permalink / raw)
  To: ofono

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

Hi Denis,

On 13/02/2018, Denis Kenzior <denkenz@gmail.com> wrote:
> I went ahead and applied the entire series.  I did fix up a few minor
> style & whitespace issues.

And the unneeded strcat I forgot to remove ;)

Thanks!

Philippe

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2018-02-14  9:35 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-02-12 18:37 [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 philippedeswert
2018-02-12 18:37 ` [PATCH 1/5] voicecall: Rename callbacks/functions related to dialing the last called number philippedeswert
2018-02-12 18:37 ` [PATCH 2/5] voicecall: Add support for dialing number at a given memory location philippedeswert
2018-02-12 18:37 ` [PATCH 3/5] voicecall: Add functionality to manager to dial from a " philippedeswert
2018-02-12 18:37 ` [PATCH 4/5] hfpmodem: Add memory dialling support philippedeswert
2018-02-12 18:37 ` [PATCH 5/5] doc: Document the new DialMemory method of the voicecallmanager-api philippedeswert
2018-02-13 19:10 ` [PATCH 0/5] Add Bluetooth HFP memory index dialing V3 Denis Kenzior
2018-02-14  9:35   ` Philippe De Swert

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.