adding camera support
diff --git a/Res/index.html b/Res/index.html
index 012bf7a..e2ccb8a 100755
--- a/Res/index.html
+++ b/Res/index.html
@@ -2,8 +2,6 @@
 <html>

 	<head>

 		<title>PhoneGap Test App</title>

-		<script type="text/javascript" src="phonegap/phonegap.js"></script>

-		<script type="text/javascript" src="main.js"></script>

     <style type="text/css">

       div { text-align: "center"; display: "block"}

     </style>

@@ -11,6 +9,12 @@
 	<body>

 		 <h2>PhoneGap Sample</h2>

      <ul id="debuglist">Debug Output</ul>

+     <!-- Camera -->

+     <h3>Camera</h3>

+     <div>

+        <input onclick="getPicture()" type="submit" value="Camera.getPicture">

+        <img src="" id="picture" width="128">

+     </div>

      <!-- Geolocation -->

      <div>

        <h3>Geolocation</h3>

@@ -70,7 +74,7 @@
         <input onclick="removeContacts()" type="submit" value="Contact.remove">

      </div>

      <!-- Notification -->

-     <h3>Contact</h3>

+     <h3>Notification</h3>

      <div>

         <input onclick="notificationAlert()" type="submit" value="Notification.alert">

         <input onclick="notificationConfirm()" type="submit" value="Notification.confirm">

@@ -78,4 +82,6 @@
         <input onclick="notificationBeep()" type="submit" value="Notification.beep">

      </div>

 	</body>

+  <script type="text/javascript" src="phonegap/phonegap.js"></script>

+  <script type="text/javascript" src="main.js"></script>

 </html>

diff --git a/Res/main.js b/Res/main.js
index 826a4a4..542d493 100755
--- a/Res/main.js
+++ b/Res/main.js
@@ -348,3 +348,21 @@
     debugPrint(e.message);

   }

 }

+

+// Camera

+

+function getPicture() {

+  try {

+    var successCallback = function(uri) {

+      var image = document.getElementById("picture");

+      debugPrint(uri);

+      image.src = uri;

+    }

+    var errorCallback = function(message) {

+      debugPrint("Camera Failed: "+message);

+    }

+    navigator.camera.getPicture(successCallback, errorCallback, {});

+  } catch(e) {

+    debugPring(e.message);

+  }

+}

diff --git a/Res/mobile-spec/index.html b/Res/mobile-spec/index.html
index 86fbc3f..923d8e1 100755
--- a/Res/mobile-spec/index.html
+++ b/Res/mobile-spec/index.html
@@ -25,6 +25,7 @@
     <script type="text/javascript" src="tests/notification.tests.js"></script>
   </head>
     <body>
+       <ul id="debuglist">Debug Output</ul>
         <!--<ul id="debuglist">Debug Output</ul>-->
         <h1 id="qunit-header">PhoneGap API Spec</h1>
         <h2 id="qunit-banner"></h2>
diff --git a/Res/phonegap/camera.js b/Res/phonegap/camera.js
index ea4f23d..1566a5e 100644
--- a/Res/phonegap/camera.js
+++ b/Res/phonegap/camera.js
@@ -13,8 +13,6 @@
  * @constructor
  */
 Camera = function() {
-    this.successCallback = null;
-    this.errorCallback = null;
     this.options = null;
 };
 
@@ -71,8 +69,6 @@
         return;
     }
 
-    this.successCallback = successCallback;
-    this.errorCallback = errorCallback;
     this.options = options;
     var quality = 80;
     if (options.quality) {
@@ -86,7 +82,7 @@
     if (typeof this.options.sourceType == "number") {
         sourceType = this.options.sourceType;
     }
-    PhoneGap.exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType]);
+    PhoneGap.exec(successCallback, errorCallback, "com.phonegap.Camera", "getPicture", [quality, destinationType, sourceType]);
 };
 
 PhoneGap.addConstructor(function() {
diff --git a/Res/phonegap/phonegap.bat b/Res/phonegap/phonegap.bat
index 2a6952a..dbc92ea 100755
--- a/Res/phonegap/phonegap.bat
+++ b/Res/phonegap/phonegap.bat
@@ -1 +1 @@
-copy /B phonegap.base.js+geolocation.js+position.js+accelerometer.js+network.js+debugconsole.js+contact.js+device.js+compass.js+notification.js phonegap.js
+copy /B phonegap.base.js+geolocation.js+position.js+accelerometer.js+network.js+debugconsole.js+contact.js+device.js+compass.js+notification.js+camera.js phonegap.js
diff --git a/inc/Kamera.h b/inc/Kamera.h
new file mode 100755
index 0000000..aef22bd
--- /dev/null
+++ b/inc/Kamera.h
@@ -0,0 +1,31 @@
+/*

+ * Kamera.h

+ *

+ *  Created on: Apr 19, 2011

+ *      Author: Anis Kadri

+ */

+

+#ifndef KAMERA_H_

+#define KAMERA_H_

+

+#include "PhoneGapCommand.h"

+#include <FApp.h>

+#include <FIo.h>

+

+using namespace Osp::App;

+using namespace Osp::Base::Collection;

+using namespace Osp::Io;

+

+class Kamera: public PhoneGapCommand, IAppControlEventListener {

+public:

+	Kamera(Web* pWeb);

+	virtual ~Kamera();

+public:

+	String callbackId;

+public:

+	void Run(const String& command);

+	void GetPicture();

+	void OnAppControlCompleted (const String &appControlId, const String &operationId, const IList *pResultList);

+};

+

+#endif /* KAMERA_H_ */

diff --git a/inc/WebForm.h b/inc/WebForm.h
index 2cdad26..2afada6 100755
--- a/inc/WebForm.h
+++ b/inc/WebForm.h
@@ -15,6 +15,7 @@
 #include "Compass.h"

 #include "Contacts.h"

 #include "Notification.h"

+#include "Kamera.h"

 

 using namespace Osp::Base;

 using namespace Osp::Base::Collection;

@@ -50,6 +51,7 @@
 	Compass*					compass;

 	Contacts*					contacts;

 	Notification*				notification;

+	Kamera*						camera;

 	String*						__phonegapCommand;

 

 public:

diff --git a/src/Kamera.cpp b/src/Kamera.cpp
new file mode 100755
index 0000000..5728803
--- /dev/null
+++ b/src/Kamera.cpp
@@ -0,0 +1,104 @@
+/*

+ * Kamera.cpp

+ *

+ *  Created on: Apr 19, 2011

+ *      Author: Anis Kadri

+ */

+

+#include "../inc/Kamera.h"

+

+Kamera::Kamera(Web* pWeb) : PhoneGapCommand(pWeb) {

+}

+

+Kamera::~Kamera() {

+}

+

+void

+Kamera::Run(const String& command) {

+	if(!command.IsEmpty()) {

+		Uri commandUri;

+		commandUri.SetUri(command);

+		String method = commandUri.GetHost();

+		StringTokenizer strTok(commandUri.GetPath(), L"/");

+		if(strTok.GetTokenCount() < 1) {

+			AppLogException("Not enough params");

+			return;

+		}

+		strTok.GetNextToken(callbackId);

+		if(method == "com.phonegap.Camera.getPicture" && !callbackId.IsEmpty()) {

+			GetPicture();

+		}

+	}

+}

+

+void

+Kamera::GetPicture() {

+	AppLogDebug("Taking picture");

+

+	ArrayList* pDataList = null;

+	pDataList = new ArrayList();

+	pDataList->Construct();

+

+	String* pData = null;

+	pData = new String(L"type:camera");

+	pDataList->Add(*pData);

+

+	AppControl* pAc = AppManager::FindAppControlN(APPCONTROL_CAMERA, OPERATION_CAPTURE);

+	if(pAc)

+	{

+	  pAc->Start(pDataList, this);

+	  delete pAc;

+	}

+	pDataList->RemoveAll(true);

+	delete pDataList;

+}

+

+void

+Kamera::OnAppControlCompleted (const String &appControlId, const String &operationId, const IList *pResultList) {

+	//This method is invoked when an application control callback event occurs.

+

+	String* pCaptureResult = null;

+	if (appControlId.Equals(APPCONTROL_CAMERA) && operationId.Equals(OPERATION_CAPTURE))

+	{

+	  pCaptureResult = (Osp::Base::String*)pResultList->GetAt(0);

+	  if (pCaptureResult->Equals(String(APPCONTROL_RESULT_SUCCEEDED)))

+	  {

+		String eval;

+		AppLog("Camera capture success.");

+		String* pCapturePath = (String*)pResultList->GetAt(1);

+

+		// copying to app Home Folder

+		String homeFilename;

+		homeFilename.Format(128, L"/Home/%S", File::GetFileName(*pCapturePath).GetPointer());

+		result r = File::Copy(*pCapturePath, homeFilename, true);

+

+		if(IsFailed(r)) {

+			AppLogException("Could not copy picture");

+			eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Could not copy picture')", callbackId.GetPointer());

+			AppLogDebug("%S", eval.GetPointer());

+			pWeb->EvaluateJavascriptN(eval);

+		}

+

+//		Uri imageUri;

+//		imageUri.setUri(homeFilename);

+		eval.Clear();

+		eval.Format(512, L"PhoneGap.callbacks['%S'].success('file://%S')", callbackId.GetPointer(), homeFilename.GetPointer());

+		AppLogDebug("%S", eval.GetPointer());

+		pWeb->EvaluateJavascriptN(eval);

+	  }

+	  else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_CANCELED)))

+	  {

+		AppLog("Camera capture canceled.");

+		String eval;

+		eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture canceled')", callbackId.GetPointer());

+		pWeb->EvaluateJavascriptN(eval);

+	  }

+	  else if (pCaptureResult->Equals(String(APPCONTROL_RESULT_FAILED)))

+	  {

+		AppLog("Camera capture failed.");

+		String eval;

+		eval.Format(512, L"PhoneGap.callbacks['%S'].fail('Camera capture failed')", callbackId.GetPointer());

+		pWeb->EvaluateJavascriptN(eval);

+	  }

+	}

+}

diff --git a/src/WebForm.cpp b/src/WebForm.cpp
index 6f543b6..84c5f59 100755
--- a/src/WebForm.cpp
+++ b/src/WebForm.cpp
@@ -35,8 +35,8 @@
 		goto CATCH;

 	}

 

-	//__pWeb->LoadUrl("file:///Res/index.html");

-	__pWeb->LoadUrl("file:///Res/mobile-spec/index.html");

+	__pWeb->LoadUrl("file:///Res/index.html");

+	//__pWeb->LoadUrl("file:///Res/mobile-spec/index.html");

 

 	return r;

 

@@ -58,6 +58,7 @@
 //	delete compass;

 //	delete contacts;

 //	delete notification;

+//	delete camera;

 	return r;

 }

 

@@ -111,8 +112,6 @@
 		AppLogDebug("Non PhoneGap command. External URL. Launching WebBrowser");

 		LaunchBrowser(url);

 		return false;

-	} else if(url.StartsWith("file:///", 0)) {

-		return false;

 	}

 

 	return false;

@@ -154,6 +153,9 @@
 		else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Notification", 0)) {

 			notification->Run(*__phonegapCommand);

 		}

+		else if(__phonegapCommand->StartsWith(L"gap://com.phonegap.Camera", 0)) {

+			camera->Run(*__phonegapCommand);

+		}

 		// Tell the JS code that we got this command, and we're ready for another

 		__pWeb->EvaluateJavascriptN(L"PhoneGap.queue.ready = true;");

 		delete __phonegapCommand;

@@ -199,6 +201,7 @@
 		compass = new Compass(__pWeb);

 		contacts = new Contacts(__pWeb);

 		notification = new Notification(__pWeb);

+		camera = new Kamera(__pWeb);

 	}

 	return r;