incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a...@apache.org
Subject [17/17] bada-wac commit: initial commit
Date Sat, 28 Apr 2012 00:27:55 GMT
initial commit


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

Branch: refs/heads/master
Commit: c0b08894b19393e2b334406363b01a2cb3481624
Parents: 
Author: Anis Kadri <anis.kadri@gmail.com>
Authored: Mon Apr 2 16:33:33 2012 -0700
Committer: Anis Kadri <anis.kadri@gmail.com>
Committed: Mon Apr 2 16:33:33 2012 -0700

----------------------------------------------------------------------
 .badaprj                   |    9 +++
 .project                   |   18 +++++++
 Icons/CordovaWAC_type3.png |  Bin 0 -> 4047 bytes
 Icons/CordovaWAC_type4.png |  Bin 0 -> 6768 bytes
 Icons/CordovaWAC_type5.png |  Bin 0 -> 6397 bytes
 Icons/Splash_type3.png     |  Bin 0 -> 75524 bytes
 Icons/Splash_type4.png     |  Bin 0 -> 161582 bytes
 Icons/Splash_type5.png     |  Bin 0 -> 59740 bytes
 Res/index.html             |   66 ++++++++++++++++++++++++
 Res/js/accelerometer.js    |   48 +++++++++++++++++
 Res/js/compass.js          |   34 ++++++++++++
 Res/js/connection.js       |   30 +++++++++++
 Res/js/device.js           |   68 +++++++++++++++++++++++++
 Res/js/sample.js           |  107 +++++++++++++++++++++++++++++++++++++++
 application.xml            |   30 +++++++++++
 manifest.xml               |   37 +++++++++++++
 16 files changed, 447 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/.badaprj
----------------------------------------------------------------------
diff --git a/.badaprj b/.badaprj
new file mode 100644
index 0000000..9c690ee
--- /dev/null
+++ b/.badaprj
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<bada>
+    <type>6</type>
+    <sdk>C:\bada\2.0.5</sdk>
+    <model>WaveWVGA</model>
+    <apiversioncheck>true</apiversioncheck>
+    <priviligecheck>false</priviligecheck>
+    <properties/>
+</bada>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/.project
----------------------------------------------------------------------
diff --git a/.project b/.project
new file mode 100644
index 0000000..8151b87
--- /dev/null
+++ b/.project
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>CordovaWAC</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>com.osp.jsdt.ide.badaJsBuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>com.osp.jsdt.ide.badaJsNature</nature>
+		<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
+	</natures>
+</projectDescription>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/CordovaWAC_type3.png
----------------------------------------------------------------------
diff --git a/Icons/CordovaWAC_type3.png b/Icons/CordovaWAC_type3.png
new file mode 100644
index 0000000..1b67a87
Binary files /dev/null and b/Icons/CordovaWAC_type3.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/CordovaWAC_type4.png
----------------------------------------------------------------------
diff --git a/Icons/CordovaWAC_type4.png b/Icons/CordovaWAC_type4.png
new file mode 100644
index 0000000..79a3d9b
Binary files /dev/null and b/Icons/CordovaWAC_type4.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/CordovaWAC_type5.png
----------------------------------------------------------------------
diff --git a/Icons/CordovaWAC_type5.png b/Icons/CordovaWAC_type5.png
new file mode 100644
index 0000000..8524c59
Binary files /dev/null and b/Icons/CordovaWAC_type5.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/Splash_type3.png
----------------------------------------------------------------------
diff --git a/Icons/Splash_type3.png b/Icons/Splash_type3.png
new file mode 100644
index 0000000..82d830c
Binary files /dev/null and b/Icons/Splash_type3.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/Splash_type4.png
----------------------------------------------------------------------
diff --git a/Icons/Splash_type4.png b/Icons/Splash_type4.png
new file mode 100644
index 0000000..7474959
Binary files /dev/null and b/Icons/Splash_type4.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Icons/Splash_type5.png
----------------------------------------------------------------------
diff --git a/Icons/Splash_type5.png b/Icons/Splash_type5.png
new file mode 100644
index 0000000..d238c8e
Binary files /dev/null and b/Icons/Splash_type5.png differ

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/index.html
----------------------------------------------------------------------
diff --git a/Res/index.html b/Res/index.html
new file mode 100644
index 0000000..4c8b5a8
--- /dev/null
+++ b/Res/index.html
@@ -0,0 +1,66 @@
+<!DOCTYPE html>
+<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en">
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta name="viewport" content="target-densitydpi=high-dpi, user-scalable=no" />
+<title>Cordova Sample</title>
+<link href="osp://webapp/css/style.css" rel="stylesheet" type="text/css" />
+<style type="text/css">
+button.btn {
+			color:#050;
+			font: bold 24px 'trebuchet ms',helvetica,sans-serif;
+			background-color:#fed;
+			width: 400px;
+			height: 100px;
+			border: 1px solid;
+			border-color: #696 #363 #363 #696;
+			/* filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0,StartColorStr='#ffffffff',EndColorStr='#ffeeddaa');
*/ 
+		  } 
+</style>
+<script type="text/javascript" src="osp://webapp/js/webapp_core.js"> </script>
+<script>
+/*
+	Osp.App.Application.addEventListener("initializing", function()
+	{
+		accelerometer.getCurrentAcceleration(null, null, null);
+		//Osp.Ui.init();
+		//appObj = new TestWeb();
+		//appObj.launch();
+	}, this);
+	
+	*/
+	document.addEventListener("deviceready", function(e) {alert('deviceready')});
+</script>
+</head>
+<body>
+	<ul>
+		<li>
+			<h3>Acceleration</h3>
+			<div>
+				<button type="button" class="btn" onclick="getCurrentAcceleration();">getCurrentAcceleration</button>
+			</div>
+			<div>
+				<button type="button" class="btn" id="accelBtn" onclick="toggleAcceleration();">watchAcceleration</button>
+			</div>
+			<div>
+				<span id="acceleration"></span>
+			</div>
+		</li>
+		<li>
+			<h3>Geolocation</h3>
+			<div>
+				<button type="button" class="btn" onclick="getCurrentPosition();">getCurrentPosition</button>
+			</div>
+			<div>
+				<button type="button" class="btn" id="geoBtn" onclick="togglePosition();">watchPosition</button>
+			</div>
+			<div>
+				<span id="geolocation"></span>
+			</div>
+		</li>
+	</ul>
+<script type="text/javascript" src="./js/accelerometer.js"></script>
+<script type="text/javascript" src="./js/device.js"></script>
+<script type="text/javascript" src="./js/sample.js"></script>
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/js/accelerometer.js
----------------------------------------------------------------------
diff --git a/Res/js/accelerometer.js b/Res/js/accelerometer.js
new file mode 100644
index 0000000..692a5b4
--- /dev/null
+++ b/Res/js/accelerometer.js
@@ -0,0 +1,48 @@
+function Acceleration(x, y, z) {
+	this.x = x;
+	this.y = y;
+	this.z = z;
+	this.timestamp = new Date().getTime();
+}
+
+navigator.accelerometer = {
+		getCurrentAcceleration: function(successCallback, errorCallback, options) {
+			var success = function(acceleration) {
+				console.log("accelermometer:getCurrentAcceleration:success");
+				var accel = new Acceleration(acceleration.xAxis, acceleration.yAxis, acceleration.zAxis);
+				successCallback(accel);
+			};
+			var error = function(err) {
+				console.log("accelermometer:getCurrentAcceleration:error");
+				switch(err.code) {
+				case err.TYPE_MISMATCH_ERR:
+					console.log("TYPE MISMATCH ERROR");
+					break;
+				}
+				
+				errorCallback(err);
+			};
+			deviceapis.accelerometer.getCurrentAcceleration(success, error);
+		},
+		watchAcceleration: function(successCallback, errorCallback, options) {
+			var success = function(acceleration) {
+				console.log("accelerometer:watchAcceleration:success");
+				var accel = new Acceleration(acceleration.xAxis, acceleration.yAxis, acceleration.zAxis);
+				successCallback(accel);
+			};
+			var error = function(err) {
+				console.log("accelerometer:watchAcceleration:error");
+				switch(err.code) {
+				case err.TYPE_MISMATCH_ERR:
+					break;
+				}
+				
+				errorCallback(err);
+			};
+			var watchID = deviceapis.accelerometer.watchAcceleration(success, error);
+			return watchID;
+		},
+		clearWatch: function(watchId) {
+			deviceapis.accelerometer.clearWatch(watchId);
+		}
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/js/compass.js
----------------------------------------------------------------------
diff --git a/Res/js/compass.js b/Res/js/compass.js
new file mode 100644
index 0000000..2bac4cc
--- /dev/null
+++ b/Res/js/compass.js
@@ -0,0 +1,34 @@
+function CompassHeading(magneticHeading, trueHeading, headingAccuracy, timestamp) {
+	this.magneticHeading = magneticHeading;
+	this.trueHeading = trueHeading;
+	this.headingAccuracy = headingAccuracy;
+	this.timestamp = timestamp;
+}
+
+navigator.compass = {
+		getCurrentHeading: function(compassSuccess, compassError, compassOptions) {
+			var success = function(orientation) {
+				var compassHeading = new CompassHeading(orientation.alpha);
+			};
+			var error = function(orientation) {
+				
+			};
+			if(deviceapis.orientation) {
+				deviceapis.orientation.getCurrentOrientation(success);
+			} else {
+				console.log("navigator.compass.getCurrentHeading", "Orientation not supported!");
+			}
+		},
+		watchHeading: function() {
+			
+		},
+		clearWatch : function() {
+			
+		},
+		watchHeadingFilter: function() {
+			
+		},
+		clearWatchFilter: function() {
+			
+		}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/js/connection.js
----------------------------------------------------------------------
diff --git a/Res/js/connection.js b/Res/js/connection.js
new file mode 100644
index 0000000..b6fed3f
--- /dev/null
+++ b/Res/js/connection.js
@@ -0,0 +1,30 @@
+Connection = {
+		UNKNOWN: "unknown",
+		ETHERNET: "ethernet",
+		WIFI: "wifi",
+		CELL_2G: "2g",
+		CELL_3G: "3g",
+		CELL_4G: "4g",
+		NONE: "none"
+};
+
+function NetworkConnection() {
+	var self = this;
+	var info = deviceapis.devicestatus;
+	
+	info.getPropertyValue(function(value) {
+		console.log("Device WiFi network status: "+value);
+		if(value == "connected") {
+			self.type = Connection.WIFI;
+		}
+	}, error, {aspect: "WiFiNetwork", property: "networkStatus"});
+	
+	info.getPropertyValue(function(value) {
+		console.log("Device Cellular network status: "+value);
+		if(value == "connected") {
+			self.type = Connection.WIFI;
+		}
+	}, error, {aspect: "CellularHardware", property: "status"});
+}
+
+var connection = new NetworkConnection();
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/js/device.js
----------------------------------------------------------------------
diff --git a/Res/js/device.js b/Res/js/device.js
new file mode 100644
index 0000000..d22d8e9
--- /dev/null
+++ b/Res/js/device.js
@@ -0,0 +1,68 @@
+function Device() {
+    this.name = "";
+    this.phonegap = "1.6.0";
+    this.platform = "";
+    this.uuid = "";
+    this.os_name = "";
+    this.os_version = "";
+    this.os_vendor = "";
+};
+
+var device;
+
+function fireDeviceReady() {
+	console.log("deviceready");
+	var e = document.createEvent("Events");
+	e.initEvent("deviceready");
+	document.dispatchEvent(e);
+}
+
+function setDeviceInfo() {
+	var info = deviceapis.devicestatus;
+	var properties = ["name", "uuid", "os_name", "os_vendor", "os_version"];
+	
+	device = new Device();
+	
+	var checkProperties = function() {
+		properties.pop();
+		if(properties.length == 0) {
+			fireDeviceReady();
+		}
+	};
+	
+	var error = function(error) {
+		console.log("Error while fetching "+error);
+	};
+	
+	info.getPropertyValue(function(value) {
+		console.log("Device IMEI: "+value);
+		device.uuid = value;
+		checkProperties();
+	}, error, {aspect: "Device", property: "imei"});
+	info.getPropertyValue(function(value) {
+		console.log("Device name: "+value);
+		device.name = value;
+		checkProperties();
+	}, error, {aspect: "Device", property: "version"});
+	info.getPropertyValue(function(value) {
+		console.log("OperatingSystem name: "+value);
+		device.os_name = value;
+		checkProperties();
+	}, error, {aspect: "OperatingSystem", property: "name"});
+	info.getPropertyValue(function(value) {
+		console.log("OperatingSystem version: "+value);
+		device.os_version = value;
+		checkProperties();
+	}, error, {aspect: "OperatingSystem", property: "version"});
+	info.getPropertyValue(function(value) {
+		console.log("OperatingSystem vendor: "+value);
+		device.os_vendor = value;
+		checkProperties();
+	}, error, {aspect: "OperatingSystem", property: "vendor"});
+};
+
+Osp.App.Application.addEventListener("initializing", function()
+{
+	console.log("initializing");
+	setDeviceInfo();
+}, this);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/Res/js/sample.js
----------------------------------------------------------------------
diff --git a/Res/js/sample.js b/Res/js/sample.js
new file mode 100644
index 0000000..639b3af
--- /dev/null
+++ b/Res/js/sample.js
@@ -0,0 +1,107 @@
+
+/*
+ * Acceleration
+ */
+var accelWatchID = null;
+
+function getCurrentAcceleration() {
+	var successCallback = function(acceleration) {
+		var accelEm = document.getElementById("acceleration");
+		accelEm.innerHTML = "X: "+acceleration.x + " Y: " + acceleration.y + " Z: " + acceleration.z;
+	};
+	
+	var errorCallback = function(error) {
+		console.log(error);
+		document.getElementById("acceleration").innerHTML = "ERROR";
+	};
+	navigator.accelerometer.getCurrentAcceleration(successCallback, errorCallback, null);
+}
+
+function toggleAcceleration() {
+	var accelBtn = document.getElementById("accelBtn");
+	if(accelBtn.innerHTML == "watchAcceleration") {
+		watchAcceleration();
+		accelBtn.innerHTML = "clearWatch";
+	} else {
+		clearAccelerationWatch();
+		accelBtn.innerHTML = "watchAcceleration";
+	}
+}
+
+function watchAcceleration() {
+	var successCallback = function(acceleration) {
+		console.log("watchAcceleration::successCallback");
+		var accelEm = document.getElementById("acceleration");
+		accelEm.innerHTML = "X: "+acceleration.x + " Y: " + acceleration.y + " Z: " + acceleration.z;
+	};
+	
+	var errorCallback = function(error) {
+		console.log(JSON.stringify(error));
+		document.getElementById("acceleration").innerHTML = "ERROR";
+	};
+	accelWatchID = navigator.accelerometer.watchAcceleration(successCallback, errorCallback,
null);
+	console.log("watchAcceleration "+accelWatchID);
+}
+function clearAccelerationWatch() {
+	if(accelWatchID != null) {
+		navigator.accelerometer.clearWatch(accelWatchID);
+		accelWatchID = null;
+		document.getElementById("acceleration").innerHTML = "";
+		console.log("clearAccelerationWatch");
+	}
+}
+
+/*
+ * Geolocation
+ */
+
+var geoWatchID = null;
+
+function getCurrentPosition() {
+	var successCallback = function(geolocation) {
+		var geoEm = document.getElementById("geolocation");
+		geoEm.innerHTML = "Latitude: "+geolocation.coords.latitude + " Longitude: " + geolocation.coords.longitude;
+	};
+	
+	var errorCallback = function(error) {
+		console.log(error);
+		var geoEm = document.getElementById("geolocation");
+		geoEm.innerHTML = "ERROR";
+	};
+	navigator.geolocation.getCurrentPosition(successCallback, errorCallback);
+}
+
+function togglePosition() {
+	var geoBtn = document.getElementById("geoBtn");
+	if(geoBtn.innerHTML == "watchPosition") {
+		watchPosition();
+		geoBtn.innerHTML = "clearWatch";
+	} else {
+		clearPositionWatch();
+		geoBtn.innerHTML = "watchPosition";
+	}
+}
+
+function watchPosition() {
+	var successCallback = function(geolocation) {
+		console.log("watchPosition::successCallback");
+		var geoEm = document.getElementById("geolocation");
+		geoEm.innerHTML = "latitude: "+geolocation.coords.latitude + " longitude: " + geolocation.coords.longitude;
+	};
+	
+	var errorCallback = function(error) {
+		console.log(error);
+		var geoEm = document.getElementById("geolocation");
+		geoEm.innerHTML = "ERROR";
+	};
+	geoWatchID = navigator.geolocation.watchPosition(successCallback, errorCallback);
+	console.log("watchPosition "+geoWatchID);
+}
+function clearPositionWatch() {
+	if(geoWatchID != null) {
+		navigator.geolocation.clearWatch(geoWatchID);
+		geoWatchID = null;
+		document.getElementById("geolocation").innerHTML = "";
+		console.log("clearPositionWatch");
+	}
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/application.xml
----------------------------------------------------------------------
diff --git a/application.xml b/application.xml
new file mode 100644
index 0000000..9a905c1
--- /dev/null
+++ b/application.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<Application>
+    <Entry>CordovaWAC</Entry>
+    <Name>
+        <English>CordovaWAC</English>
+        <eng-GB>CordovaWAC</eng-GB>
+    </Name>
+    <Vendor/>
+    <Description/>
+    <Icons>
+        <MainMenu>CordovaWAC_type4.png<Type1/>
+            <Type2/>
+            <Type3>CordovaWAC_type3.png</Type3>
+            <Type4>CordovaWAC_type4.png</Type4>
+            <Type5>CordovaWAC_type5.png</Type5>
+        </MainMenu>
+        <Setting/>
+        <Ticker/>
+        <QuickPanel/>
+        <LaunchImage>Splash_type4.png<Type1/>
+            <Type2/>
+            <Type3>Splash_type3.png</Type3>
+            <Type4>Splash_type4.png</Type4>
+            <Type5>Splash_type5.png</Type5>
+        </LaunchImage>
+    </Icons>
+    <AutoScaling>
+        <Enabled>false</Enabled>
+    </AutoScaling>
+</Application>

http://git-wip-us.apache.org/repos/asf/incubator-cordova-bada-wac/blob/c0b08894/manifest.xml
----------------------------------------------------------------------
diff --git a/manifest.xml b/manifest.xml
new file mode 100644
index 0000000..76a674c
--- /dev/null
+++ b/manifest.xml
@@ -0,0 +1,37 @@
+<?xml version='1.0' ?>
+<Manifest>
+    <Id>texp59v0qj</Id>
+    <Secret>BC1078A6ABEBA3A60AA9DBDBA9A68869</Secret>
+  <AppVersion>2.0.0</AppVersion>
+  <ManifestVersion>1.2</ManifestVersion>
+  <AppType>WebApp</AppType>
+    <Privileges>
+        <Privilege>
+            <Name>CALENDARBOOK</Name>
+        </Privilege>
+        <Privilege>
+            <Name>CAMERA</Name>
+        </Privilege>
+        <Privilege>
+            <Name>RECORDING</Name>
+        </Privilege>
+        <Privilege>
+            <Name>ADDRESSBOOK</Name>
+        </Privilege>
+        <Privilege>
+            <Name>SYSTEM_SERVICE</Name>
+        </Privilege>
+        <Privilege>
+            <Name>TELEPHONY</Name>
+        </Privilege>
+        <Privilege>
+            <Name>MESSAGING</Name>
+        </Privilege>
+        <Privilege>
+            <Name>WEB_SERVICE</Name>
+        </Privilege>
+    </Privileges>
+    <DeviceProfile>
+        <APIVersion>2.0</APIVersion>
+    </DeviceProfile>
+</Manifest>
\ No newline at end of file


Mime
View raw message