[AUDIO_EVENT_DEVICE_INFO_CHANGED] = {
.name = "DeviceInfoChanged",
},
+ [AUDIO_EVENT_DEVICE_STATE_CHANGED] = {
+ .name = "DeviceStateChanged",
+ },
[AUDIO_EVENT_FOCUS_CHANGED] = {
.name = "FocusChanged",
},
(cb_data->user_cb)(AUDIO_EVENT_DEVICE_CONNECTED, params, cb_data->user_data);
} else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_INFO_CHANGED].name)) {
(cb_data->user_cb)(AUDIO_EVENT_DEVICE_INFO_CHANGED, params, cb_data->user_data);
+ } else if (!strcmp(signal_name, g_events[AUDIO_EVENT_DEVICE_STATE_CHANGED].name)) {
+ (cb_data->user_cb)(AUDIO_EVENT_DEVICE_STATE_CHANGED, params, cb_data->user_data);
} else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_CHANGED].name)) {
(cb_data->user_cb)(AUDIO_EVENT_FOCUS_CHANGED, params, cb_data->user_data);
} else if (!strcmp(signal_name, g_events[AUDIO_EVENT_FOCUS_WATCH].name)) {
-int mm_sound_add_volume_changed_callback(mm_sound_volume_changed_cb func, void* user_data, unsigned int *subs_id);
+int mm_sound_add_volume_changed_callback(mm_sound_volume_changed_cb func, void* user_data, unsigned int *id);
/**
* @return This function returns MM_ERROR_NONE on success, or negative value
* with error code.
**/
-int mm_sound_remove_volume_changed_callback(unsigned int subs_id);
+int mm_sound_remove_volume_changed_callback(unsigned int id);
/**
* This function is to set volume level of certain volume type.
typedef void *MMSoundDeviceList_t; /**< MMsound Device list handle */
typedef void (*mm_sound_device_connected_cb) (MMSoundDevice_t device_h, bool is_connected, void *user_data);
typedef void (*mm_sound_device_info_changed_cb) (MMSoundDevice_t device_h, int changed_info_type, void *user_data);
+typedef void (*mm_sound_device_state_changed_cb) (MMSoundDevice_t device_h, mm_sound_device_state_e state, void *user_data);
-int mm_sound_add_device_connected_callback(mm_sound_device_flags_e flags, mm_sound_device_connected_cb func, void *user_data, unsigned int *subs_id);
-int mm_sound_remove_device_connected_callback(unsigned int subs_id);
-int mm_sound_add_device_information_changed_callback(mm_sound_device_flags_e flags, mm_sound_device_info_changed_cb func, void *user_data, unsigned int *subs_id);
-int mm_sound_remove_device_information_changed_callback(unsigned int subs_id);
+int mm_sound_add_device_connected_callback(int flags, mm_sound_device_connected_cb func, void *user_data, unsigned int *id);
+int mm_sound_remove_device_connected_callback(unsigned int id);
+int mm_sound_add_device_information_changed_callback(int flags, mm_sound_device_info_changed_cb func, void *user_data, unsigned int *id);
+int mm_sound_remove_device_information_changed_callback(unsigned int id);
+int mm_sound_add_device_state_changed_callback(int flags, mm_sound_device_state_changed_cb func, void *user_data, unsigned int *id);
+int mm_sound_remove_device_state_changed_callback(unsigned int id);
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);
typedef void (*mm_sound_test_cb) (int a, void *user_data);
int mm_sound_test(int a, int b, int* get);
-int mm_sound_add_test_callback(mm_sound_test_cb func, void *user_data, unsigned int *subs_id);
+int mm_sound_add_test_callback(mm_sound_test_cb func, void *user_data, unsigned int *id);
int mm_sound_remove_test_callback(unsigned int sub_id);
void mm_sound_convert_volume_type_to_stream_type(int volume_type, char *stream_type);
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);
int mm_sound_client_remove_device_info_changed_callback(unsigned int subs_id);
+int mm_sound_client_add_device_state_changed_callback(int device_flags, mm_sound_device_state_changed_cb func, void *userdata, unsigned int *id);
+int mm_sound_client_remove_device_state_changed_callback(unsigned int id);
#ifdef USE_FOCUS
int mm_sound_client_set_session_interrupt_callback(mm_sound_focus_session_interrupt_cb callback, void* user_data);
int mm_sound_client_unset_session_interrupt_callback(void);
const char *name, gboolean is_connected, void *userdata);
typedef void (*mm_sound_device_info_changed_wrapper_cb)(int device_id, const char *device_type, int io_direction, int state,
const char *name, int changed_device_info_type, void *userdata);
+typedef void (*mm_sound_device_state_changed_wrapper_cb)(int device_id, const char *device_type, int io_direction, int state,
+ const char *name, void *userdata);
typedef void (*mm_sound_stop_callback_wrapper_func)(int id, void *userdata);
#endif /* __MM_SOUND_CLIENT_H__ */
AUDIO_EVENT_VOLUME_CHANGED,
AUDIO_EVENT_DEVICE_CONNECTED,
AUDIO_EVENT_DEVICE_INFO_CHANGED,
+ AUDIO_EVENT_DEVICE_STATE_CHANGED,
AUDIO_EVENT_FOCUS_CHANGED,
AUDIO_EVENT_FOCUS_WATCH,
AUDIO_EVENT_EMERGENT_EXIT,
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);
int mm_sound_proxy_remove_device_info_changed_callback(unsigned subs_id);
+int mm_sound_proxy_add_device_state_changed_callback(int device_flags, mm_sound_device_state_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
+int mm_sound_proxy_remove_device_state_changed_callback(unsigned subs_id);
int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned volume_level);
int mm_sound_proxy_add_volume_changed_callback(mm_sound_volume_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id);
int mm_sound_proxy_remove_volume_changed_callback(unsigned subs_id);
}
+static void _mm_sound_device_state_changed_callback_wrapper_func(int device_id, const char *device_type, int io_direction,
+ int state, const char *name, void *userdata)
+{
+ mm_sound_device_t device_h;
+ struct callback_data *cb_data = (struct callback_data*) userdata;
+ int device_flags;
+
+ debug_log("[Device State Changed] id(%d) type(%s) direction(%d) state(%d) name(%s)",
+ device_id, device_type, io_direction, state, name);
+
+ if (cb_data == NULL) {
+ debug_warning("device state changed callback data null");
+ return;
+ }
+
+ device_flags = (int) cb_data->extra_data;
+
+ if (!device_is_match_with_mask(device_type, io_direction, state, device_flags))
+ return;
+
+ device_h.id = device_id;
+ device_h.io_direction = io_direction;
+ device_h.state = state;
+ MMSOUND_STRNCPY(device_h.name, name, MAX_DEVICE_NAME_NUM);
+ MMSOUND_STRNCPY(device_h.type, device_type, MAX_DEVICE_TYPE_STR_LEN);
+
+ ((mm_sound_device_state_changed_cb)(cb_data->user_cb))(&device_h, state, cb_data->user_data);
+}
+
+int mm_sound_client_add_device_state_changed_callback(int device_flags, mm_sound_device_state_changed_cb func, void *userdata, unsigned int *id)
+{
+ int ret = MM_ERROR_NONE;
+ struct callback_data *cb_data = (struct callback_data*) userdata;
+
+ debug_fenter();
+
+ GET_CB_DATA(cb_data, func, userdata, (void *) device_flags);
+
+ ret = mm_sound_proxy_add_device_state_changed_callback(device_flags, _mm_sound_device_state_changed_callback_wrapper_func, cb_data, g_free, id);
+
+ debug_fleave();
+ return ret;
+}
+
+int mm_sound_client_remove_device_state_changed_callback(unsigned int id)
+{
+ int ret = MM_ERROR_NONE;
+ debug_fenter();
+
+ ret = mm_sound_proxy_remove_device_state_changed_callback(id);
+
+ debug_fleave();
+ return ret;
+
+}
+
int __convert_volume_type_to_str(int volume_type, char **volume_type_str)
{
int ret = MM_ERROR_NONE;
}
EXPORT_API
-int mm_sound_add_device_connected_callback(mm_sound_device_flags_e flags, mm_sound_device_connected_cb func, void *user_data, unsigned int *subs_id)
+int mm_sound_add_device_connected_callback(int flags, mm_sound_device_connected_cb func, void *user_data, unsigned int *id)
{
int ret = MM_ERROR_NONE;
- if (func == NULL || subs_id == NULL) {
+ if (func == NULL || id == NULL) {
debug_error("argument is not valid\n");
return MM_ERROR_INVALID_ARGUMENT;
}
ret = _check_for_valid_mask(flags);
if (ret == MM_ERROR_NONE) {
- ret = mm_sound_client_add_device_connected_callback(flags, func, user_data, subs_id);
+ ret = mm_sound_client_add_device_connected_callback(flags, func, user_data, id);
if (ret < 0) {
debug_error("Could not add device connected callback, ret = %x\n", ret);
}
}
EXPORT_API
-int mm_sound_remove_device_connected_callback(unsigned int subs_id)
+int mm_sound_remove_device_connected_callback(unsigned int id)
{
int ret = MM_ERROR_NONE;
- ret = mm_sound_client_remove_device_connected_callback(subs_id);
+ ret = mm_sound_client_remove_device_connected_callback(id);
if (ret < 0) {
debug_error("Could not remove device connected callback, ret = %x\n", ret);
}
}
EXPORT_API
-int mm_sound_add_device_information_changed_callback(mm_sound_device_flags_e flags, mm_sound_device_info_changed_cb func, void *user_data, unsigned int *subs_id)
+int mm_sound_add_device_information_changed_callback(int flags, mm_sound_device_info_changed_cb func, void *user_data, unsigned int *id)
{
int ret = MM_ERROR_NONE;
- if (func == NULL || subs_id == NULL) {
+ if (func == NULL || id == NULL) {
debug_error("argument is not valid\n");
return MM_ERROR_INVALID_ARGUMENT;
}
ret = _check_for_valid_mask(flags);
if (ret == MM_ERROR_NONE) {
- ret = mm_sound_client_add_device_info_changed_callback(flags, func, user_data, subs_id);
+ ret = mm_sound_client_add_device_info_changed_callback(flags, func, user_data, id);
if (ret < 0) {
debug_error("Could not add device information changed callback, ret = %x\n", ret);
}
}
EXPORT_API
-int mm_sound_remove_device_information_changed_callback(unsigned int subs_id)
+int mm_sound_remove_device_information_changed_callback(unsigned int id)
{
int ret = MM_ERROR_NONE;
- ret = mm_sound_client_remove_device_info_changed_callback(subs_id);
+ ret = mm_sound_client_remove_device_info_changed_callback(id);
if (ret < 0) {
debug_error("Could not remove device information changed callback, ret = %x\n", ret);
}
}
EXPORT_API
+int mm_sound_add_device_state_changed_callback(int flags, mm_sound_device_state_changed_cb func, void *user_data, unsigned int *id)
+{
+ int ret = MM_ERROR_NONE;
+
+ if (func == NULL || id == NULL) {
+ debug_error("argument is not valid\n");
+ return MM_ERROR_INVALID_ARGUMENT;
+ }
+ ret = _check_for_valid_mask(flags);
+ if (ret == MM_ERROR_NONE) {
+ ret = mm_sound_client_add_device_state_changed_callback(flags, func, user_data, id);
+ if (ret < 0) {
+ debug_error("Could not add device state changed callback, ret = %x\n", ret);
+ }
+ }
+
+ return ret;
+}
+
+EXPORT_API
+int mm_sound_remove_device_state_changed_callback(unsigned int id)
+{
+ int ret = MM_ERROR_NONE;
+
+ ret = mm_sound_client_remove_device_state_changed_callback(id);
+ if (ret < 0) {
+ debug_error("Could not remove device state changed callback, ret = %x\n", ret);
+ }
+
+ return ret;
+}
+
+
+EXPORT_API
int mm_sound_get_current_device_list(mm_sound_device_flags_e flags, MMSoundDeviceList_t *device_list)
{
int ret = MM_ERROR_NONE;
&state, &name, &changed_device_info_type);
((mm_sound_device_info_changed_wrapper_cb)(cb_data->user_cb))(device_id, device_type, io_direction,
state, name, changed_device_info_type, cb_data->user_data);
+ } else if (event == AUDIO_EVENT_DEVICE_STATE_CHANGED) {
+ const char *name = NULL, *device_type = NULL;
+ int device_id, io_direction, state;
+
+ g_variant_get(params, "(u(i&sii&s))", &event_id, &device_id, &device_type, &io_direction,
+ &state, &name);
+ ((mm_sound_device_state_changed_wrapper_cb)(cb_data->user_cb))(device_id, device_type, io_direction,
+ state, name, cb_data->user_data);
} else if (event == AUDIO_EVENT_FOCUS_CHANGED) {
} else if (event == AUDIO_EVENT_FOCUS_WATCH) {
} else if (event == AUDIO_EVENT_TEST) {
return ret;
}
+int mm_sound_proxy_add_device_state_changed_callback(int device_flags, mm_sound_device_state_changed_wrapper_cb func, void* userdata, mm_sound_proxy_userdata_free freefunc, unsigned *subs_id)
+{
+ int ret = MM_ERROR_NONE;
+ struct callback_data *cb_data;
+
+ debug_fenter();
+
+ CB_DATA_NEW(cb_data, func, userdata, freefunc);
+
+ if ((ret = mm_sound_dbus_signal_subscribe_to(AUDIO_PROVIDER_DEVICE_MANAGER, AUDIO_EVENT_DEVICE_STATE_CHANGED, dbus_callback, cb_data, simple_callback_data_free_func, &cb_data->subs_id)) != MM_ERROR_NONE)
+ debug_error("Add device state changed callback failed");
+ else
+ *subs_id = cb_data->subs_id;
+
+ debug_fleave();
+ return ret;
+}
+
+int mm_sound_proxy_remove_device_state_changed_callback(unsigned subs_id)
+{
+ int ret = MM_ERROR_NONE;
+ debug_fenter();
+
+ if ((ret = mm_sound_dbus_signal_unsubscribe(subs_id)) != MM_ERROR_NONE) {
+ debug_error("remove device state changed callback failed");
+ }
+
+ debug_fleave();
+ return ret;
+}
+
int mm_sound_proxy_set_volume_by_type(const char *volume_type, const unsigned volume_level)
{
int ret = MM_ERROR_NONE;
Name: libmm-sound
Summary: MMSound Package contains client lib and sound_server binary
-Version: 0.10.67
+Version: 0.10.68
Release: 0
Group: System/Libraries
License: Apache-2.0