[TVAudio] Stub
authorMariusz Polasinski <m.polasinski@samsung.com>
Thu, 18 Dec 2014 16:50:14 +0000 (17:50 +0100)
committerJerzy Pabich <j.pabich@samsung.com>
Wed, 7 Jan 2015 11:47:41 +0000 (20:47 +0900)
[Verification]
Code complies without error
Methods are visible in node

Change-Id: Ibb807716c3890b7063a7a2eb36b028dd97a53bcf
Signed-off-by: Mariusz Polasinski <m.polasinski@samsung.com>
src/tizen-wrt.gyp
src/tvaudio/tvaudio.gyp
src/tvaudio/tvaudio_api.js [new file with mode: 0644]
src/tvaudio/tvaudio_extension.cc [new file with mode: 0644]
src/tvaudio/tvaudio_extension.h [new file with mode: 0644]
src/tvaudio/tvaudio_instance.cc [new file with mode: 0644]
src/tvaudio/tvaudio_instance.h [new file with mode: 0644]
src/tvaudio/tvaudio_manager.cc [new file with mode: 0755]
src/tvaudio/tvaudio_manager.h [new file with mode: 0755]

index 412d2714fa89c57286738ee2331381d3f25329d6..05b25004dde8f40f7c4f5f507743c52296843b3f 100644 (file)
@@ -38,7 +38,7 @@
             'dependencies': [
               'tvdisplay/tvdisplay.gyp:*',
               # 'tvchannel/tvchannel.gyp:*',
-              'tvaudio/tvaudio.gyp:*',
+              'tvaudio/tvaudio.gyp:*',
             ],
           },
         ], # end tv
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..5d8f7230f10ffc729c4fa038133adcfd5858f72a 100644 (file)
@@ -0,0 +1,34 @@
+{
+  'includes':[
+    '../common/common.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'tizen_tvaudio',
+      'type': 'loadable_module',
+      'sources': [
+        'tvaudio_api.js',
+        'tvaudio_extension.cc',
+        'tvaudio_extension.h',
+        'tvaudio_instance.cc',
+        'tvaudio_instance.h',
+        'tvaudio_manager.cc',
+        'tvaudio_manager.h'
+      ],
+      'includes': [
+        '../common/pkg-config.gypi',
+      ],
+      'conditions': [
+        ['tizen == 1', {
+          'variables': {
+            'packages': [
+              'glib-2.0',
+              'libavoc',
+              'capi-media-audio-io',
+            ]
+          },
+        }],
+      ],
+    },
+  ],
+}
diff --git a/src/tvaudio/tvaudio_api.js b/src/tvaudio/tvaudio_api.js
new file mode 100644 (file)
index 0000000..c25ca86
--- /dev/null
@@ -0,0 +1,100 @@
+/* global xwalk, extension, tizen */
+
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+
+
+/**
+ * This class provides access to the API functionalities through the tizen.tvaudiocontrol interface.
+ * @constructor
+ */
+function AudioControlManager() {
+  if (!(this instanceof AudioControlManager)) {
+    throw new TypeError;
+  }
+}
+
+
+/**
+ * Turns on or off the silent mode.
+ * @param {!boolean} mute  The mute state
+ *     (true = turn on the silent mode, false = turn off the silent mode)
+ */
+AudioControlManager.prototype.setMute = function(mute) {
+  return undefined;
+};
+
+
+/**
+ * Gets the mute state.
+ */
+AudioControlManager.prototype.isMute = function() {
+  return undefined;
+};
+
+
+/**
+ * Changes the volume level.
+ * @param {!number} volume The value of volume
+ *     (the available volume range is 0 ~ 100)
+ */
+AudioControlManager.prototype.setVolume = function(volume) {
+  return undefined;
+};
+
+
+/**
+ * Increases the volume by 1 level.
+ */
+AudioControlManager.prototype.setVolumeUp = function() {
+  return undefined;
+};
+
+
+/**
+ * Decreases the volume by 1 level.
+ */
+AudioControlManager.prototype.setVolumeDown = function() {
+  return undefined;
+};
+
+
+/**
+ * Gets the current volume level.
+ * @return {number} The current volume (the volume range is 0 ~ 100)
+ */
+AudioControlManager.prototype.getVolume = function() {
+  return undefined;
+};
+
+
+/**
+ * Registers a volume change callback for getting notified when TV volume has been changed.
+ * @param {!function} listener The method to invoke when the volume has been changed.
+ */
+AudioControlManager.prototype.setVolumeChangeListener = function(listener) {
+  return undefined;
+};
+
+
+/**
+ * Unregisters the volume change callback for detecting the volume changes.
+ */
+AudioControlManager.prototype.unsetVolumeChangeListener = function() {
+  return undefined;
+};
+
+
+/**
+ * Gets the current audio output mode.
+ * @return {AudioOutputMode} The current audio output mode
+ */
+AudioControlManager.prototype.getOutputMode = function() {
+  return undefined;
+};
+
+
+// Exports
+exports = new AudioControlManager();
diff --git a/src/tvaudio/tvaudio_extension.cc b/src/tvaudio/tvaudio_extension.cc
new file mode 100644 (file)
index 0000000..aa06270
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tvaudio/tvaudio_extension.h"
+#include "tvaudio/tvaudio_instance.h"
+
+// This will be generated from tvaudio_api.js
+extern const char kSource_tvaudio_api[];
+
+namespace extension {
+namespace tvaudio {
+
+TVAudioExtension::TVAudioExtension() {
+    SetExtensionName("tizen.tvaudio");
+    SetJavaScriptAPI(kSource_tvaudio_api);
+}
+
+TVAudioExtension::~TVAudioExtension() {}
+
+AudioControlManager& TVAudioExtension::manager() {
+    // Initialize API on first request
+    return AudioControlManager::getInstance();
+}
+
+common::Instance* TVAudioExtension::CreateInstance() {
+    return new TVAudioInstance;
+}
+
+}  // namespace tvaudio
+}  // namespace extension
+
+common::Extension* CreateExtension() {
+    return new extension::tvaudio::TVAudioExtension;
+}
diff --git a/src/tvaudio/tvaudio_extension.h b/src/tvaudio/tvaudio_extension.h
new file mode 100644 (file)
index 0000000..91fd9e2
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SRC_TVAUDIO_TVAUDIO_EXTENSION_H_
+#define SRC_TVAUDIO_TVAUDIO_EXTENSION_H_
+
+#include "common/extension.h"
+#include "tvaudio/tvaudio_manager.h"
+
+namespace extension {
+namespace tvaudio {
+
+class TVAudioExtension : public common::Extension {
+ public:
+    TVAudioExtension();
+    virtual ~TVAudioExtension();
+
+    AudioControlManager& manager();
+
+ private:
+    virtual common::Instance* CreateInstance();
+};
+
+}  // namespace tvaudio
+}  // namespace extension
+
+#endif  // SRC_TVAUDIO_TVAUDIO_EXTENSION_H_
+
diff --git a/src/tvaudio/tvaudio_instance.cc b/src/tvaudio/tvaudio_instance.cc
new file mode 100644 (file)
index 0000000..9ff5d78
--- /dev/null
@@ -0,0 +1,15 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tvaudio/tvaudio_instance.h"
+
+namespace extension {
+namespace tvaudio {
+
+TVAudioInstance::TVAudioInstance() {}
+
+TVAudioInstance::~TVAudioInstance() {}
+
+}  // namespace tvaudio
+}  // namespace extension
diff --git a/src/tvaudio/tvaudio_instance.h b/src/tvaudio/tvaudio_instance.h
new file mode 100644 (file)
index 0000000..1fefab5
--- /dev/null
@@ -0,0 +1,22 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SRC_TVAUDIO_TVAUDIO_INSTANCE_H_
+#define SRC_TVAUDIO_TVAUDIO_INSTANCE_H_
+
+#include "common/extension.h"
+
+namespace extension {
+namespace tvaudio {
+
+class TVAudioInstance : public common::ParsedInstance {
+ public:
+    TVAudioInstance();
+    virtual ~TVAudioInstance();
+};
+
+}  // namespace tvaudio
+}  // namespace extension
+
+#endif  // SRC_TVAUDIO_TVAUDIO_INSTANCE_H_
diff --git a/src/tvaudio/tvaudio_manager.cc b/src/tvaudio/tvaudio_manager.cc
new file mode 100755 (executable)
index 0000000..2cc5e8d
--- /dev/null
@@ -0,0 +1,23 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "tvaudio/tvaudio_manager.h"
+
+namespace extension {
+namespace tvaudio {
+
+AudioControlManager::AudioControlManager() {
+}
+
+AudioControlManager::~AudioControlManager() {
+}
+
+AudioControlManager& AudioControlManager::getInstance() {
+  static AudioControlManager instance;
+  return instance;
+}
+
+}  // namespace tvaudio
+}  // namespace extension
+
diff --git a/src/tvaudio/tvaudio_manager.h b/src/tvaudio/tvaudio_manager.h
new file mode 100755 (executable)
index 0000000..77e7358
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright 2014 Samsung Electronics Co, Ltd. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef SRC_TVAUDIO_TVAUDIO_MANAGER_H_
+#define SRC_TVAUDIO_TVAUDIO_MANAGER_H_
+
+namespace extension {
+namespace tvaudio {
+
+class AudioControlManager {
+ public:
+    // Not copyable, assignable, movable
+    AudioControlManager(AudioControlManager const&) = delete;
+    void operator=(AudioControlManager const&) = delete;
+    AudioControlManager(AudioControlManager &&) = delete;
+
+    static AudioControlManager& getInstance();
+ private:
+    AudioControlManager();
+    virtual ~AudioControlManager();
+};
+
+}  // namespace tvaudio
+}  // namespace extension
+
+#endif  // SRC_TVAUDIO_TVAUDIO_MANAGER_H_
+