--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/js/device.js Tue Jul 06 11:31:19 2010 -0700
@@ -0,0 +1,55 @@
+PhoneGap.ExtendWrtDeviceObj = function(){
+
+ if (!window.device)
+ window.device = {};
+ navigator.device = window.device;
+
+ try {
+
+ if (window.menu)
+ window.menu.hideSoftkeys();
+
+ device.available = PhoneGap.available;
+ device.platform = null;
+ device.version = null;
+ device.name = null;
+ device.uuid = null;
+
+ var so = device.getServiceObject("Service.SysInfo", "ISysInfo");
+ var pf = PhoneGap.GetWrtPlatformVersion(so);
+ device.platform = pf.platform;
+ device.version = pf.version;
+ device.uuid = PhoneGap.GetWrtDeviceProperty(so, "IMEI");
+ device.name = PhoneGap.GetWrtDeviceProperty(so, "PhoneModel");
+ }
+ catch (e) {
+ device.available = false;
+ }
+};
+
+PhoneGap.GetWrtDeviceProperty = function(serviceObj, key) {
+ var criteria = { "Entity": "Device", "Key": key };
+ var result = serviceObj.ISysInfo.GetInfo(criteria);
+ if (result.ErrorCode == 0) {
+ return result.ReturnValue.StringData;
+ }
+ else {
+ return null;
+ }
+};
+
+PhoneGap.GetWrtPlatformVersion = function(serviceObj) {
+ var criteria = { "Entity": "Device", "Key": "PlatformVersion" };
+ var result = serviceObj.ISysInfo.GetInfo(criteria);
+ if (result.ErrorCode == 0) {
+ var version = {};
+ version.platform = result.ReturnValue.MajorVersion;
+ version.version = result.ReturnValue.MinorVersion;
+ return version;
+ }
+ else {
+ return null;
+ }
+};
+
+PhoneGap.ExtendWrtDeviceObj();
\ No newline at end of file