add support for HFP plugin for oFono(ofono.org)
PATCH 1/1 add support for HFP plugin for oFono(ofono.org)
Compared with last version, the file name is changed from telephony-oFono.c to telephony-ofono.c.
Thanks,
Forrest
--- audio/Makefile.am | 3 +- audio/telephony-ofono.c | 1140 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 1142 insertions(+), 1 deletions(-) create mode 100644 audio/telephony-ofono.c
audio/Makefile.am +2 -1
@@ -77,7 +77,8 @@ CLEANFILES = $(BUILT_SOURCES) INCLUDES = -I$(top_srcdir)/common -I$(top_srcdir)/src -EXTRA_DIST = audio.conf telephony-dummy.c telephony-maemo.c bluetooth.conf +EXTRA_DIST = audio.conf telephony-dummy.c telephony-maemo.c telephony-ofono.c \ + bluetooth.conf MAINTAINERCLEANFILES = Makefile.in
audio/telephony-ofono.c new file +1140 -0
1,140 lines not on this page · raw message
Signature · 1 line
1.5.4.5
Hi Forrest,
In general the patch looks ok'ish (which it should since it seems to be largely based on the maemo driver), though I do have a couple of comments:
audio/telephony-ofono.c line 181
Quoted 4 lines · Forrest Zhao
audio/telephony-ofono.c new file +4
-0+static int send_method_call (const char *dest,const char *path, +const char *interface,const char *method, +DBusPendingCallNotifyFunction cb, +void *user_data,int type, ...);
I don't think there should be any need for this forward declaration. Just move the function higher up in the file.
Quoted 32 lines
audio/telephony-ofono.c new file +32
-0+static void answer_reply (DBusPendingCall *call,void *user_data) +{ +DBusMessage *reply; +DBusError err; + + reply =dbus_pending_call_steal_reply (call); +dbus_error_init (&err); +if (dbus_set_error_from_message (&err, reply)) { +error ("oFono answer incoming call failed: %s, %s" , + err.name, err.message); +dbus_error_free (&err); + goto done; + } + +done: +dbus_message_unref (reply); +} + +void telephony_answer_call_req (void *telephony_device) +{ +struct voice_call *vc =find_vc_with_status (CALL_STATUS_INCOMING ); +int ret; + +if (!vc) { +telephony_answer_call_rsp (telephony_device, +CME_ERROR_NOT_ALLOWED ); +return ; + } + + ret = send_method_call(OFONO_BUS_NAME, vc->obj_path, + OFONO_VC_INTERFACE, + "Answer", answer_reply,
audio/telephony-ofono.c line 260
Quoted 10 lines
audio/telephony-ofono.c new file +10
-0+ NULL, DBUS_TYPE_INVALID); + +if (ret <0 ) { +telephony_answer_call_rsp (telephony_device, +CME_ERROR_AG_FAILURE ); +return ; + } + +telephony_answer_call_rsp (telephony_device,CME_ERROR_NONE ); +}
If you're actually going to handle the D-Bus reply to the Answer method call (which the maemo driver doesn't do -- it relies on the state signals instead), doesn't it make sense to call telephony_answer_call_rsp in the reply handler (answer_reply) instead of here?
Johan
Quoted 9 lines · Forrest Zhao
Quoted 4 lines
+static int send_method_call(const char *dest, const char *path,
+ const char *interface, const char *method,
+ DBusPendingCallNotifyFunction cb,
+ void*user_data, int type, ...);I don't think there should be any need for this forward declaration. Just move the function higher up in the file.
OK.
Quoted 39 lines
Quoted 39 lines
audio/telephony-ofono.c new file +39
-0+static void answer_reply (DBusPendingCall *call,void *user_data) +{ + DBusMessage *reply; + DBusError err; + + reply = dbus_pending_call_steal_reply(call); + dbus_error_init(&err); + if (dbus_set_error_from_message(&err, reply)) { + error("oFono answer incoming call failed: %s, %s", + err.name, err.message); + dbus_error_free(&err); + goto done; + } + +done: + dbus_message_unref(reply); +} + +void telephony_answer_call_req (void *telephony_device) +{ + struct voice_call *vc = find_vc_with_status(CALL_STATUS_INCOMING); + int ret; + + if (!vc) { + telephony_answer_call_rsp(telephony_device, + CME_ERROR_NOT_ALLOWED); + return; + } + + ret = send_method_call(OFONO_BUS_NAME, vc->obj_path, + OFONO_VC_INTERFACE, + "Answer", answer_reply, + NULL, DBUS_TYPE_INVALID); + + if (ret < 0) { + telephony_answer_call_rsp(telephony_device, + CME_ERROR_AG_FAILURE); + return; + }
Quoted 8 lines
audio/telephony-ofono.c line 217
Quoted 3 lines
audio/telephony-ofono.c new file +3
-0+ + telephony_answer_call_rsp(telephony_device, CME_ERROR_NONE); +}If you're actually going to handle the D-Bus reply to the Answer method call (which the maemo driver doesn't do -- it relies on the state signals instead), doesn't it make sense to call
telephony_answer_call_rspin the reply handler (answer_reply) instead of here?
After reviewing the patch I think I should remove answer_reply() because it also depends on the state signals to know if "answer" actually succeed.
Thanks,
Forrest