Hi Johan:

On Mon, Mar 11, 2013 at 11:55 AM, Johan Hedberg <[email protected]> wrote:
> Hi Claudio,
>
> On Fri, Mar 08, 2013, Claudio Takahasi wrote:
>> This patch adds the call of NewConnection method when the SCO connection
>> is established for HF initiated scenarios.
>> ---
>>  src/handsfree-audio.c | 7 +++++++
>>  1 file changed, 7 insertions(+)
>>
>> diff --git a/src/handsfree-audio.c b/src/handsfree-audio.c
>> index f5d0a7b..6fa8b67 100644
>> --- a/src/handsfree-audio.c
>> +++ b/src/handsfree-audio.c
>> @@ -242,12 +242,19 @@ static gboolean sco_connect_cb(GIOChannel *io, 
>> GIOCondition cond,
>>  {
>>       struct ofono_handsfree_card *card = user_data;
>>       DBusMessage *reply;
>> +     int sk;
>>
>>       if (cond & (G_IO_ERR | G_IO_HUP | G_IO_NVAL)) {
>>               reply = __ofono_error_failed(card->msg);
>>               goto done;
>>       }
>>
>> +     sk = g_io_channel_unix_get_fd(io);
>> +
>> +     send_new_connection(card->path, sk);
>> +
>> +     close(sk);
>> +
>>       reply = dbus_message_new_method_return(card->msg);
>
> Shouldn't you be adding a watch for the connected SCO socket instead of
> closing it? Is it not necessary for oFono to know the SCO state? (to
> detect when PA did shutdown() on the socket, return "already connected"
> for Connect(), etc.)

In the current implementation if the user calls Connect and the audio
connection is established already, Handsfree Audio Card returns
'org.ofono.Error.Failed: Operation failed'

In the current API, it is not necessary to track the state or emit
signals. I prefer to keep this simple approach than add additional
logic to track incoming/outgoing SCO connections.
We can improve it later if necessary, as soon as Denis pushes the
basic functionality we can fix the corner cases and issues like this
one.

Regards,
Claudio.
_______________________________________________
ofono mailing list
[email protected]
http://lists.ofono.org/listinfo/ofono

Reply via email to