You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by pu...@apache.org on 2012/08/17 21:31:16 UTC

[5/5] Rename away

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/CaptureProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/CaptureProxy.js b/lib/windows8/plugin/windows8/CaptureProxy.js
new file mode 100644
index 0000000..34a2e33
--- /dev/null
+++ b/lib/windows8/plugin/windows8/CaptureProxy.js
@@ -0,0 +1,134 @@
+var MediaFile = require('cordova/plugin/MediaFile');
+var CaptureError = require('cordova/plugin/CaptureError');
+var CaptureAudioOptions = require('cordova/plugin/CaptureAudioOptions');
+var CaptureImageOptions = require('cordova/plugin/CaptureImageOptions');
+var CaptureVideoOptions = require('cordova/plugin/CaptureVideoOptions');
+var MediaFileData = require('cordova/plugin/MediaFileData');
+
+module.exports = {
+    
+    // No UI support. The duration of the audio recording.
+    cameraCaptureAudioDuration: null,
+
+    captureAudio:function(successCallback, errorCallback, options) {
+		var options = options[0];
+        var audioOptions = new CaptureAudioOptions();
+        if (options.duration && options.duration > 0) {
+            audioOptions.duration = options.duration;
+            cameraCaptureAudioDuration = audioOptions.duration;
+        } else {
+            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+            return;
+        }
+        var mediaCaputreSettings;
+        var initCaptureSettings = function () {
+            mediaCaputreSettings = null;
+            mediaCaputreSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
+            mediaCaputreSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;
+        }
+        initCaptureSettings();
+        var mediaCapture = new Windows.Media.Capture.MediaCapture();
+        mediaCapture.initializeAsync(mediaCaputreSettings).done(function () {
+            Windows.Storage.KnownFolders.musicLibrary.createFileAsync("captureAudio.mp3", Windows.Storage.NameCollisionOption.generateUniqueName).then(function (storageFile) {
+                var mediaEncodingProfile = new Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
+                var stopRecord = function () {
+                    mediaCapture.stopRecordAsync().then(function (result) {
+                        storageFile.getBasicPropertiesAsync().then(function (basicProperties) {
+                            var results = [];
+                            results.push(new MediaFile(storageFile.name, storageFile.path, storageFile.contentType, basicProperties.dateModified, basicProperties.size));
+                            successCallback(results);
+                        }, function () {
+                            errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
+                        })
+                    }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
+                }
+                mediaCapture.startRecordToStorageFileAsync(mediaEncodingProfile, storageFile).then(function () {
+                    setTimeout(stopRecord, cameraCaptureAudioDuration * 1000);
+                }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
+            }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
+        })
+    },
+
+    captureImage:function (successCallback, errorCallback, options) {
+		var options = options[0];
+        var imageOptions = new CaptureImageOptions();
+        var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
+        cameraCaptureUI.photoSettings.allowCropping = true;
+        cameraCaptureUI.photoSettings.maxResolution = Windows.Media.Capture.CameraCaptureUIMaxPhotoResolution.highestAvailable;
+        cameraCaptureUI.photoSettings.format = Windows.Media.Capture.CameraCaptureUIPhotoFormat.jpeg;
+        cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.photo).then(function (file) {
+            file.moveAsync(Windows.Storage.KnownFolders.picturesLibrary, "cameraCaptureImage.jpg", Windows.Storage.NameCollisionOption.generateUniqueName).then(function () {
+                file.getBasicPropertiesAsync().then(function (basicProperties) {
+                    var results = [];
+                    results.push(new MediaFile(file.name, file.path, file.contentType, basicProperties.dateModified, basicProperties.size));
+                    successCallback(results);
+                }, function () {
+                    errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
+                })
+            }, function () {
+                errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
+            });
+        }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
+    },
+
+    captureVideo:function (successCallback, errorCallback, options) {
+		var options = options[0];
+        var videoOptions = new CaptureVideoOptions();
+        if (options.duration && options.duration > 0) {
+            videoOptions.duration = options.duration;
+        }
+        if (options.limit > 1) {
+            videoOptions.limit = options.limit;
+        }
+        var cameraCaptureUI = new Windows.Media.Capture.CameraCaptureUI();
+        cameraCaptureUI.videoSettings.allowTrimming = true;
+        cameraCaptureUI.videoSettings.format = Windows.Media.Capture.CameraCaptureUIVideoFormat.mp4;
+        cameraCaptureUI.videoSettings.maxDurationInSeconds = videoOptions.duration;
+        cameraCaptureUI.captureFileAsync(Windows.Media.Capture.CameraCaptureUIMode.video).then(function (file) {
+            file.moveAsync(Windows.Storage.KnownFolders.videosLibrary, "cameraCaptureVedio.mp4", Windows.Storage.NameCollisionOption.generateUniqueName).then(function () {
+                file.getBasicPropertiesAsync().then(function (basicProperties) {
+                    var results = [];
+                    results.push(new MediaFile(file.name, file.path, file.contentType, basicProperties.dateModified, basicProperties.size));
+                    successCallback(results);
+                }, function () {
+                    errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
+                })
+            }, function () {
+                errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES));
+            });
+        }, function () { errorCallback(new CaptureError(CaptureError.CAPTURE_NO_MEDIA_FILES)); })
+    
+    },
+	
+    getFormatData:function (successCallback, errorCallback, args) {
+	    var contentType = args[1];
+	    Windows.Storage.StorageFile.getFileFromPathAsync(args[0]).then(function (storageFile) {
+	            var mediaTypeFlag = String(contentType).split("/")[0].toLowerCase();
+	            if (mediaTypeFlag === "audio") {
+	                storageFile.properties.getMusicPropertiesAsync().then(function (audioProperties) {
+	                    successCallback(new MediaFileData(null, audioProperties.bitrate, 0, 0, audioProperties.duration / 1000));
+	                }, function () {
+	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+	                })
+	            }
+	            else if (mediaTypeFlag === "video") {
+	                storageFile.properties.getVideoPropertiesAsync().then(function (videoProperties) {
+	                    successCallback(new MediaFileData(null, videoProperties.bitrate, videoProperties.height, videoProperties.width, videoProperties.duration / 1000));
+	                }, function () {
+	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+	                })
+	            }
+	            else if (mediaTypeFlag === "image") {
+	                storageFile.properties.getImagePropertiesAsync().then(function (imageProperties) {
+	                    successCallback(new MediaFileData(null, 0, imageProperties.height, imageProperties.width, 0));
+	                }, function () {
+	                    errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+	                })
+	            }
+	            else { errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)) }
+	        }, function () {
+	            errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+	        }
+	    )
+	}
+}	

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/CompassProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/CompassProxy.js b/lib/windows8/plugin/windows8/CompassProxy.js
new file mode 100644
index 0000000..9be8ecd
--- /dev/null
+++ b/lib/windows8/plugin/windows8/CompassProxy.js
@@ -0,0 +1,41 @@
+/*global Windows:true */
+var cordova = require('cordova'),
+    CompassHeading = require('cordova/plugin/CompassHeading');
+
+
+module.exports = {
+
+    onReadingChanged:null,
+    getHeading:function(win,lose) {
+        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
+        if(!deviceCompass) {
+            setTimeout(function(){lose("Compass not available");},0);
+        }
+        else {
+
+            deviceCompass.reportInterval = Math.max(16,deviceCompass.minimumReportInterval);
+
+            this.onReadingChanged = function(e) {
+                var reading = e.reading;
+                var heading = new CompassHeading(reading.headingMagneticNorth, reading.headingTrueNorth);
+                win(heading);
+            };
+            deviceCompass.addEventListener("readingchanged",this.onReadingChanged);
+        }
+
+    },
+    stopHeading:function(win,lose) {
+        var deviceCompass = Windows.Devices.Sensors.Compass.getDefault();
+        if(!deviceCompass) {
+            setTimeout(function(){lose("Compass not available");},0);
+        }
+        else {
+
+            deviceCompass.removeEventListener("readingchanged",this.onReadingChanged);
+            this.onReadingChanged = null;
+            deviceCompass.reportInterval = 0;
+            win();
+        }
+
+    }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/DeviceProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/DeviceProxy.js b/lib/windows8/plugin/windows8/DeviceProxy.js
new file mode 100644
index 0000000..ffd9351
--- /dev/null
+++ b/lib/windows8/plugin/windows8/DeviceProxy.js
@@ -0,0 +1,12 @@
+var cordova = require('cordova');
+
+
+module.exports = {
+
+        getDeviceInfo:function(win,fail,args){
+            console.log("NativeProxy::getDeviceInfo");
+            setTimeout(function(){
+                win({platform:"windows8", version:"8", name:"TODO", uuid:"TODO", cordova:"2.0.1"});
+            },0);
+        }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/FileProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/FileProxy.js b/lib/windows8/plugin/windows8/FileProxy.js
new file mode 100644
index 0000000..9c2dade
--- /dev/null
+++ b/lib/windows8/plugin/windows8/FileProxy.js
@@ -0,0 +1,72 @@
+var cordova = require('cordova');
+
+
+module.exports = {
+
+    getFileMetaData:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    getMetadata:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    getParent:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    readAsText:function(win,fail,args) { // ["fileName","encoding"]
+        var fileName = args[0];
+        var encoding = args[1];
+    },
+    readAsDataURL:function(win,fail,args) { // ["fileName"]
+        var fileName = args[0];
+    },
+    getDirectory:function(win,fail,args) { // ["fullPath","path","options"]
+        var fullPath = args[0];
+        var path = args[1];
+        var options = args[2];
+    },
+    remove:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    removeRecursively:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    getFile:function(win,fail,args) { // ["fullPath","path","options"]
+        var fullPath = args[0];
+        var path = args[1];
+        var options = args[2];
+    },
+    readEntries:function(win,fail,args) { // ["fullPath"]
+        var fullPath = args[0];
+    },
+    write:function(win,fail,args) { // ["fileName","data","position"]
+        var fileName = args[0];
+        var data = args[1];
+        var position = args[2];
+    },
+    truncate:function(win,fail,args) { // ["fileName","size"]
+        var fileName = args[0];
+        var size = args[1];
+    },
+    copyTo:function(win,fail,args) { // ["fullPath","parent", "newName"]
+        var fullPath = args[0];
+        var parent = args[1];
+        var newName = args[2];
+    },
+    moveTo:function(win,fail,args) { // ["fullPath","parent", "newName"]
+        var fullPath = args[0];
+        var parent = args[1];
+        var newName = args[2];
+    },
+    tempFileSystem:null,
+    persistentFileSystem:null,
+    requestFileSystem:function(win,fail,args) { // ["type","size"]
+
+        var type = args[0];
+        var size = args[1];
+
+    },
+    resolveLocalFileSystemURI:function(win,fail,args) { // ["uri"]
+        var uri = args[0];
+    }
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/MediaFile.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/MediaFile.js b/lib/windows8/plugin/windows8/MediaFile.js
new file mode 100644
index 0000000..940886d
--- /dev/null
+++ b/lib/windows8/plugin/windows8/MediaFile.js
@@ -0,0 +1,42 @@
+var MediaFileData = require('cordova/plugin/MediaFileData');
+var CaptureError = require('cordova/plugin/CaptureError');
+
+module.exports = {
+
+    getFormatData: function (successCallback, errorCallback, args) {
+		Windows.Storage.StorageFile.getFileFromPathAsync(this.fullPath).then(
+			function (storageFile) {
+				var mediaTypeFlag = String(contentType).split("/")[0].toLowerCase();
+				if (mediaTypeFlag === "audio") {
+					storageFile.properties.getMusicPropertiesAsync().then(
+						function (audioProperties) {
+							successCallback(new MediaFileData(null, audioProperties.bitrate, 0, 0, audioProperties.duration / 1000));
+						}, function () {
+							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+						}
+					)
+				} else if (mediaTypeFlag === "video") {
+					storageFile.properties.getVideoPropertiesAsync().then(
+						function (videoProperties) {
+							successCallback(new MediaFileData(null, videoProperties.bitrate, videoProperties.height, videoProperties.width, videoProperties.duration / 1000));
+						}, function () {
+							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+						}
+					)
+				} else if (mediaTypeFlag === "image") {
+					storageFile.properties.getImagePropertiesAsync().then(
+						function (imageProperties) {
+							successCallback(new MediaFileData(null, 0, imageProperties.height, imageProperties.width, 0));
+						}, function () {
+							errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+						}
+					)
+				} else {
+					errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT))
+				}
+			}, function () {
+				errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT));
+			}
+		)
+    }
+}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/MediaProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/MediaProxy.js b/lib/windows8/plugin/windows8/MediaProxy.js
new file mode 100644
index 0000000..39de090
--- /dev/null
+++ b/lib/windows8/plugin/windows8/MediaProxy.js
@@ -0,0 +1,159 @@
+var cordova = require('cordova');
+
+module.exports = {
+    mediaCaptureMrg:null,
+
+    // Initiates the audio file
+    create:function(win, lose, args) {
+        var id = args[0];
+        var src = args[1];
+        var thisM = Media.get(id);
+        Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STARTING);
+
+        Media.prototype.node = null;
+
+        var fn = src.split('.').pop(); // gets the file extension
+        if (thisM.node === null) {
+            if (fn === 'mp3' || fn === 'wma' || fn === 'wma' ||
+                fn === 'cda' || fn === 'adx' || fn === 'wm' ||
+                fn === 'm3u' || fn === 'wmx') {
+                thisM.node = new Audio(src);
+                thisM.node.load();
+                var dur = thisM.node.duration;
+                if (isNaN(dur)) {
+                    dur = -1;
+                };
+                Media.onStatus(id, Media.MEDIA_DURATION, dur);
+            } else {
+                lose("Invalid file type");
+            }
+        }
+    },
+
+    // Start playing the audio
+    startPlayingAudio:function(win, lose, args) {
+        var id = args[0];
+        //var src = args[1];
+        //var options = args[2];
+        Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_RUNNING);
+
+        (Media.get(id)).node.play();
+    },
+
+    // Stops the playing audio
+    stopPlayingAudio:function(win, lose, args) {
+        var id = args[0];
+        try {
+            (Media.get(id)).node.pause();
+            (Media.get(id)).node.currentTime = 0;
+            Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_STOPPED);
+            win();
+        } catch (err) {
+            lose("Failed to stop: "+err);
+        };
+    },
+
+    // Seeks to the postion in the audio
+    seekToAudio:function(win, lose, args) {
+        var id = args[0];
+        var milliseconds = args[1];
+        try {
+            (Media.get(id)).node.currentTime = milliseconds / 1000;
+            win();
+        } catch (err) {
+            lose("Failed to seek: "+err);
+        };
+    },
+
+    // Pauses the playing audio
+    pausePlayingAudio:function(win, lose, args) {
+        var id = args[0];
+        var thisM = Media.get(id);
+        try {
+            thisM.node.pause();
+            Media.onStatus(id, Media.MEDIA_STATE, Media.MEDIA_PAUSED);
+        } catch (err) {
+            lose("Failed to pause: "+err);
+        }
+    },
+
+    // Gets current position in the audio
+    getCurrentPositionAudio:function(win, lose, args) {
+        var id = args[0];
+        try {
+            var p = (Media.get(id)).node.currentTime;
+            Media.onStatus(id, Media.MEDIA_POSITION, p);
+            win(p);
+        } catch (err) {
+            lose(err);
+        }
+    },
+
+    // Start recording audio
+    startRecordingAudio:function(win, lose, args) {
+        var id = args[0];
+        var src = args[1];
+        // Initialize device
+        Media.prototype.mediaCaptureMgr = null;
+        var thisM = (Media.get(id));
+        var captureInitSettings = new Windows.Media.Capture.MediaCaptureInitializationSettings();
+        captureInitSettings.streamingCaptureMode = Windows.Media.Capture.StreamingCaptureMode.audio;
+        thisM.mediaCaptureMgr = new Windows.Media.Capture.MediaCapture();
+        thisM.mediaCaptureMgr.addEventListener("failed", lose);
+
+        thisM.mediaCaptureMgr.initializeAsync(captureInitSettings).done(function (result) {
+            thisM.mediaCaptureMgr.addEventListener("recordlimitationexceeded", lose);
+            thisM.mediaCaptureMgr.addEventListener("failed", lose);
+        }, lose);
+        // Start recording
+        Windows.Storage.KnownFolders.musicLibrary.createFileAsync(src, Windows.Storage.CreationCollisionOption.replaceExisting).done(function (newFile) {
+            var storageFile = newFile;
+            var fileType = this.src.split('.').pop();
+            var encodingProfile = null;
+            switch (fileType) {
+                case 'm4a':
+                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createM4a(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
+                    break;
+                case 'mp3':
+                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createMp3(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
+                    break;
+                case 'wma':
+                    encodingProfile = Windows.Media.MediaProperties.MediaEncodingProfile.createWma(Windows.Media.MediaProperties.AudioEncodingQuality.auto);
+                    break;
+                default:
+                    lose("Invalid file type for record");
+                    break;
+            };
+            thisM.mediaCaptureMgr.startRecordToStorageFileAsync(encodingProfile, storageFile).done(win, lose);
+        }, lose);
+    },
+
+    // Stop recording audio
+    stopRecordingAudio:function(win, lose, args) {
+        var id = args[0];
+        var thisM = Media.get(id);
+        thisM.mediaCaptureMgr.stopRecordAsync().done(win, lose);
+    },
+
+    // Release the media object
+    release:function(win, lose, args) {
+        var id = args[0];
+        var thisM = Media.get(id);
+        try {
+            delete thisM.node;
+        } catch (err) {
+            lose("Failed to release: "+err);
+        }
+    },
+    setVolume:function(win, lose, args) {
+        var id = args[0];
+        var volume = args[1];
+        var thisM = Media.get(id);
+        thisM.volume = volume;
+    }
+
+    //    Still need code for Media.onStatus
+    //        Need to fire event when duration is looked up
+    //                                position is looked up
+    //                                media is stopped
+};

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/NetworkStatusProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/NetworkStatusProxy.js b/lib/windows8/plugin/windows8/NetworkStatusProxy.js
new file mode 100644
index 0000000..6916d0a
--- /dev/null
+++ b/lib/windows8/plugin/windows8/NetworkStatusProxy.js
@@ -0,0 +1,49 @@
+
+/*global Windows:true */
+
+var cordova = require('cordova');
+
+
+module.exports = {
+
+    getConnectionInfo:function(win,fail,args)
+    {
+        var winNetConn = Windows.Networking.Connectivity;
+        var networkInfo = winNetConn.NetworkInformation;
+        var networkCostInfo = winNetConn.NetworkCostType;
+        var networkConnectivityInfo = winNetConn.NetworkConnectivityLevel;
+        var networkAuthenticationInfo = winNetConn.NetworkAuthenticationType;
+        var networkEncryptionInfo = winNetConn.NetworkEncryptionType;
+
+        var profile = Windows.Networking.Connectivity.NetworkInformation.getInternetConnectionProfile();
+        if(profile) {
+        var conLevel = profile.getNetworkConnectivityLevel();
+
+        switch (conLevel) {
+            case Windows.Networking.Connectivity.NetworkConnectivityLevel.none:
+                break;
+            case Windows.Networking.Connectivity.NetworkConnectivityLevel.localAccess:
+                break;
+            case Windows.Networking.Connectivity.NetworkConnectivityLevel.internetAccess:
+                break;
+            case Windows.Networking.Connectivity.NetworkConnectivityLevel.constrainedInternetAccess:
+                break;
+        }
+    }
+
+
+        // FYI
+        //Connection.UNKNOWN  'Unknown connection';
+        //Connection.ETHERNET 'Ethernet connection';
+        //Connection.WIFI     'WiFi connection';
+        //Connection.CELL_2G  'Cell 2G connection';
+        //Connection.CELL_3G  'Cell 3G connection';
+        //Connection.CELL_4G  'Cell 4G connection';
+        //Connection.NONE     'No network connection';
+
+        setTimeout(function(){
+            win("wifi");
+        },0);
+    }
+
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/NotificationProxy.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/NotificationProxy.js b/lib/windows8/plugin/windows8/NotificationProxy.js
new file mode 100644
index 0000000..96441a8
--- /dev/null
+++ b/lib/windows8/plugin/windows8/NotificationProxy.js
@@ -0,0 +1,60 @@
+var cordova = require('cordova');
+
+module.exports = {
+    alert:function(win, loseX, args) {
+        var message = args[0];
+        var _title = args[1];
+        var _buttonLabel = args[2];
+
+        var md = new Windows.UI.Popups.MessageDialog(message, _title);
+        md.commands.append(new Windows.UI.Popups.UICommand(_buttonLabel));
+        md.showAsync().then(win);
+    },
+
+    confirm:function(win, loseX, args) {
+        var message = args[0];
+        var _title = args[1];
+        var _buttonLabels = args[2];
+
+		var btnList = [];
+        function commandHandler (command) {
+			win(btnList[command.label]);
+		};
+
+        var md = new Windows.UI.Popups.MessageDialog(message, _title);
+        var button = _buttonLabels.split(',');
+        var btnList = [];
+        for (var i = 0; i<button.length; i++) {
+			btnList[button[i]] = i+1;
+			md.commands.append(new Windows.UI.Popups.UICommand(button[i],commandHandler));
+		};
+        md.showAsync();
+    },
+
+    vibrate:function(winX, loseX, args) {
+        var mills = args[0];
+
+        //...
+    },
+
+    beep:function(winX, loseX, args) {
+        var count = args[0];
+        /*
+        var src = //filepath//
+        var playTime = 500; // ms
+        var quietTime = 1000; // ms
+        var media = new Media(src, function(){});
+        var hit = 1;
+        var intervalId = window.setInterval( function () {
+            media.play();
+            sleep(playTime);
+            media.stop();
+            media.seekTo(0);
+            if (hit < count) {
+                hit++;
+            } else {
+                window.clearInterval(intervalId);
+            }
+        }, playTime + quietTime); */
+    }
+};
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/console.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/console.js b/lib/windows8/plugin/windows8/console.js
new file mode 100644
index 0000000..a0ada8e
--- /dev/null
+++ b/lib/windows8/plugin/windows8/console.js
@@ -0,0 +1,25 @@
+
+if(!console || !console.log)
+{
+    var exec = require('cordova/exec');
+
+    var debugConsole = {
+        log:function(msg){
+            exec(null,null,"DebugConsole","log",msg);
+        },
+        warn:function(msg){
+            exec(null,null,"DebugConsole","warn",msg);
+        },
+        error:function(msg){
+            exec(null,null,"DebugConsole","error",msg);
+        }
+    };
+
+    module.exports = debugConsole;
+}
+else if(console && console.log) {
+    
+  console.log("console.log exists already!");
+  console.warn = console.warn || function(msg){console.log("warn:"+msg);};
+  console.error = console.error || function(msg){console.log("error:"+msg);};
+}

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/device.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/device.js b/lib/windows8/plugin/windows8/device.js
new file mode 100644
index 0000000..26381fe
--- /dev/null
+++ b/lib/windows8/plugin/windows8/device.js
@@ -0,0 +1,36 @@
+
+
+if(!console || !console.log)
+{
+    var exec = require('cordova/exec'),
+        channel = require('cordova/channel');
+
+
+
+    var debugConsole = {
+        log:function(msg){
+        exec(null,null,"DebugConsole","log",msg);
+        },
+        warn:function(msg){
+            exec(null,null,"DebugConsole","warn",msg);
+        },
+        error:function(msg){
+            exec(null,null,"DebugConsole","error",msg);
+        }
+    };
+
+
+    module.exports = debugConsole;
+}
+else
+{
+
+    if(console && console.log)
+    {
+        console.log("console.log exists already!");
+        console.warn = console.warn || function(msg){console.log("warn:"+msg);};
+        console.error = console.error || function(msg){console.log("error:"+msg);};
+
+    }
+}
+

http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/f0ec45f6/lib/windows8/plugin/windows8/geolocation.js
----------------------------------------------------------------------
diff --git a/lib/windows8/plugin/windows8/geolocation.js b/lib/windows8/plugin/windows8/geolocation.js
new file mode 100644
index 0000000..434dcf9
--- /dev/null
+++ b/lib/windows8/plugin/windows8/geolocation.js
@@ -0,0 +1,89 @@
+var Position = require('cordova/plugin/Position'),
+    PositionError = require('cordova/plugin/PositionError');
+
+module.exports = { // Merges with common
+
+
+    getLocation:function(win, lose, args) {
+        // options.enableHighAccuracy
+        // options.maximumAge
+        // options.timeout
+
+        var geolocator = new Windows.Devices.Geolocation.Geolocator();
+        if (options.enableHighAccuracy) {
+            geolocator.desiredAccuracy = Windows.Devices.Geolocation.PositionAccuracy.high;
+        }
+
+        geolocator.getGeopositionAsync(options.maximumAge, options.timeout).done(
+            function(geoposition) {
+                // Win8 JS API coordinate Object
+                win(geoposition.coordinate);
+            }, function() {
+                var e = new Object();
+
+                switch (geolocator.locationStatus) {
+                    case Windows.Devices.Geolocation.PositionStatus.ready:
+                        // Location data is available
+                        e.message = "Location is available.";
+                        e.code = PositionError.TIMEOUT;
+                        lose (e);
+                        break;
+                    case Windows.Devices.Geolocation.PositionStatus.initializing:
+                        // This status indicates that a GPS is still acquiring a fix
+                        e.message = "A GPS device is still initializing.";
+                        e.code = PositionError.POSITION_UNAVAILABLE;
+                        lose(e);
+                        break;
+                    case Windows.Devices.Geolocation.PositionStatus.noData:
+                        // No location data is currently available
+                        e.message = "Data from location services is currently unavailable.";
+                        e.code = PositionError.POSITION_UNAVAILABLE;
+                        lose(e);
+                        break;
+                    case Windows.Devices.Geolocation.PositionStatus.disabled:
+                        // The app doesn't have permission to access location,
+                        // either because location has been turned off.
+                        e.message = "Your location is currently turned off. " +
+                        "Change your settings through the Settings charm " +
+                        " to turn it back on.";
+                        e.code = PositionError.PERMISSION_DENIED;
+                        lose(e);
+                        break;
+                    case Windows.Devices.Geolocation.PositionStatus.notInitialized:
+                        // This status indicates that the app has not yet requested
+                        // location data by calling GetGeolocationAsync() or
+                        // registering an event handler for the positionChanged event.
+                        e.message = "Location status is not initialized because " +
+                        "the app has not requested location data.";
+                        e.code = PositionError.POSITION_UNAVAILABLE;
+                        lose(e);
+                        break;
+                    case Windows.Devices.Geolocation.PositionStatus.notAvailable:
+                        // Location is not available on this version of Windows
+                        e.message = "You do not have the required location services " +
+                        "present on your system.";
+                        e.code = PositionError.POSITION_UNAVAILABLE;
+                        lose(e);
+                        break;
+                    default:
+                        e.code = PositionError.TIMEOUT;
+                        lose(e);
+                        break;
+
+                }
+            }
+        )
+    },
+
+    addWatch:function(win, lose, args) {
+        // id
+        // options
+        // options.maximumAge
+        // options.timeout
+        // timers[]
+        timers[id] = new Windows.Devices.Geolocation.Geolocator().getGeopositionAsync(options.maximumAge, options.timeout).done(
+            new Geolocation().getCurrentPosition(win, lose, options)
+        )
+    }
+    // clearWatch is not needed as in common code the timer is deleted
+};
\ No newline at end of file