[AUDIO_METHOD_GET_CONNECTED_DEVICE_LIST] = {
.name = "GetConnectedDeviceList",
},
+ [AUDIO_METHOD_GET_DEVICE_BY_ID] = {
+ .name = "GetDeviceById",
+ },
[AUDIO_METHOD_IS_STREAM_ON_DEVICE] = {
.name = "IsStreamOnDevice",
},
int mm_sound_get_current_device_list(mm_sound_device_flags_e device_mask, MMSoundDeviceList_t *device_list);
int mm_sound_get_device_list(int device_mask, MMSoundDeviceList_t *device_list);
+int mm_sound_get_device_by_id(int device_id, MMSoundDevice_t **device);
int mm_sound_free_device_list(MMSoundDeviceList_t device_list);
+int mm_sound_free_device(MMSoundDevice_t *device);
int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
int mm_sound_get_prev_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device);
int mm_sound_get_device_type(MMSoundDevice_t device_h, mm_sound_device_type_e *type);
int mm_sound_client_unset_filter_by_type(const char *stream_type);
int mm_sound_client_control_filter_by_type(const char *stream_type, const char *filter_name, const char *filter_controls);
int mm_sound_client_get_current_connected_device_list(int device_flgas, mm_sound_device_list_t *device_list);
+int mm_sound_client_get_device_by_id(int device_id, mm_sound_device_t **device);
int mm_sound_client_add_device_connected_callback(int device_flags, mm_sound_device_connected_cb func, void* user_data, unsigned int *subs_id);
int mm_sound_client_remove_device_connected_callback(unsigned int subs_id);
int mm_sound_client_add_device_info_changed_callback(int device_flags, mm_sound_device_info_changed_cb func, void* user_data, unsigned int *subs_id);
AUDIO_METHOD_GET_BT_A2DP_STATUS,
AUDIO_METHOD_SET_PATH_FOR_ACTIVE_DEVICE,
AUDIO_METHOD_GET_CONNECTED_DEVICE_LIST,
+ AUDIO_METHOD_GET_DEVICE_BY_ID,
AUDIO_METHOD_IS_STREAM_ON_DEVICE,
AUDIO_METHOD_GET_AUDIO_PATH,
AUDIO_METHOD_SET_VOLUME_LEVEL,
int mm_sound_proxy_add_play_sound_end_callback(mm_sound_stop_callback_wrapper_func func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
int mm_sound_proxy_remove_play_sound_end_callback(unsigned subs_id);
int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** device_list);
+int mm_sound_proxy_get_device_by_id(int device_id, mm_sound_device_t **device);
int mm_sound_proxy_add_device_connected_callback(int device_flags, mm_sound_device_connected_wrapper_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
int mm_sound_proxy_remove_device_connected_callback(unsigned subs_id);
int mm_sound_proxy_add_device_info_changed_callback(int device_flags, mm_sound_device_info_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
return ret;
}
+int mm_sound_client_get_device_by_id(int device_id, mm_sound_device_t **device)
+{
+ int ret = MM_ERROR_NONE;
+
+ debug_fenter();
+
+ if ((ret = mm_sound_proxy_get_device_by_id(device_id, device)) != MM_ERROR_NONE)
+ debug_error("[Client] failed to get device by id");
+
+ debug_fleave();
+
+ return ret;
+}
+
static bool device_is_match_direction(int direction, int mask)
{
if (mask == DEVICE_IO_DIRECTION_FLAGS || mask == 0)
}
EXPORT_API
+int mm_sound_free_device(MMSoundDevice_t *device)
+{
+ if (device == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
+ g_free(device);
+
+ return MM_ERROR_NONE;
+}
+
+EXPORT_API
+int mm_sound_get_device_by_id(int device_id, MMSoundDevice_t **device)
+{
+ int ret = MM_ERROR_NONE;
+
+ if (device_id < 1 || device == NULL)
+ return MM_ERROR_INVALID_ARGUMENT;
+
+ ret = mm_sound_client_get_device_by_id(device_id, (mm_sound_device_t**)device);
+ if (ret < 0)
+ debug_error("Could not get device by id, ret = %x\n", ret);
+
+ return ret;
+}
+
+EXPORT_API
int mm_sound_get_next_device (MMSoundDeviceList_t device_list, MMSoundDevice_t *device)
{
int ret = MM_ERROR_NONE;
return ret;
}
+int mm_sound_proxy_get_device_by_id(int device_id, mm_sound_device_t **device)
+{
+ int ret = MM_ERROR_NONE;
+ GVariant *params = NULL, *result = NULL;
+ mm_sound_device_t* device_item = NULL;
+ const gchar *device_name_tmp = NULL, *device_type_tmp = NULL;
+
+ debug_fenter();
+
+ if (!device || device_id < 1) {
+ debug_error("Invalid Parameter, device null or improper device id");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+
+ if ((params = g_variant_new("(i)", device_id)) == NULL) {
+ debug_error("Construct Param for get device by id failed");
+ return MM_ERROR_SOUND_INTERNAL;
+ }
+
+ if ((ret = mm_sound_dbus_method_call_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_METHOD_GET_DEVICE_BY_ID, params, &result)) != MM_ERROR_NONE) {
+ debug_error("get device by id failed");
+ ret = MM_ERROR_SOUND_NO_DATA;
+ goto cleanup;
+ }
+
+ if (result) {
+ if ((device_item = g_malloc0(sizeof(mm_sound_device_t))) == NULL) {
+ debug_error("Alloc device handle failed");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ goto cleanup;
+ }
+
+ g_variant_get(result, "(i&sii&s)",
+ &device_item->id, &device_type_tmp, &device_item->io_direction,
+ &device_item->state, &device_name_tmp);
+ MMSOUND_STRNCPY(device_item->name, device_name_tmp, MAX_DEVICE_NAME_NUM);
+ MMSOUND_STRNCPY(device_item->type, device_type_tmp, MAX_DEVICE_TYPE_STR_LEN);
+ debug_log("Get device id(%d) type(%17s) direction(%d) state(%d) name(%s)",
+ device_item->id, device_item->type, device_item->io_direction,
+ device_item->state, device_item->name);
+ device_item->stream_num = -1;
+ *device = device_item;
+ } else {
+ debug_error("reply null");
+ ret = MM_ERROR_SOUND_INTERNAL;
+ }
+
+cleanup:
+ if (result)
+ g_variant_unref(result);
+
+ debug_fleave();
+ return ret;
+}
+
int mm_sound_proxy_add_device_connected_callback(int device_flags, mm_sound_device_connected_wrapper_cb func, void *userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
{
int ret = MM_ERROR_NONE;
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.11.2
+Version: 0.11.3
Release: 0
Group: System/Libraries
License: Apache-2.0
g_print("Z : VideoCall start \t");
g_print("N : Notification start \n");
g_print("n : VOIP start \t");
- g_print("v : Session end \t");
+ g_print("v : Session end \n");
g_print("==================================================================\n");
g_print(" Audio device APIs\n");
g_print("==================================================================\n");
g_print("L : Get current list of connected devices \n");
+ g_print("I : Get device by id \n");
g_print("C : Add device connected callback \t");
g_print("D : Remove device connected callback \n");
g_print("Q : Add device info. changed callback \t");
}
}
+ else if(strncmp(cmd, "I", 1) == 0) {
+ int ret = 0;
+ MMSoundDevice_t device_h = NULL;
+ mm_sound_device_type_e device_type = 0;
+ mm_sound_device_io_direction_e io_direction = 0;
+ mm_sound_device_state_e state = 0;
+ char *name;
+ int id = 0, input_id = 0;
+ char input_string[128];
+
+ fflush(stdin);
+ g_print ("> Input id : ");
+
+ if (fgets(input_string, sizeof(input_string)-1, stdin)) {
+ input_id = atoi(input_string);
+
+ ret = mm_sound_get_device_by_id(input_id, &device_h);
+ if (ret == MM_ERROR_NONE) {
+ ret = mm_sound_get_device_type(device_h, &device_type);
+ if (ret)
+ g_print("failed to mm_sound_get_device_type()\n");
+ ret = mm_sound_get_device_io_direction(device_h, &io_direction);
+ if (ret)
+ g_print("failed to mm_sound_get_device_io_direction()\n");
+ ret = mm_sound_get_device_state(device_h, &state);
+ if (ret)
+ g_print("failed to mm_sound_get_device_state()\n");
+ ret = mm_sound_get_device_id(device_h, &id);
+ if (ret)
+ g_print("failed to mm_sound_get_device_id()\n");
+ ret = mm_sound_get_device_name(device_h, &name);
+ if (ret)
+ g_print("failed to mm_sound_get_device_name()\n");
+ g_print("*** --- type[%d], id[%d], io_direction[%d], state[%d], name[%s]\n", device_type, id, io_direction, state, name);
+ } else {
+ g_print("failed to mm_sound_get_device_by_id()\n");
+ }
+ } else {
+ g_print("### fgets return NULL\n");
+ }
+ }
+
else if(strncmp(cmd, "C", 1) == 0) {
int ret = 0;
char input_string[128];