#endif
#include "communicator.h"
+#include "hal-interface.h"
#include "device-manager.h"
#define SHARED_DEVICE_MANAGER "tizen-device-manager"
DM_DEVICE_CLASS_MAX,
} dm_device_class_t;
-
typedef enum {
DEVICE_IO_DIRECTION_IN_FLAG = 0x0001, /**< Flag for input devices */
DEVICE_IO_DIRECTION_OUT_FLAG = 0x0002, /**< Flag for output devices */
pa_hook_slot *comm_hook_device_connection_changed_slot;
pa_hook_slot *comm_hook_device_state_changed_slot;
pa_communicator *comm;
+ pa_hal_interface *hal_interface;
/*
Idxset for save parsed information about device-type.
pa_dbus_connection *dbus_conn;
};
-
struct composite_type {
const char *type;
const char *role;
}
handle_device_status_changed(dm, DEVICE_TYPE_BT_SCO,
name, dbus_message_get_path(s), detected);
+ } else if (pa_streq(property_name, "Playing")) {
+ pa_log_info("SCO Playing : %d", value);
+ if (value) {
+ /* update BT band/nrec information */
+ pa_tz_device *device;
+ if ((device = _device_list_get_device(dm, DEVICE_TYPE_BT_SCO, NULL)) != NULL) {
+ bool is_wide_band = false;
+ bool nrec = false;
+ pa_tz_device_sco_get_property(device, &is_wide_band, &nrec);
+ pa_log_info("got new wideband:%d, nrec:%d", is_wide_band, nrec);
+
+ UPDATE_HAL_ROUTE_OPTION(dm->hal_interface, NULL, "bt-wideband", is_wide_band);
+ UPDATE_HAL_ROUTE_OPTION(dm->hal_interface, NULL, "bt-nrec", nrec);
+ }
+ }
+ UPDATE_HAL_ROUTE_OPTION(dm->hal_interface, NULL, "bt-sco-ready", value);
}
}
} else {
PA_HOOK_EARLY, (pa_hook_cb_t)device_connection_changed_hook_cb, dm);
dm->comm_hook_device_state_changed_slot = pa_hook_connect(pa_communicator_hook(dm->comm, PA_COMMUNICATOR_HOOK_DEVICE_STATE_CHANGED),
PA_HOOK_EARLY, (pa_hook_cb_t)device_state_changed_hook_cb, dm);
+
+ dm->hal_interface = pa_hal_interface_get(dm->core);
+
if (!(dm->type_infos = parse_device_type_infos())) {
pa_log_error("Parse device-type-map failed");
return NULL;
if (dm->source_unlink_hook_slot)
pa_hook_slot_free(dm->source_unlink_hook_slot);
+ if (dm->hal_interface)
+ pa_hal_interface_unref(dm->hal_interface);
+
if (dm->comm)
pa_communicator_unref(dm->comm);
dbus_deinit(dm);
-
if (dm->core)
pa_shared_remove(dm->core, SHARED_DEVICE_MANAGER);
#include <dlfcn.h>
#include <pulsecore/core.h>
+#include <pulsecore/macro.h>
typedef struct _pa_hal_interface pa_hal_interface;
typedef void* pcm_handle;
+#define UPDATE_HAL_ROUTE_OPTION(x_hal_intf, x_role, x_name, x_value) \
+do { \
+ pa_assert(x_hal_intf); \
+ hal_route_option route_option; \
+ memset(&route_option, 0, sizeof(hal_route_option)); \
+ route_option.role = x_role; \
+ route_option.name = x_name; \
+ route_option.value = x_value; \
+ pa_hal_interface_update_route_option(x_hal_intf, &route_option); \
+} while (0) \
+
#define MSG_FOR_LOOPBACK_ARG_LATENCY "loopback::latency"
#define MSG_FOR_LOOPBACK_ARG_ADJUST_TIME "loopback::adjust_time"
typedef void (*hal_message_callback)(const char *name, int value, void *user_data);
}
}
-static void update_hal_route_option(pa_hal_interface *hal_intf, const char *role, const char* name, int value)
-{
- hal_route_option route_option;
-
- memset(&route_option, 0, sizeof(hal_route_option));
- route_option.role = role;
- route_option.name = name;
- route_option.value = value;
-
- pa_hal_interface_update_route_option(hal_intf, &route_option);
-}
-
/* threre is only one sco connected device */
static pa_tz_device* _get_sco_connected_device(pa_device_manager *dm) {
pa_idxset *device_list;
if (get_bt_property(u->device_manager, &is_wb, &is_nrec) == 0) {
pa_log_info("bt property : wideband(%d), nrec(%d)", is_wb, is_nrec);
- update_hal_route_option(u->hal_interface, role, "bt-wideband", (int)is_wb);
- update_hal_route_option(u->hal_interface, role, "bt-nrec", (int)is_nrec);
- } else
+ UPDATE_HAL_ROUTE_OPTION(u->hal_interface, role, "bt-wideband", (int)is_wb);
+ UPDATE_HAL_ROUTE_OPTION(u->hal_interface, role, "bt-nrec", (int)is_nrec);
+ } else {
pa_log_warn("Failed to get property for wideband / nrec....");
+ }
}
/* Load/Unload module-loopback */