hfp: set timeout to service level connection procedure
PATCH 1/1 hfp: set timeout to service level connection procedure
If it expires we call org.bluez.HandsfreeGateway.Disconnect()
--- plugins/hfp.c | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-)
plugins/hfp.c +20 -0
@@ -785,11 +785,31 @@ static int hfp_connect_ofono_handsfree(struct ofono_modem *modem) NULL, NULL, DBUS_TYPE_INVALID); } +static gboolean hfp_enable_timeout (gpointer user_data) +{ +struct ofono_modem *modem = user_data; +struct hfp_data *data =ofono_modem_get_data (modem); +int ret; + +if (ofono_modem_get_powered (modem)) +return FALSE; + + ret =send_method_call (BLUEZ_SERVICE , data->handsfree_path, +BLUEZ_GATEWAY_INTERFACE ,"Disconnect" , +NULL ,NULL ,DBUS_TYPE_INVALID ); +if (ret <0 ) +ofono_error ("Disconnect failed(%d)" , ret); + +return FALSE; +} +/* power up hardware */ static int hfp_enable (struct ofono_modem *modem) {DBG ("%p" , modem); +g_timeout_add_seconds (15 , hfp_enable_timeout, modem); +if (hfp_connect_ofono_handsfree (modem) <0 )return -EINVAL ;
Signature · 1 line
1.6.4.4