Return-Path: X-Original-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Delivered-To: apmail-incubator-callback-commits-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9F61E9F76 for ; Wed, 9 May 2012 15:27:03 +0000 (UTC) Received: (qmail 48815 invoked by uid 500); 9 May 2012 15:27:03 -0000 Delivered-To: apmail-incubator-callback-commits-archive@incubator.apache.org Received: (qmail 48732 invoked by uid 500); 9 May 2012 15:27:03 -0000 Mailing-List: contact callback-commits-help@incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: callback-dev@incubator.apache.org Delivered-To: mailing list callback-commits@incubator.apache.org Received: (qmail 48715 invoked by uid 99); 9 May 2012 15:27:03 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 09 May 2012 15:27:03 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id EF050150ED; Wed, 9 May 2012 15:27:02 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: anis@apache.org To: callback-commits@incubator.apache.org X-Mailer: ASF-Git Admin Mailer Subject: [2/4] js commit: updating capture and camera to use common code Message-Id: <20120509152702.EF050150ED@tyr.zones.apache.org> Date: Wed, 9 May 2012 15:27:02 +0000 (UTC) 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 Authored: Wed May 9 03:33:28 2012 -0700 Committer: Anis Kadri 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 = { }); } - }, + } };