incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [2/4] js commit: updating capture and camera to use common code
Date Wed, 09 May 2012 15:27:02 GMT
updating capture and camera to use common code


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/dc4219d9
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/dc4219d9
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/dc4219d9

Branch: refs/heads/master
Commit: dc4219d9df8ee32d2e7e3566ca10d63d4672db8a
Parents: caa733b
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Wed May 9 03:33:28 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Wed May 9 03:33:28 2012 -0700

----------------------------------------------------------------------
 lib/bada/exec.js                |    4 +++-
 lib/bada/platform.js            |    6 +++---
 lib/bada/plugin/bada/Camera.js  |    2 +-
 lib/bada/plugin/bada/Capture.js |   27 ++++++++++++++++++++++++++-
 4 files changed, 33 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/dc4219d9/lib/bada/exec.js
----------------------------------------------------------------------
diff --git a/lib/bada/exec.js b/lib/bada/exec.js
index d11505b..d83a793 100644
--- a/lib/bada/exec.js
+++ b/lib/bada/exec.js
@@ -3,7 +3,9 @@ var plugins = {
     "NetworkStatus": require('cordova/plugin/bada/NetworkStatus'),
     "Accelerometer": require('cordova/plugin/bada/Accelerometer'),
     "Notification": require('cordova/plugin/bada/Notification'),
-    "Compass": require('cordova/plugin/bada/Compass')
+    "Compass": require('cordova/plugin/bada/Compass'),
+    "Capture": require('cordova/plugin/bada/Capture'),
+    "Camera": require('cordova/plugin/bada/Camera')
 };
 
 module.exports = function(success, fail, service, action, args) {

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/dc4219d9/lib/bada/platform.js
----------------------------------------------------------------------
diff --git a/lib/bada/platform.js b/lib/bada/platform.js
index b4ee1c0..07443df 100644
--- a/lib/bada/platform.js
+++ b/lib/bada/platform.js
@@ -12,9 +12,9 @@ module.exports = {
                 device: {
                     path: "cordova/plugin/bada/device"
                 },
-                camera: {
-                    path: "cordova/plugin/bada/Camera"
-                },
+//                camera: {
+//                    path: "cordova/plugin/bada/Camera"
+//                },
                 capture: {
                     path: "cordova/plugin/bada/Capture"
                 }

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/dc4219d9/lib/bada/plugin/bada/Camera.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Camera.js b/lib/bada/plugin/bada/Camera.js
index 382f3ec..6722222 100644
--- a/lib/bada/plugin/bada/Camera.js
+++ b/lib/bada/plugin/bada/Camera.js
@@ -1,7 +1,7 @@
 module.exports = {
     _mainCamera: null,
     _cams: [],
-    getPicture: function(success, fail, cameraOptions) {
+    takePicture: function(success, fail, cameraOptions) {
         var dataList = [];
         dataList[0] = "type:camera";
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/dc4219d9/lib/bada/plugin/bada/Capture.js
----------------------------------------------------------------------
diff --git a/lib/bada/plugin/bada/Capture.js b/lib/bada/plugin/bada/Capture.js
index fb2dfc6..8d62db6 100644
--- a/lib/bada/plugin/bada/Capture.js
+++ b/lib/bada/plugin/bada/Capture.js
@@ -25,6 +25,31 @@ module.exports = {
         if(appcontrolobject) {
             appcontrolobject.start(dataList, function(cbtype, appControlId, operationId,
resultList) {
                 var i;
+                var pluginResult = [];
+                if(cbtype === "onAppControlCompleted") {
+                    for(i = 1 ; i < resultList.length ; i += 1) {
+                       if(resultList[i]) {
+                           //console.log("resultList[" + i + "] = " + resultList[i]);
+                           pluginResult.push( {fullPath: resultList[i]} );
+                       }
+                    }
+                    success(pluginResult);
+                } else {
+                    var error = {message: "An error occured while capturing image", code:
0};
+                    fail(error);
+                }
+            });
+        }
+    },
+    captureVideo: function(success, fail, options) {
+        var dataList = [];
+        dataList[0] = "type:camcorder";
+
+        var appcontrolobject = Osp.App.AppManager.findAppControl("osp.appcontrol.provider.camera",
"osp.appcontrol.operation.record");
+
+        if(appcontrolobject) {
+            appcontrolobject.start(dataList, function(cbtype, appControlId, operationId,
resultList) {
+                var i;
                 var mediaFiles = [];
                 if(cbtype === "onAppControlCompleted") {
                     for(i = 1 ; i < resultList.length ; i += 1) {
@@ -41,5 +66,5 @@ module.exports = {
             });
         }
 
-    },
+    }
 };


Mime
View raw message