Fix the bug in HFP API
authorDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 2 May 2013 00:34:02 +0000 (09:34 +0900)
committerDoHyun Pyun <dh79.pyun@samsung.com>
Thu, 9 May 2013 00:15:33 +0000 (09:15 +0900)
If we call bluetooth_telephony_audio_open API in next step 6,
the API call fails.

bluetooth-audio.c: bt_ag_open_sco(259) > ALREADY_DONE(0xffff8103)

1. bt_audio_initialize();
2. bt_ag_open_sco();
3. bt_ag_close_sco();
4. bt_audio_deinitialize();
5. bt_audio_initialize();
6. bt_ag_open_sco();

The cause was the headset state was not initailized.
(Because telephony library could not get the event
 - bt_audio_deinitailize also remove the event handler)

Change-Id: Ia724205e394dda8ee956805e951fb40385e623d2

bt-api/bt-telephony.c

index c20a8ed..da421e4 100644 (file)
@@ -1171,6 +1171,7 @@ BT_EXPORT_API int bluetooth_telephony_init(bt_telephony_func_ptr cb,
        /*Callback and user applicaton data*/
        telephony_info.cb = cb;
        telephony_info.user_data = user_data;
+       telephony_info.headset_state = BLUETOOTH_STATE_DISCONNETED;
 
        dbus_error_init(&dbus_error);
        conn = dbus_g_connection_get_connection(telephony_dbus_info.conn);
@@ -1242,6 +1243,7 @@ BT_EXPORT_API int bluetooth_telephony_deinit(void)
        telephony_info.cb = NULL;
        telephony_info.user_data = NULL;
        telephony_info.call_count = 0;
+       telephony_info.headset_state = BLUETOOTH_STATE_DISCONNETED;
 
        /*Remove BT enabled signal*/
        dbus_g_proxy_disconnect_signal(