<div dir="ltr"><p dir="ltr"><br>
On Jul 19, 2013 6:32 AM, "Tanu Kaskinen" <<a href="mailto:tanu.kaskinen@linux.intel.com" target="_blank">tanu.kaskinen@linux.intel.com</a>> wrote:<br>
><br>
> On Thu, 2013-07-18 at 18:31 +0300, Tanu Kaskinen wrote:<br>
> > On Fri, 2013-07-12 at 15:06 -0300, <a href="mailto:jprvita@gmail.com" target="_blank">jprvita@gmail.com</a> wrote:<br>
> > > static void pa_bluetooth_device_free(pa_bluetooth_device *d) {<br>
> > > + unsigned i;<br>
> > > +<br>
> > > pa_assert(d);<br>
> > ><br>
> > > + for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++) {<br>
> > > + pa_bluetooth_transport *t;<br>
> > > +<br>
> > > + if (!(t = d->transports[i]))<br>
> > > + continue;<br>
> > > +<br>
> > > + d->transports[i] = NULL;<br>
> > > + t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;<br>
> > > + pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);<br>
> ><br>
> > Can the transport state be DISCONNECTED already before we set it here?<br>
> > If it can, please fire the hook only if the state actually changes.<br>
><br>
> Also, I'd like a log message (debug level) whenever t->state changes.<br>
> There could be set_state() helper function that checks whether the new<br>
> state is different than the old state, and if it is, then sets t->state,<br>
> logs a message (including the old state, "state changed from <old> to<br>
> <new>") and fires the STATE_CHANGED hook.<br>
><br>
> This is just a wish, so I won't continue arguing if you for some reason<br>
> don't think this is a good idea.<br>
></p>
<p dir="ltr">I like the idea of having a helper function to handle transport state changes, also because this would factor code used in other parts of bluez5-util.c. I'll look into that for the next series.</p>
<p dir="ltr">--<br>
João Paulo Rechi Vita<br>
<a href="http://about.me/jprvita" target="_blank">http://about.me/jprvita</a></p>
</div>