From 53f6222d2ca009c86f301a630e4bf81d25c86feb Mon Sep 17 00:00:00 2001 From: Matt Porter Date: Fri, 19 May 2017 12:56:35 -0400 Subject: Refactor telephony binding voicecall object management Refactor the voicecall object lifecycle management in the telephony binding using g_object-derived handles. Instead of passing around and managing raw strings as a handle to a voicecall, we use the voicecall object itself returned from the new dbus proxy init. This simplifies memory management of these objects that are created and freed each time as calls are dialed/answered and terminated. It then simplifies the forthcoming call answering support. AGL-Bug: SPEC-600 Change-Id: I89efed1eb7927f4ffe2d1eaed295e0aa914efdcc Signed-off-by: Matt Porter --- telephony-binding/gdbus/ofono_voicecall.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) (limited to 'telephony-binding/gdbus/ofono_voicecall.c') diff --git a/telephony-binding/gdbus/ofono_voicecall.c b/telephony-binding/gdbus/ofono_voicecall.c index 44b6cec..b602c89 100644 --- a/telephony-binding/gdbus/ofono_voicecall.c +++ b/telephony-binding/gdbus/ofono_voicecall.c @@ -16,13 +16,21 @@ #include "ofono_voicecall_interface.h" -void ofono_hangup(const gchar *op) +OrgOfonoVoiceCall *ofono_voicecall_new(gchar *op) { - GError *error = NULL; + return org_ofono_voice_call_proxy_new_for_bus_sync( + G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, + "org.ofono", op, NULL, NULL); +} - OrgOfonoVoiceCall *voice_call = org_ofono_voice_call_proxy_new_for_bus_sync( - G_BUS_TYPE_SYSTEM, G_DBUS_PROXY_FLAGS_NONE, - "org.ofono", op, NULL, NULL); +void ofono_voicecall_free(OrgOfonoVoiceCall *voice_call) +{ + g_object_unref(G_OBJECT(voice_call)); +} + +void ofono_voicecall_hangup(OrgOfonoVoiceCall *voice_call) +{ + GError *error = NULL; org_ofono_voice_call_call_hangup_sync(voice_call, NULL, &error); } -- cgit 1.2.3-korg