int sound_manager_set_filter_preset(sound_stream_type_e stream_type, sound_filter_e filter, sound_filter_preset_e preset);
/**
+ * @internal
+ * @brief Gets the vendor id of the device.
+ * @since_tizen 4.0
+ *
+ * @remarks It works only with USB audio device. Otherwise, #SOUND_MANAGER_ERROR_NOT_SUPPORTED will be returned.\n
+ *
+ * @param[in] device The device item
+ * @param[out] vendor_id The vendor id of the device
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_type()
+ * @see sound_manager_get_device_io_direction()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_get_device_state()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_product_id()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id);
+
+/**
+ * @internal
+ * @brief Gets the product id of the device.
+ * @since_tizen 4.0
+ *
+ * @remarks It works only with USB audio device. Otherwise, #SOUND_MANAGER_ERROR_NOT_SUPPORTED will be returned.\n
+ *
+ * @param[in] device The device item
+ * @param[out] product_id The product id of the device
+ * @return @c 0 on success,
+ * otherwise a negative error value
+ * @retval #SOUND_MANAGER_ERROR_NONE Success
+ * @retval #SOUND_MANAGER_ERROR_INVALID_PARAMETER Invalid parameter
+ * @retval #SOUND_MANAGER_ERROR_NOT_SUPPORTED Not supported
+ * @see sound_manager_get_device_list()
+ * @see sound_manager_get_next_device()
+ * @see sound_manager_get_prev_device()
+ * @see sound_manager_get_device_type()
+ * @see sound_manager_get_device_io_direction()
+ * @see sound_manager_get_device_name()
+ * @see sound_manager_get_device_state()
+ * @see sound_manager_get_device_id()
+ * @see sound_manager_get_device_vendor_id()
+ * @see sound_manager_free_device_list()
+ */
+int sound_manager_get_device_product_id(sound_device_h device, int *product_id);
+
+/**
* @}
*/
LEAVE:
return _convert_sound_manager_error_code(__func__, ret);
}
+
+int sound_manager_get_device_vendor_id(sound_device_h device, int *vendor_id)
+{
+ int ret = MM_ERROR_NONE;
+ mm_sound_device_type_e type;
+
+ LOGI(">> enter");
+
+ SM_INSTANCE_CHECK(device);
+ SM_NULL_ARG_CHECK(vendor_id);
+
+ if ((ret = mm_sound_get_device_type(device, &type)))
+ return _convert_sound_manager_error_code(__func__, ret);
+
+ if (type != MM_SOUND_DEVICE_TYPE_USB_AUDIO) {
+ LOGE("device type is not USB audio device, device_type[%d]", type);
+ return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
+ }
+
+ ret = mm_sound_get_device_vendor_id(device, vendor_id);
+
+ return _convert_sound_manager_error_code(__func__, ret);
+}
+
+int sound_manager_get_device_product_id(sound_device_h device, int *product_id)
+{
+ int ret = MM_ERROR_NONE;
+ mm_sound_device_type_e type;
+
+ LOGI(">> enter");
+
+ SM_INSTANCE_CHECK(device);
+ SM_NULL_ARG_CHECK(product_id);
+
+ if ((ret = mm_sound_get_device_type(device, &type)))
+ return _convert_sound_manager_error_code(__func__, ret);
+
+ if (type != MM_SOUND_DEVICE_TYPE_USB_AUDIO) {
+ LOGE("device type is not USB audio device, device_type[%d]", type);
+ return SOUND_MANAGER_ERROR_NOT_SUPPORTED;
+ }
+
+ ret = mm_sound_get_device_product_id(device, product_id);
+
+ return _convert_sound_manager_error_code(__func__, ret);
+}
+
/* If failed to get some property, just give some default value */
void _get_device_props_simple(sound_device_h device, int *id, char **type, char **name,
- const char **direc, const char **state)
+ const char **direc, const char **state, int *vendor_id, int *product_id)
{
int ret;
sound_device_type_e _type;
sound_device_io_direction_e _direc;
sound_device_state_e _state;
+ *id = -1;
+ *vendor_id = -1;
+ *product_id = -1;
+
if ((ret = sound_manager_get_device_type(device, &_type)))
g_print("failed to get device type, ret[0x%x]\n", ret);
else
_convert_device_type_enum_to_str(_type, type);
- if ((ret = sound_manager_get_device_id(device, id))) {
+ if ((ret = sound_manager_get_device_id(device, id)))
g_print("failed to get device id, ret[0x%x]\n", ret);
- *id = -1;
- }
if (_type == SOUND_DEVICE_BLUETOOTH_MEDIA || _type == SOUND_DEVICE_BLUETOOTH_VOICE || _type == SOUND_DEVICE_USB_AUDIO) {
if ((ret = sound_manager_get_device_name(device, name))) {
g_print("failed to get device name, ret[0x%x]\n", ret);
*name = NOT_AVAIL;
}
+ if (_type == SOUND_DEVICE_USB_AUDIO) {
+ if ((ret = sound_manager_get_device_vendor_id(device, vendor_id)))
+ g_print("failed to get device vendor id, ret[0x%x]\n", ret);
+ if ((ret = sound_manager_get_device_product_id(device, product_id)))
+ g_print("failed to get device product id, ret[0x%x]\n", ret);
+ }
} else {
*name = "";
}
void _set_device_connected_cb(sound_device_h device, bool is_connected, void *user_data)
{
int id = -1;
+ int vendor_id = -1;
+ int product_id = -1;
char *type, *name;
const char *direc, *state;
- _get_device_props_simple(device, &id, &type, &name, &direc, &state);
+ _get_device_props_simple(device, &id, &type, &name, &direc, &state, &vendor_id, &product_id);
g_print("[ Device #%d %s %s ] %s\n", id, type, name, is_connected ? "Connected" : "Disconnected");
- g_print(" Direc[ %-4s ] State[ %-12s ]\n", direc, state);
+ g_print(" Direc[ %-4s ] State[ %-12s ] VendorID[ %04x ], ProductID[ %04x ]\n", direc, state, vendor_id, product_id);
}
void _set_device_info_changed_cb(sound_device_h device, sound_device_changed_info_e changed_info, void *user_data)
{
int id = -1;
+ int vendor_id = -1;
+ int product_id = -1;
char *type, *name;
const char *direc, *state;
const char *changed_info_str[] = {"State", "Direction", "Avail-Mode"};
- _get_device_props_simple(device, &id, &type, &name, &direc, &state);
+ _get_device_props_simple(device, &id, &type, &name, &direc, &state, &vendor_id, &product_id);
g_print("[Device #%d %s %s] %s changed\n", id, type, name, changed_info_str[changed_info]);
- g_print(" Direc[ %-4s ] State[ %-12s ]\n", direc, state);
+ g_print(" Direc[ %-4s ] State[ %-12s ] VendorID[ %04x ], ProductID[ %04x ]\n", direc, state, vendor_id, product_id);
}
void _device_state_changed_cb(sound_device_h device, sound_device_state_e state, void *user_data)
{
int id = -1;
+ int vendor_id = -1;
+ int product_id = -1;
char *type, *name;
const char *direc, *_state;
- _get_device_props_simple(device, &id, &type, &name, &direc, &_state);
+ _get_device_props_simple(device, &id, &type, &name, &direc, &_state, &vendor_id, &product_id);
g_print("[Device #%d %s %s] state changed\n", id, type, name);
- g_print(" Direc[ %-4s ] State(%d)[ %-12s ]\n", direc, state, _state);
+ g_print(" Direc[ %-4s ] State(%d)[ %-12s ] VendorID[ %04x ], ProductID[ %04x ]\n", direc, state, _state, vendor_id, product_id);
}
void reset_menu_state(void)
sound_device_h device;
int ret = SOUND_MANAGER_ERROR_NONE;
int id = -1;
+ int vendor_id = -1;
+ int product_id = -1;
char *type;
char *name;
const char *direc;
if (!(ret = sound_manager_get_device_list(g_device_mask, &device_list))) {
g_print("success to get current device list\n");
while (!sound_manager_get_next_device(device_list, &device)) {
- _get_device_props_simple(device, &id, &type, &name, &direc, &state);
+ _get_device_props_simple(device, &id, &type, &name, &direc, &state, &vendor_id, &product_id);
g_print("[ Device #%d %s %s ]\n", id, type, name);
- g_print(" Direc[ %-4s ] State[ %-12s ]\n", direc, state);
+ g_print(" Direc[ %-4s ] State[ %-12s ] VendorID[ %04x ], ProductID[ %04x ]\n", direc, state, vendor_id, product_id);
}
} else {
g_print("fail to get current device list, ret[0x%x]\n", ret);