[TVWindow] Stubs
authorPiotr Czaja <p.czaja@samsung.com>
Fri, 12 Dec 2014 13:49:53 +0000 (14:49 +0100)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Wed, 4 Feb 2015 08:09:37 +0000 (09:09 +0100)
Change-Id: I729f6d26fdb493d757a04a797e20db51c3317e00
Signed-off-by: Piotr Czaja <p.czaja@samsung.com>
packaging/webapi-plugins.spec
src/tizen-wrt.gyp
src/tvwindow/tvwindow.gyp [new file with mode: 0644]
src/tvwindow/tvwindow_api.js [new file with mode: 0644]
src/tvwindow/tvwindow_extension.cc [new file with mode: 0644]
src/tvwindow/tvwindow_extension.h [new file with mode: 0644]
src/tvwindow/tvwindow_instance.cc [new file with mode: 0644]
src/tvwindow/tvwindow_instance.h [new file with mode: 0644]
src/tvwindow/tvwindow_manager.cc [new file with mode: 0644]
src/tvwindow/tvwindow_manager.h [new file with mode: 0644]

index 2f0ca5479299b9304e0f92124f7cd2b30b402d0e..39bcac566c372b71f20cfe757dcf1eb8a24e8058 100644 (file)
@@ -143,6 +143,7 @@ Source0:    %{name}-%{version}.tar.gz
 %define tizen_feature_wi_fi_support               0
 %define tizen_feature_tv_display_support          1
 %define tizen_feature_tvchannel_support           1
+%define tizen_feature_tvwindow_support            1
 
 %endif # tizen_profile_tv
 
@@ -232,6 +233,10 @@ Requires: sync-agent
 BuildRequires: pkgconfig(tvs-api)
 %endif
 
+%if 0%{?tizen_feature_tvwindow_support}
+BuildRequires: pkgconfig(tvs-api)
+%endif
+
 %if 0%{?tizen_feature_exif_support}
 BuildRequires:  pkgconfig(libexif)
 %endif
index a57d104106af7c46705dd7f295b51704ee076b5e..c7aa07526954f9592d99702b18c50fc67932a316 100644 (file)
@@ -49,6 +49,7 @@
               'tvaudio/tvaudio.gyp:*',
               'tvchannel/tvchannel.gyp:*',
               'tvinputdevice/tvinputdevice.gyp:*',
+              'tvwindow/tvwindow.gyp:*',
             ],
           },
         ], # end tv
diff --git a/src/tvwindow/tvwindow.gyp b/src/tvwindow/tvwindow.gyp
new file mode 100644 (file)
index 0000000..3e0619a
--- /dev/null
@@ -0,0 +1,31 @@
+{
+  'includes':[
+    '../common/common.gypi',
+  ],
+  'targets': [
+    {
+      'target_name': 'tizen_tvwindow',
+      'type': 'loadable_module',
+      'variables': {
+        'packages': [
+          'tvs-api',
+        ],
+      },
+      'dependencies': [
+        '../tizen/tizen.gyp:tizen',
+      ],
+      'includes': [
+        '../common/pkg-config.gypi',
+      ],
+      'sources': [
+        'tvwindow_api.js',
+        'tvwindow_extension.cc',
+        'tvwindow_extension.h',
+        'tvwindow_manager.cc',
+        'tvwindow_manager.h',
+        'tvwindow_instance.cc',
+        'tvwindow_instance.h',
+      ],
+    },
+  ],
+}
diff --git a/src/tvwindow/tvwindow_api.js b/src/tvwindow/tvwindow_api.js
new file mode 100644 (file)
index 0000000..fc90d38
--- /dev/null
@@ -0,0 +1,47 @@
+//Copyright (c) 2013 Intel Corporation. All rights reserved.
+//Use of this source code is governed by a BSD-style license that can be
+//found in the LICENSE file.
+
+extension.setMessageListener(function(msg) {
+
+});
+
+//TVWindowManager interface
+function TVWindowManager() {
+  if (!(this instanceof TVWindowManager)) {
+    throw new TypeError;
+  }
+}
+
+
+TVWindowManager.prototype.getAvailableWindows = function(successCallback, errorCallback)
+    {
+  return undefined;
+};
+
+TVWindowManager.prototype.setSource = function(videosource, successCallback, errorCallback, type)
+    {
+  return undefined;
+};
+
+TVWindowManager.prototype.getSource = function(type)
+    {
+  return undefined;
+};
+
+TVWindowManager.prototype.show = function(successCallback, errorCallback, rectangle, type)
+    {
+  return undefined;
+};
+
+TVWindowManager.prototype.hide = function(successCallback, errorCallback, type)
+    {
+  return undefined;
+};
+
+TVWindowManager.prototype.getRect = function(successCallback, errorCallback, unit, type)
+    {
+  return undefined;
+};
+
+exports = new TVWindowManager();
diff --git a/src/tvwindow/tvwindow_extension.cc b/src/tvwindow/tvwindow_extension.cc
new file mode 100644 (file)
index 0000000..ab42886
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (c) 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 "tvwindow/tvwindow_extension.h"
+#include "tvwindow/tvwindow_instance.h"
+
+// This will be generated from datasync_api.js.
+extern const char kSource_tvwindow_api[];
+
+namespace extension {
+namespace tvwindow {
+
+TVWindowExtension::TVWindowExtension() {
+  SetExtensionName("tizen.tvwindow");
+  SetJavaScriptAPI(kSource_tvwindow_api);
+}
+
+TVWindowExtension::~TVWindowExtension() {}
+
+TVWindowManager& TVWindowExtension::manager() {
+  // Initialize API on first request
+  return TVWindowManager::getInstance();
+}
+
+common::Instance* TVWindowExtension::CreateInstance() {
+  return new TVWindowInstance(*this);
+}
+
+}  // namespace tvwindow
+}  // namespace extension
+
+// entry point
+common::Extension* CreateExtension() {
+  return new extension::tvwindow::TVWindowExtension;
+}
diff --git a/src/tvwindow/tvwindow_extension.h b/src/tvwindow/tvwindow_extension.h
new file mode 100644 (file)
index 0000000..abdf270
--- /dev/null
@@ -0,0 +1,29 @@
+// Copyright (c) 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_TVWINDOW_TVWINDOW_EXTENSION_H_
+#define SRC_TVWINDOW_TVWINDOW_EXTENSION_H_
+
+#include "common/extension.h"
+#include "tvwindow/tvwindow_manager.h"
+
+namespace extension {
+namespace tvwindow {
+
+class TVWindowExtension : public common::Extension {
+ public:
+    TVWindowExtension();
+    virtual ~TVWindowExtension();
+
+    TVWindowManager& manager();
+
+ private:
+    // common::Extension implementation.
+    virtual common::Instance* CreateInstance();
+};
+
+}  // namespace tvwindow
+}  // namespace extension
+
+#endif  // SRC_TVWINDOW_TVWINDOW_EXTENSION_H_
diff --git a/src/tvwindow/tvwindow_instance.cc b/src/tvwindow/tvwindow_instance.cc
new file mode 100644 (file)
index 0000000..a526187
--- /dev/null
@@ -0,0 +1,35 @@
+// Copyright (c) 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 "tvwindow/tvwindow_instance.h"
+#include "common/logger.h"
+#include "tizen/tizen.h"
+#include "common/picojson.h"
+
+namespace extension {
+namespace tvwindow {
+
+TVWindowInstance::TVWindowInstance(TVWindowExtension const& extension) {
+    LOGD("Entered");
+}
+
+TVWindowInstance::~TVWindowInstance() {
+    LOGD("Entered");
+}
+
+void TVWindowInstance::HandleMessage(const char* msg) {
+    // this is stub, no async messages
+    LOGD("Entered");
+}
+
+void TVWindowInstance::HandleSyncMessage(const char* msg) {
+    LOGD("Entered %s", msg);
+    picojson::object answer;
+    answer["answer"] = picojson::value(true);
+
+    SendSyncReply(picojson::value(answer).serialize().c_str());
+}
+
+}  // namespace tvwindow
+}  // namespace extension
diff --git a/src/tvwindow/tvwindow_instance.h b/src/tvwindow/tvwindow_instance.h
new file mode 100644 (file)
index 0000000..058b3dc
--- /dev/null
@@ -0,0 +1,31 @@
+// Copyright (c) 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_TVWINDOW_TVWINDOW_INSTANCE_H_
+#define SRC_TVWINDOW_TVWINDOW_INSTANCE_H_
+
+#include <string>
+
+#include "common/extension.h"
+#include "common/picojson.h"
+
+#include "tvwindow/tvwindow_extension.h"
+
+namespace extension {
+namespace tvwindow {
+
+class TVWindowInstance : public common::ParsedInstance {
+ public:
+  explicit TVWindowInstance(TVWindowExtension const& extension);
+  virtual ~TVWindowInstance();
+
+ private:
+  virtual void HandleMessage(const char* msg);
+  virtual void HandleSyncMessage(const char* msg);
+};
+
+}  // namespace tvwindow
+}  // namespace extension
+
+#endif  // SRC_TVWINDOW_TVWINDOW_INSTANCE_H_
diff --git a/src/tvwindow/tvwindow_manager.cc b/src/tvwindow/tvwindow_manager.cc
new file mode 100644 (file)
index 0000000..64631d5
--- /dev/null
@@ -0,0 +1,19 @@
+// Copyright (c) 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 "tvwindow/tvwindow_manager.h"
+
+namespace extension {
+namespace tvwindow {
+
+TVWindowManager::TVWindowManager() {
+       LOGD("Enter");
+}
+
+TVWindowManager& TVWindowManager::getInstance() {
+    static TVWindowManager manager;
+    return manager;
+}
+}  // namespace tvwindow
+}  // namespace extension
diff --git a/src/tvwindow/tvwindow_manager.h b/src/tvwindow/tvwindow_manager.h
new file mode 100644 (file)
index 0000000..8185cdb
--- /dev/null
@@ -0,0 +1,28 @@
+// Copyright (c) 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_TVWINDOW_TVWINDOW_MANAGER_H_
+#define SRC_TVWINDOW_TVWINDOW_MANAGER_H_
+
+#include "common/logger.h"
+
+namespace extension {
+namespace tvwindow {
+
+class TVWindowManager {
+ public:
+    static TVWindowManager& getInstance();
+
+ private:
+    TVWindowManager();
+    // Not copyable, assignable, movable
+    TVWindowManager(TVWindowManager const&);
+    void operator=(TVWindowManager const&);
+    TVWindowManager(TVWindowManager &&);
+};
+
+}  // namespace tvwindow
+}  // namespace extension
+
+#endif  // SRC_TVWINDOW_TVWINDOW_MANAGER_H_