diff --git a/BB10/deviceInfo/NDK_project/.cproject b/BB10/deviceInfo/NDK_project/.cproject index 8b6fbabb..64266e3c 100644 --- a/BB10/deviceInfo/NDK_project/.cproject +++ b/BB10/deviceInfo/NDK_project/.cproject @@ -3,85 +3,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158,157 +79,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -382,156 +152,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/BB10/deviceInfo/NDK_project/Device-Debug/libDeviceInfo.so b/BB10/deviceInfo/NDK_project/Device-Debug/libDeviceInfo.so deleted file mode 100644 index 81c4e882..00000000 Binary files a/BB10/deviceInfo/NDK_project/Device-Debug/libDeviceInfo.so and /dev/null differ diff --git a/BB10/deviceInfo/NDK_project/Device-Release/libDeviceInfo.so b/BB10/deviceInfo/NDK_project/Device-Release/libDeviceInfo.so deleted file mode 100644 index 7e9fcb50..00000000 Binary files a/BB10/deviceInfo/NDK_project/Device-Release/libDeviceInfo.so and /dev/null differ diff --git a/BB10/deviceInfo/NDK_project/Simulator-Debug/libDeviceInfo.so b/BB10/deviceInfo/NDK_project/Simulator-Debug/libDeviceInfo.so deleted file mode 100644 index 918139e9..00000000 Binary files a/BB10/deviceInfo/NDK_project/Simulator-Debug/libDeviceInfo.so and /dev/null differ diff --git a/BB10/deviceInfo/NDK_project/src/template_js.cpp b/BB10/deviceInfo/NDK_project/src/template_js.cpp index 58ff2624..05cdc7ad 100644 --- a/BB10/deviceInfo/NDK_project/src/template_js.cpp +++ b/BB10/deviceInfo/NDK_project/src/template_js.cpp @@ -85,5 +85,7 @@ string TemplateJS::InvokeMethod(const string& command) { return m_pTemplateController->getRoamingStatus(); else if (strCommand == "getMNC") return m_pTemplateController->getMNC(); + else if (strCommand == "isSimulator") + return m_pTemplateController->isSimulator(); return "Unknown C++ method"; } diff --git a/BB10/deviceInfo/NDK_project/src/template_ndk.cpp b/BB10/deviceInfo/NDK_project/src/template_ndk.cpp index 9260dfd3..087ae4ae 100644 --- a/BB10/deviceInfo/NDK_project/src/template_ndk.cpp +++ b/BB10/deviceInfo/NDK_project/src/template_ndk.cpp @@ -16,6 +16,8 @@ #include #include +#include +#include #include #include #include @@ -29,6 +31,7 @@ namespace webworks { DeviceInfo::DeviceInfo(TemplateJS *parent) { m_pParent = parent; + bps_initialize(); } std::string DeviceInfo::getModelNumber() { @@ -52,7 +55,22 @@ std::string DeviceInfo::getMNC() { return simInfo.mobileNetworkCode().toLocal8Bit().data(); } +std::string DeviceInfo::isSimulator() { + deviceinfo_details_t *details; + + if (BPS_SUCCESS == deviceinfo_get_details(&details)) { + if(deviceinfo_details_is_simulator(details)) { + return "true"; + } else { + return "false"; + } + deviceinfo_free_details(&details); + } + return "null"; +} + DeviceInfo::~DeviceInfo() { + bps_shutdown(); } diff --git a/BB10/deviceInfo/NDK_project/src/template_ndk.hpp b/BB10/deviceInfo/NDK_project/src/template_ndk.hpp index 75540e09..79ea31ce 100644 --- a/BB10/deviceInfo/NDK_project/src/template_ndk.hpp +++ b/BB10/deviceInfo/NDK_project/src/template_ndk.hpp @@ -32,6 +32,7 @@ class DeviceInfo { std::string getRoamingStatus(); std::string getMCC(); std::string getMNC(); + std::string isSimulator(); private: TemplateJS *m_pParent; diff --git a/BB10/deviceInfo/Readme.md b/BB10/deviceInfo/Readme.md index 6088e872..737d5908 100644 --- a/BB10/deviceInfo/Readme.md +++ b/BB10/deviceInfo/Readme.md @@ -21,6 +21,11 @@ Copy the ext\community.deviceInfo folder into the Framework\ext folder of the We community.deviceInfo.getModelNumber() +
+//returns whether the device is a Simulator - 'true' or 'false'
+community.deviceInfo.isSimulator()
+
+
 //returns Roaming Status as 'true' or 'false'
 community.deviceInfo.getRoamingStatus()
diff --git a/BB10/deviceInfo/ext/community.deviceInfo/client.js b/BB10/deviceInfo/ext/community.deviceInfo/client.js
index fefdf2b1..44e3f8c1 100644
--- a/BB10/deviceInfo/ext/community.deviceInfo/client.js
+++ b/BB10/deviceInfo/ext/community.deviceInfo/client.js
@@ -40,4 +40,10 @@ var _self = {},
     _self.getMNC = function () {
         return window.webworks.execSync(_ID, "getMNC", null);
     };
+	
+    //get Mobile Network Code
+    _self.isSimulator = function () {
+        return window.webworks.execSync(_ID, "isSimulator", null);
+    };
+
 module.exports = _self;
diff --git a/BB10/deviceInfo/ext/community.deviceInfo/device/libDeviceInfo.so b/BB10/deviceInfo/ext/community.deviceInfo/device/libDeviceInfo.so
index 7e9fcb50..f910a820 100644
Binary files a/BB10/deviceInfo/ext/community.deviceInfo/device/libDeviceInfo.so and b/BB10/deviceInfo/ext/community.deviceInfo/device/libDeviceInfo.so differ
diff --git a/BB10/deviceInfo/ext/community.deviceInfo/index.js b/BB10/deviceInfo/ext/community.deviceInfo/index.js
index 163772ce..38de8891 100644
--- a/BB10/deviceInfo/ext/community.deviceInfo/index.js
+++ b/BB10/deviceInfo/ext/community.deviceInfo/index.js
@@ -34,5 +34,9 @@ module.exports = {
     
     getMNC: function (success, fail) {
         success(template.getInstance().getMNC());
+    },
+	
+	isSimulator: function (success, fail) {
+        success(template.getInstance().isSimulator());
     }
 };
\ No newline at end of file
diff --git a/BB10/deviceInfo/ext/community.deviceInfo/simulator/libDeviceInfo.so b/BB10/deviceInfo/ext/community.deviceInfo/simulator/libDeviceInfo.so
index 918139e9..cbea9054 100644
Binary files a/BB10/deviceInfo/ext/community.deviceInfo/simulator/libDeviceInfo.so and b/BB10/deviceInfo/ext/community.deviceInfo/simulator/libDeviceInfo.so differ
diff --git a/BB10/deviceInfo/ext/community.deviceInfo/templateJNEXT.js b/BB10/deviceInfo/ext/community.deviceInfo/templateJNEXT.js
index ba98640f..1fe4a43d 100644
--- a/BB10/deviceInfo/ext/community.deviceInfo/templateJNEXT.js
+++ b/BB10/deviceInfo/ext/community.deviceInfo/templateJNEXT.js
@@ -64,6 +64,10 @@ JNEXT.Template = function () {
         return JNEXT.invoke(self.m_id, "getMNC");
     };
     
+    self.isSimulator = function () {
+        return JNEXT.invoke(self.m_id, "isSimulator");
+    };
+    
 	// ************************
 	// End of methods to edit
 	// ************************