Hi Martin,
> After two days' hacking and debugging work, I worked out below auto connect
> patch, please review.
> The Methodology is single auto connection according to our discussion on last
> mail.
>
> The patch can achieve below functions:
> The favorite service with high order can be connected automatically after
> system booting and flight-mode off.
>
> 1. The single_auto_connection() is triggered when new service is created.
> 2. The timeout call back is used to track the connection state and try the
> sequence items. So this part can be independent with other parts, and make
> implementation simple.
> 3. The new trigger can refresh the old single_auto_connection().
I think this patch has more complexity than actually needed. I am
thinking more of something around these lines:
for (i = 0; service_count; i++) {
if (service[i].favorite == FALSE)
break;
if (service[i].state == READY)
break;
if (service[i].state == FAILURE)
continue;
err = connect_service(service[i]);
if (err < 0 && err != -EINPROGRESS)
continue;
break;
}
And we can keep calling this multiple times. Since if a connect attempt
fails, the state will become FAILURE and we would skip that service the
next time. This also ensures that user interaction and scan results are
taken into account during that auto-connect phase.
So we can trigger this auto-connect on startup and when all states are
either in IDLE or FAILURE state. For that a global counter could be used
to make it an inexpensive check.
Regards
Marcel
_______________________________________________
connman mailing list
[email protected]
http://lists.connman.net/listinfo/connman