[Device] Code structure changed to match cordova architecture.
authorPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 7 Apr 2016 11:22:24 +0000 (13:22 +0200)
committerPawel Andruszkiewicz <p.andruszkie@samsung.com>
Thu, 7 Apr 2016 11:24:23 +0000 (13:24 +0200)
Change-Id: I157d52bfb87d82eebd1c12ee618a81e6a0bee88d
Signed-off-by: Pawel Andruszkiewicz <p.andruszkie@samsung.com>
src/cordova-api.gyp
src/device/cordova_device.gyp [deleted file]
src/device/cordova_device_api.js [deleted file]
src/device/cordova_device_extension.cc [deleted file]
src/device/cordova_device_extension.h [deleted file]
src/lib/cordova_plugins.js
src/lib/plugins/cordova-plugin-device/tizen/Device.js [new file with mode: 0755]

index 0266c84ae382ec6169193af4e3bea4e77d06b201..e4e0e868886d7dea3e04d25b1b552dca8389bbc9 100644 (file)
@@ -9,7 +9,6 @@
       'type': 'none',
       'dependencies': [
         'cordova/cordova.gyp:*',
-        'device/cordova_device.gyp:*',
         'devicemotion/cordova_devicemotion.gyp:*',
         'dialog/cordova_dialog.gyp:*',
         'events/cordova_events.gyp:*',
diff --git a/src/device/cordova_device.gyp b/src/device/cordova_device.gyp
deleted file mode 100644 (file)
index b57f435..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-{
-  'includes':[
-    '/usr/include/webapi-plugins/src/common/common.gypi',
-  ],
-  'targets': [
-    {
-      'target_name': 'tizen_cordova_device',
-      'type': 'loadable_module',
-      'sources': [
-        'cordova_device_api.js',
-        'cordova_device_extension.cc',
-        'cordova_device_extension.h',
-      ],
-      'include_dirs': [
-        '../',
-        '<(SHARED_INTERMEDIATE_DIR)',
-      ],
-      'variables': {
-        'packages': [
-          'webapi-plugins',
-        ],
-      },
-    },
-  ],
-}
diff --git a/src/device/cordova_device_api.js b/src/device/cordova_device_api.js
deleted file mode 100755 (executable)
index b154467..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-// TODO: remove when added to public cordova repository -> begin
-var plugin_name = 'cordova-plugin-device.tizen.Device';
-
-cordova.define(plugin_name, function(require, exports, module) {
-// TODO: remove -> end
-
-function DeviceInfo() {
-  this.cordovaVersion = require('cordova/platform').cordovaVersion;
-  this.model = tizen.systeminfo.getCapability('http://tizen.org/system/model_name');
-  this.platform = tizen.systeminfo.getCapability('http://tizen.org/system/platform.name');
-  this.uuid = tizen.systeminfo.getCapability('http://tizen.org/system/tizenid');
-  this.version = tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version');
-  this.manufacturer = tizen.systeminfo.getCapability('http://tizen.org/system/manufacturer');
-  this.isVirtual = -1 !== this.model.toLowerCase().indexOf('emulator');
-  this.serial = this.uuid;
-}
-
-var di;
-
-exports = {
-  getDeviceInfo: function (success, error) {
-    if (!di) {
-      di = new DeviceInfo();
-    }
-    success({
-      cordova: di.cordovaVersion,
-      model: di.model,
-      platform: di.platform,
-      uuid: di.uuid,
-      version: di.version,
-      manufacturer: di.manufacturer,  // not documented, but required by tests
-      isVirtual: di.isVirtual,
-      serial: di.serial
-    });
-  }
-};
-
-require("cordova/exec/proxy").add("Device", exports);
-
-console.log('Loaded cordova.device API');
-
-// TODO: remove when added to public cordova repository -> begin
-});
-
-exports = function(require) {
-  require('cordova-tizen').addPlugin('cordova-plugin-device.device', plugin_name, 'runs');
-};
-// TODO: remove -> end
diff --git a/src/device/cordova_device_extension.cc b/src/device/cordova_device_extension.cc
deleted file mode 100755 (executable)
index 7287d0c..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#include "device/cordova_device_extension.h"
-
-// This will be generated from cordova_device_api.js
-extern const char kSource_cordova_device_api[];
-
-common::Extension* CreateExtension() {
-  return new extension::cordova::device::CordovaDeviceExtension();
-}
-
-namespace extension {
-namespace cordova {
-namespace device {
-
-CordovaDeviceExtension::CordovaDeviceExtension() {
-  SetExtensionName("tizen.cordova.device");
-  SetJavaScriptAPI(kSource_cordova_device_api);
-}
-
-CordovaDeviceExtension::~CordovaDeviceExtension() {}
-
-}  // device
-}  // cordova
-}  // extension
diff --git a/src/device/cordova_device_extension.h b/src/device/cordova_device_extension.h
deleted file mode 100755 (executable)
index 93a8072..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
- *
- *    Licensed under the Apache License, Version 2.0 (the "License");
- *    you may not use this file except in compliance with the License.
- *    You may obtain a copy of the License at
- *
- *        http://www.apache.org/licenses/LICENSE-2.0
- *
- *    Unless required by applicable law or agreed to in writing, software
- *    distributed under the License is distributed on an "AS IS" BASIS,
- *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *    See the License for the specific language governing permissions and
- *    limitations under the License.
- */
-
-#ifndef DEVICE_CORDOVA_DEVICE_EXTENSION_H_
-#define DEVICE_CORDOVA_DEVICE_EXTENSION_H_
-
-#include <common/extension.h>
-
-namespace extension {
-namespace cordova {
-namespace device {
-
-class CordovaDeviceExtension : public common::Extension {
- public:
-  CordovaDeviceExtension();
-  virtual ~CordovaDeviceExtension();
-};
-
-}  // device
-}  // cordova
-}  // extension
-
-#endif // DEVICE_CORDOVA_DEVICE_EXTENSION_H_
index 672cfbd5c999286fd27cf0400dd2bb499f7ed79a..f85b71202df33fee166a6a7774e36869b16b5850 100644 (file)
@@ -21,6 +21,11 @@ module.exports = [
             "device"
         ]
     },
+    {
+      "file": "plugins/cordova-plugin-device/tizen/Device.js",
+      "id": "cordova-plugin-device.tizen.Device",
+      "runs": true
+    },
     {
         "file": "plugins/cordova-plugin-device-motion/www/accelerometer.js",
         "id": "cordova-plugin-device-motion.Accelerometer",
diff --git a/src/lib/plugins/cordova-plugin-device/tizen/Device.js b/src/lib/plugins/cordova-plugin-device/tizen/Device.js
new file mode 100755 (executable)
index 0000000..34da27c
--- /dev/null
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2015 Samsung Electronics Co., Ltd All Rights Reserved
+ *
+ *    Licensed under the Apache License, Version 2.0 (the "License");
+ *    you may not use this file except in compliance with the License.
+ *    You may obtain a copy of the License at
+ *
+ *        http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *    Unless required by applicable law or agreed to in writing, software
+ *    distributed under the License is distributed on an "AS IS" BASIS,
+ *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *    See the License for the specific language governing permissions and
+ *    limitations under the License.
+ */
+
+// TODO: remove when added to public cordova repository -> begin
+var plugin_name = 'cordova-plugin-device.tizen.Device';
+
+cordova.define(plugin_name, function(require, exports, module) {
+// TODO: remove -> end
+
+function DeviceInfo() {
+  this.cordovaVersion = require('cordova/platform').cordovaVersion;
+  this.model = tizen.systeminfo.getCapability('http://tizen.org/system/model_name');
+  this.platform = tizen.systeminfo.getCapability('http://tizen.org/system/platform.name');
+  this.uuid = tizen.systeminfo.getCapability('http://tizen.org/system/tizenid');
+  this.version = tizen.systeminfo.getCapability('http://tizen.org/feature/platform.version');
+  this.manufacturer = tizen.systeminfo.getCapability('http://tizen.org/system/manufacturer');
+  this.isVirtual = -1 !== this.model.toLowerCase().indexOf('emulator');
+  this.serial = this.uuid;
+}
+
+var di;
+
+exports = {
+  getDeviceInfo: function (success, error) {
+    if (!di) {
+      di = new DeviceInfo();
+    }
+    success({
+      cordova: di.cordovaVersion,
+      model: di.model,
+      platform: di.platform,
+      uuid: di.uuid,
+      version: di.version,
+      manufacturer: di.manufacturer,  // not documented, but required by tests
+      isVirtual: di.isVirtual,
+      serial: di.serial
+    });
+  }
+};
+
+require("cordova/exec/proxy").add("Device", exports);
+
+console.log('Loaded cordova.device API');
+
+// TODO: remove when added to public cordova repository -> begin
+});
+// TODO: remove -> end