Skip to contentSkip to conversation

Add org.bluez.Telephony interface

RFC In review Frédéric Danis 6 participants 11 messages Nov 22, 2011 – Nov 24, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover Add org.bluez.Telephony interface

Hello,

I am working on this set of patches.

Replace telephony drivers for HeadSet/HandsFree Profiles by a new DBus interface (org.bluez.Telephony).
External applications, which should implement AT parsing and telephony part of HeadSet or HandsFree Profiles, will have to register a telephony agent using this new interface.

First patch add the new org.bluez.Telephony interface and remove functions related to AT parsing from audio/headset.c.

Second patch remove the telephony drivers (dummy, maemo5, maemo6 and ofono), functions used by telephony drivers and no more needed methods of org.bluez.Headset interface.

What I would like to do to continue is:
- move rfcomm servers from audio/manager.c to audio/telephony.c, so servers are started only when a telephony agent is registered. This should also replace audio/gateway.c.
- pass MediaTransport object in NewConnection method so telephony agent will be able to set NREC and ringtone, which can in turn notify Pulse Audio of property changed.

Any comments appreciated

Regards

Fred

Frédéric Danis (2):
audio: Move tel drivers to DBus interface
audio: Remove tel drivers

 Makefile.am              |   17 +-
 audio/headset.c          | 1517 +-------------------------------
 audio/headset.h          |    7 +-
 audio/manager.c          |    4 +-
 audio/telephony-dummy.c  |  433 ---------
 audio/telephony-maemo5.c | 2104 --------------------------------------------
 audio/telephony-maemo6.c | 2201 ----------------------------------------------
 audio/telephony-ofono.c  | 1638 ----------------------------------
 audio/telephony.c        |  494 +++++++++++
 audio/telephony.h        |  196 +----
 audio/transport.c        |   10 +
 audio/unix.c             |    2 +
 doc/audio-api.txt        |   99 +++
 13 files changed, 631 insertions(+), 8091 deletions(-)
 delete mode 100644 audio/telephony-dummy.c
 delete mode 100644 audio/telephony-maemo5.c
 delete mode 100644 audio/telephony-maemo6.c
 delete mode 100644 audio/telephony-ofono.c
 create mode 100644 audio/telephony.c
#1 lore raw

RFC 1/2 audio: Move tel drivers to DBus interface

---
 Makefile.am       |   13 +-
 audio/headset.c   |  614 ++---------------------------------------------------
 audio/headset.h   |    2 +
 audio/manager.c   |    4 +-
 audio/telephony.c |  494 ++++++++++++++++++++++++++++++++++++++++++
 audio/telephony.h |   25 +--
 doc/audio-api.txt |   99 +++++++++
 7 files changed, 620 insertions(+), 631 deletions(-)
 create mode 100644 audio/telephony.c
Makefile.am +2 -11
index 07b8626..31c1083 100644
@@ -154,14 +154,8 @@ builtin_sources += audio/main.c \
 			audio/unix.h audio/unix.c \
 			audio/media.h audio/media.c \
 			audio/transport.h audio/transport.c \
-			audio/telephony.h audio/a2dp-codecs.h
-builtin_nodist += audio/telephony.c
-
-noinst_LIBRARIES += audio/libtelephony.a
-
-audio_libtelephony_a_SOURCES = audio/telephony.h audio/telephony-dummy.c \
-				audio/telephony-maemo5.c audio/telephony-ofono.c \
-				audio/telephony-maemo6.c
+			audio/telephony.h audio/telephony.c \
+			audio/a2dp-codecs.h
 endif
 
 if SAPPLUGIN
@@ -476,9 +470,6 @@ MAINTAINERCLEANFILES = Makefile.in \
 src/builtin.h: src/genbuiltin $(builtin_sources)
 	$(AM_V_GEN)$(srcdir)/src/genbuiltin $(builtin_modules) > $@
 
-audio/telephony.c: audio/@TELEPHONY_DRIVER@
-	$(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@
-
 sap/sap.c: sap/@SAP_DRIVER@
 	$(AM_V_GEN)$(LN_S) $(abs_top_srcdir)/$< $@
 
audio/headset.c +15 -599

771 lines not on this page · raw message

audio/headset.h +2 -0
index 99eeca8..d43952f 100644
@@ -111,3 +111,5 @@ gboolean headset_unlock(struct audio_device *dev, headset_lock_t lock);
 gboolean headset_suspend(struct audio_device *dev, void *data);
 gboolean headset_play(struct audio_device *dev, void *data);
 void headset_shutdown(struct audio_device *dev);
+
+void headset_slc_complete(struct audio_device *dev);
audio/manager.c +2 -2
index 8de5515..4624552 100644
@@ -880,7 +880,7 @@ static void state_changed(struct btd_adapter *adapter, gboolean powered)
 		/* telephony driver already initialized*/
 		if (telephony == TRUE)
 			return;
-		telephony_init();
+		telephony_init(adapter);
 		telephony = TRUE;
 		return;
 	}
@@ -896,7 +896,7 @@ static void state_changed(struct btd_adapter *adapter, gboolean powered)
 			return;
 	}
 
-	telephony_exit();
+	telephony_exit(adapter);
 	telephony = FALSE;
 }
 
audio/telephony.c new file +494 -0

494 lines not on this page · raw message

audio/telephony.h +6 -19
index 73b390c..7d1d337 100644
@@ -144,26 +144,13 @@ struct indicator {
 /* Notify telephony-*.c of connected/disconnected devices. Implemented by
  * telephony-*.c
  */
+void *telephony_device_connecting(GIOChannel *io, void *telephony_device);
 void telephony_device_connected(void *telephony_device);
+void telephony_device_disconnect(void *slc);
 void telephony_device_disconnected(void *telephony_device);
 
-/* HF requests (sent by the handsfree device). These are implemented by
- * telephony-*.c
- */
-void telephony_event_reporting_req(void *telephony_device, int ind);
-void telephony_response_and_hold_req(void *telephony_device, int rh);
-void telephony_last_dialed_number_req(void *telephony_device);
-void telephony_terminate_call_req(void *telephony_device);
-void telephony_answer_call_req(void *telephony_device);
-void telephony_dial_number_req(void *telephony_device, const char *number);
-void telephony_transmit_dtmf_req(void *telephony_device, char tone);
-void telephony_subscriber_number_req(void *telephony_device);
-void telephony_list_current_calls_req(void *telephony_device);
-void telephony_operator_selection_req(void *telephony_device);
-void telephony_call_hold_req(void *telephony_device, const char *cmd);
-void telephony_nr_and_ec_req(void *telephony_device, gboolean enable);
-void telephony_voice_dial_req(void *telephony_device, gboolean enable);
-void telephony_key_press_req(void *telephony_device, const char *keys);
+gboolean telephony_get_ready_state(void);
+uint32_t telephony_get_ag_features(void);
 
 /* AG responses to HF requests. These are implemented by headset.c */
 int telephony_event_reporting_rsp(void *telephony_device, cme_error_t err);
@@ -240,5 +227,5 @@ static inline int telephony_get_indicator(const struct indicator *indicators,
 	return -ENOENT;
 }
 
-int telephony_init(void);
-void telephony_exit(void);
+int telephony_init(void *adapter);
+void telephony_exit(void *adapter);
doc/audio-api.txt +99 -0

102 lines not on this page · raw message

Signature · 1 line
1.7.1
#2 lore raw

Re: [RFC 1/2] audio: Move tel drivers to DBus interface

Hi Frédéric,

Quoted 21 lines · Frédéric Danis
doc/audio-api.txt +21 -0
+Telephony hierarchy [experiemental]
+===================
+
+Service		org.bluez
+Interface	org.bluez.Telephony
+Object path	[variable prefix]/{hci0,hci1,...}
+
+Methods		void RegisterAgent(object path, dict properties)
+
+			Register a TelephonyAgent to sender, the sender can
+			register as many agents as it likes.
+
+			Note: If the sender disconnects its agents are
+			automatically unregistered.
+
+			possible properties:
+
+				string UUID:
+
+					UUID of the profile which the agent is
+					for.

doc/audio-api.txt properties boolean Connected [readonly] · line 491

Quoted 10 lines
doc/audio-api.txt +10 -0
+
+				uint16 Version:
+
+					Version of the profile which the agent
+					implements.
+
+				byte Features:
+
+					Agent supported features as defined in
+					profile spec e.g. HFP.

The HFP spec uses a 16-bit integer for Features in SDP so I believe we should too.

Quoted 6 lines
doc/audio-api.txt +6 -0
+
+			Possible Errors: org.bluez.Error.InvalidArguments
+
+
+		void UnregisterAgent(object path)
+

doc/audio-api.txt properties boolean Connected [readonly] · line 507

Quoted 10 lines
doc/audio-api.txt +10 -0
+			Unregister sender agent.
+
+TelephonyAgent hierarchy
+========================
+
+Service		unique name
+Interface	org.bluez.TelephonyAgent
+Object path	freely definable
+
+ethods		void NewConnection(filedescriptor fd, dict properties)

M missing :)

Quoted 23 lines
doc/audio-api.txt +23 -0
+
+			This method gets called whenever a new connection
+			has been established. This method assumes that DBus
+			daemon with file descriptor passing capability is
+			being used.
+
+			The agent should only return successfully once the
+			establishment of the service level connection (SLC)
+			has been completed.  In the case of Handsfree this
+			means that BRSF exchange has been performed and
+			necessary initialization has been done.
+
+			If Endpoint is set the agent is responsible to
+			create an object implementing org.bluez.MediaTransport
+			and notify the Endpoint using org.bluez.MediaEndpoint.
+
+			possible properties:
+
+				strict Device:
+
+					BlueZ remote device object.
+
+				string UUID:

doc/audio-api.txt properties boolean Connected [readonly] · line 540

Quoted 10 lines
doc/audio-api.txt +10 -0
+
+					Profile UUID of the connection.
+
+				uint16 Version:
+
+					Remote profile version.
+
+				byte Features:
+
+					Remote profile features.

Same thing here about the Features integer size.

Johan

#3 lore raw
In reply to Frédéric Danis

Hi Frédéric,

Quoted 11 lines · Frédéric Danis

Hello,

I am working on this set of patches.

Replace telephony drivers for HeadSet/HandsFree Profiles by a new DBus interface (org.bluez.Telephony).
External applications, which should implement AT parsing and telephony part of HeadSet or HandsFree Profiles, will have to register a telephony agent using this new interface.

Quoted 4 lines

First patch add the new org.bluez.Telephony interface and remove functions related to AT parsing from audio/headset.c.

Second patch remove the telephony drivers (dummy, maemo5, maemo6

is this really needed?

Best regards
Andrei Emeltchenko

Quoted 47 lines

and ofono), functions used by telephony drivers and no more needed methods of org.bluez.Headset interface.

What I would like to do to continue is:
- move rfcomm servers from audio/manager.c to audio/telephony.c, so servers are started only when a telephony agent is registered. This should also replace audio/gateway.c.
- pass MediaTransport object in NewConnection method so telephony agent will be able to set NREC and ringtone, which can in turn notify Pulse Audio of property changed.

Any comments appreciated

Regards

Fred

Frédéric Danis (2):
audio: Move tel drivers to DBus interface
audio: Remove tel drivers

 Makefile.am              |   17 +-
 audio/headset.c          | 1517 +-------------------------------
 audio/headset.h          |    7 +-
 audio/manager.c          |    4 +-
 audio/telephony-dummy.c  |  433 ---------
 audio/telephony-maemo5.c | 2104 --------------------------------------------
 audio/telephony-maemo6.c | 2201 ----------------------------------------------
 audio/telephony-ofono.c  | 1638 ----------------------------------
 audio/telephony.c        |  494 +++++++++++
 audio/telephony.h        |  196 +----
 audio/transport.c        |   10 +
 audio/unix.c             |    2 +
 doc/audio-api.txt        |   99 +++
 13 files changed, 631 insertions(+), 8091 deletions(-)
 delete mode 100644 audio/telephony-dummy.c
 delete mode 100644 audio/telephony-maemo5.c
 delete mode 100644 audio/telephony-maemo6.c
 delete mode 100644 audio/telephony-ofono.c
 create mode 100644 audio/telephony.c

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

#4 lore raw

Hello Andrei,

Quoted 10 lines · Andrei Emeltchenko
Quoted 4 lines

First patch add the new org.bluez.Telephony interface and remove functions related to AT parsing from audio/headset.c.

Second patch remove the telephony drivers (dummy, maemo5, maemo6

is this really needed?

Best regards
Andrei Emeltchenko

During latest BlueZ conf, it has been decided that telephony drivers should be replaced by the telephony D-Bus interface for BlueZ 5.

Regards

Fred

Signature · 2 lines
Frederic Danis                            Open Source Technology Centre
[email protected]                              Intel Corporation
#5 lore raw

Hi Frederic,

Quoted 9 lines · Frederic Danis

Hello Andrei,

Quoted 6 lines · Andrei Emeltchenko
Quoted 5 lines

First patch add the new org.bluez.Telephony interface and remove functions related to AT parsing from audio/headset.c.

Second patch remove the telephony drivers (dummy, maemo5, maemo6

Quoted 8 lines
Quoted 5 lines

is this really needed?

Best regards
Andrei Emeltchenko

During latest BlueZ conf, it has been decided that telephony drivers should be replaced by the telephony D-Bus interface for BlueZ 5.

We will need also platform specific services/plugins to implement BLE GATT profiles. Phone Alert Status and Alert Notification need to get/set to platform specific information, such as incoming call, mute once, alert level, ...

BT SIG designed BR/EDR and BLE GATT profiles avoiding(trying) features "overlap". However, from the development point of view the low layer will be shared by both. So, please keep the code flexible enough to be used by more than one profile.

BR,
Claudio.

#6 lore raw

Hello Claudio,

Quoted 27 lines · Claudio Takahasi

Hi Frederic,

Quoted 9 lines · Frederic Danis

Hello Andrei,

Quoted 6 lines · Andrei Emeltchenko
Quoted 5 lines

First patch add the new org.bluez.Telephony interface and remove functions related to AT parsing from audio/headset.c.

Second patch remove the telephony drivers (dummy, maemo5, maemo6

Quoted 8 lines
Quoted 5 lines

is this really needed?

Best regards
Andrei Emeltchenko

During latest BlueZ conf, it has been decided that telephony drivers should be replaced by the telephony D-Bus interface for BlueZ 5.

We will need also platform specific services/plugins to implement BLE GATT profiles. Phone Alert Status and Alert Notification need to get/set to platform specific information, such as incoming call, mute once, alert level, ...

Quoted 4 lines

BT SIG designed BR/EDR and BLE GATT profiles avoiding(trying) features "overlap". However, from the development point of view the low layer will be shared by both. So, please keep the code flexible enough to be used by more than one profile.

The new telephony D-Bus interface is just in charge of performing SDP publication and RFComm connection. All Telephony related code is managed by the agent (i.e. oFono).

I take a look to the Phone Alert Status and Alert Notification and I thought that this should be implemented in the agent, or in a BlueZ service accessible by the agent through D-Bus.

Regards

Fred

Signature · 2 lines
Frederic Danis                            Open Source Technology Centre
[email protected]                              Intel Corporation
#7 lore raw

Hi Frederic,

Quoted 3 lines · Frederic Danis

The new telephony D-Bus interface is just in charge of performing SDP publication and RFComm connection. All Telephony related code is managed by the agent (i.e. oFono).

How t

Quoted 3 lines

I take a look to the Phone Alert Status and Alert Notification and I thought that this should be implemented in the agent, or in a BlueZ service accessible by the agent through D-Bus.

I'm wondering what exactly has been discussed/decided on the BlueZ summit.

Are we supposed to move everything "platform specific" to agents and remove all drivers from BlueZ? Are we okay with have BlueZ depending on multiple agents?

Besides that, I think your proposed Telephony API is too tied to HFP/HSP. I think it is interesting to have a more generic API so that other telephony related profiles (e.g. LE ones) could reuse it without requiring their own agent based API.

Regards,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
#8 lore raw

Hello Lizardo,

Quoted 14 lines · Anderson Lizardo

Hi Frederic,

Quoted 3 lines · Frederic Danis

The new telephony D-Bus interface is just in charge of performing SDP publication and RFComm connection. All Telephony related code is managed by the agent (i.e. oFono).

How t

Quoted 3 lines

I take a look to the Phone Alert Status and Alert Notification and I thought that this should be implemented in the agent, or in a BlueZ service accessible by the agent through D-Bus.

Quoted 6 lines

I'm wondering what exactly has been discussed/decided on the BlueZ summit.

Are we supposed to move everything "platform specific" to agents and remove all drivers from BlueZ? Are we okay with have BlueZ depending on multiple agents?

Yes, this is what I understand for BlueZ 5.

Quoted 6 lines

Besides that, I think your proposed Telephony API is too tied to HFP/HSP. I think it is interesting to have a more generic API so that other telephony related profiles (e.g. LE ones) could reuse it without requiring their own agent based API.

Regards,

With this new D-Bus telephony drivers there will be no more need of telephony related code into BlueZ, which will move to platform telephony daemon.

My understanding for those LE profiles are, as they are related to telephony, that they should listen for D-Bus signals (simple way, read only) or should be implemented into telephony daemon.

Regards

Fred

Signature · 2 lines
Frederic Danis                            Open Source Technology Centre
[email protected]                              Intel Corporation
#9 lore raw

Hi Frederic,

Quoted 5 lines · Frederic Danis
Quoted 5 lines

Besides that, I think your proposed Telephony API is too tied to HFP/HSP. I think it is interesting to have a more generic API so that other telephony related profiles (e.g. LE ones) could reuse it without requiring their own agent based API.

Quoted 8 lines
Quoted 1 line

Regards,

With this new D-Bus telephony drivers there will be no more need of telephony related code into BlueZ, which will move to platform telephony daemon.

My understanding for those LE profiles are, as they are related to telephony, that they should listen for D-Bus signals (simple way, read only)

Phone Alert Status has a method to silent the ringer during a incoming call. It also allows to change to/from "silent" profile. Alert notification allows to enable/disable notifications of incoming calls/SMS.

All of this is platform specific, therefore if we are going this route for BlueZ 5, we need a more complete telephony interface that allows to implement platform specific telephony bits outside BlueZ.

Quoted 1 line

or should be implemented into telephony daemon.

Maybe myself or Claudio are not clear, but I think the "org.bluez.Telephony" interface name were supposed to mean a generic telephony interface for BlueZ (so any Telephony related component could use), but for me looks like it is just a HFP/HSP "proxy" interface.

In other words, if we wanted to move the Phone Alert Status or Alert Notification to e.g. ofono, your interface (as is) would be not suitable to connect to a LE socket.

Best Regards,

Signature · 3 lines
Anderson Lizardo
Instituto Nokia de Tecnologia - INdT
Manaus - Brazil
#10 lore raw

Hi Anderson,

Quoted 10 lines

Phone Alert Status has a method to silent the ringer during a incoming call. It also allows to change to/from "silent" profile. Alert notification allows to enable/disable notifications of incoming calls/SMS.

All of this is platform specific, therefore if we are going this route for BlueZ 5, we need a more complete telephony interface that allows to implement platform specific telephony bits outside BlueZ.

These are indeed highly platform specific, moreover, they are UI/UX specific.

Quoted 11 lines
Quoted 1 line

or should be implemented into telephony daemon.

Maybe myself or Claudio are not clear, but I think the "org.bluez.Telephony" interface name were supposed to mean a generic telephony interface for BlueZ (so any Telephony related component could use), but for me looks like it is just a HFP/HSP "proxy" interface.

In other words, if we wanted to move the Phone Alert Status or Alert Notification to e.g. ofono, your interface (as is) would be not suitable to connect to a LE socket.

It sounds like moving these to oFono is not a good idea in the first place, since oFono is not responsible for the UI, ringtone generation, etc.

The question is whether you want to reserve .Telephony interface for some LE specific bits (in which case we can use something like VoiceTelephony or HandsfreeTelephony for the current proposal) or try not expose the LE bits over D-Bus at all (e.g. using bluez plugins.)

Regards,
-Denis