enum {
BLUETOOTH_MESSAGE_IO_THREAD_FAILED,
+ BLUETOOTH_MESSAGE_TRANSPORT_STATE_CHANGED,
BLUETOOTH_MESSAGE_MAX
};
pending_read_bytes = 0;
writable = false;
+ if (u->profile == PA_BLUETOOTH_PROFILE_HEADSET_AUDIO_GATEWAY) {
+ u->transport->state = PA_BLUETOOTH_TRANSPORT_STATE_IDLE;
+ pa_asyncmsgq_post(pa_thread_mq_get()->outq, PA_MSGOBJECT(u->msg), BLUETOOTH_MESSAGE_TRANSPORT_STATE_CHANGED, u, 0,
+ NULL, NULL);
+ }
+
teardown_stream(u);
}
/* Run from main thread context */
static int device_process_msg(pa_msgobject *obj, int code, void *data, int64_t offset, pa_memchunk *chunk) {
- struct bluetooth_msg *u = BLUETOOTH_MSG(obj);
+ struct bluetooth_msg *b = BLUETOOTH_MSG(obj);
+ struct userdata *u = data;
switch (code) {
+ case BLUETOOTH_MESSAGE_TRANSPORT_STATE_CHANGED:
+ handle_transport_state_change(u, u->transport);
+ break;
case BLUETOOTH_MESSAGE_IO_THREAD_FAILED:
- if (u->card->module->unload_requested)
+ if (b->card->module->unload_requested)
break;
pa_log_debug("Switching the profile to off due to IO thread failure.");
- pa_assert_se(pa_card_set_profile(u->card, "off", false) >= 0);
+ pa_assert_se(pa_card_set_profile(b->card, "off", false) >= 0);
break;
}