#include <stdlib.h>
#include <sound_manager.h>
-#include <sound_manager_private.h>
#include <sound_manager_internal.h>
#include <mm_sound.h>
#include <pthread.h>
}
/* 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,
+void _get_device_props_simple(sound_device_h device, int *id, const char **type, char **name,
const char **direc, const char **state, int *vendor_id, int *product_id, bool *is_running)
{
int ret;
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);
+ *type = g_device_type_str[_type];
if ((ret = sound_manager_get_device_id(device, id)))
g_print("failed to get device id, ret[0x%x]\n", ret);
int id = -1;
int vendor_id = -1;
int product_id = -1;
- char *type, *name;
- const char *direc, *state;
+ char *name;
+ const char *type, *direc, *state;
bool is_running = false;
int ret;
sound_device_type_e device_type;
if (ret)
g_print("fail to sound_manager_get_current_media_playback_device_type, ret(0x%x)\n", ret);
else
- g_print("current media playback device type is [%d] (0:BuiltinSPK 1:BuiltinRcv 2:BuiltinMic 3:AudioJack 4:BTMedia 5:HDMI 6:Forwarding 7:USBAduio 8:BTVoice)\n", device_type);
+ g_print("current media playback device type is [%s]\n", g_device_type_str[device_type]);
}
void _device_running_changed_cb(sound_device_h device, bool is_running, void *user_data)
int id = -1;
int vendor_id = -1;
int product_id = -1;
- char *type, *name;
- const char *direc, *_state;
+ char *name;
+ const char *type, *direc, *state;
bool _is_running = false;
- _get_device_props_simple(device, &id, &type, &name, &direc, &_state, &vendor_id, &product_id, &_is_running);
+ _get_device_props_simple(device, &id, &type, &name, &direc, &state, &vendor_id, &product_id, &_is_running);
g_print("[Device #%d %s %s] running changed to [ %d ]\n", id, type, name, is_running);
g_print(" Direc[ %-4s ] State[ %-12s ] Running[ %d ] VendorID[ %04x ], ProductID[ %04x ]\n",
- direc, _state, _is_running, vendor_id, product_id);
+ direc, state, _is_running, vendor_id, product_id);
}
void reset_menu_state(void)
int id = -1;
int vendor_id = -1;
int product_id = -1;
- char *type;
char *name;
+ const char *type;
const char *direc;
const char *state;
bool is_running;
if ((ret = sound_manager_is_device_running(g_device, &is_running)))
g_print("failed to get device state, ret[0x%x]\n", ret);
if (!ret)
- g_print("-- NEXT device type[%d], io_direction[%d], id[%d], name[%s], state[%s]\n",
- type, io_direction, id, name, is_running ? "Running" : "Not running");
+ g_print("-- NEXT device type[%s], io_direction[%d], id[%d], name[%s], state[%s]\n",
+ g_device_type_str[type], io_direction, id, name, is_running ? "Running" : "Not running");
} else {
g_print("failed to get next device, ret[0x%x]\n", ret);
g_device = NULL;
if ((ret = sound_manager_is_device_running(g_device, &is_running)))
g_print("failed to get device state, ret[0x%x]\n", ret);
if (!ret)
- g_print("-- PREV device type[%d], io_direction[%d], id[%d], name[%s], state[%s]\n",
- type, io_direction, id, name, is_running ? "Running" : "Not running");
+ g_print("-- PREV device type[%s], io_direction[%d], id[%d], name[%s], state[%s]\n",
+ g_device_type_str[type], io_direction, id, name, is_running ? "Running" : "Not running");
} else {
g_print("failed to get previous device, ret[0x%x]\n", ret);
}
if (ret)
g_print("fail to sound_manager_get_current_media_playback_device_type, ret(0x%x)\n", ret);
else
- g_print("device_type(%d)\n", device_type);
+ g_print("device type is [%s]\n", g_device_type_str[device_type]);
reset_menu_state();
break;