/**
* @internal
+ * @brief Sets the mute specified for a particular sound type.
+ * @since_tizen 5.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/volume.set
+ * @param[in] type The sound type
+ * @param[in] mute The mute state to be set: (@c true = mute, @c false = unmute)
+ * @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_PERMISSION_DENIED Permission denied
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_mute()
+ */
+int sound_manager_set_mute(sound_type_e type, bool mute);
+
+/**
+ * @internal
+ * @brief Gets the mute specified for a particular sound type.
+ * @since_tizen 5.5
+ * @param[in] type The sound type
+ * @param[out] muted The current mute state: (@c true = muted, @c false = unmuted)
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_mute()
+ */
+int sound_manager_get_mute(sound_type_e type, bool *muted);
+
+/**
+ * @internal
* @brief Creates a handle for stream information.
* @since_tizen 3.0
*
+
/*
* Copyright (c) 2015 - 2018 Samsung Electronics Co., Ltd All Rights Reserved
*
/**
* @internal
+ * @brief Sets the mute specified for a particular sound type.
+ * @since_tizen 5.5
+ * @privlevel public
+ * @privilege %http://tizen.org/privilege/volume.set
+ * @param[in] type The sound type
+ * @param[in] mute The mute state to be set: (@c true = mute, @c false = unmute)
+ * @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_PERMISSION_DENIED Permission denied
+ * @retval #SOUND_MANAGER_ERROR_INTERNAL Internal error inside the sound system
+ * @see sound_manager_get_mute()
+ */
+int sound_manager_set_mute(sound_type_e type, bool mute);
+
+/**
+ * @internal
+ * @brief Gets the mute specified for a particular sound type.
+ * @since_tizen 5.5
+ * @param[in] type The sound type
+ * @param[out] muted The current mute state: (@c true = muted, @c false = unmuted)
+ * @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_INTERNAL Internal error inside the sound system
+ * @see sound_manager_set_mute()
+ */
+int sound_manager_get_mute(sound_type_e type, bool *muted);
+
+/**
+ * @internal
* @brief Creates a handle for stream information.
* @since_tizen 3.0
*
CURRENT_STATUS_SET_VOLUME,
CURRENT_STATUS_GET_VOLUME,
CURRENT_STATUS_GET_CURRENT_SOUND_TYPE,
+ CURRENT_STATUS_SET_MUTE,
+ CURRENT_STATUS_GET_MUTE,
CURRENT_STATUS_ADD_VOLUME_CHANGED_CB,
CURRENT_STATUS_REMOVE_VOLUME_CHANGED_CB,
CURRENT_STATUS_SET_DEVICE_MASK,
void _interpret_main_menu(char *cmd)
{
- if (strncmp(cmd, "gx", 3) == 0)
+ if (strncmp(cmd, "gx", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_MAX_VOLUME;
- else if (strncmp(cmd, "sv", 3) == 0)
+ else if (strncmp(cmd, "sv", 2) == 0)
g_menu_state = CURRENT_STATUS_SET_VOLUME;
- else if (strncmp(cmd, "gv", 3) == 0)
+ else if (strncmp(cmd, "gv", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_VOLUME;
- else if (strncmp(cmd, "gt", 3) == 0)
+ else if (strncmp(cmd, "gt", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_CURRENT_SOUND_TYPE;
- else if (strncmp(cmd, "av", 3) == 0)
+ else if (strncmp(cmd, "av", 2) == 0)
g_menu_state = CURRENT_STATUS_ADD_VOLUME_CHANGED_CB;
- else if (strncmp(cmd, "rv", 3) == 0)
+ else if (strncmp(cmd, "rv", 2) == 0)
g_menu_state = CURRENT_STATUS_REMOVE_VOLUME_CHANGED_CB;
- else if (strncmp(cmd, "sk", 3) == 0)
+ else if (strncmp(cmd, "sm", 2) == 0)
+ g_menu_state = CURRENT_STATUS_SET_MUTE;
+ else if (strncmp(cmd, "gm", 2) == 0)
+ g_menu_state = CURRENT_STATUS_GET_MUTE;
+ else if (strncmp(cmd, "sk", 2) == 0)
g_menu_state = CURRENT_STATUS_SET_DEVICE_MASK;
- else if (strncmp(cmd, "gk", 3) == 0)
+ else if (strncmp(cmd, "gk", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_DEVICE_MASK;
- else if (strncmp(cmd, "gl", 3) == 0)
+ else if (strncmp(cmd, "gl", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_DEVICE_LIST;
- else if (strncmp(cmd, "pl", 3) == 0)
+ else if (strncmp(cmd, "pl", 2) == 0)
g_menu_state = CURRENT_STATUS_PRINT_DEVICE_LIST;
- else if (strncmp(cmd, "fl", 3) == 0)
+ else if (strncmp(cmd, "fl", 2) == 0)
g_menu_state = CURRENT_STATUS_FREE_DEVICE_LIST;
- else if (strncmp(cmd, "gn", 3) == 0)
+ else if (strncmp(cmd, "gn", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_DEVICE_NEXT;
- else if (strncmp(cmd, "gp", 3) == 0)
+ else if (strncmp(cmd, "gp", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_DEVICE_PREV;
- else if (strncmp(cmd, "gd", 3) == 0)
+ else if (strncmp(cmd, "gd", 2) == 0)
g_menu_state = CURRENT_STATUS_GET_DEVICE_STATE_BY_ID;
else if (strncmp(cmd, "gssf", 4) == 0)
g_menu_state = CURRENT_STATUS_GET_SUPPORTED_SAMPLE_FORMATS;
g_print("gx. Get Max Volume \t");
g_print("gv. Get Volume \t");
g_print("sv. Set Volume \n");
- g_print("gt. Get Current Sound Type \n");
+ g_print("gt. Get Current Sound Type \t");
+ g_print("gm. *Get Mute \t");
+ g_print("sm. *Set Mute \n");
g_print("av. Add Volume Changed CB \t");
g_print("rv. Remove Volume Changed CB \n");
#ifndef TIZEN_FEATURE_TV_PROD
g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
else if (g_menu_state == CURRENT_STATUS_GET_CURRENT_SOUND_TYPE)
g_print("*** press enter to get current sound type\n");
+ else if (g_menu_state == CURRENT_STATUS_SET_MUTE) {
+ if (flag == 0)
+ g_print("*** input sound type and desired mute state(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE, (0:unmute, 1:mute))\n");
+ flag = 1;
+ } else if (g_menu_state == CURRENT_STATUS_GET_MUTE)
+ g_print("*** input sound type(0:SYSTEM 1:NOTIFICATION 2:ALARM 3:RINGTONE 4:MEDIA 5:CALL 6:VOIP 7:VOICE)\n");
else if (g_menu_state == CURRENT_STATUS_ADD_VOLUME_CHANGED_CB)
g_print("*** press enter to add volume changed cb\n");
else if (g_menu_state == CURRENT_STATUS_REMOVE_VOLUME_CHANGED_CB)
reset_menu_state();
break;
}
+ case CURRENT_STATUS_SET_MUTE: {
+ static int cnt = 0;
+ static sound_type_e type;
+ bool mute = false;
+ switch (cnt) {
+ case 0:
+ if (convert_sound_type(&type, cmd) == 1)
+ cnt++;
+ else
+ reset_menu_state();
+ break;
+ case 1:
+ mute = (bool)atoi(cmd);
+ if (sound_manager_set_mute(type, mute) != SOUND_MANAGER_ERROR_NONE)
+ g_print("fail to set mute\n");
+ else
+ g_print("set mute success : sound type(%d), mute(%d)\n", type, mute);
+ cnt = 0;
+ reset_menu_state();
+ break;
+ default:
+ break;
+ }
+ break;
+ }
+ case CURRENT_STATUS_GET_MUTE: {
+ sound_type_e type;
+ bool muted;
+ if (convert_sound_type(&type, cmd) == 1) {
+ if (sound_manager_get_mute(type, &muted) != SOUND_MANAGER_ERROR_NONE)
+ g_print("fail to get mute\n");
+ else
+ g_print("get mute success : sound_type(%d), muted(%d)\n", type, muted);
+ }
+ reset_menu_state();
+ break;
+ }
case CURRENT_STATUS_ADD_VOLUME_CHANGED_CB: {
if (sound_manager_add_volume_changed_cb(_volume_changed_cb, NULL, &g_volume_cb_id) != SOUND_MANAGER_ERROR_NONE)
g_print("fail to add volume changed cb\n");