Add TV BT device when current device list query 22/170922/1
authorSeungbae Shin <seungbae.shin@samsung.com>
Wed, 10 Jan 2018 12:58:07 +0000 (21:58 +0900)
committerSeungbae Shin <seungbae.shin@samsung.com>
Fri, 23 Feb 2018 07:35:38 +0000 (16:35 +0900)
[Version] 0.12.9
[Profile] TV
[Issue Type] Bug

Change-Id: I74998313adbd54ac99094a1f68f34e983723d767

mm_sound_proxy.c
packaging/libmm-sound.spec

index be5aec6..5ca029b 100644 (file)
@@ -1,6 +1,10 @@
 #include <stdint.h>
 #include <glib.h>
 
+#ifdef TIZEN_TV
+#include <vconf.h>
+#endif
+
 #include <mm_error.h>
 #include <mm_debug.h>
 
@@ -354,6 +358,41 @@ cleanup:
        return ret;
 }
 
+#ifdef TIZEN_TV
+#define _VCONF_KEY_SOUND_SPEAKER_SELECTION "file/private/sound/feature/SpeakerSelection"
+#define _AUDIO_TV_OUTPUT_BT_HEADSET 5
+
+static mm_sound_device_t* _get_tv_bt_device(void)
+{
+       int speaker_value = 0;
+       mm_sound_device_t* device_item = NULL;
+
+       if (vconf_get_int(_VCONF_KEY_SOUND_SPEAKER_SELECTION, &speaker_value) == VCONF_ERROR) {
+               debug_error("vconf_get_int(%s) failed..", _VCONF_KEY_SOUND_SPEAKER_SELECTION);
+               return NULL;
+       }
+
+       debug_warning("speaker selection value = %d", speaker_value);
+       if (speaker_value != _AUDIO_TV_OUTPUT_BT_HEADSET)
+               return NULL;
+
+       device_item = g_malloc0(sizeof(mm_sound_device_t));
+       if (!device_item)
+               return NULL;
+
+       MMSOUND_STRNCPY(device_item->name, "BluetoothMedia", MAX_DEVICE_NAME_NUM);
+       MMSOUND_STRNCPY(device_item->type, "bt-a2dp", MAX_DEVICE_TYPE_STR_LEN);
+       device_item->id = 99;
+       device_item->io_direction = DEVICE_IO_DIRECTION_OUT;
+       device_item->state = DEVICE_STATE_ACTIVATED;
+       device_item->vendor_id = -1;
+       device_item->product_id = -1;
+       device_item->stream_num = -1;
+
+       return device_item;
+}
+#endif /* TIZEN_TV */
+
 int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** device_list)
 {
        int ret = MM_ERROR_NONE;
@@ -404,6 +443,17 @@ int mm_sound_proxy_get_current_connected_device_list(int device_flags, GList** d
                }
        }
 
+
+#ifdef TIZEN_TV
+       device_item = _get_tv_bt_device();
+       if (device_item) {
+               *device_list = g_list_append(*device_list, device_item);
+               debug_msg("Added TV bt device id(%d) type(%17s) direction(%d) state(%d) name(%s) vendor-id(%04x) product-id(%04x)",
+                                       device_item->id, device_item->type, device_item->io_direction, device_item->state,
+                                       device_item->name, device_item->vendor_id, device_item->product_id);
+       }
+#endif /* TIZEN_TV */
+
 cleanup:
        if (result)
                g_variant_unref(result);
index 0afbbb6..8ddeecd 100644 (file)
@@ -1,6 +1,6 @@
 Name:       libmm-sound
 Summary:    MMSound Package contains client lib and sound_server binary
-Version:    0.12.8
+Version:    0.12.9
 Release:    0
 Group:      System/Libraries
 License:    Apache-2.0