From: Mariusz Polasinski Date: Thu, 18 Dec 2014 16:50:14 +0000 (+0100) Subject: [TVAudio] Stub X-Git-Tag: submit/tizen_tv/20150603.064601~1^2~678 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d39e39ca64f5fdbc2f8e692ed3ffdcff932dc781;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [TVAudio] Stub [Verification] Code complies without error Methods are visible in node Change-Id: Ibb807716c3890b7063a7a2eb36b028dd97a53bcf Signed-off-by: Mariusz Polasinski --- diff --git a/src/tizen-wrt.gyp b/src/tizen-wrt.gyp index 412d2714..05b25004 100644 --- a/src/tizen-wrt.gyp +++ b/src/tizen-wrt.gyp @@ -38,7 +38,7 @@ 'dependencies': [ 'tvdisplay/tvdisplay.gyp:*', # 'tvchannel/tvchannel.gyp:*', - # 'tvaudio/tvaudio.gyp:*', + 'tvaudio/tvaudio.gyp:*', ], }, ], # end tv diff --git a/src/tvaudio/tvaudio.gyp b/src/tvaudio/tvaudio.gyp index e69de29b..5d8f7230 100644 --- a/src/tvaudio/tvaudio.gyp +++ b/src/tvaudio/tvaudio.gyp @@ -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 index 00000000..c25ca866 --- /dev/null +++ b/src/tvaudio/tvaudio_api.js @@ -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 index 00000000..aa062704 --- /dev/null +++ b/src/tvaudio/tvaudio_extension.cc @@ -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 index 00000000..91fd9e2c --- /dev/null +++ b/src/tvaudio/tvaudio_extension.h @@ -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 index 00000000..9ff5d783 --- /dev/null +++ b/src/tvaudio/tvaudio_instance.cc @@ -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 index 00000000..1fefab5f --- /dev/null +++ b/src/tvaudio/tvaudio_instance.h @@ -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 index 00000000..2cc5e8d4 --- /dev/null +++ b/src/tvaudio/tvaudio_manager.cc @@ -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 index 00000000..77e7358d --- /dev/null +++ b/src/tvaudio/tvaudio_manager.h @@ -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_ +