[pulseaudio-discuss] [PATCH 26/56] bluetooth: Create pa_bluetooth_transport for BlueZ 5 support

Tanu Kaskinen tanu.kaskinen at linux.intel.com
Fri Jul 19 02:32:23 PDT 2013


On Thu, 2013-07-18 at 18:31 +0300, Tanu Kaskinen wrote:
> On Fri, 2013-07-12 at 15:06 -0300, jprvita at gmail.com wrote:
> >  static void pa_bluetooth_device_free(pa_bluetooth_device *d) {
> > +    unsigned i;
> > +
> >      pa_assert(d);
> >  
> > +    for (i = 0; i < PA_BLUETOOTH_PROFILE_COUNT; i++) {
> > +        pa_bluetooth_transport *t;
> > +
> > +        if (!(t = d->transports[i]))
> > +            continue;
> > +
> > +        d->transports[i] = NULL;
> > +        t->state = PA_BLUETOOTH_TRANSPORT_STATE_DISCONNECTED;
> > +        pa_hook_fire(&d->discovery->hooks[PA_BLUETOOTH_HOOK_TRANSPORT_STATE_CHANGED], t);
> 
> Can the transport state be DISCONNECTED already before we set it here?
> If it can, please fire the hook only if the state actually changes.

Also, I'd like a log message (debug level) whenever t->state changes.
There could be set_state() helper function that checks whether the new
state is different than the old state, and if it is, then sets t->state,
logs a message (including the old state, "state changed from <old> to
<new>") and fires the STATE_CHANGED hook.

This is just a wish, so I won't continue arguing if you for some reason
don't think this is a good idea.

-- 
Tanu



More information about the pulseaudio-discuss mailing list