diff --git a/Android/AccountList/AccountList.java b/Android/AccountList/AccountList.java index 3e54ebc7..8bde72df 100644 --- a/Android/AccountList/AccountList.java +++ b/Android/AccountList/AccountList.java @@ -7,6 +7,7 @@ import android.accounts.Account; import android.accounts.AccountManager; +import org.apache.cordova.DroidGap; import org.apache.cordova.api.Plugin; import org.apache.cordova.api.PluginResult; @@ -18,7 +19,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) { try { JSONObject obj = args.getJSONObject(0); - AccountManager am = AccountManager.get(this.ctx.getContext()); + AccountManager am = AccountManager.get(cordova.getActivity()); Account[] accounts; if (obj.has("type")) diff --git a/Android/AccountList/accountlist.js b/Android/AccountList/accountlist.js index 388a6c59..e6d7a493 100644 --- a/Android/AccountList/accountlist.js +++ b/Android/AccountList/accountlist.js @@ -1,13 +1,23 @@ -var AccountList = function() {}; - -AccountList.prototype.get = function(params, success, fail) { - return PhoneGap.exec( function(args) { - success(args); - }, function(args) { - fail(args); - }, 'AccountList', '', [params]); -}; +var AccountList = function(gap) { -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin('AccountList', new AccountList()); -}); \ No newline at end of file + AccountList.prototype.get = function(params, success, fail) { + return gap.exec( function(args) { + success(args); + }, function(args) { + fail(args); + }, 'AccountList', '', [params]); + }; + + gap.addConstructor(function () { + if (gap.addPlugin) { + gap.addPlugin("AccountList", new AccountList()); + } else { + if (!window.plugins) { + window.plugins = {}; + } + + window.plugins.ccountList = new AccountList(); + } + }); + +})(window.cordova || window.Cordova || window.PhoneGap); diff --git a/Android/ActionBarSherlockTabBar/REPO MOVED.txt b/Android/ActionBarSherlockTabBar/REPO MOVED.txt new file mode 100644 index 00000000..ededc5b1 --- /dev/null +++ b/Android/ActionBarSherlockTabBar/REPO MOVED.txt @@ -0,0 +1 @@ +This plugin is now located at https://github.com/AndiDog/phonegap-android-actionbarsherlock-tabbar-plugin \ No newline at end of file diff --git a/Android/Analytics/2.0/README.md b/Android/Analytics/2.0/README.md index 2398f064..21306e32 100644 --- a/Android/Analytics/2.0/README.md +++ b/Android/Analytics/2.0/README.md @@ -30,7 +30,7 @@ Using this plugin requires [PhoneGap Cordova library for Android](http://phonega 5. In your res/xml/config.xml file add the following line: - + <plugin name="GoogleAnalyticsTracker" value="com.phonegap.plugins.analytics.GoogleAnalyticsTracker" /> ## Using the plugin ## @@ -86,7 +86,25 @@ Sample use: Sample use: window.plugins.analytics.trackEvent("category", "action", "event", 1, function(){alert("Track: success");}, function(){alert("Track: failure");}); + +
+/**
+ * Set a custom variable on Google Analytics
+ * @param index			The slot for the custom variable
+ * @param label			The name for the custom variable
+ * @param value			The value for the custom variable
+ * @param scope			The scope for the custom variable (optional)
+
+ * @param successCallback	The success callback
+ * @param failureCallback	The error callback 
+ */
+
+  setCustomVar(index, label, value, scope, successCallback, failureCallback);
+
+ +Sample use: + window.plugins.analytics.setCustomVar(1, "type", "android", null, function(){alert("SetVar: success");}, function(){alert("SetVar: failure");}); Please keep in mind that these methods, as in any other plugin, are ready to be invoked only after '[deviceready](http://docs.phonegap.com/phonegap_events_events.md.html#deviceready)' event has been fired Good practice will be manual dispatch and stop session. Add this code to your main activity: diff --git a/Android/Analytics/2.0/src/com/phonegap/plugins/analytics/GoogleAnalyticsTracker.java b/Android/Analytics/2.0/src/com/phonegap/plugins/analytics/GoogleAnalyticsTracker.java index 4697f60f..c700844d 100644 --- a/Android/Analytics/2.0/src/com/phonegap/plugins/analytics/GoogleAnalyticsTracker.java +++ b/Android/Analytics/2.0/src/com/phonegap/plugins/analytics/GoogleAnalyticsTracker.java @@ -55,6 +55,7 @@ public PluginResult execute(String action, JSONArray data, String callbackId) { } else if (SET_CUSTOM_VARIABLE.equals(action)){ try { setCustomVar(data.getInt(0), data.getString(1), data.getString(2), data.getInt(3)); + result = new PluginResult(Status.OK); } catch (JSONException e) { result = new PluginResult(Status.JSON_EXCEPTION); } @@ -77,6 +78,7 @@ private void trackEvent(String category, String action, String label, int value) } private void setCustomVar(int index, String label, String value, int scope) { - tracker.setCustomVar(index, label, value, scope); + if(scope > 0) tracker.setCustomVar(index, label, value, scope); + else tracker.setCustomVar(index, label, value); } } \ No newline at end of file diff --git a/Android/Analytics/2.0/www/analytics.js b/Android/Analytics/2.0/www/analytics.js index 0e415641..8c31841c 100644 --- a/Android/Analytics/2.0/www/analytics.js +++ b/Android/Analytics/2.0/www/analytics.js @@ -68,6 +68,17 @@ Analytics.prototype.trackEvent = function(category, action, label, value, succes ]); }; +/** + * Set a custom variable on Google Analytics + * @param index The slot for the custom variable + * @param label The name for the custom variable + * @param value The value for the custom variable + * @param scope The scope for the custom variable (optional) + + * @param successCallback The success callback + * @param failureCallback The error callback + */ + Analytics.prototype.setCustomVar = function(index, label, value, scope, successCallback, failureCallback){ return cordova.exec( successCallback, diff --git a/Android/AppPreferences/1.8.1/assets/www/applicationPreferences.js b/Android/AppPreferences/1.8.1/assets/www/applicationPreferences.js deleted file mode 100644 index 05b9ae3a..00000000 --- a/Android/AppPreferences/1.8.1/assets/www/applicationPreferences.js +++ /dev/null @@ -1,29 +0,0 @@ -var AppPreferences = function () {}; - -var AppPreferencesError = function(code, message) { - this.code = code || null; - this.message = message || ''; -}; - -AppPreferencesError.NO_PROPERTY = 0; -AppPreferencesError.NO_PREFERENCE_ACTIVITY = 1; - -AppPreferences.prototype.get = function(key,success,fail) { - cordova.exec(success,fail,"applicationPreferences","get",[key]); -}; - -AppPreferences.prototype.set = function(key,value,success,fail) { - cordova.exec(success,fail,"applicationPreferences","set",[key, value]); -}; - -AppPreferences.prototype.load = function(success,fail) { - cordova.exec(success,fail,"applicationPreferences","load",[]); -}; - -AppPreferences.prototype.show = function(activity,success,fail) { - cordova.exec(success,fail,"applicationPreferences","show",[activity]); -}; - -cordova.addConstructor(function() { - cordova.addPlugin("applicationPreferences", new AppPreferences()); -}); \ No newline at end of file diff --git a/Android/AppPreferences/1.8.1/src/com/simonmacdonald/prefs/AppPreferences.java b/Android/AppPreferences/1.8.1/src/com/simonmacdonald/prefs/AppPreferences.java deleted file mode 100644 index de63d4a5..00000000 --- a/Android/AppPreferences/1.8.1/src/com/simonmacdonald/prefs/AppPreferences.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.simonmacdonald.prefs; - -import java.util.Iterator; -import java.util.Map; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.content.ActivityNotFoundException; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; -import android.preference.PreferenceManager; -import android.util.Log; - -public class AppPreferences extends Plugin { - - private static final String LOG_TAG = "AppPrefs"; - private static final int NO_PROPERTY = 0; - private static final int NO_PREFERENCE_ACTIVITY = 1; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.ctx.getContext()); - - try { - if (action.equals("get")) { - String key = args.getString(0); - if (sharedPrefs.contains(key)) { - Object obj = sharedPrefs.getAll().get(key); - return new PluginResult(status, obj.toString()); - } else { - return createErrorObj(NO_PROPERTY, "No such property called " + key); - } - } else if (action.equals("set")) { - String key = args.getString(0); - String value = args.getString(1); - if (sharedPrefs.contains(key)) { - Editor editor = sharedPrefs.edit(); - if ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase())) { - editor.putBoolean(key, Boolean.parseBoolean(value)); - } else { - editor.putString(key, value); - } - return new PluginResult(status, editor.commit()); - } else { - return createErrorObj(NO_PROPERTY, "No such property called " + key); - } - } else if (action.equals("load")) { - JSONObject obj = new JSONObject(); - Map prefs = sharedPrefs.getAll(); - Iterator it = prefs.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry)it.next(); - obj.put(pairs.getKey().toString(), pairs.getValue().toString()); - } - return new PluginResult(status, obj); - } else if (action.equals("show")) { - String activityName = args.getString(0); - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setClassName(this.ctx.getContext(), activityName); - try { - this.ctx.startActivity(intent); - } catch (ActivityNotFoundException e) { - return createErrorObj(NO_PREFERENCE_ACTIVITY, "No preferences activity called " + activityName); - } - } - } catch (JSONException e) { - status = PluginResult.Status.JSON_EXCEPTION; - } - return new PluginResult(status, result); - } - - private PluginResult createErrorObj(int code, String message) throws JSONException { - JSONObject errorObj = new JSONObject(); - errorObj.put("code", code); - errorObj.put("message", message); - return new PluginResult(PluginResult.Status.ERROR, errorObj); - } - -} diff --git a/Android/AppPreferences/2.0.0/assets/www/applicationPreferences.js b/Android/AppPreferences/2.0.0/assets/www/applicationPreferences.js deleted file mode 100644 index 9db81d68..00000000 --- a/Android/AppPreferences/2.0.0/assets/www/applicationPreferences.js +++ /dev/null @@ -1,31 +0,0 @@ -cordova.define("cordova/plugin/applicationpreferences", function(require, exports, module) { - var exec = require("cordova/exec"); - var AppPreferences = function () {}; - - var AppPreferencesError = function(code, message) { - this.code = code || null; - this.message = message || ''; - }; - - AppPreferencesError.NO_PROPERTY = 0; - AppPreferencesError.NO_PREFERENCE_ACTIVITY = 1; - - AppPreferences.prototype.get = function(key,success,fail) { - cordova.exec(success,fail,"applicationPreferences","get",[key]); - }; - - AppPreferences.prototype.set = function(key,value,success,fail) { - cordova.exec(success,fail,"applicationPreferences","set",[key, value]); - }; - - AppPreferences.prototype.load = function(success,fail) { - cordova.exec(success,fail,"applicationPreferences","load",[]); - }; - - AppPreferences.prototype.show = function(activity,success,fail) { - cordova.exec(success,fail,"applicationPreferences","show",[activity]); - }; - - var appPreferences = new AppPreferences(); - module.exports = appPreferences; -}); diff --git a/Android/AppPreferences/2.0.0/src/com/simonmacdonald/prefs/AppPreferences.java b/Android/AppPreferences/2.0.0/src/com/simonmacdonald/prefs/AppPreferences.java deleted file mode 100644 index 152f55d7..00000000 --- a/Android/AppPreferences/2.0.0/src/com/simonmacdonald/prefs/AppPreferences.java +++ /dev/null @@ -1,87 +0,0 @@ -package com.simonmacdonald.prefs; - -import java.util.Iterator; -import java.util.Map; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.content.ActivityNotFoundException; -import android.content.Intent; -import android.content.SharedPreferences; -import android.content.SharedPreferences.Editor; -import android.preference.PreferenceManager; -import android.util.Log; - -public class AppPreferences extends Plugin { - - private static final String LOG_TAG = "AppPrefs"; - private static final int NO_PROPERTY = 0; - private static final int NO_PREFERENCE_ACTIVITY = 1; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this.cordova.getActivity()); - - try { - if (action.equals("get")) { - String key = args.getString(0); - if (sharedPrefs.contains(key)) { - Object obj = sharedPrefs.getAll().get(key); - return new PluginResult(status, obj.toString()); - } else { - return createErrorObj(NO_PROPERTY, "No such property called " + key); - } - } else if (action.equals("set")) { - String key = args.getString(0); - String value = args.getString(1); - if (sharedPrefs.contains(key)) { - Editor editor = sharedPrefs.edit(); - if ("true".equals(value.toLowerCase()) || "false".equals(value.toLowerCase())) { - editor.putBoolean(key, Boolean.parseBoolean(value)); - } else { - editor.putString(key, value); - } - return new PluginResult(status, editor.commit()); - } else { - return createErrorObj(NO_PROPERTY, "No such property called " + key); - } - } else if (action.equals("load")) { - JSONObject obj = new JSONObject(); - Map prefs = sharedPrefs.getAll(); - Iterator it = prefs.entrySet().iterator(); - while (it.hasNext()) { - Map.Entry pairs = (Map.Entry)it.next(); - obj.put(pairs.getKey().toString(), pairs.getValue().toString()); - } - return new PluginResult(status, obj); - } else if (action.equals("show")) { - String activityName = args.getString(0); - Intent intent = new Intent(Intent.ACTION_VIEW); - intent.setClassName(this.cordova.getActivity(), activityName); - try { - this.cordova.getActivity().startActivity(intent); - } catch (ActivityNotFoundException e) { - return createErrorObj(NO_PREFERENCE_ACTIVITY, "No preferences activity called " + activityName); - } - } - } catch (JSONException e) { - status = PluginResult.Status.JSON_EXCEPTION; - } - return new PluginResult(status, result); - } - - private PluginResult createErrorObj(int code, String message) throws JSONException { - JSONObject errorObj = new JSONObject(); - errorObj.put("code", code); - errorObj.put("message", message); - return new PluginResult(PluginResult.Status.ERROR, errorObj); - } - -} diff --git a/Android/AppPreferences/README.md b/Android/AppPreferences/README.md index 15fd2dcd..8b6089aa 100644 --- a/Android/AppPreferences/README.md +++ b/Android/AppPreferences/README.md @@ -1,105 +1,2 @@ -# Application Preferences plugin for Phonegap # -Originally by Simon MacDonald (@macdonst) - -## Adding the Plugin to your project ## - -1) To install the plugin, move applicationPreferences.js to your project's www folder and include a reference to it in your html files. - -`` - -2) Create a folder called 'com/simonmacdonald/prefs' within your project's src folder. -3) And copy the AppPreferences.java file into that new folder. - -`mkdir /src/com/simonmacdonald/prefs` - -`cp ./src/com/simonmacdonald/prefs/AppPreferences.java /src/com/simonmacdonald/prefs` - -4) In your res/xml/plugins.xml file add the following line: - - `` - -## Using the plugin ## -The plugin creates the object `window.plugins.applicationPreferences` - -### get ### - -In order to get the value a property you would call the get method. - - /** - * Get the value of the named property. - * - * @param key - */ - get(key, success, fail) - -Sample use: - - window.plugins.applicationPreference.get("key", success, fail); - -### set ### - -In order to set the value a property you would call the set method. - - /** - * Set the value of the named property. - * - * @param key - * @param value - */ - set(key, value, success, fail) - -Sample use: - - window.plugins.applicationPreference.set("key", "value", success, fail); - -### load ### - -In order to get all the properties you can call the load method. The success callback of the load method will be called with a JSONObject which contains all the preferences. - - /** - * Get all the preference values. - * - */ - load(success, fail) - -Sample use: - - window.plugins.applicationPreference.load(success, fail); - -### show ### - -If you want to load the PreferenceActivity of your application that displays all the preferences you can call the show method with the class name. - - /** - * Get all the preference values. - * - */ - show(activity, success, fail) - -Sample use: - - window.plugins.applicationPreference.show("com.simonmacdonald.prefs.PreferenceActivity", success, fail); - -## Licence ## - -The MIT License - -Copyright (c) 2012 Simon MacDonald - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN -THE SOFTWARE. \ No newline at end of file +# Moved to # +https://github.com/macdonst/AppPreferences \ No newline at end of file diff --git a/Android/Asset2SD/README.md b/Android/Asset2SD/README.md new file mode 100644 index 00000000..7833ce20 --- /dev/null +++ b/Android/Asset2SD/README.md @@ -0,0 +1 @@ +# Asset2SD plugin for Phonegap # By Gautam Chaudhary Phonegap plugin for Android for copying files from app assets to device SD Card. The repository for this plugin is located at https://github.com/gkcgautam/Asset2SD \ No newline at end of file diff --git a/Android/AugmentedReality-Wikitude/README.md b/Android/AugmentedReality-Wikitude/README.md new file mode 100644 index 00000000..a4bed477 --- /dev/null +++ b/Android/AugmentedReality-Wikitude/README.md @@ -0,0 +1,6 @@ +# Augmented Reality meets PhoneGap - Wikitude + + +##This plugin moved to another git, please visit [Wikitude's PhoneGap Git](https://github.com/Wikitude/wikitude-phonegap "AR Plugin PhoneGap") + +[https://github.com/Wikitude/wikitude-phonegap](https://github.com/Wikitude/wikitude-phonegap "AR Plugin PhoneGap") \ No newline at end of file diff --git a/Android/BackgroundService/1.8.1/MyService.java b/Android/BackgroundService/1.8.1/MyService.java new file mode 100644 index 00000000..cb39447f --- /dev/null +++ b/Android/BackgroundService/1.8.1/MyService.java @@ -0,0 +1,78 @@ +package com.yournamespace.yourappname; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.json.JSONException; +import org.json.JSONObject; + +import android.util.Log; + +import com.red_folder.phonegap.plugin.backgroundservice.BackgroundService; + +public class MyService extends BackgroundService { + + private final static String TAG = MyService.class.getSimpleName(); + + private String mHelloTo = "World"; + + @Override + protected JSONObject doWork() { + JSONObject result = new JSONObject(); + + try { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + String now = df.format(new Date(System.currentTimeMillis())); + + String msg = "Hello " + this.mHelloTo + " - its currently " + now; + result.put("Message", msg); + + Log.d(TAG, msg); + } catch (JSONException e) { + } + + return result; + } + + @Override + protected JSONObject getConfig() { + JSONObject result = new JSONObject(); + + try { + result.put("HelloTo", this.mHelloTo); + } catch (JSONException e) { + } + + return result; + } + + @Override + protected void setConfig(JSONObject config) { + try { + if (config.has("HelloTo")) + this.mHelloTo = config.getString("HelloTo"); + } catch (JSONException e) { + } + + } + + @Override + protected JSONObject initialiseLatestResult() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void onTimerEnabled() { + // TODO Auto-generated method stub + + } + + @Override + protected void onTimerDisabled() { + // TODO Auto-generated method stub + + } + + +} diff --git a/Android/BackgroundService/1.8.1/README.md b/Android/BackgroundService/1.8.1/README.md new file mode 100644 index 00000000..03ce8cf3 --- /dev/null +++ b/Android/BackgroundService/1.8.1/README.md @@ -0,0 +1,73 @@ +# Background Service Plugin for Phonegap # + +A plugin (and framework code) that allows the development and operation of an Android Background Service. + +The example MyService Background Service will write a Hello message to the LogCat every minute. The MyService is designed as sample code. + +## Adding the plugin to your project ## + +Copy the files to the following locations: + +* libs\backgroundserviceplugin.jar +* src\com\yournamespace\yourappname\MyService.java +* assets\www\backgroundService.js +* assets\www\myService.js +* assets\www\index.html + +Add the following to res\xml\plugins.xml + +``` + +``` + +Add the following to AndroidManifest.xml + +``` + + + + + + + + + + + + + + +``` +## Change Log ## + +* 14th November 2012 - Fix for service not stopping if the app has been closed then re-opened + + +## Further Information ## + +Further information on the plugin can be found at: + +* http://red-folder.blogspot.co.uk/2012/09/phonegap-android-background-service.html +* http://red-folder.blogspot.com/2012/09/phonegap-android-background-service_11.html + +The below is a tutorial to create your own Twitter service: + +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-1.html +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-2.html +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-3.html + +Please let me know your thoughts and comments. + +## Licence ## + +The MIT License + +Copyright (c) 2012 Red Folder Consultancy Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + diff --git a/Android/BackgroundService/1.8.1/backgroundService.js b/Android/BackgroundService/1.8.1/backgroundService.js new file mode 100644 index 00000000..e6be7158 --- /dev/null +++ b/Android/BackgroundService/1.8.1/backgroundService.js @@ -0,0 +1,171 @@ +/* + * Copyright 2012 Red Folder Consultancy Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Constructor + */ +function BackgroundService(serviceName) { + var ServiceName = serviceName; + + this.getServiceName = function() { + return ServiceName; + }; +}; + +/** + * All methods attempt to return the following data in both the success and failure callbacks + * Front end development should take into account any all or all of these values may be null + * + * Following returned in the JSONObject: + * Boolean Success - was the call a success + * int ErrorCode - Error code if an error occurred, else will be zero + * String ErrorMessage - Text representation of the error code + * Boolean ServiceRunning - True if the Service is running + * Boolean TimerEnabled - True if the Timer is enabled + * Boolean RegisteredForBootStart - True if the Service is registered for boot start + * JSONObject Configuration - A JSONObject of the configuration of the service (contents dependant on the service) + * JSONObject LastestResult - A JSONObject of the last result of the service (contents dependant on the service) + */ + +/** + * Starts the Service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.startService = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'startService', + [this.getServiceName()]); +}; + +/** + * Stops the Service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.stopService = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'stopService', + [this.getServiceName()]); +}; + +/** + * Enables the Service Timer + * + * @param milliseconds The milliseconds used for the timer + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.enableTimer = function(milliseconds, successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'enableTimer', + [this.getServiceName(), milliseconds]); +}; + +/** + * Disabled the Service Timer + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.disableTimer = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'disableTimer', + [this.getServiceName()]); +}; + +/** + * Sets the configuration for the service + * + * @oaran configuration JSONObject to be sent to the service + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.setConfiguration = function(configuration, successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'setConfiguration', + [this.getServiceName(), configuration]); +}; + +/** + * Registers the service for Boot Start + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.registerForBootStart = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'registerForBootStart', + [this.getServiceName()]); +}; + +/** + * Deregisters the service for Boot Start + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.deregisterForBootStart = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'deregisterForBootStart', + [this.getServiceName()]); +}; + +/** + * Get the current status of the service. + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.isRegisteredForBootStart = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'isRegisteredForBootStart', + [this.getServiceName()]); +}; + + +/** + * Returns the status of the service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ +BackgroundService.prototype.getStatus = function(successCallback, failureCallback) { + return cordova.exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'getStatus', + [this.getServiceName()]); +}; + diff --git a/Android/BackgroundService/1.8.1/backgroundserviceplugin.jar b/Android/BackgroundService/1.8.1/backgroundserviceplugin.jar new file mode 100644 index 00000000..e72e0e7a Binary files /dev/null and b/Android/BackgroundService/1.8.1/backgroundserviceplugin.jar differ diff --git a/Android/BackgroundService/1.8.1/index.html b/Android/BackgroundService/1.8.1/index.html new file mode 100644 index 00000000..d50a9144 --- /dev/null +++ b/Android/BackgroundService/1.8.1/index.html @@ -0,0 +1,219 @@ + + + + + MyService + + + + + + + + + + +

MyService

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Service
Timer
Boot
Configuration
Hello To
Latest Result
+ + + \ No newline at end of file diff --git a/Android/BackgroundService/1.8.1/myService.js b/Android/BackgroundService/1.8.1/myService.js new file mode 100644 index 00000000..3849f361 --- /dev/null +++ b/Android/BackgroundService/1.8.1/myService.js @@ -0,0 +1,31 @@ +/* + * Copyright 2012 Red Folder Consultancy Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +// /////////////////// +(function(){ +// /////////////////// + +// get local ref to global PhoneGap/Cordova/cordova object for exec function +var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks + + +cordovaRef.addConstructor(function() { + cordovaRef.addPlugin("myService", new BackgroundService('com.yournamespace.yourappname.MyService')); +}); + +// /////////////////// +})(); +// /////////////////// diff --git a/Android/BackgroundService/2.0.0/MyService.java b/Android/BackgroundService/2.0.0/MyService.java new file mode 100644 index 00000000..cb39447f --- /dev/null +++ b/Android/BackgroundService/2.0.0/MyService.java @@ -0,0 +1,78 @@ +package com.yournamespace.yourappname; + +import java.text.SimpleDateFormat; +import java.util.Date; + +import org.json.JSONException; +import org.json.JSONObject; + +import android.util.Log; + +import com.red_folder.phonegap.plugin.backgroundservice.BackgroundService; + +public class MyService extends BackgroundService { + + private final static String TAG = MyService.class.getSimpleName(); + + private String mHelloTo = "World"; + + @Override + protected JSONObject doWork() { + JSONObject result = new JSONObject(); + + try { + SimpleDateFormat df = new SimpleDateFormat("dd/MM/yyyy HH:mm:ss"); + String now = df.format(new Date(System.currentTimeMillis())); + + String msg = "Hello " + this.mHelloTo + " - its currently " + now; + result.put("Message", msg); + + Log.d(TAG, msg); + } catch (JSONException e) { + } + + return result; + } + + @Override + protected JSONObject getConfig() { + JSONObject result = new JSONObject(); + + try { + result.put("HelloTo", this.mHelloTo); + } catch (JSONException e) { + } + + return result; + } + + @Override + protected void setConfig(JSONObject config) { + try { + if (config.has("HelloTo")) + this.mHelloTo = config.getString("HelloTo"); + } catch (JSONException e) { + } + + } + + @Override + protected JSONObject initialiseLatestResult() { + // TODO Auto-generated method stub + return null; + } + + @Override + protected void onTimerEnabled() { + // TODO Auto-generated method stub + + } + + @Override + protected void onTimerDisabled() { + // TODO Auto-generated method stub + + } + + +} diff --git a/Android/BackgroundService/2.0.0/README.md b/Android/BackgroundService/2.0.0/README.md new file mode 100644 index 00000000..74dcb835 --- /dev/null +++ b/Android/BackgroundService/2.0.0/README.md @@ -0,0 +1,72 @@ +# Background Service Plugin for Phonegap # + +A plugin (and framework code) that allows the development and operation of an Android Background Service. + +The example MyService Background Service will write a Hello message to the LogCat every minute. The MyService is designed as sample code. + +## Adding the plugin to your project ## + +Copy the files to the following locations: + +* libs\backgroundserviceplugin-2.0.0.jar +* src\com\yournamespace\yourappname\MyService.java +* assets\www\backgroundService-2.0.0.js +* assets\www\myService-2.0.0.js +* assets\www\index-2.0.0.html + +Add the following to res\xml\config.xml + +``` + +``` + +Add the following to AndroidManifest.xml + +``` + + + + + + + + + + + + + + +``` +## Change Log ## + +* 14th November 2012 - Fix for service not stopping if the app has been closed then re-opened + +## Further Information ## + +Further information on the plugin can be found at: + +* http://red-folder.blogspot.co.uk/2012/09/phonegap-android-background-service.html +* http://red-folder.blogspot.com/2012/09/phonegap-android-background-service_11.html + +The below is a tutorial to create your own Twitter service: + +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-1.html +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-2.html +* http://red-folder.blogspot.com/2012/09/phonegap-service-tutorial-part-3.html + +Please let me know your thoughts and comments. + +## Licence ## + +The MIT License + +Copyright (c) 2012 Red Folder Consultancy Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + diff --git a/Android/BackgroundService/2.0.0/backgroundService-2.0.0.js b/Android/BackgroundService/2.0.0/backgroundService-2.0.0.js new file mode 100644 index 00000000..ae70e2cf --- /dev/null +++ b/Android/BackgroundService/2.0.0/backgroundService-2.0.0.js @@ -0,0 +1,181 @@ +/* + * Copyright 2012 Red Folder Consultancy Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +/* + * Constructor + */ +function CreateBackgroundService(serviceName, require, exports, module) { + var exec = require("cordova/exec"); + + var BackgroundService = function (serviceName) { + var ServiceName = serviceName + this.getServiceName = function() { + return ServiceName; + }; + }; + + var BackgroundServiceError = function (code, message) { + this.code = code || null; + this.message = message || null; + }; + + /** + * All methods attempt to return the following data in both the success and failure callbacks + * Front end development should take into account any all or all of these values may be null + * + * Following returned in the JSONObject: + * Boolean Success - was the call a success + * int ErrorCode - Error code if an error occurred, else will be zero + * String ErrorMessage - Text representation of the error code + * Boolean ServiceRunning - True if the Service is running + * Boolean TimerEnabled - True if the Timer is enabled + * Boolean RegisteredForBootStart - True if the Service is registered for boot start + * JSONObject Configuration - A JSONObject of the configuration of the service (contents dependant on the service) + * JSONObject LastestResult - A JSONObject of the last result of the service (contents dependant on the service) + */ + + /** + * Starts the Service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.startService = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'startService', + [this.getServiceName()]); + }; + + /** + * Stops the Service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.stopService = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'stopService', + [this.getServiceName()]); + }; + + /** + * Enables the Service Timer + * + * @param milliseconds The milliseconds used for the timer + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.enableTimer = function(milliseconds, successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'enableTimer', + [this.getServiceName(), milliseconds]); + }; + + /** + * Disabled the Service Timer + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.disableTimer = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'disableTimer', + [this.getServiceName()]); + }; + + /** + * Sets the configuration for the service + * + * @oaran configuration JSONObject to be sent to the service + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.setConfiguration = function(configuration, successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'setConfiguration', + [this.getServiceName(), configuration]); + }; + + /** + * Registers the service for Boot Start + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.registerForBootStart = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'registerForBootStart', + [this.getServiceName()]); + }; + + /** + * Deregisters the service for Boot Start + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.deregisterForBootStart = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'deregisterForBootStart', + [this.getServiceName()]); + }; + + /** + * Get the current status of the service. + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.isRegisteredForBootStart = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'isRegisteredForBootStart', + [this.getServiceName()]); + }; + + + /** + * Returns the status of the service + * + * @param successCallback The callback which will be called if the method is successful + * @param failureCallback The callback which will be called if the method encounters an error + */ + BackgroundService.prototype.getStatus = function(successCallback, failureCallback) { + return exec( successCallback, + failureCallback, + 'BackgroundServicePlugin', + 'getStatus', + [this.getServiceName()]); + }; + + var backgroundService = new BackgroundService(serviceName); + module.exports = backgroundService; +}; diff --git a/Android/BackgroundService/2.0.0/backgroundserviceplugin-2.0.0.jar b/Android/BackgroundService/2.0.0/backgroundserviceplugin-2.0.0.jar new file mode 100644 index 00000000..a9cd9eac Binary files /dev/null and b/Android/BackgroundService/2.0.0/backgroundserviceplugin-2.0.0.jar differ diff --git a/Android/BackgroundService/2.0.0/index-2.0.0.html b/Android/BackgroundService/2.0.0/index-2.0.0.html new file mode 100644 index 00000000..e49998d1 --- /dev/null +++ b/Android/BackgroundService/2.0.0/index-2.0.0.html @@ -0,0 +1,215 @@ + + + + + MyService + + + + + + + + + + +

MyService

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Service
Timer
Boot
Configuration
Hello To
Latest Result
+ + + \ No newline at end of file diff --git a/Android/BackgroundService/2.0.0/myService-2.0.0.js b/Android/BackgroundService/2.0.0/myService-2.0.0.js new file mode 100644 index 00000000..02341b16 --- /dev/null +++ b/Android/BackgroundService/2.0.0/myService-2.0.0.js @@ -0,0 +1,19 @@ +/* + * Copyright 2012 Red Folder Consultancy Ltd + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +cordova.define( 'cordova/plugin/myService', function(require, exports, module) { + CreateBackgroundService('com.yournamespace.yourappname.MyService', require, exports, module); + }); diff --git a/Android/BackgroundService/README.md b/Android/BackgroundService/README.md new file mode 100644 index 00000000..b93303be --- /dev/null +++ b/Android/BackgroundService/README.md @@ -0,0 +1,25 @@ +# Background Service Plugin for Phonegap # + +A plugin (and framework code) that allows the development and operation of an Android Background Service. + +The example MyService Background Service will write a Hello message to the LogCat every minute. The MyService is designed as sample code. + +## Repository Location ## + +The location for this repository has been moved to https://github.com/Red-Folder/Cordova-Plugin-BackgroundService + +This was moved based on the Plugin recommendations here -> http://shazronatadobe.wordpress.com/2012/11/07/cordova-plugins-put-them-in-your-own-repo-2/ + + +## Licence ## + +The MIT License + +Copyright (c) 2012 Red Folder Consultancy Ltd + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/Android/BarcodeScanner/1.8.1/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java b/Android/BarcodeScanner/1.8.1/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java index 29786360..77b42adf 100644 --- a/Android/BarcodeScanner/1.8.1/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java +++ b/Android/BarcodeScanner/1.8.1/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java @@ -110,7 +110,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { //Log.d(LOG_TAG, "This should never happen"); } this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback); - } if (resultCode == Activity.RESULT_CANCELED) { + } else if (resultCode == Activity.RESULT_CANCELED) { JSONObject obj = new JSONObject(); try { obj.put("text", ""); diff --git a/Android/BarcodeScanner/2.0.0/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java b/Android/BarcodeScanner/2.0.0/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java index b18c0cb8..c451b457 100644 --- a/Android/BarcodeScanner/2.0.0/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java +++ b/Android/BarcodeScanner/2.0.0/src/com/phonegap/plugins/barcodescanner/BarcodeScanner.java @@ -121,7 +121,7 @@ public void onActivityResult(int requestCode, int resultCode, Intent intent) { //Log.d(LOG_TAG, "This should never happen"); } this.success(new PluginResult(PluginResult.Status.OK, obj), this.callback); - } if (resultCode == Activity.RESULT_CANCELED) { + } else if (resultCode == Activity.RESULT_CANCELED) { JSONObject obj = new JSONObject(); try { obj.put(TEXT, ""); @@ -149,4 +149,4 @@ public void encode(String type, String data) { this.cordova.getActivity().startActivity(intentEncode); } -} \ No newline at end of file +} diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/.classpath b/Android/BarcodeScanner/2.2.0/LibraryProject/.classpath new file mode 100644 index 00000000..a4763d1e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/.project b/Android/BarcodeScanner/2.2.0/LibraryProject/.project new file mode 100644 index 00000000..43ee6b5b --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/.project @@ -0,0 +1,33 @@ + + + CaptureActivity + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/AndroidManifest.xml b/Android/BarcodeScanner/2.2.0/LibraryProject/AndroidManifest.xml new file mode 100644 index 00000000..a4a2541f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/AndroidManifest.xml @@ -0,0 +1,175 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/ant.properties b/Android/BarcodeScanner/2.2.0/LibraryProject/ant.properties new file mode 100644 index 00000000..c0f6ae50 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/ant.properties @@ -0,0 +1,21 @@ +# This file is used to override default values used by the Ant build system. +# +# This file must be checked in Version Control Systems, as it is +# integral to the build system of your project. + +# This file is only used by the Ant script. + +# You can use this to override default values such as +# 'source.dir' for the location of your java source folder and +# 'out.dir' for the location of your output folder. + +# You can also use it define how the release builds are signed by declaring +# the following properties: +# 'key.store' for the location of your keystore and +# 'key.alias' for the name of the key to use. +# The password will be asked during the build when you use the 'release' target. + +application-package=com.google.zxing.client.android +external-libs-folder=libs +key.store=../../release.keystore +key.alias=release \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about1d.html new file mode 100644 index 00000000..5d1551e1 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about1d.html @@ -0,0 +1,15 @@ + + + + +Über 1D-Barcodes (Strichcodes) + + + +

Die altbekannten Strichcodes, wie solche auf Produktverpackungen, werden auch eindimensionale Barcodes genannt. Es gibt einige verbreitete Arten, wie den UPC (Universal Product Code) und den EAN (European Article Number). Die meisten schauen so aus:

+

+

Diese Strichcodes enthalten eine einmalige Nummer, welche ein Produkt, wie ein Buch oder eine CD, beschreiben. Man kann nach dieser Nummer im Internet suchen, um Preise oder Beurteilungen zu finden.

+

Wenn man den Code eines Buches einscannt, kann man den Inhalt des Buches nach Wörtern oder Sätzen durchsuchen und alle Seiten finden, in denen dieses Wort vorkam:

+

+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about2d.html new file mode 100644 index 00000000..a7f4d277 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/about2d.html @@ -0,0 +1,26 @@ + + + + +Über 2D-Barcodes + + + +

Der Barcode Scanner kann auch zweidimensionale Barcodes, wie den QR-Code und den DataMatrix-Code einlesen. Die Barcodes in diesem Beispiel enthalten einen Hyperlink auf die Projekt-Homepage von ZXing:

+

+ + +

+

Ein QR-Code kann auch eine Visitenkarte mit Kontaktinformationen wie Telefonnummern und E-Mail-Adressen enthalten. Wird ein solcher Code eingescannt, dann wird eine Auswahl an Aktionen angezeigt:

+

+

Neben URLs und Kontaktdaten können QR-Codes auch folgendes enthalten:

+
    +
  • Kalendereinträge, die man dem Kalender hinzufügen kann
  • +
  • Telefonnummern, die man anrufen oder abspeichern kann
  • +
  • SMS-Nachrichten, die man verschicken kann
  • +
  • E-Mail-Adressen, denen man eine Nachricht schreiben kann
  • +
  • Geographische Koordinaten, die zu der man die Karte öffnen kann
  • +
  • Einfachen Text, den man lesen oder in die Zwischenablage kopieren kann
  • +
+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/index.html new file mode 100644 index 00000000..f0bd0613 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/index.html @@ -0,0 +1,23 @@ + + + + +Barcode Scanner-Hilfe + + + +

Barcode Scanner 4.3.1

+

Dies ist die offizielle Android App des Open-Source-Projekts ZXing:
+http://code.google.com/p/zxing

+

Der Barcode Scanner verwendet die Kamera ihres Handys, um Barcodes zu lesen und Produktinformationen wie Preise und Bewertungen zu suchen.

+

+

Er liest auch 2D-Barcodes wie den QR-Code und DataMatrix. Diese Barcodes können z.B. Links zu Webseiten enthalten oder Kontaktinformationen wie Telefonnummern und E-Mail-Adressen und vieles mehr.

+ + + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/scanning.html new file mode 100644 index 00000000..59d23a0b --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/scanning.html @@ -0,0 +1,19 @@ + + + + +Tips fürs scannen + + + +

Der Scanner durchsucht kontinuierlich den rechteckigen Bereich auf dem Bildschirm. Dabei muss der Barcode vollständig im rechteckigen Sucher erscheinen:

+

+

Für 1D-Barcodes, auch Strichcodes genannt, welche sich auf allen Handelsprodukten befinden, benötigt man ein Handy mit Autofokus. Ohne diesen können nur QR-Codes und DataMatrix-Codes eingescannt werden.

+

Wenn ein Barcode eingelesen wurde, piepst das Handy und es wird das Ergebnis des Scans angezeigt, sowie eine Beschreibung des Barcode-Inhalts, und verschiedene Möglichkeiten wie weiter verfahren werden soll.

+

Falls das Einscannen nicht richtig funktioniert, versuchen Sie das Handy ruhiger zu halten. Wenn das Bild unscharf ist, vergrößern oder verkleinern Sie den Abstand zum Barcode.

+ + + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/sharing.html new file mode 100644 index 00000000..daf7078c --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/sharing.html @@ -0,0 +1,14 @@ + + + + +So erstellen Sie einen QR-Code + + + +

Der Barcode Scanner kann nicht nur QR-Codes einlesen, sondern auch selbst erzeugen und auf dem Bildschirm anzeigen. Diesen QR-Code können Sie dann einem Freund zeigen, der den Code mit seinen Handy einscannen kann.

+

+

Um diese Funktion zu nutzen, einfach auf dem Hauptbildschirm auf die Menü-Taste drücken, und auf Senden tippen. Dann wählen, ob Sie einen Kontakt, ein Lesezeichen, eine Anwendung oder den Inhalt der Zwischenablage senden wollen und der QR-Code wird automatisch generiert. Wenn Sie fertig sind, drücken Sie die Zurücktaste.

+

Um QR-Codes auf Ihrem Computer zu erzeugen, testen Sie den ZXing QR Code Generator, er basiert auf dem selben Quelltext wie dieses Programm: http://zxing.appspot.com/generator/

+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/whatsnew.html new file mode 100644 index 00000000..aedeeac5 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-de/whatsnew.html @@ -0,0 +1,15 @@ + + + + +Neues in dieser Version von Barcode Scanner + + + +

Neu in der Version 4.3.1:

+
    +
  • Belichtungssteuerung deaktivierbar, wenn diese auf Ihrem Gerät Probleme verursacht
  • +
  • Einige weitere kleine Fehler behoben
  • +
+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about1d.html new file mode 100644 index 00000000..d809b931 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about1d.html @@ -0,0 +1,15 @@ + + + + +About 1D barcodes + + + +

Traditional barcodes, such as those printed on product packaging, are also known as one dimensional barcodes. There are several types commonly used, including UPC and EAN. Most look similar to this:

+

+

These 1D barcodes contain a unique code which typically describes a product, like a CD or a book. You can look this code up on the internet to find prices, reviews, and more.

+

If you scan a book, you can also search the contents of the book for a word or phrase, and find all the pages where it appears:

+

+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about2d.html new file mode 100644 index 00000000..42cfaedb --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/about2d.html @@ -0,0 +1,26 @@ + + + + +About 2D barcodes + + + +

Barcode Scanner also understands how to read two dimensional barcodes, like QR Codes and Data Matrix codes. For example, the codes below contain a hyperlink to the ZXing Project home page:

+

+ + +

+

You can also represent contact information in a QR Code, and put it on a business card or web site. When you scan it, the results screen provides a choice of actions:

+

+

Besides URLs and contact info, QR Codes can also contain:

+
    +
  • Calendar events, which you can add to your Calendar
  • +
  • Phone numbers, which you can dial
  • +
  • SMS numbers, which you can text message
  • +
  • Email addresses, which you can email
  • +
  • Geographic coordinates, which you can open in Maps
  • +
  • Plain text, which you can read, then share with a friend
  • +
+ + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/index.html new file mode 100644 index 00000000..2e1cc336 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/index.html @@ -0,0 +1,23 @@ + + + + +Barcode Scanner Help + + + +

Barcode Scanner 4.3.1

+

The official Android app of the open source ZXing project:
+http://code.google.com/p/zxing

+

Barcode Scanner uses the camera on your phone to read barcodes and look up product information such as prices and reviews.

+

+

It also reads 2D barcodes such as QR Codes and Data Matrix. These can contain links to web sites, contact information such as phone numbers and email addresses, and more.

+ + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/scanning.html new file mode 100644 index 00000000..bdcc05e8 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/scanning.html @@ -0,0 +1,19 @@ + + + + +How to scan + + + +

Barcode Scanner continuously scans a square region shown on your screen -- just line up the phone so the barcode is completely inside the viewfinder rectangle:

+

+

1D barcodes like those found on products require a phone with autofocus. Without it, only QR Codes and Data Matrix codes will be scannable.

+

When a barcode is read, a beep sound will play and you'll see the results of the scan, a description of what the barcode contains, and options to take action on the contents.

+

If you're having trouble scanning, make sure to hold the phone steady. If the camera is unable to focus, try moving the phone further or closer from the barcode.

+ + + \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/sharing.html new file mode 100644 index 00000000..8943dd2c --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/sharing.html @@ -0,0 +1,14 @@ + + + + +How to create QR Codes + + + +

In addition to scanning 2D barcodes, Barcode Scanner can also generate a QR Code and display it on your screen. Then you can show it to a friend, and let them scan the barcode with their phone:

+

+

To use this feature, press the Menu button from the main scanning screen, and tap Share. Then choose whether you want to share a contact, a bookmark, an application, or the contents of the clipboard. A QR Code will be generated automatically. When you're done, press Back or Home.

+

To generate QR Codes from your computer, try the ZXing QR Code Generator: http://zxing.appspot.com/generator/

+ + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/whatsnew.html new file mode 100644 index 00000000..09b84b79 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-en/whatsnew.html @@ -0,0 +1,15 @@ + + + + +What's new in Barcode Scanner + + + +

New in version 4.3.1:

+
    +
  • Disabled exposure control as it caused problems on several buggy devices
  • +
  • Other small bug fixes
  • +
+ + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about1d.html new file mode 100644 index 00000000..5c13f982 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about1d.html @@ -0,0 +1,15 @@ + + + + + Acerca de los códigos de barras 1D + + + +

Códigos de barras tradicionales, tales como las impresas en el embalaje del producto, se conocen también como uno códigos de barras bidimensionales. Existen varios tipos de uso común, incluyendo UPC y EAN. La mayoría de aspecto similar a este:

+

+

Estos códigos de barras 1D contiene un código único que generalmente describe un producto, como un CD o un libro. Usted puede ver este código en el Internet para encontrar precios, comentarios y más.

+

Si digitaliza un libro, también puede buscar en el contenido del libro para una palabra o frase, y encontrar todas las páginas en las que aparece:

+

+

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about2d.html new file mode 100644 index 00000000..57fe24b2 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/about2d.html @@ -0,0 +1,26 @@ + + + + + Acerca de los códigos de barras 2D + + + +

Barcode Scanner También entiende cómo leer dos códigos de barras bidimensionales, como los códigos QR y códigos Data Matrix. Por ejemplo, los códigos que siguen contienen un hipervínculo a la página principal de Project ZXing:

+

+ + +

+

También puede representar la información de contacto en un código QR, y lo puso en una tarjeta de visita o en el sitio web. Cuando se escanea, la pantalla de resultados se ofrecen una serie de acciones:

+

+

Además de las direcciones URL y la información de contacto, los códigos QR también puede contener:

+
    +
  • Los eventos del calendario, que se pueden añadir a su calendario
  • +
  • Los números de teléfono, que puede marcar
  • +
  • SMS números, que puede mensaje de texto
  • +
  • Direcciones de correo electrónico, que se puede enviar por correo electrónico
  • +
  • Coordenadas Geográficas, que se puede abrir en Mapas
  • +
  • Texto sin formato, que se puede leer, compartir con un amigo
  • +
+

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/index.html new file mode 100644 index 00000000..98cee79a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/index.html @@ -0,0 +1,23 @@ + + + + + Barcode Scanner Ayuda + + + +

Barcode Scanner 4.3.1

+

La aplicación oficial de Android del proyecto de código abierto ZXing:
+ http://code.google.com/p/zxing

+

Barcode Scanner utiliza la cámara de su móvil para leer códigos de barras y buscar información sobre los productos como los precios y las revisiones.

+

+

También lee los códigos de barras 2D, como los Códigos QR y Data Matrix. Estos pueden contener enlaces a otros sitios web, información de contacto, como números de teléfono y direcciones de correo electrónico y mucho más.

+ +

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/scanning.html new file mode 100644 index 00000000..61cb0c70 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/scanning.html @@ -0,0 +1,19 @@ + + + + + Cómo analizar + + + +

Barcode Scanner escanea continuamente una región cuadrada que aparece en su pantalla - Sólo basta definir el teléfono de modo que el código de barras es completamente dentro del rectángulo del visor:

+

+

Códigos de barras 1D, como las que se encuentran en los productos requieren un teléfono con enfoque automático. Sin él, sólo los códigos QR y códigos Data Matrix será susceptible de ser analizada.

+

Cuando un código de barras es leído, un sonido se reproducirá y podrás ver los resultados del análisis, una descripción de lo que contiene el código de barras, y las opciones para tomar acción sobre los contenidos.

+

Si usted está teniendo problemas de escaneo, asegúrese de sujetar el teléfono fijo. Si la cámara no puede enfocar, mueva el teléfono más lejos o más cerca del código de barras.

+ +

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/sharing.html new file mode 100644 index 00000000..fed2c93f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/sharing.html @@ -0,0 +1,14 @@ + + + + + Cómo crear códigos QR + + + +

Además de escanear códigos de barras 2D, escáner de código de barras también puede generar un código QR y lo mostrará en la pantalla. A continuación, puede mostrar a un amigo, y dejar que escanear el código de barras con su teléfono:

+

+

Para utilizar esta función, presione el botón Menú en la pantalla de exploración principal y toque Compartir. A continuación, seleccione si desea compartir un contacto, un marcador, una aplicación o el contenido del portapapeles. Un código QR se generará automáticamente. Cuando haya terminado, pulse Atrás o Inicio.

+

Para generar códigos QR desde su computadora, pruebe el generador ZXing Código QR: http://zxing.appspot.com/generator/

+

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/whatsnew.html new file mode 100644 index 00000000..ec733d61 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-es/whatsnew.html @@ -0,0 +1,15 @@ + + + + + ¿Qué hay de nuevo en Barcode Scanner + + + +

Nuevo en la versión 4.3.1:

+
    +
  • Desactivado el control de exposición ya que causó problemas en los dispositivos con errores varios
  • +
  • Otras pequeñas correcciones de errores
  • +
+

Traducido por Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about1d.html new file mode 100644 index 00000000..4c35fb36 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about1d.html @@ -0,0 +1,15 @@ + + + + + À propos de codes à barres 1D + + + +

Codes à barres traditionnels, tels que ceux imprimés sur l'emballage du produit, sont également connus comme une dimension codes à barres. Il existe plusieurs types couramment utilisés, y compris l'UPC et EAN. La plupart ressembler à ceci:

+

+

Ces codes à barres 1D contient un code unique qui décrit typiquement un produit, comme un CD ou un livre. Vous pouvez regarder ce code sur internet pour trouver les prix, critiques et autres.

+

Si vous numérisez un livre, vous pouvez également rechercher le contenu du livre pour un mot ou une phrase, et de trouver toutes les pages où il apparaît:

+

+

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about2d.html new file mode 100644 index 00000000..10d22f57 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/about2d.html @@ -0,0 +1,26 @@ + + + + + À propos de codes-barres 2D + + + +

Barcode Scanner comprend également comment lire deux dimensions, comme les codes-barres QR Codes et les codes Data Matrix. Par exemple, les codes ci-dessous contiennent un lien hypertexte vers la page d'accueil du projet ZXing:

+

+ + +

+

Vous pouvez également représenter des informations de contact dans un QR Code, et le mettre sur une carte de visite ou un site Web. Lorsque vous scannez, l'écran de résultats fournit un choix d'actions:

+

+

Outre les URL et les informations de contact, les codes QR peuvent aussi contenir:

+
    +
  • Calendrier des événements que vous pouvez ajouter à votre agenda
  • +
  • Les numéros de téléphone que vous pouvez composer
  • +
  • Numéros SMS, que vous pouvez Texte du message
  • +
  • Adresses e-mail, que vous pouvez envoyer un courriel
  • +
  • Coordonnées géographiques, que vous pouvez ouvrir dans Google Maps
  • +
  • Texte, que vous pouvez lire, puis partager avec un ami
  • +
+

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/index.html new file mode 100644 index 00000000..c019d574 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/index.html @@ -0,0 +1,23 @@ + + + + + Aide Barcode Scanner + + + +

Barcode Scanner 4.3.1

+

L'application officielle Android du projet ZXing open source:
+ http://code.google.com/p/zxing

+

Barcode Scanner utilise la caméra de votre téléphone pour lire des codes barres et de rechercher des informations sur des produits tels que les prix et les critiques.

+

+

Il lit également les codes à barres 2D tels que les codes QR et Data Matrix. Ceux-ci peuvent contenir des liens vers des sites Web, communiquer avec des informations telles que les numéros de téléphone et adresses e-mail, et plus encore.

+ +

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/scanning.html new file mode 100644 index 00000000..8c98f5c9 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/scanning.html @@ -0,0 +1,19 @@ + + + + + Comment numériser + + + +

Barcode Scanner scanne en permanence une zone carrée affichée sur votre écran - ligne juste le téléphone de sorte que le code à barres est complètement à l'intérieur du rectangle du viseur:

+

+

Codes à barres 1D comme ceux qu'on trouve sur les produits nécessitent un téléphone avec autofocus. Sans elle, seuls les codes QR et les codes Data Matrix sera analysable.

+

Quand un code-barres est lu, un bip sonore se jouer et vous verrez les résultats de l'analyse, une description de ce que le code à barres contient, et les options à prendre des mesures sur le contenu.

+

Si vous rencontrez des problèmes de numérisation, assurez-vous de tenir le téléphone fixe. Si l'appareil photo est incapable de se concentrer, essayez de déplacer le téléphone supplémentaire ou plus près du code à barres.

+ +

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/sharing.html new file mode 100644 index 00000000..62f1704c --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/sharing.html @@ -0,0 +1,14 @@ + + + + + Comment créer des codes QR + + + +

En plus de la numérisation des codes à barres 2D, Barcode Scanner peut aussi générer un QR Code et l'afficher sur votre écran. Ensuite, vous pouvez le montrer à un ami, et laissez-les scanner le code-barres avec leur téléphone:

+

+

Pour utiliser cette fonction, appuyez sur la touche Menu depuis l'écran du balayage principal, puis appuyez sur Partager. Ensuite, choisissez si vous voulez partager un contact, un signet, une application ou le contenu du presse-papiers. Un Code QR est généré automatiquement. Lorsque vous avez terminé, appuyez sur Retour ou d'accueil.

+

Pour générer les codes QR à partir de votre ordinateur, essayez le générateur de code QR ZXing: http://zxing.appspot.com/generator/

+

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/whatsnew.html new file mode 100644 index 00000000..839ed68a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-fr/whatsnew.html @@ -0,0 +1,15 @@ + + + + + Quoi de neuf dans Barcode Scanner + + + +

Nouveau dans la version 4.3.1:

+
    +
  • Désactivé contrôle de l'exposition que cela causait des problèmes sur les appareils de buggy plusieurs
  • +
  • D'autres petites corrections de bugs
  • +
+

Traduit par Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about1d.html new file mode 100644 index 00000000..8b0d8a0a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about1d.html @@ -0,0 +1,15 @@ + + + + + A proposito di codici a barre 1D + + + +

Codici a barre tradizionali, come quelle stampate sulla confezione del prodotto, sono noti anche come uno codici a barre bidimensionali. Ci sono diversi tipi di uso comune, tra cui UPC ed EAN. La maggior parte simile al seguente:

+

+

Queste barre 1D contengono un codice unico che descrive tipicamente un prodotto, come un CD o un libro. È possibile cercare questo codice su internet per trovare i prezzi, recensioni e altro.

+

Se si esegue la scansione di un libro, è anche possibile cercare i contenuti del libro per una parola o una frase, e trovare tutte le pagine in cui appare:

+

+

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about2d.html new file mode 100644 index 00000000..6b862639 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/about2d.html @@ -0,0 +1,26 @@ + + + + + A proposito di codici a barre 2D + + + +

Barcode Scanner comprende anche come leggere due codici a barre bidimensionali, come i codici QR e codici Data Matrix. Per esempio, i seguenti codici contengono un collegamento ipertestuale alla pagina ZXing principale del progetto:

+

+ + +

+

È anche possibile rappresentare le informazioni di contatto in un QR Code, e metterlo su un biglietto da visita o un sito web. Quando si esegue la scansione, la schermata dei risultati fornisce una serie di azioni:

+

+

Oltre URL e informazioni di contatto, i codici QR possono contenere anche:

+
    +
  • Eventi del Calendario, che è possibile aggiungere al vostro calendario
  • +
  • I numeri di telefono, che possono essere digitati
  • +
  • Numeri di SMS, che è possibile il testo del messaggio
  • +
  • Indirizzi e-mail, che possono essere inviati per email
  • +
  • Coordinate geografiche, che è possibile aprire in Mappe
  • +
  • Testo semplice, che si può leggere, quindi condividere con un amico
  • +
+

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/index.html new file mode 100644 index 00000000..b8e8d737 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/index.html @@ -0,0 +1,23 @@ + + + + + Barcode Scanner Aiuto + + + +

Barcode Scanner 4.3.1

+

L'applicazione ufficiale di Android del progetto aperto ZXing fonte:
+ http://code.google.com/p/zxing

+

Scanner di codici a barre utilizza la fotocamera del telefono per leggere codici a barre e ricercare informazioni sui prodotti, i prezzi e le recensioni.

+

+

Legge anche codici a barre 2D, come i codici QR e Data Matrix. Questi possono contenere link a siti web, informazioni di contatto, quali numeri di telefono e indirizzi e-mail e altro ancora.

+ +

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/scanning.html new file mode 100644 index 00000000..81d3cc03 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/scanning.html @@ -0,0 +1,19 @@ + + + + + Come eseguire la scansione + + + +

Barcode Scanner analizza continuamente una regione quadrata mostrata sullo schermo - solo linea il telefono in modo che il codice a barre è completamente all'interno del rettangolo del mirino:

+

+

Codici a barre 1D, come quelle che si trovano sui prodotti richiede un telefono con autofocus. Senza di essa, solo i codici QR e codici Data Matrix sarà leggibile.

+

Quando un codice a barre viene letto, un bip si giocare e vedrete i risultati della scansione, una descrizione di ciò che il codice a barre contiene, e le opzioni per intervenire sui contenuti.

+

Se hai dei problemi di scansione, assicurarsi di tenere il telefono fermo. Se la fotocamera non riesce a mettere a fuoco, provare a spostare il telefono lontano o più vicino dal codice a barre.

+ +

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/sharing.html new file mode 100644 index 00000000..32ad9276 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/sharing.html @@ -0,0 +1,14 @@ + + + + + Come creare codici QR + + + +

Oltre alla scansione di codici a barre 2D, Barcode Scanner può anche generare un codice QR e visualizzarla sullo schermo. Poi si può mostrare ad un amico, e far loro eseguire la scansione del codice a barre con il proprio telefono:

+

+

Per utilizzare questa funzione, premere il tasto Menu dalla schermata di scansione principale, e toccare Condividi. Quindi scegliere se si desidera condividere un contatto, un segnalibro, un'applicazione, o il contenuto degli appunti. Un codice a barre verrà generato automaticamente. Al termine, premere Indietro o Home.

+

Per generare i codici QR dal tuo computer, provare il generatore di ZXing QR Code: http://zxing.appspot.com/generator/

+

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/whatsnew.html new file mode 100644 index 00000000..bae41c91 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-it/whatsnew.html @@ -0,0 +1,15 @@ + + + + + Cosa c'è di nuovo nella Barcode Scanner + + + +

Nuovo nella versione 4.3.1:

+
    +
  • Disabilitato il controllo dell'esposizione, ha causato problemi su dispositivi diversi buggy
  • +
  • Altre correzioni di bug piccoli
  • +
+

Tradotto da Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about1d.html new file mode 100644 index 00000000..6af6ad70 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about1d.html @@ -0,0 +1,15 @@ + + + + + 1Dãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã«ã¤ã„㦠+ + + +

ãã®ã‚ˆã†ãªè£½å“パッケージã«å°åˆ·ã•れるよã†ãªä¼çµ±çš„ãªãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚‚ã¾ãŸã€1次元ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã¨ã—ã¦çŸ¥ã‚‰ã‚Œã¦ã„ã¾ã™ã€‚ UPCã¨EANãªã©ã€ä¸€èˆ¬çš„ã«ä½¿ç”¨ã•れるã„ãã¤ã‹ã®ç¨®é¡žãŒã‚りã¾ã™ã€‚ã»ã¨ã‚“ã©ã¯ã“れã«ä¼¼ã¦ã„るよã†ã«è¦‹ãˆã¾ã™ï¼š

+

+

ã“れらã®1Dãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã¯ã€é€šå¸¸ã€CDや本ã®ã‚ˆã†ã«ã€è£½å“を説明ã™ã‚‹å›ºæœ‰ã®ã‚³ãƒ¼ãƒ‰ãŒå«ã¾ã‚Œã¦ã„ã¾ã™ã€‚ã‚ãªãŸã¯ã€ä¾¡æ ¼ã‚„レビューãªã©ã‚’見ã¤ã‘ã‚‹ãŸã‚ã«ã€ã‚¤ãƒ³ã‚¿ãƒ¼ãƒãƒƒãƒˆä¸Šã§ã“ã®ã‚³ãƒ¼ãƒ‰ã‚’調ã¹ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚

+

ã‚ãªãŸãŒæœ¬ã‚’スキャンã™ã‚‹å ´åˆã¯ã€å˜èªžã‚„ãƒ•ãƒ¬ãƒ¼ã‚ºã®æœ¬ã®å†…容を検索ã—ã¦ã€ãれãŒè¡¨ç¤ºã•れるã™ã¹ã¦ã®ãƒšãƒ¼ã‚¸ã‚’見ã¤ã‘ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼š

+

+

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about2d.html new file mode 100644 index 00000000..c7bc5810 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/about2d.html @@ -0,0 +1,26 @@ + + + + + 約二次元ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ + + + +

ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠ ã¾ãŸã€QRコードã¨ãƒ‡ãƒ¼ã‚¿ãƒžãƒˆãƒªãƒƒã‚¯ã‚¹ã‚³ãƒ¼ãƒ‰ã®ã‚ˆã†ãª2次元ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’読ã¿å–る方法をç†è§£ã—ã¦ã„ã¾ã™ã€‚ãŸã¨ãˆã°ã€ä»¥ä¸‹ã®ã‚³ãƒ¼ãƒ‰ã¯ã€ZXingプロジェクトã®ãƒ›ãƒ¼ãƒ Â·ãƒšãƒ¼ã‚¸ã¸ã®ãƒã‚¤ãƒ‘ーリンクãŒå«ã¾ã‚Œã¦ã„ã¾ã™ã€‚

+

+ + +

+

ã¾ãŸã€QRコードã§é€£çµ¡å…ˆæƒ…報を表ã—ã¦ãŠã‚Šã€å刺やWebサイト上ã§ãれを置ãã“ã¨ãŒã§ãã¾ã™ã€‚ã‚ãªãŸãŒãれをスキャンã™ã‚‹ã¨ã€çµæžœç”»é¢ã«ã¯ã€ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã®é¸æŠžè‚¢ã‚’æä¾›ã—ã¾ã™ï¼š

+

+

URLや連絡先情報ã®ã»ã‹ã«ã€QRコードもå«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚

+
    +
  • ã‚ãªãŸã®ã‚«ãƒ¬ãƒ³ãƒ€ãƒ¼ã«è¿½åŠ ã§ãるカレンダーイベントã€
  • +
  • ã‚ãªãŸãŒãƒ€ã‚¤ãƒ¤ãƒ«ã§ãる電話番å·ã¯ã€
  • +
  • ã‚ãªãŸãŒãƒ†ã‚­ã‚¹ãƒˆãƒ¡ãƒƒã‚»ãƒ¼ã‚¸ã§ãã‚‹SMS番å·ã€
  • +
  • ã‚ãªãŸãŒé›»å­ãƒ¡ãƒ¼ãƒ«ã§é€ã‚‹ã“ã¨ãŒã§ãã€é›»å­ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã€
  • +
  • ã‚ãªãŸãŒãƒžãƒƒãƒ—ã§é–‹ãã“ã¨ãŒã§ãã€åœ°ç†åº§æ¨™ã€
  • +
  • ã‚ãªãŸãŒèª­ã‚€ã“ã¨ãŒã§ãるプレーンテキストã¯ã€ãã®å¾Œã€å‹äººã¨å…±æœ‰
  • +
+

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/index.html new file mode 100644 index 00000000..8c055b6e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/index.html @@ -0,0 +1,23 @@ + + + + + ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠã®ãƒ˜ãƒ«ãƒ— + + + +

Barcode Scanner 4.3.1

+

オープンソースZXingプロジェクトã®å…¬å¼Androidアプリ:
+ http://code.google.com/p/zxing

+

ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠã¯ã€ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’読ã¿å–ã‚‹ã¨ã€ä¾¡æ ¼ã‚„レビューãªã©ã®è£½å“情報をルックアップã™ã‚‹ãŸã‚ã«ãŠä½¿ã„ã®æºå¸¯é›»è©±ã®ã‚«ãƒ¡ãƒ©ã‚’使用ã—ã¦ã„ã¾ã™ã€‚

+

+

ã¾ãŸã€ãã®ã‚ˆã†ãªQRコードã¨ãƒ‡ãƒ¼ã‚¿ãƒžãƒˆãƒªã‚¯ã‚¹ã¨ã—ã¦2次元ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’読ã¿å–りã¾ã™ã€‚ã“れらã¯ã€ã‚¦ã‚§ãƒ–サイトã€é›»è©±ç•ªå·ã‚„é›»å­ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã€ãã®ä»–ãªã©ã®é€£çµ¡å…ˆæƒ…å ±ã¸ã®ãƒªãƒ³ã‚¯ã‚’å«ã‚ã‚‹ã“ã¨ãŒã§ãã¾ã™ã€‚

+ +

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/scanning.html new file mode 100644 index 00000000..0d76df7a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/scanning.html @@ -0,0 +1,19 @@ + + + + + スキャンã™ã‚‹æ–¹æ³• + + + +

:ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ãŒå®Œå…¨ã«ãƒ•ァインダーã®å››è§’å½¢ã®å†…部ã«ã‚ã‚‹ã®ã§ã€é›»è©±æœ€å¤§ã¡ã‚‡ã†ã©ãƒ©ã‚¤ãƒ³ - ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠã¯ã€é€£ç¶šã—ã¦ã€ç”»é¢ã«è¡¨ç¤ºã•れる正方形ã®é ˜åŸŸã‚’スキャン

+

+

商å“ã§è¦‹ã‚‰ã‚Œã‚‹ã‚ˆã†ãª1Dãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã¯ã€ã‚ªãƒ¼ãƒˆãƒ•ォーカス機能付ãã®æºå¸¯é›»è©±ã‚’å¿…è¦ã¨ã—ã¾ã™ã€‚ãれãŒãªã‘れã°ã€å”¯ä¸€ã®QRコードã¨ãƒ‡ãƒ¼ã‚¿ãƒžãƒˆãƒªã‚¯ã‚¹ã‚³ãƒ¼ãƒ‰ãŒã‚¹ã‚­ãƒ£ãƒ³å¯èƒ½ã«ãªã‚Šã¾ã™ã€‚

+

ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ãŒèª­ã¿å–られるã¨ã€ãƒ“ープ音ãŒé³´ã‚Šã€ã‚ãªãŸã¯ã€ã‚¹ã‚­ãƒ£ãƒ³ã€ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ãŒå«ã¾ã‚Œã¦ã„る内容ã®èª¬æ˜Žã€ãŠã‚ˆã³ã‚³ãƒ³ãƒ†ãƒ³ãƒ„ã«å¯¾ã—ã¦ã‚¢ã‚¯ã‚·ãƒ§ãƒ³ã‚’実行ã™ã‚‹ãŸã‚ã®ã‚ªãƒ—ションã®çµæžœãŒè¡¨ç¤ºã•れã¾ã™ã€‚

+

ã‚ãªãŸã¯ã€ã‚¹ã‚­ãƒ£ãƒ³ã®ãƒˆãƒ©ãƒ–ルを抱ãˆã¦ã„ã‚‹å ´åˆã¯ã€é›»è©±æ©Ÿã‚’ã—ã£ã‹ã‚Šã¨æŠ‘ãˆã¦ã„ã‚‹ã“ã¨ã‚’確èªã—ã¦ãã ã•ã„。ピントãŒåˆã£ã¦ã„ã¾ã›ã‚“ã§ã‚れã°ã€ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‹ã‚‰ã•らãªã‚‹ã¾ãŸã¯è¿‘ã„電話を動ã‹ã—ã¦ã¿ã¦ãã ã•ã„。

+ +

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/sharing.html new file mode 100644 index 00000000..e03c0686 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/sharing.html @@ -0,0 +1,14 @@ + + + + + ã©ã®ã‚ˆã†ã«QRコードを作æˆã™ã‚‹ + + + +

2Dãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’スキャンã™ã‚‹ã ã‘ã§ãªãã€ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠã‚‚QRコードを生æˆã™ã‚‹ã“ã¨ãŒã§ãã€ã‚ãªãŸã®ç”»é¢ä¸Šã«è¡¨ç¤ºã€‚ãã®å¾Œã€å‹äººã«ãれを見ã›ã€ãã‚Œã‚‰ã‚’è‡ªåˆ†ã®æºå¸¯é›»è©±ã§ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚’スキャンã•ã›ã‚‹ã“ã¨ãŒã§ãã¾ã™ï¼š

+

+

ã“ã®æ©Ÿèƒ½ã‚’使用ã™ã‚‹ã«ã¯ã€ä¸»èµ°æŸ»ç”»é¢ã‹ã‚‰ãƒ¡ãƒ‹ãƒ¥ãƒ¼ãƒœã‚¿ãƒ³ã‚’押ã—ã¦ã€å…±æœ‰ã‚’タップã—ã¾ã™ã€‚次ã«ã€ã‚ãªãŸãŒé€£çµ¡å…ˆã€ãƒ–ックマークã€ã‚¢ãƒ—リケーションã€ã¾ãŸã¯ã‚¯ãƒªãƒƒãƒ—ボードã®å†…容を共有ã—ãŸã„ã¨æ€ã†ã‹ã©ã†ã‹ã‚’é¸æŠžã—ã¾ã™ã€‚ QRコードãŒè‡ªå‹•çš„ã«ç”Ÿæˆã•れã¾ã™ã€‚設定ãŒå®Œäº†ã—ãŸã‚‰ã€[戻る]ã¾ãŸã¯[ホームキーを押ã—ã¾ã™ã€‚

+

ãŠä½¿ã„ã®ã‚³ãƒ³ãƒ”ュータã‹ã‚‰QRコードを生æˆã™ã‚‹ã«ã¯ã€ZXingã®QRコードジェãƒãƒ¬ãƒ¼ã‚¿ã‚’試ã—ã¦ãã ã•ã„: http://zxing.appspot.com/generator/

+

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/whatsnew.html new file mode 100644 index 00000000..8826525a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ja/whatsnew.html @@ -0,0 +1,15 @@ + + + + + ãƒãƒ¼ã‚³ãƒ¼ãƒ‰ã‚¹ã‚­ãƒ£ãƒŠã®æ–°æ©Ÿèƒ½ + + + +

ãƒãƒ¼ã‚¸ãƒ§ãƒ³4.3.1ã®æ–°æ©Ÿèƒ½ï¼š

+
    +
  • ãれã¯ã„ãã¤ã‹ã®ãƒã‚°ã®ãƒ‡ãƒã‚¤ã‚¹ã§å•題ãŒç™ºç”Ÿã—ãŸéœ²å…‰åˆ¶å¾¡ã‚’無効ã«ã—ã¦
  • +
  • ãã®ä»–ã®å°ã•ãªãƒã‚°ä¿®æ­£
  • +
+

Google翻訳ã§ç¿»è¨³ã€‚

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about1d.html new file mode 100644 index 00000000..90680ee6 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about1d.html @@ -0,0 +1,15 @@ + + + + + 1D 바코드 정보 + + + +

ì´ëŸ¬í•œ 제품 í¬ìž¥ì— ì¸ì‡„ ëœ ê²ƒê³¼ ê°™ì€ ì „í†µì ì¸ ë°”ì½”ë“œëŠ”ë„ 1 ì°¨ì› ë°”ì½”ë“œë¡œ 알려져 있습니다. UPC ë° EAN 등 ì¼ë°˜ì ìœ¼ë¡œ 사용ë˜ëŠ” 여러 종류가 있습니다. ëŒ€ë¶€ë¶„ì€ ë‹¤ìŒê³¼ 유사 :

+

+

ì´ 1D 바코드는 ì¼ë°˜ì ìœ¼ë¡œ CD 나 ì±… ê°™ì€ ì œí’ˆì„ ì„¤ëª…í•˜ëŠ” 고유 한 코드가 í¬í•¨ë˜ì–´ 있습니다. ë‹¹ì‹ ì€ ê°€ê²©, 리뷰 ë“±ì„ ì°¾ì•„ ì¸í„°ë„·ì—ì„œì´ ì½”ë“œë¥¼ 찾아 ë³¼ 수 있습니다.

+

ë‹¹ì‹ ì€ ì±…ì„ ìŠ¤ìº” í•  경우, ë‹¹ì‹ ì€ ë˜í•œ 단어 나 ë¬¸êµ¬ì— ëŒ€í•œ ì±…ì˜ ë‚´ìš©ì„ ê²€ìƒ‰í•˜ê³  표시 모든 페ì´ì§€ë¥¼ ì°¾ì„ ìˆ˜ 있습니다 :

+

+

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about2d.html new file mode 100644 index 00000000..16119f5e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/about2d.html @@ -0,0 +1,26 @@ + + + + + ì— ëŒ€í•œ 2 ì°¨ì› ë°”ì½”ë“œ + + + +

바코드 스ìºë„ˆ ë˜í•œ, QR 코드 ë° ë°ì´í„° 매트릭스 코드와 ê°™ì€ 2 ì°¨ì› ë°”ì½”ë“œë¥¼ ì½ëŠ” ë°©ë²•ì„ ì´í•´í•˜ê³  있습니다. 예를 들어, ì•„ëž˜ì˜ ì½”ë“œëŠ” ZXing 프로ì íЏ 홈 페ì´ì§€ì— 하ì´í¼ ë§í¬ë¥¼ í¬í•¨ :

+

+ + +

+

ë‹¹ì‹ ì€ ë˜í•œ QR ì½”ë“œì— ì—°ë½ì²˜ 정보를 나타냅니다, 그리고 명함 ë˜ëŠ” 웹 사ì´íŠ¸ì— ë„£ì„ ìˆ˜ 있습니다. ë‹¹ì‹ ì´ ê·¸ê²ƒì„ ìŠ¤ìº”í•˜ë©´ ê²°ê³¼ í™”ë©´ì´ ìž‘ì—…ì˜ ì„ íƒì„ 제공합니다 :

+

+

URL ë° ì—°ë½ì²˜ ì •ë³´ 외ì—, QR ì½”ë“œë„ í¬í•¨ í•  수 있습니다 :

+
    +
  • ê·€í•˜ì˜ ìº˜ë¦°ë”ì— ì¶”ê°€ í•  수있는 ìº˜ë¦°ë” ì´ë²¤íЏ,
  • +
  • ë‹¹ì‹ ì´ ì „í™”ë¥¼ 걸 수 ì „í™” 번호,
  • +
  • ë‹¹ì‹ ì€ ë¬¸ìž ë©”ì‹œì§€ë¥¼ 보낼 수있는 SMS 번호,
  • +
  • ë‹¹ì‹ ì€ ì´ë©”ì¼ì„ 보낼 수 ì´ë©”ì¼ ì£¼ì†Œ
  • +
  • 당신ì´ì§€ë„ì—서 ì—´ 수있는 지리 좌표,
  • +
  • ë‹¹ì‹ ì´ ì½ì„ 수있는 ì¼ë°˜ í…스트는 ë‹¤ìŒ ì¹œêµ¬ì™€ 공유
  • +
+

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/index.html new file mode 100644 index 00000000..13f9fb97 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/index.html @@ -0,0 +1,23 @@ + + + + + 바코드 스ìºë„ˆ ë„ì›€ë§ + + + +

Barcode Scanner 4.3.1

+

오픈 소스 ZXing 프로ì íŠ¸ì˜ ê³µì‹ ì•ˆë“œë¡œì´ë“œ ì‘ìš© 프로그램 :
+ http://code.google.com/p/zxing

+

바코드 스ìºë„ˆëŠ” 바코드를 ì½ì–´ì™€ ê°™ì€ ê°€ê²©ê³¼ 리뷰 ë“±ì˜ ì œí’ˆ 정보를 조회 í•  휴대 ì „í™”ì˜ ì¹´ë©”ë¼ë¥¼ 사용합니다.

+

+

ê·¸ê²ƒì€ ë˜í•œ QR 코드와 ë°ì´í„° 매트릭스와 ê°™ì€ 2 ì°¨ì› ë°”ì½”ë“œë¥¼ ì½ìŠµë‹ˆë‹¤. ì´ëŸ¬í•œ 웹 사ì´íŠ¸ì— ëŒ€í•œ ë§í¬ë¥¼ í¬í•¨ í•  수 있습니다, ê°™ì€ ì „í™” 번호와 ì´ë©”ì¼ ì£¼ì†Œ ë“±ì˜ ì •ë³´ë¥¼ 문ì˜í•˜ì‹­ì‹œì˜¤.

+ +

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/scanning.html new file mode 100644 index 00000000..1169cf39 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/scanning.html @@ -0,0 +1,19 @@ + + + + + 스캔하는 방법 + + + +

: 바코드가 완전히 ë·° 파ì¸ë”ì˜ ì‚¬ê°í˜• 안ì—하ë„ë¡ ì „í™”, 조금만 ë¼ì¸ - 바코드 스ìºë„ˆëŠ” ì§€ì†ì ìœ¼ë¡œ í™”ë©´ì— í‘œì‹œ 사ê°í˜• ì˜ì—­ì„ 검사

+

+

제품ì—서 발견 ëœ ê²ƒê³¼ ê°™ì€ 1D 바코드는 ìžë™ ì´ˆì ê³¼ 전화를해야합니다. ê°€ 없으면 ë§Œ QR 코드와 ë°ì´í„° 매트릭스 코드는 í™•ì¸ ê°€ëŠ¥í•œ 것입니다.

+

바코드를 ì½ì„ 때, ì‚ ì†Œë¦¬ê°€ 재ìƒë©ë‹ˆë‹¤ 그리고 ë‹¹ì‹ ì€ ìŠ¤ìº”, ë°”ì½”ë“œì˜ ë‚´ìš©ì´ ë­”ì§€ 설명 ë° ë‚´ìš©ì— ì¡°ì¹˜ë¥¼ 취할 수있는 ì˜µì…˜ì˜ ê²°ê³¼ë¥¼ ë³¼ 수 있습니다.

+

ë‹¹ì‹ ì€ ë¬¸ì œê°€ 검색하는 ë° ë¬¸ì œê°€ìžˆëŠ” 경우 휴대 전화가 ì •ìƒ ìƒíƒœì— 있는지 확ì¸í•˜ì‹­ì‹œì˜¤. ì¹´ë©”ë¼ê°€ ì´ˆì ì„ ë§žì¶œ 수없는 경우, 바코드ì—서 ë” ë˜ëŠ” ë” ê°€ê¹Œì´ íœ´ëŒ€ 전화를 ì´ë™í•˜ì‹­ì‹œì˜¤.

+ +

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/sharing.html new file mode 100644 index 00000000..8c5e5412 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/sharing.html @@ -0,0 +1,14 @@ + + + + + 어떻게 QR 코드를 만드는 방법 + + + +

2D 바코드를 스캔ë¿ë§Œ 아니ë¼, 바코드 스ìºë„ˆëŠ” QR 코드를 ìƒì„± í•  수 있으며 í™”ë©´ì— í‘œì‹œë©ë‹ˆë‹¤. 그럼 ë‹¹ì‹ ì€ ì¹œêµ¬ì—게 ë³´ì—¬, ê·¸ ìžì‹ ì˜ 휴대 전화로 바코드를 스캔하ë„ë¡ í•  수 있습니다 :

+

+

ì´ ê¸°ëŠ¥ì„ ì‚¬ìš©í•˜ë ¤ë©´ 기본 검색 화면ì—서 메뉴 ë²„íŠ¼ì„ ëˆ„ë¥´ë©´,하고 공유를 누릅니다. 그런 ë‹¤ìŒ ì—°ë½ì²˜, ì¦ê²¨ 찾기, ì‘ìš© 프로그램 ë˜ëŠ” í´ë¦½ ë³´ë“œì˜ ë‚´ìš©ì„ ê³µìœ í• ì§€ 여부를 ì„ íƒí•©ë‹ˆë‹¤. QR 코드가 ìžë™ìœ¼ë¡œ ìƒì„±ë©ë‹ˆë‹¤. ì´ ì™„ë£Œë˜ë©´, 뒤로 ë˜ëŠ” í™ˆì„ ëˆ„ë¦…ë‹ˆë‹¤.

+

컴퓨터ì—서 QR 코드를 ìƒì„±í•˜ë ¤ë©´ ZXing QR 코드 ìƒì„±ê¸°ë¥¼ 사용해 : http://zxing.appspot.com/generator/

+

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/whatsnew.html new file mode 100644 index 00000000..1706376f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ko/whatsnew.html @@ -0,0 +1,15 @@ + + + + + 바코드 스ìºë„ˆì˜ 새로운 기능 + + + +

버전 4.3.1ì˜ ìƒˆë¡œìš´ 기능 :

+
    +
  • ê·¸ê²ƒì€ ì—¬ëŸ¬ 버그가 ìž¥ì¹˜ì— ë¬¸ì œë¥¼ 야기로 노출 제어를 비활성화
  • +
  • 기타 ìž‘ì€ ë²„ê·¸ 수정
  • +
+

Google ë²ˆì—­ì„ í†µí•´ 번역.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about1d.html new file mode 100644 index 00000000..c49fb57b --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about1d.html @@ -0,0 +1,15 @@ + + + + + Over 1D barcodes + + + +

Traditionele barcodes, zoals gedrukt op de verpakking, ook bekend als eendimensionale barcodes. Er zijn verschillende types gebruikt, zoals UPC en EAN. De meeste lijken op deze:

+

+

Deze 1D barcodes bevatten een unieke code die typisch beschrijft een product, zoals een cd of een boek. U kunt kijken deze code op het internet om de prijzen, reviews en nog veel meer te vinden.

+

Als u scant een boek, kunt u ook zoeken in de inhoud van het boek voor een woord of zin, en vind alle pagina's waar het verschijnt:

+

+

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about2d.html new file mode 100644 index 00000000..dcb1d47b --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/about2d.html @@ -0,0 +1,26 @@ + + + + + Over 2D barcodes + + + +

Barcode Scanner begrijpt ook hoe om te lezen tweedimensionale barcodes, zoals QR Codes en Data Matrix codes. Bijvoorbeeld, de volgende codes bevatten een hyperlink naar de ZXing Project home page:

+

+ + +

+

U kunt contactgegevens ook te vertegenwoordigen in een QR-code, en zet het op een visitekaartje of website. Als u het scannen, de resultaten scherm biedt een keuze van acties:

+

+

Naast URL's en contactgegevens, kunnen QR Codes bevatten:

+
    +
  • Agenda-items, die u kunt toevoegen aan uw agenda
  • +
  • Telefoonnummers, die u kunt bellen
  • +
  • SMS-nummers, die u kunt SMS-bericht
  • +
  • E-mailadressen, die u kunt e-mailen
  • +
  • Geografische coördinaten, die u kunt openen in Google Maps
  • +
  • Platte tekst, die u kunt lezen, dan delen met een vriend
  • +
+

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/index.html new file mode 100644 index 00000000..7e5e36bd --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/index.html @@ -0,0 +1,23 @@ + + + + + Barcode Scanner Help + + + +

Barcode Scanner 4.3.1

+

De officiële Android app van de open source ZXing project:
+ http://code.google.com/p/zxing

+

Barcode Scanner maakt gebruik van de camera op je telefoon om barcodes te lezen en op te zoeken productinformatie, zoals prijzen en reviews.

+

+

Het leest ook 2D barcodes zoals QR Codes en Data Matrix. Deze kunnen links naar websites bevatten, contactgegevens zoals telefoonnummers en e-mailadressen, en nog veel meer.

+ +

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/scanning.html new file mode 100644 index 00000000..b9e61394 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/scanning.html @@ -0,0 +1,19 @@ + + + + + Hoe om te scannen + + + +

Barcode Scanner scant continu een vierkant gebied op uw scherm - net line-up van de telefoon, zodat de barcode is helemaal in de zoeker rechthoek:

+

+

1D barcodes zoals die gevonden op producten vereisen een telefoon met autofocus. Zonder dat zal alleen maar QR Codes en Data Matrix codes zijn leesbaar.

+

Wanneer een barcode wordt gelezen, zal een pieptoon te spelen en zie je de resultaten van de scan, een beschrijving van wat de barcode bevat, en opties om actie te ondernemen op de inhoud.

+

Als u problemen ondervindt bij het scannen, moet u Houd de telefoon stil. Als de camera niet kan scherpstellen, probeer dan het verplaatsen van de telefoon verder of dichter van de barcode.

+ +

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/sharing.html new file mode 100644 index 00000000..c4c635f2 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/sharing.html @@ -0,0 +1,14 @@ + + + + + Hoe kan ik QR Codes te creëren + + + +

In aanvulling op het scannen van 2D-barcodes, kan Barcode Scanner ook het genereren van een QR-code en geeft deze weer op het scherm. Dan kunt u laten zien aan een vriend, en laat ze de streepjescode scannen met hun telefoon:

+

+

Om deze functie te gebruiken, drukt u op de knop Menu van de belangrijkste scannen scherm en tik op Delen. Vervolgens kiest u of u een contact, een bladwijzer, een toepassing, of de inhoud van het klembord te delen. Een QR-code wordt automatisch gegenereerd. Als u klaar bent, drukt u op Terug of Home.

+

Om QR Codes van uw computer te genereren, probeer dan de ZXing QR Code Generator: http://zxing.appspot.com/generator/

+

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/whatsnew.html new file mode 100644 index 00000000..aa7b6d4f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-nl/whatsnew.html @@ -0,0 +1,15 @@ + + + + + Wat is nieuw in Barcode Scanner + + + +

Nieuw in versie 4.3.1:

+
    +
  • Uitgeschakeld blootstelling beheersing als het veroorzaakt problemen op meerdere buggy apparaten
  • +
  • Andere kleine bugfixes
  • +
+

Vertaald door Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about1d.html new file mode 100644 index 00000000..1a4e5575 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about1d.html @@ -0,0 +1,15 @@ + + + + + Sobre códigos de barras 1D + + + +

Códigos de barras tradicionais, tais como aqueles impressos nas embalagens dos produtos, são também conhecidos como um código de barras de dimensão. Existem vários tipos comumente usados, incluindo UPC e EAN. Mais semelhante a este:

+

+

Estes códigos de barras 1D conter um código único, o qual geralmente descreve um produto, como um CD ou um livro. Você pode olhar este código na internet para pesquisar preços, opiniões, e muito mais.

+

Se você digitalizar um livro, você também pode pesquisar o conteúdo do livro para uma palavra ou frase, e encontrar todas as páginas em que ele aparece:

+

+

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about2d.html new file mode 100644 index 00000000..dd6fa0f2 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/about2d.html @@ -0,0 +1,26 @@ + + + + + Sobre códigos de barras 2D + + + +

Barcode Scanner também entende como ler dois códigos de barras bidimensionais, como QR Codes e códigos Data Matrix. Por exemplo, os códigos abaixo contêm um link para a página do Projeto ZXing casa:

+

+ + +

+

Você também pode representar informações de contato em um QR Code, e colocá-lo em um cartão de visita ou site. Quando você escaneá-lo, a tela de resultados fornece uma escolha de ações:

+

+

Além de URLs e informações de contato, QR Codes também pode conter:

+
    +
  • Calendário de eventos, que você pode adicionar ao seu calendário
  • +
  • Os números de telefone, que você pode discar
  • +
  • Números de SMS, que você pode mensagem de texto
  • +
  • Endereços de e-mail, que você pode enviar e-mail
  • +
  • Coordenadas geográficas, que você pode abrir em Mapas
  • +
  • Texto simples, que você pode ler, em seguida, compartilhar com um amigo
  • +
+

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/index.html new file mode 100644 index 00000000..0b419f7e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/index.html @@ -0,0 +1,23 @@ + + + + + Ajuda Barcode Scanner + + + +

Barcode Scanner 4.3.1

+

O app Android oficial do projeto de código aberto ZXing:
+ http://code.google.com/p/zxing

+

Barcode Scanner utiliza a câmera do seu celular para ler códigos de barras e procurar informações sobre o produto, tais como preços e opiniões.

+

+

Ele também lê código de barras 2D, tais como QR Codes e matriz de dados. Estes podem conter links para web sites, informações de contato, como números de telefone e endereços de e-mail, e muito mais.

+ +

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/scanning.html new file mode 100644 index 00000000..ddc19779 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/scanning.html @@ -0,0 +1,19 @@ + + + + + Como digitalizar + + + +

Barcode Scanner examina continuamente uma região quadrada mostrado na tela - apenas a linha até o telefone para o código de barras é completamente dentro do retângulo do visor:

+

+

Códigos de barras 1D como os encontrados em produtos necessitam de um telefone com foco automático. Sem ele, apenas QR Codes e códigos Data Matrix será legível.

+

Quando um código de barras é lido, um sinal sonoro vai jogar e você vai ver os resultados da verificação, uma descrição do que contém o código de barras, e as opções a tomar medidas sobre o conteúdo.

+

Se você está tendo problemas de digitalização, certifique-se de segurar o telefone fixo. Se a câmera não consegue focar, tente mover o telefone mais próximo ou a partir do código de barras.

+ +

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/sharing.html new file mode 100644 index 00000000..655967bf --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/sharing.html @@ -0,0 +1,14 @@ + + + + + Como criar QR Codes + + + +

Além de digitalizar códigos de barras 2D, Barcode Scanner também pode gerar um QR Code e exibi-lo na tela. Então você pode mostrá-lo a um amigo, e deixe-escanear o código de barras com o seu telefone:

+

+

Para usar esse recurso, pressione o botão Menu a partir do ecrã de digitalização principal e toque em Compartilhar. Em seguida, escolha se você deseja compartilhar um contato, um marcador, um aplicativo, ou o conteúdo da área de transferência. Um QR Code será gerado automaticamente. Quando estiver pronto, pressione Voltar ou Casa.

+

Para gerar QR Codes do seu computador, experimente a Gerador de código QR ZXing: http://zxing.appspot.com/generator/

+

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/whatsnew.html new file mode 100644 index 00000000..34398279 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-pt/whatsnew.html @@ -0,0 +1,15 @@ + + + + + O que há de novo no Barcode Scanner + + + +

Novo na versão 4.3.1:

+
    +
  • Desativado controle de exposição, uma vez que causou problemas em dispositivos de buggy vários
  • +
  • Outras pequenas correções de bugs
  • +
+

Traduzido pelo Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about1d.html new file mode 100644 index 00000000..1ba439fe --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about1d.html @@ -0,0 +1,15 @@ + + + + + О 1D штрих-кодов + + + +

Традиционные штрих-коды, такие как напечатанный на упаковке продукта, также извеÑтный как одномерные штрих-коды. ЕÑть неÑколько типов широко иÑпользуютÑÑ, в том чиÑле UPC и EAN. БольшинÑтво выглÑдеть примерно так:

+

+

Эти 1D штрих-коды Ñодержат уникальный код, который обычно опиÑывает продукт, как компакт-диÑк или книгу. Ð’Ñ‹ можете поÑмотреть Ñтот код на Интернет, чтобы найти цены, обзоры и многое другое.

+

ЕÑли вы Ñканируете книгу, вы также можете найти в Ñодержании книги Ñлово или фразу, и найти вÑе Ñтраницы, где он поÑвлÑетÑÑ:

+

+

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about2d.html new file mode 100644 index 00000000..7e1de1cb --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/about2d.html @@ -0,0 +1,26 @@ + + + + + О 2D штрих-кодов + + + +

Barcode Scanner также понимает, как читать двумерные штрих-коды, такие как QR-коды и коды Data Matrix. Ðапример, код ниже, Ñодержат гиперÑÑылки на ZXing домашней Ñтранице проекта:

+

+ + +

+

Ð’Ñ‹ также можете предÑтавлÑть контактную информацию в QR Code, и положил его на визитную карточку или веб-Ñайт. При Ñканировании она, результатов Ñкрана обеÑпечивает выбор дейÑтвий:

+

+

Кроме того адреÑа и контактные данные, QR-коды могут также Ñодержать:

+
    +
  • Календарь Ñобытий, которые вы можете добавить в Ñвой календарь
  • +
  • Телефонные номера, которые можно набрать
  • +
  • SMS-номера, который вы можете текÑте ÑообщениÑ
  • +
  • ÐдреÑа Ñлектронной почты, который вы можете по Ñлектронной почте
  • +
  • ГеографичеÑкие координаты, которые можно открыть в карты
  • +
  • Обычный текÑÑ‚, который можно прочитать, а затем поделитьÑÑ Ñ Ð´Ñ€ÑƒÐ³Ð¾Ð¼
  • +
+

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/index.html new file mode 100644 index 00000000..1183ae3e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/index.html @@ -0,0 +1,23 @@ + + + + + Помощь Barcode Scanner + + + +

Barcode Scanner 4.3.1

+

Официальное приложение Ð´Ð»Ñ Android проекта Ñ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚Ñ‹Ð¼ ZXing иÑточник:
+ http://code.google.com/p/zxing

+

Barcode Scanner иÑпользует камеру на телефоне, чтобы читать штрих-код и поÑмотреть информацию о продуктах, таких как цены и отзывы.

+

+

Он также читает 2D штрих-коды, такие как QR-коды и Data Matrix. Они могут Ñодержать ÑÑылки на веб-Ñайты, контактную информацию, такую как номера телефонов и адреÑа Ñлектронной почты и многое другое.

+ +

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/scanning.html new file mode 100644 index 00000000..34fc8c9f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/scanning.html @@ -0,0 +1,19 @@ + + + + + Как проверить + + + +

Штрих коды непрерывно Ñканирует площадь облаÑти, показанной на Ñкране - проÑто Ð»Ð¸Ð½Ð¸Ñ Ñ‚ÐµÐ»ÐµÑ„Ð¾Ð½Ð°, чтобы штрих-код полноÑтью внутри видоиÑÐºÐ°Ñ‚ÐµÐ»Ñ Ð¿Ñ€Ñмоугольника:

+

+

1D штрих-кодов как найденные на продукты требуют телефону Ñ Ð°Ð²Ñ‚Ð¾Ñ„Ð¾ÐºÑƒÑом. Без него, только QR-коды и коды Data Matrix будет развертываемых.

+

ЕÑли штрих-код ÑчитываетÑÑ, звуковой Ñигнал будет играть, и вы увидите результаты проверки, опиÑание того, что штрих-код Ñодержит и варианты принÑÑ‚Ð¸Ñ Ñ€ÐµÑˆÐµÐ½Ð¸Ð¹ по Ñодержанию.

+

ЕÑли у Ð²Ð°Ñ Ð²Ð¾Ð·Ð½Ð¸ÐºÐ»Ð¸ проблемы ÑканированиÑ, убедитеÑÑŒ, что держать телефон поÑтоÑнно. ЕÑли фотокамера не может ÑфокуÑироватьÑÑ, попробуйте перемеÑтить телефон дальше или ближе от штрих-кода.

+ +

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/sharing.html new file mode 100644 index 00000000..f443306c --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/sharing.html @@ -0,0 +1,14 @@ + + + + + Как Ñоздать QR-коды + + + +

Ð’ дополнение к Ñканированию 2D штрих-кодов, штрих-код Ñканером также может генерировать QR-код и отображает его на Ñкране. Затем вы можете показать его другу, и пуÑть они Ñканировать штрих-код Ñ Ñ‚ÐµÐ»ÐµÑ„Ð¾Ð½Ð°:

+

+

Чтобы иÑпользовать Ñту функцию, нажмите кнопку меню на главном Ñкране ÑÐºÐ°Ð½Ð¸Ñ€Ð¾Ð²Ð°Ð½Ð¸Ñ Ð¸ нажмите Отправить. Затем выберите, хотите ли вы поделитьÑÑ ÐºÐ¾Ð½Ñ‚Ð°ÐºÑ‚, закладки, Ð¿Ñ€Ð¸Ð»Ð¾Ð¶ÐµÐ½Ð¸Ñ Ð¸Ð»Ð¸ Ñодержимое буфера обмена. QR-код будет Ñгенерирован автоматичеÑки. Когда вы закончите, нажмите кнопку Ðазад или дома.

+

Ð”Ð»Ñ ÑÐ¾Ð·Ð´Ð°Ð½Ð¸Ñ QR-коды Ñ ÐºÐ¾Ð¼Ð¿ÑŒÑŽÑ‚ÐµÑ€Ð°, попробуйте ZXing QR Генератор кода: http://zxing.appspot.com/generator/

+

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/whatsnew.html new file mode 100644 index 00000000..eee8d22a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-ru/whatsnew.html @@ -0,0 +1,15 @@ + + + + + Что нового в Barcode Scanner + + + +

Ðовое в верÑии 4.3.1:

+
    +
  • Отключен контроль ÑкÑпозиции, как Ñто вызвало проблемы на неÑкольких уÑтройÑтвах багги
  • +
  • Другие мелкие иÑÐ¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð¸Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°
  • +
+

Перевод Google Translate.

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about1d.html new file mode 100644 index 00000000..86fee49b --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about1d.html @@ -0,0 +1,15 @@ + + + + + 关于一维æ¡ç  + + + +

传统的æ¡å½¢ç ï¼Œå¦‚产å“包装上å°åˆ·ï¼Œä¹Ÿè¢«ç§°ä¸ºä¸€ç»´æ¡å½¢ç ã€‚常用的有几ç§ç±»åž‹ï¼ŒåŒ…括UPCå’ŒEAN。大多数看起æ¥åƒè¿™æ ·ï¼š

+

+

这些一维æ¡ç åŒ…å«ä¸€ä¸ªç‹¬ç‰¹çš„代ç ï¼Œå®ƒé€šå¸¸æè¿°äº†ä¸€ç§äº§å“,如CD或一本书。你å¯ä»¥çœ‹ä¸€ä¸‹è¿™æ®µä»£ç ï¼Œåœ¨äº’è”网上找到价格,评论等。

+

如果扫æä¸€æœ¬ä¹¦ï¼Œä½ ä¹Ÿå¯ä»¥ä¸ºä¸€ä¸ªè¯æˆ–短语æœç´¢æœ¬ä¹¦çš„内容,它出现的地方找到的所有网页:

+

+

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about2d.html new file mode 100644 index 00000000..914e2a4e --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/about2d.html @@ -0,0 +1,26 @@ + + + + + 关于二维æ¡ç  + + + +

æ¡ç æ‰«æå™¨ 还知é“如何读å–二维æ¡å½¢ç ï¼ŒQRç å’ŒData Matrixç ã€‚例如,下é¢çš„代ç åŒ…å«è¶…链接的ZXing项目主页:

+

+ + +

+

您也å¯ä»¥åœ¨QRç ä»£è¡¨çš„è”系信æ¯ï¼Œå¹¶æŠŠå®ƒæ”¾åœ¨ä¸€å¼ å片或网站。当您扫æï¼Œç»“æžœå±å¹•æä¾›äº†ä¸€ä¸ªå¯ä¾›é€‰æ‹©çš„行动:

+

+

除了网å€å’Œè”系方å¼ï¼ŒQRç è¿˜å¯ä»¥åŒ…å«ä»¥ä¸‹å†…容:

+
    +
  • 日历事件,您å¯ä»¥æ·»åŠ åˆ°æ‚¨çš„æ—¥åŽ†
  • +
  • 您å¯ä»¥æ‹¨æ‰“的电è¯å·ç ï¼Œ
  • +
  • 短信å·ç ï¼Œæ‚¨å¯ä»¥çŸ­ä¿¡
  • +
  • 您å¯ä»¥é€šè¿‡ç”µå­é‚®ä»¶çš„电å­é‚®ä»¶åœ°å€ï¼Œ
  • +
  • 地ç†å标,你å¯ä»¥æ‰“开地图
  • +
  • 纯文本,你å¯ä»¥é˜…读,然åŽä¸Žæœ‹å‹åˆ†äº«
  • +
+

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/index.html new file mode 100644 index 00000000..b074552a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/index.html @@ -0,0 +1,23 @@ + + + + + æ¡ç æ‰«æå™¨è¯´æ˜Ž + + + +

Barcode Scanner 4.3.1

+

官方的Android应用程åºçš„å¼€æºZXing项目:
+ http://code.google.com/p/zxing

+

æ¡ç æ‰«æå™¨åœ¨æ‚¨çš„æ‰‹æœºä¸Šä½¿ç”¨æ‘„åƒå¤´è¯»å–æ¡å½¢ç ï¼ŒæŸ¥è¯¢äº§å“的信æ¯ï¼Œå¦‚价格和评论。

+

+

此外,还å¯ä»¥è¯»å–QRç å’ŒData Matrix二维æ¡ç ï¼Œå¦‚。这些都å¯ä»¥åŒ…å«ç½‘站的链接,è”系信æ¯ï¼Œå¦‚电è¯å·ç å’Œç”µå­é‚®ä»¶åœ°å€ï¼Œä»¥åŠæ›´å¤šã€‚

+ +

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/scanning.html new file mode 100644 index 00000000..b790737a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/scanning.html @@ -0,0 +1,19 @@ + + + + + 如何扫æ + + + +

æŒç»­ä¸æ–­åœ°æ‰«ææ¡ç æ‰«æä»ªå±å¹•上显示的一个方形区域 - åªæ˜¯äº†ç”µè¯çº¿ï¼Œä½¿æ¡ç æ˜¯å®Œå…¨å–景器内的矩形:

+

+

一维æ¡ç çš„产å“需è¦ä¸€ä¸ªç”µè¯ï¼Œæ”¯æŒè‡ªåŠ¨å¯¹ç„¦ã€‚å¦‚æžœæ²¡æœ‰å®ƒï¼ŒQRç å’ŒData Matrixç å°†è¢«æ‰«æã€‚

+

当æ¡ç é˜…读,蜂鸣声会玩,你会看到扫æçš„æ¡å½¢ç åŒ…å«çš„æè¿°å’Œé€‰é¡¹çš„内容采å–行动的结果。

+

如果你有麻烦扫æï¼Œè¯·ä¸€å®šè¦ä¿æŒç¨³å®šçš„æ‰‹æœºã€‚如果相机无法对焦,å°è¯•从æ¡å½¢ç ç§»åŠ¨ç”µè¯æˆ–接近的。

+ +

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/sharing.html new file mode 100644 index 00000000..32d89685 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/sharing.html @@ -0,0 +1,14 @@ + + + + + 如何创建QRç  + + + +

除了扫æäºŒç»´æ¡ç ï¼Œæ¡ç æ‰«æä»ªè¿˜å¯ä»¥äº§ç”Ÿä¸€ä¸ªQRç ï¼Œå¹¶å°†å…¶æ˜¾ç¤ºåœ¨å±å¹•上。然åŽä½ å°±å¯ä»¥æ˜¾ç¤ºç»™æœ‹å‹ï¼Œè®©ä»–ä»¬ç”¨è‡ªå·±çš„æ‰‹æœºæ‰«ææ¡å½¢ç ï¼š

+

+

è¦ä½¿ç”¨æ­¤åŠŸèƒ½ï¼Œè¯·ä»Žä¸»æ‰«æå±å¹•上的èœå•按钮,并点击“分享â€ã€‚ç„¶åŽé€‰æ‹©æ˜¯å¦è¦å…±äº«è”系人,书签,应用程åºï¼Œæˆ–将剪贴æ¿çš„内容。将自动生æˆçš„QRç ã€‚当你完æˆåŽï¼ŒæŒ‰è¿”回或家庭。

+

è¦ç”ŸæˆQRç ä»Žæ‚¨çš„计算机,å°è¯•çš„ZXing QR代ç ç”Ÿæˆï¼š http://zxing.appspot.com/generator/

+

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/whatsnew.html new file mode 100644 index 00000000..d8747f6f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rCN/whatsnew.html @@ -0,0 +1,15 @@ + + + + + 有什么新的æ¡ç æ‰«æå™¨ + + + +

新的版本4.3.1:

+
    +
  • 残疾人æ›å…‰æŽ§åˆ¶ï¼Œå®ƒå¼•起的问题在几个车设备
  • +
  • å…¶ä»–å°çš„bugä¿®å¤
  • +
+

谷歌翻译,译。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about1d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about1d.html new file mode 100644 index 00000000..d675afc0 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about1d.html @@ -0,0 +1,15 @@ + + + + + 關於一維æ¢ç¢¼ + + + +

傳統的æ¢å½¢ç¢¼ï¼Œå¦‚產å“包è£ä¸Šå°åˆ·ï¼Œä¹Ÿè¢«ç¨±ç‚ºä¸€ç¶­æ¢å½¢ç¢¼ã€‚常用的有幾種類型,包括UPCå’ŒEAN。大多數看起來åƒé€™æ¨£ï¼š

+

+

這些一維æ¢ç¢¼åŒ…å«ä¸€å€‹ç¨ç‰¹çš„代碼,它通常æè¿°äº†ä¸€ç¨®ç”¢å“,如CD或一本書。你å¯ä»¥çœ‹ä¸€ä¸‹é€™æ®µä»£ç¢¼ï¼Œåœ¨äº’è¯ç¶²ä¸Šæ‰¾åˆ°åƒ¹æ ¼ï¼Œè©•論等。

+

如果掃æä¸€æœ¬æ›¸ï¼Œä½ ä¹Ÿå¯ä»¥ç‚ºä¸€å€‹è©žæˆ–短語æœç´¢æœ¬æ›¸çš„內容,它出ç¾çš„地方找到的所有網é ï¼š

+

+

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about2d.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about2d.html new file mode 100644 index 00000000..6761fe41 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/about2d.html @@ -0,0 +1,26 @@ + + + + + 關於二維æ¢ç¢¼ + + + +

æ¢ç¢¼æŽƒæå™¨ 還知é“如何讀å–二維æ¢å½¢ç¢¼ï¼ŒQR碼和Data Matrix碼。例如,下é¢çš„代碼包å«è¶…éˆæŽ¥çš„ZXing項目主é ï¼š

+

+ + +

+

您也å¯ä»¥åœ¨QR碼代表的è¯ç¹«ä¿¡æ¯ï¼Œä¸¦æŠŠå®ƒæ”¾åœ¨ä¸€å¼µå片或網站。當您掃æï¼Œçµæžœå±å¹•æä¾›äº†ä¸€å€‹å¯ä¾›é¸æ“‡çš„行動:

+

+

除了網å€å’Œè¯ç¹«æ–¹å¼ï¼ŒQR碼還å¯ä»¥åŒ…å«ä»¥ä¸‹å…§å®¹ï¼š

+
    +
  • 日曆事件,您å¯ä»¥æ·»åŠ åˆ°æ‚¨çš„æ—¥æ›†
  • +
  • 您å¯ä»¥æ’¥æ‰“的電話號碼,
  • +
  • 短信號碼,您å¯ä»¥çŸ­ä¿¡
  • +
  • 您å¯ä»¥é€šéŽé›»å­éƒµä»¶çš„é›»å­éƒµä»¶åœ°å€ï¼Œ
  • +
  • 地ç†å標,你å¯ä»¥æ‰“開地圖
  • +
  • 純文本,你å¯ä»¥é–±è®€ï¼Œç„¶å¾Œèˆ‡æœ‹å‹åˆ†äº«
  • +
+

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/index.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/index.html new file mode 100644 index 00000000..64a35de2 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/index.html @@ -0,0 +1,23 @@ + + + + + æ¢ç¢¼æŽƒæå™¨èªªæ˜Ž + + + +

Barcode Scanner 4.3.1

+

官方的Android應用程åºçš„é–‹æºZXing項目:
+ http://code.google.com/p/zxing

+

æ¢ç¢¼æŽƒæå™¨åœ¨æ‚¨çš„æ‰‹æ©Ÿä¸Šä½¿ç”¨æ”åƒé ­è®€å–æ¢å½¢ç¢¼ï¼ŒæŸ¥è©¢ç”¢å“的信æ¯ï¼Œå¦‚價格和評論。

+

+

此外,還å¯ä»¥è®€å–QR碼和Data Matrix二維æ¢ç¢¼ï¼Œå¦‚。這些都å¯ä»¥åŒ…å«ç¶²ç«™çš„éˆæŽ¥ï¼Œè¯ç¹«ä¿¡æ¯ï¼Œå¦‚電話號碼和電å­éƒµä»¶åœ°å€ï¼Œä»¥åŠæ›´å¤šã€‚

+ +

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/scanning.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/scanning.html new file mode 100644 index 00000000..79deb61f --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/scanning.html @@ -0,0 +1,19 @@ + + + + + 如何掃æ + + + +

æŒçºŒä¸æ–·åœ°æŽƒææ¢ç¢¼æŽƒæå„€å±å¹•上顯示的一個方形å€åŸŸ - åªæ˜¯äº†é›»è©±ç·šï¼Œä½¿æ¢ç¢¼æ˜¯å®Œå…¨å–景器內的矩形:

+

+

一維æ¢ç¢¼çš„產å“需è¦ä¸€å€‹é›»è©±ï¼Œæ”¯æŒè‡ªå‹•å°ç„¦ã€‚如果沒有它,QR碼和Data Matrix碼將被掃æã€‚

+

ç•¶æ¢ç¢¼é–±è®€ï¼Œèœ‚é³´è²æœƒçŽ©ï¼Œä½ æœƒçœ‹åˆ°æŽƒæçš„æ¢å½¢ç¢¼åŒ…å«çš„æè¿°å’Œé¸é …的內容採å–è¡Œå‹•çš„çµæžœã€‚

+

如果你有麻煩掃æï¼Œè«‹ä¸€å®šè¦ä¿æŒç©©å®šçš„æ‰‹æ©Ÿã€‚如果相機無法å°ç„¦ï¼Œå˜—試從æ¢å½¢ç¢¼ç§»å‹•電話或接近的。

+ +

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/sharing.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/sharing.html new file mode 100644 index 00000000..df1ca487 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/sharing.html @@ -0,0 +1,14 @@ + + + + + 如何創建QR碼 + + + +

除了掃æäºŒç¶­æ¢ç¢¼ï¼Œæ¢ç¢¼æŽƒæå„€é‚„å¯ä»¥ç”¢ç”Ÿä¸€å€‹QR碼,並將其顯示在å±å¹•上。然後你就å¯ä»¥é¡¯ç¤ºçµ¦æœ‹å‹ï¼Œè®“ä»–å€‘ç”¨è‡ªå·±çš„æ‰‹æ©ŸæŽƒææ¢å½¢ç¢¼ï¼š

+

+

è¦ä½¿ç”¨æ­¤åŠŸèƒ½ï¼Œè«‹å¾žä¸»æŽƒæå±å¹•上的èœå–®æŒ‰éˆ•,並點擊“分享â€ã€‚ç„¶å¾Œé¸æ“‡æ˜¯å¦è¦å…±äº«è¯ç¹«äººï¼Œæ›¸ç±¤ï¼Œæ‡‰ç”¨ç¨‹åºï¼Œæˆ–將剪貼æ¿çš„內容。將自動生æˆçš„QR碼。當你完æˆå¾Œï¼ŒæŒ‰è¿”回或家庭。

+

è¦ç”ŸæˆQR碼從您的計算機,嘗試的ZXing QR代碼生æˆï¼š http://zxing.appspot.com/generator/

+

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/whatsnew.html b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/whatsnew.html new file mode 100644 index 00000000..d6aa62f7 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/html-zh-rTW/whatsnew.html @@ -0,0 +1,15 @@ + + + + + 有什麼新的æ¢ç¢¼æŽƒæå™¨ + + + +

新的版本4.3.1:

+
    +
  • 殘疾人æ›å…‰æŽ§åˆ¶ï¼Œå®ƒå¼•èµ·çš„å•題在幾個車設備
  • +
  • å…¶ä»–å°çš„bug修復
  • +
+

谷歌翻譯,譯。

+ \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-1d.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-1d.png new file mode 100644 index 00000000..c695260b Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-1d.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-datamatrix.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-datamatrix.png new file mode 100644 index 00000000..d6f7bcd5 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-datamatrix.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-qr.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-qr.png new file mode 100644 index 00000000..37381fd0 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/big-qr.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/contact-results-screen.jpg b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/contact-results-screen.jpg new file mode 100644 index 00000000..68148db7 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/contact-results-screen.jpg differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-no.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-no.png new file mode 100644 index 00000000..96528813 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-no.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-yes.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-yes.png new file mode 100644 index 00000000..7e0e94b1 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/demo-yes.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-example.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-example.png new file mode 100644 index 00000000..b5183e46 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-example.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-from-phone.png b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-from-phone.png new file mode 100644 index 00000000..56c34492 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/scan-from-phone.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/search-book-contents.jpg b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/search-book-contents.jpg new file mode 100644 index 00000000..f98ec4ce Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/images/search-book-contents.jpg differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/assets/style.css b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/style.css new file mode 100644 index 00000000..ec885380 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/assets/style.css @@ -0,0 +1,10 @@ +body { + font-family:sans-serif; +} +ul.touchable li { + padding-top:8px; + padding-bottom:8px; +} +p.imgcenter { + text-align:center; +} \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/build.xml b/Android/BarcodeScanner/2.2.0/LibraryProject/build.xml new file mode 100644 index 00000000..9cf123d1 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/build.xml @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/BuildConfig.java b/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/BuildConfig.java new file mode 100644 index 00000000..2c405e8a --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/BuildConfig.java @@ -0,0 +1,6 @@ +/** Automatically generated file. DO NOT MODIFY */ +package com.google.zxing.client.android; + +public final class BuildConfig { + public final static boolean DEBUG = true; +} \ No newline at end of file diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/R.java b/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/R.java new file mode 100644 index 00000000..fcf7bd9c --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/gen/com/google/zxing/client/android/R.java @@ -0,0 +1,237 @@ +/* AUTO-GENERATED FILE. DO NOT MODIFY. + * + * This class was automatically generated by the + * aapt tool from the resource data it found. It + * should not be modified by hand. + */ + +package com.google.zxing.client.android; + +public final class R { + public static final class array { + public static int country_codes=0x7f060000; + } + public static final class attr { + } + public static final class color { + public static int contents_text=0x7f070000; + public static int encode_view=0x7f070001; + public static int possible_result_points=0x7f070002; + /** Android standard ICS color + */ + public static int result_minor_text=0x7f070003; + public static int result_points=0x7f070004; + /** Android standard ICS color + */ + public static int result_text=0x7f070005; + public static int result_view=0x7f070006; + public static int status_text=0x7f070007; + public static int transparent=0x7f070008; + public static int viewfinder_laser=0x7f070009; + /** Android standard ICS color + */ + public static int viewfinder_mask=0x7f07000a; + } + public static final class dimen { + public static int half_padding=0x7f080001; + public static int standard_padding=0x7f080000; + } + public static final class drawable { + public static int launcher_icon=0x7f020000; + public static int share_via_barcode=0x7f020001; + public static int shopper_icon=0x7f020002; + } + public static final class id { + public static int back_button=0x7f090019; + public static int barcode_image_view=0x7f09000c; + public static int bookmark_title=0x7f090007; + public static int bookmark_url=0x7f090008; + public static int contents_supplement_text_view=0x7f090013; + public static int contents_text_view=0x7f090012; + public static int decode=0x7f090000; + public static int decode_failed=0x7f090001; + public static int decode_succeeded=0x7f090002; + public static int done_button=0x7f09001a; + public static int format_text_view=0x7f09000d; + public static int help_contents=0x7f090018; + public static int history_detail=0x7f09001c; + public static int history_title=0x7f09001b; + public static int image_view=0x7f090017; + public static int launch_product_query=0x7f090003; + public static int menu_encode=0x7f09002b; + public static int menu_help=0x7f09002a; + public static int menu_history=0x7f090028; + public static int menu_history_clear_text=0x7f09002d; + public static int menu_history_send=0x7f09002c; + public static int menu_settings=0x7f090029; + public static int menu_share=0x7f090027; + public static int meta_text_view=0x7f090011; + public static int meta_text_view_label=0x7f090010; + public static int page_number_view=0x7f090020; + public static int preview_view=0x7f090009; + public static int query_button=0x7f09001e; + public static int query_text_view=0x7f09001d; + public static int quit=0x7f090004; + public static int restart_preview=0x7f090005; + public static int result_button_view=0x7f090014; + public static int result_list_view=0x7f09001f; + public static int result_view=0x7f09000b; + public static int return_scan_result=0x7f090006; + public static int share_app_button=0x7f090022; + public static int share_bookmark_button=0x7f090023; + public static int share_clipboard_button=0x7f090025; + public static int share_contact_button=0x7f090024; + public static int share_text_view=0x7f090026; + public static int shopper_button=0x7f090015; + public static int snippet_view=0x7f090021; + public static int status_view=0x7f090016; + public static int time_text_view=0x7f09000f; + public static int type_text_view=0x7f09000e; + public static int viewfinder_view=0x7f09000a; + } + public static final class layout { + public static int bookmark_picker_list_item=0x7f030000; + public static int capture=0x7f030001; + public static int encode=0x7f030002; + public static int help=0x7f030003; + public static int history_list_item=0x7f030004; + public static int search_book_contents=0x7f030005; + public static int search_book_contents_header=0x7f030006; + public static int search_book_contents_list_item=0x7f030007; + public static int share=0x7f030008; + } + public static final class menu { + public static int capture=0x7f0b0000; + public static int encode=0x7f0b0001; + public static int history=0x7f0b0002; + } + public static final class raw { + public static int beep=0x7f050000; + } + public static final class string { + public static int app_name=0x7f0a0000; + public static int app_picker_name=0x7f0a0001; + public static int bookmark_picker_name=0x7f0a0002; + public static int button_add_calendar=0x7f0a0003; + public static int button_add_contact=0x7f0a0004; + public static int button_back=0x7f0a0005; + public static int button_book_search=0x7f0a0006; + public static int button_cancel=0x7f0a0007; + public static int button_custom_product_search=0x7f0a0008; + public static int button_dial=0x7f0a0009; + public static int button_done=0x7f0a000a; + public static int button_email=0x7f0a000b; + public static int button_get_directions=0x7f0a000c; + public static int button_google_shopper=0x7f0a000d; + public static int button_mms=0x7f0a000e; + public static int button_ok=0x7f0a000f; + public static int button_open_browser=0x7f0a0010; + public static int button_product_search=0x7f0a0011; + public static int button_search_book_contents=0x7f0a0012; + public static int button_share_app=0x7f0a0013; + public static int button_share_bookmark=0x7f0a0014; + public static int button_share_by_email=0x7f0a0015; + public static int button_share_by_sms=0x7f0a0016; + public static int button_share_clipboard=0x7f0a0017; + public static int button_share_contact=0x7f0a0018; + public static int button_show_map=0x7f0a0019; + public static int button_sms=0x7f0a001a; + public static int button_web_search=0x7f0a001b; + public static int button_wifi=0x7f0a001c; + public static int contents_contact=0x7f0a001d; + public static int contents_email=0x7f0a001e; + public static int contents_location=0x7f0a001f; + public static int contents_phone=0x7f0a0020; + public static int contents_sms=0x7f0a0021; + public static int contents_text=0x7f0a0022; + public static int history_clear_one_history_text=0x7f0a0024; + public static int history_clear_text=0x7f0a0023; + public static int history_email_title=0x7f0a0025; + public static int history_empty=0x7f0a0026; + public static int history_empty_detail=0x7f0a0027; + public static int history_send=0x7f0a0028; + public static int history_title=0x7f0a0029; + public static int menu_encode_mecard=0x7f0a002a; + public static int menu_encode_vcard=0x7f0a002b; + public static int menu_help=0x7f0a002c; + public static int menu_history=0x7f0a002d; + public static int menu_settings=0x7f0a002e; + public static int menu_share=0x7f0a002f; + public static int msg_bulk_mode_scanned=0x7f0a0030; + public static int msg_camera_framework_bug=0x7f0a0031; + public static int msg_default_format=0x7f0a0032; + public static int msg_default_meta=0x7f0a0033; + public static int msg_default_mms_subject=0x7f0a0034; + public static int msg_default_status=0x7f0a0035; + public static int msg_default_time=0x7f0a0036; + public static int msg_default_type=0x7f0a0037; + public static int msg_encode_contents_failed=0x7f0a0038; + public static int msg_google_books=0x7f0a0039; + public static int msg_google_product=0x7f0a003a; + public static int msg_google_shopper_missing=0x7f0a003b; + public static int msg_install_google_shopper=0x7f0a003c; + public static int msg_intent_failed=0x7f0a003d; + public static int msg_redirect=0x7f0a003e; + public static int msg_sbc_book_not_searchable=0x7f0a003f; + public static int msg_sbc_failed=0x7f0a0040; + public static int msg_sbc_no_page_returned=0x7f0a0041; + public static int msg_sbc_page=0x7f0a0042; + public static int msg_sbc_results=0x7f0a0043; + public static int msg_sbc_searching_book=0x7f0a0044; + public static int msg_sbc_snippet_unavailable=0x7f0a0045; + public static int msg_sbc_unknown_page=0x7f0a0046; + public static int msg_share_explanation=0x7f0a0047; + public static int msg_share_subject_line=0x7f0a0048; + public static int msg_share_text=0x7f0a0049; + public static int msg_sure=0x7f0a004a; + public static int msg_unmount_usb=0x7f0a004b; + public static int preferences_actions_title=0x7f0a004c; + public static int preferences_auto_focus_title=0x7f0a004d; + public static int preferences_bulk_mode_summary=0x7f0a004e; + public static int preferences_bulk_mode_title=0x7f0a004f; + public static int preferences_copy_to_clipboard_title=0x7f0a0050; + public static int preferences_custom_product_search_summary=0x7f0a0051; + public static int preferences_custom_product_search_title=0x7f0a0052; + public static int preferences_decode_1D_title=0x7f0a0053; + public static int preferences_decode_Data_Matrix_title=0x7f0a0054; + public static int preferences_decode_QR_title=0x7f0a0055; + public static int preferences_device_bug_workarounds_title=0x7f0a0056; + public static int preferences_disable_continuous_focus_summary=0x7f0a0057; + public static int preferences_disable_continuous_focus_title=0x7f0a0058; + public static int preferences_disable_exposure_title=0x7f0a0059; + public static int preferences_front_light_summary=0x7f0a005a; + public static int preferences_front_light_title=0x7f0a005b; + public static int preferences_general_title=0x7f0a005c; + public static int preferences_name=0x7f0a005d; + public static int preferences_play_beep_title=0x7f0a005e; + public static int preferences_remember_duplicates_summary=0x7f0a005f; + public static int preferences_remember_duplicates_title=0x7f0a0060; + public static int preferences_result_title=0x7f0a0061; + public static int preferences_scanning_title=0x7f0a0062; + public static int preferences_search_country=0x7f0a0063; + public static int preferences_supplemental_summary=0x7f0a0066; + public static int preferences_supplemental_title=0x7f0a0067; + public static int preferences_try_bsplus=0x7f0a0064; + public static int preferences_try_bsplus_summary=0x7f0a0065; + public static int preferences_vibrate_title=0x7f0a0068; + public static int result_address_book=0x7f0a0069; + public static int result_calendar=0x7f0a006a; + public static int result_email_address=0x7f0a006b; + public static int result_geo=0x7f0a006c; + public static int result_isbn=0x7f0a006d; + public static int result_product=0x7f0a006e; + public static int result_sms=0x7f0a006f; + public static int result_tel=0x7f0a0070; + public static int result_text=0x7f0a0071; + public static int result_uri=0x7f0a0072; + public static int result_wifi=0x7f0a0073; + public static int sbc_name=0x7f0a0074; + public static int share_name=0x7f0a0075; + public static int wifi_changing_network=0x7f0a0076; + public static int wifi_ssid_label=0x7f0a0077; + public static int wifi_type_label=0x7f0a0078; + } + public static final class xml { + public static int preferences=0x7f040000; + } +} diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/proguard-android-optimize.txt b/Android/BarcodeScanner/2.2.0/LibraryProject/proguard-android-optimize.txt new file mode 100644 index 00000000..4f94e229 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/proguard-android-optimize.txt @@ -0,0 +1,69 @@ +# This is a configuration file for ProGuard. +# http://proguard.sourceforge.net/index.html#manual/usage.html + +# Optimizations: If you don't want to optimize, use the +# proguard-android.txt configuration file instead of this one, which +# turns off the optimization flags. Adding optimization introduces +# certain risks, since for example not all optimizations performed by +# ProGuard works on all versions of Dalvik. The following flags turn +# off various optimizations known to have issues, but the list may not +# be complete or up to date. (The "arithmetic" optimization can be +# used if you are only targeting Android 2.0 or later.) Make sure you +# test thoroughly if you go this route. +-optimizations !code/simplification/cast,!code/allocation/*,!field/*,!class/merging/* +-optimizationpasses 5 +-allowaccessmodification +-dontpreverify + +# The remainder of this file is identical to the non-optimized version +# of the Proguard configuration file (except that the other file has +# flags to turn off optimization). + +-dontusemixedcaseclassnames +-dontskipnonpubliclibraryclasses +-verbose + +-keepattributes *Annotation* +-keep public class com.google.vending.licensing.ILicensingService +-keep public class com.android.vending.licensing.ILicensingService + +# ADDED +-keep class com.google.zxing.client.android.camera.open.** +#-keep class com.google.zxing.client.android.camera.exposure.** +-keep class com.google.zxing.client.android.common.executor.** + +# For native methods, see http://proguard.sourceforge.net/manual/examples.html#native +-keepclasseswithmembernames class * { + native ; +} + +# keep setters in Views so that animations can still work. +# see http://proguard.sourceforge.net/manual/examples.html#beans +-keepclassmembers public class * extends android.view.View { + void set*(***); + *** get*(); +} + +# We want to keep methods in Activity that could be used in the XML attribute onClick +-keepclassmembers class * extends android.app.Activity { + public void *(android.view.View); +} + +# For enumeration classes, see http://proguard.sourceforge.net/manual/examples.html#enumerations +-keepclassmembers enum * { + public static **[] values(); + public static ** valueOf(java.lang.String); +} + +-keep class * implements android.os.Parcelable { + public static final android.os.Parcelable$Creator *; +} + +-keepclassmembers class **.R$* { + public static ; +} + +# The support library contains references to newer platform versions. +# Don't warn about those in case this app is linking against an older +# platform version. We know about them, and they are safe. +-dontwarn android.support.** diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/project.properties b/Android/BarcodeScanner/2.2.0/LibraryProject/project.properties new file mode 100644 index 00000000..91c9b916 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/project.properties @@ -0,0 +1,15 @@ +# This file is automatically generated by Android Tools. +# Do not modify this file -- YOUR CHANGES WILL BE ERASED! +# +# This file must be checked in Version Control Systems. +# +# To customize properties used by the Ant build system edit +# "ant.properties", and override values to adapt the script to your +# project structure. +# +# To enable ProGuard to shrink and obfuscate your code, uncomment this (available properties: sdk.dir, user.home): +proguard.config=proguard-android-optimize.txt + +# Project target. +target=android-15 +android.library=true diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/launcher_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/launcher_icon.png new file mode 100644 index 00000000..5932aade Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/launcher_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/shopper_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/shopper_icon.png new file mode 100644 index 00000000..4df84426 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-hdpi/shopper_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xhdpi/launcher_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xhdpi/launcher_icon.png new file mode 100644 index 00000000..330dc2f9 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xhdpi/launcher_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xxhdpi/launcher_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xxhdpi/launcher_icon.png new file mode 100644 index 00000000..d535fdae Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable-xxhdpi/launcher_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/launcher_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/launcher_icon.png new file mode 100644 index 00000000..fc5fafcf Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/launcher_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/share_via_barcode.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/share_via_barcode.png new file mode 100644 index 00000000..56c34492 Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/share_via_barcode.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/shopper_icon.png b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/shopper_icon.png new file mode 100644 index 00000000..63346faa Binary files /dev/null and b/Android/BarcodeScanner/2.2.0/LibraryProject/res/drawable/shopper_icon.png differ diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/encode.xml b/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/encode.xml new file mode 100644 index 00000000..947f9701 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/encode.xml @@ -0,0 +1,48 @@ + + + + + + + + + + + + + diff --git a/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/share.xml b/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/share.xml new file mode 100644 index 00000000..5bbfe1f7 --- /dev/null +++ b/Android/BarcodeScanner/2.2.0/LibraryProject/res/layout-land/share.xml @@ -0,0 +1,90 @@ + + + + + + + + + + + + +
+ + + \ No newline at end of file diff --git a/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/camera.js b/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/camera.js new file mode 100644 index 00000000..1c246f4c --- /dev/null +++ b/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/camera.js @@ -0,0 +1,91 @@ +/** + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vin�cius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * This class provides access to the device camera. + * + * @constructor + */ +var Camera = function() { + this.successCallback = null; + this.errorCallback = null; + this.options = null; +}; + +/** + * Gets a picture from source defined by "options.sourceType", and returns the + * image as defined by the "options.destinationType" option. + + * The defaults are sourceType=CAMERA and destinationType=DATA_URL. + * + * @param {Function} successCallback + * @param {Function} errorCallback + * @param {Object} options + */ +Camera.prototype.getPicture = function(successCallback, errorCallback, + options) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Camera Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Camera Error: errorCallback is not a function"); + return; + } + + if (options === null || typeof options === "undefined") { + options = {}; + } + if (options.quality === null || typeof options.quality === "undefined") { + options.quality = 80; + } + if (options.maxResolution === null + || typeof options.maxResolution === "undefined") { + options.maxResolution = 0; + } + + if (options.targetWidth === null + || typeof options.targetWidth === "undefined") { + options.targetWidth = -1; + } else if (typeof options.targetWidth === "string") { + var width = new Number(options.targetWidth); + if (isNaN(width) === false) { + options.targetWidth = width.valueOf(); + } + } + if (options.targetHeight === null + || typeof options.targetHeight === "undefined") { + options.targetHeight = -1; + } else if (typeof options.targetHeight === "string") { + var height = new Number(options.targetHeight); + if (isNaN(height) === false) { + options.targetHeight = height.valueOf(); + } + } + + cordova.exec(successCallback, errorCallback, "Camera", "takePicture", + [ options ]); +}; + +cordova.addConstructor(function() { + if (typeof navigator.camera === "undefined") { + navigator.camera = new Camera(); + } +}); \ No newline at end of file diff --git a/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js b/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js new file mode 100644 index 00000000..9e7fa8ec --- /dev/null +++ b/Android/ForegroundCamera/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js @@ -0,0 +1,5814 @@ +// commit 143f5221a6251c9cbccdedc57005c61551b97f12 + +// File generated at :: Wed Sep 12 2012 12:51:58 GMT-0700 (PDT) + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +;(function() { + +// file: lib/scripts/require.js +var require, + define; + +(function () { + var modules = {}; + + function build(module) { + var factory = module.factory; + module.exports = {}; + delete module.factory; + factory(require, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw "module " + id + " not found"; + } + return modules[id].factory ? build(modules[id]) : modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + +})(); + +//Export for use in node +if (typeof module === "object" && typeof require === "function") { + module.exports.require = require; + module.exports.define = define; +} +// file: lib/cordova.js +define("cordova", function(require, exports, module) { +var channel = require('cordova/channel'); + +/** + * Listen for DOMContentLoaded and notify our channel subscribers. + */ +document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); +}, false); +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}, + windowEventHandlers = {}; + +document.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] != 'undefined') { + if (evt === 'deviceready') { + documentEventHandlers[e].subscribeOnce(handler); + } else { + documentEventHandlers[e].subscribe(handler); + } + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] != "undefined") { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent(type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + +if(typeof window.console === "undefined") { + window.console = { + log:function(){} + }; +} + +var cordova = { + define:define, + require:require, + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler:function(event, opts) { + return (windowEventHandlers[event] = channel.create(event, opts)); + }, + addDocumentEventHandler:function(event, opts) { + return (documentEventHandlers[event] = channel.create(event, opts)); + }, + removeWindowEventHandler:function(event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler:function(event) { + delete documentEventHandlers[event]; + }, + /** + * Retreive original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function() { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + * bNoDetach is required for events which cause an exception which needs to be caught in native code + */ + fireDocumentEvent: function(type, data, bNoDetach) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + if( bNoDetach ) { + documentEventHandlers[type].fire(evt); + } + else { + setTimeout(function() { + documentEventHandlers[type].fire(evt); + }, 0); + } + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function(type, data) { + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + + // TODO: iOS only + // This queue holds the currently executing command and all pending + // commands executed with cordova.exec(). + commandQueue:[], + // Indicates if we're currently in the middle of flushing the command + // queue on the native side. + commandQueueFlushing:false, + // END TODO + /** + * Plugin callback mechanism. + */ + callbackId: 0, + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + * + * @param callbackId + * @param args + */ + callbackSuccess: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + + // If result is to be sent to callback + if (args.status == cordova.callbackStatus.OK) { + try { + if (cordova.callbacks[callbackId].success) { + cordova.callbacks[callbackId].success(args.message); + } + } + catch (e) { + console.log("Error in success callback: "+callbackId+" = "+e); + } + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + + /** + * Called by native code when returning error result from an action. + * + * @param callbackId + * @param args + */ + callbackError: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + try { + if (cordova.callbacks[callbackId].fail) { + cordova.callbacks[callbackId].fail(args.message); + } + } + catch (e) { + console.log("Error in error callback: "+callbackId+" = "+e); + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + addConstructor: function(func) { + channel.onCordovaReady.subscribeOnce(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); + } +}; + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready'); + +module.exports = cordova; + +}); + +// file: lib/common/builder.js +define("cordova/builder", function(require, exports, module) { +var utils = require('cordova/utils'); + +function each(objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function include(parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + parent[key] = result; + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + parent[key] = result; + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + parent[key] = result; + } else if (merge && typeof obj.path !== 'undefined') { + // If merging, merge parent onto result + recursiveMerge(result, parent[key]); + parent[key] = result; + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge(target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + target.prototype[prop] = src[prop]; + } else { + target[prop] = typeof src[prop] === 'object' ? recursiveMerge( + target[prop], src[prop]) : src[prop]; + } + } + } + return target; +} + +module.exports = { + build: function (objects) { + return { + intoButDontClobber: function (target) { + include(target, objects, false, false); + }, + intoAndClobber: function(target) { + include(target, objects, true, false); + }, + intoAndMerge: function(target) { + include(target, objects, true, true); + } + }; + } +}; + +}); + +// file: lib/common/channel.js +define("cordova/channel", function(require, exports, module) { +var utils = require('cordova/utils'), + nextGuid = 1; + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded Internal event that is received when the web page is loaded and parsed. + * onNativeReady Internal event that indicates the Cordova native side is ready. + * onCordovaReady Internal event fired when all Cordova JavaScript objects have been created. + * onCordovaInfoReady Internal event fired when device properties are available. + * onCordovaConnectionReady Internal event fired when the connection property has been set. + * onDeviceReady User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * onDestroy Internal event fired when app is being destroyed (User should use window.onunload event, not this one). + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + * @param opts Object options to pass into the channel, currently + * supports: + * onSubscribe: callback that fires when + * something subscribes to the Channel. Sets + * context to the Channel. + * onUnsubscribe: callback that fires when + * something unsubscribes to the Channel. Sets + * context to the Channel. + */ +var Channel = function(type, opts) { + this.type = type; + this.handlers = {}; + this.numHandlers = 0; + this.fired = false; + this.enabled = true; + this.events = { + onSubscribe:null, + onUnsubscribe:null + }; + if (opts) { + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + } +}, + channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. + */ + join: function (h, c) { + var i = c.length; + var len = i; + var f = function() { + if (!(--i)) h(); + }; + for (var j=0; j} phoneNumbers array of phone numbers +* @param {Array.} emails array of email addresses +* @param {Array.} addresses array of addresses +* @param {Array.} ims instant messaging user ids +* @param {Array.} organizations +* @param {DOMString} birthday contact's birthday +* @param {DOMString} note user notes about contact +* @param {Array.} photos +* @param {Array.} categories +* @param {Array.} urls contact's web sites +*/ +var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses, + ims, organizations, birthday, note, photos, categories, urls) { + this.id = id || null; + this.rawId = null; + this.displayName = displayName || null; + this.name = name || null; // ContactName + this.nickname = nickname || null; + this.phoneNumbers = phoneNumbers || null; // ContactField[] + this.emails = emails || null; // ContactField[] + this.addresses = addresses || null; // ContactAddress[] + this.ims = ims || null; // ContactField[] + this.organizations = organizations || null; // ContactOrganization[] + this.birthday = birthday || null; + this.note = note || null; + this.photos = photos || null; // ContactField[] + this.categories = categories || null; // ContactField[] + this.urls = urls || null; // ContactField[] +}; + +/** +* Removes contact from device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.remove = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + if (this.id === null) { + fail(ContactError.UNKNOWN_ERROR); + } + else { + exec(successCB, fail, "Contacts", "remove", [this.id]); + } +}; + +/** +* Creates a deep copy of this Contact. +* With the contact ID set to null. +* @return copy of this Contact +*/ +Contact.prototype.clone = function() { + var clonedContact = utils.clone(this); + var i; + clonedContact.id = null; + clonedContact.rawId = null; + // Loop through and clear out any id's in phones, emails, etc. + if (clonedContact.phoneNumbers) { + for (i = 0; i < clonedContact.phoneNumbers.length; i++) { + clonedContact.phoneNumbers[i].id = null; + } + } + if (clonedContact.emails) { + for (i = 0; i < clonedContact.emails.length; i++) { + clonedContact.emails[i].id = null; + } + } + if (clonedContact.addresses) { + for (i = 0; i < clonedContact.addresses.length; i++) { + clonedContact.addresses[i].id = null; + } + } + if (clonedContact.ims) { + for (i = 0; i < clonedContact.ims.length; i++) { + clonedContact.ims[i].id = null; + } + } + if (clonedContact.organizations) { + for (i = 0; i < clonedContact.organizations.length; i++) { + clonedContact.organizations[i].id = null; + } + } + if (clonedContact.categories) { + for (i = 0; i < clonedContact.categories.length; i++) { + clonedContact.categories[i].id = null; + } + } + if (clonedContact.photos) { + for (i = 0; i < clonedContact.photos.length; i++) { + clonedContact.photos[i].id = null; + } + } + if (clonedContact.urls) { + for (i = 0; i < clonedContact.urls.length; i++) { + clonedContact.urls[i].id = null; + } + } + return clonedContact; +}; + +/** +* Persists contact to device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.save = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + var success = function(result) { + if (result) { + if (typeof successCB === 'function') { + var fullContact = require('cordova/plugin/contacts').create(result); + successCB(convertIn(fullContact)); + } + } + else { + // no Entry object returned + fail(ContactError.UNKNOWN_ERROR); + } + }; + var dupContact = convertOut(utils.clone(this)); + exec(success, fail, "Contacts", "save", [dupContact]); +}; + + +module.exports = Contact; + +}); + +// file: lib/common/plugin/ContactAddress.js +define("cordova/plugin/ContactAddress", function(require, exports, module) { +/** +* Contact address. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code +* @param formatted // NOTE: not a W3C standard +* @param streetAddress +* @param locality +* @param region +* @param postalCode +* @param country +*/ + +var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.formatted = formatted || null; + this.streetAddress = streetAddress || null; + this.locality = locality || null; + this.region = region || null; + this.postalCode = postalCode || null; + this.country = country || null; +}; + +module.exports = ContactAddress; +}); + +// file: lib/common/plugin/ContactError.js +define("cordova/plugin/ContactError", function(require, exports, module) { +/** + * ContactError. + * An error code assigned by an implementation when an error has occured + * @constructor + */ +var ContactError = function(err) { + this.code = (typeof err != 'undefined' ? err : null); +}; + +/** + * Error codes + */ +ContactError.UNKNOWN_ERROR = 0; +ContactError.INVALID_ARGUMENT_ERROR = 1; +ContactError.TIMEOUT_ERROR = 2; +ContactError.PENDING_OPERATION_ERROR = 3; +ContactError.IO_ERROR = 4; +ContactError.NOT_SUPPORTED_ERROR = 5; +ContactError.PERMISSION_DENIED_ERROR = 20; + +module.exports = ContactError; +}); + +// file: lib/common/plugin/ContactField.js +define("cordova/plugin/ContactField", function(require, exports, module) { +/** +* Generic contact field. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param type +* @param value +* @param pref +*/ +var ContactField = function(type, value, pref) { + this.id = null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; + this.pref = (typeof pref != 'undefined' ? pref : false); +}; + +module.exports = ContactField; +}); + +// file: lib/common/plugin/ContactFindOptions.js +define("cordova/plugin/ContactFindOptions", function(require, exports, module) { +/** + * ContactFindOptions. + * @constructor + * @param filter used to match contacts against + * @param multiple boolean used to determine if more than one contact should be returned + */ + +var ContactFindOptions = function(filter, multiple) { + this.filter = filter || ''; + this.multiple = (typeof multiple != 'undefined' ? multiple : false); +}; + +module.exports = ContactFindOptions; +}); + +// file: lib/common/plugin/ContactName.js +define("cordova/plugin/ContactName", function(require, exports, module) { +/** +* Contact name. +* @constructor +* @param formatted // NOTE: not part of W3C standard +* @param familyName +* @param givenName +* @param middle +* @param prefix +* @param suffix +*/ +var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) { + this.formatted = formatted || null; + this.familyName = familyName || null; + this.givenName = givenName || null; + this.middleName = middle || null; + this.honorificPrefix = prefix || null; + this.honorificSuffix = suffix || null; +}; + +module.exports = ContactName; +}); + +// file: lib/common/plugin/ContactOrganization.js +define("cordova/plugin/ContactOrganization", function(require, exports, module) { +/** +* Contact organization. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param name +* @param dept +* @param title +* @param startDate +* @param endDate +* @param location +* @param desc +*/ + +var ContactOrganization = function(pref, type, name, dept, title) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.name = name || null; + this.department = dept || null; + this.title = title || null; +}; + +module.exports = ContactOrganization; +}); + +// file: lib/common/plugin/Coordinates.js +define("cordova/plugin/Coordinates", function(require, exports, module) { +/** + * This class contains position information. + * @param {Object} lat + * @param {Object} lng + * @param {Object} alt + * @param {Object} acc + * @param {Object} head + * @param {Object} vel + * @param {Object} altacc + * @constructor + */ +var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { + /** + * The latitude of the position. + */ + this.latitude = lat; + /** + * The longitude of the position, + */ + this.longitude = lng; + /** + * The accuracy of the position. + */ + this.accuracy = acc; + /** + * The altitude of the position. + */ + this.altitude = (alt !== undefined ? alt : null); + /** + * The direction the device is moving at the position. + */ + this.heading = (head !== undefined ? head : null); + /** + * The velocity with which the device is moving at the position. + */ + this.speed = (vel !== undefined ? vel : null); + + if (this.speed === 0 || this.speed === null) { + this.heading = NaN; + } + + /** + * The altitude accuracy of the position. + */ + this.altitudeAccuracy = (altacc !== undefined) ? altacc : null; +}; + +module.exports = Coordinates; + +}); + +// file: lib/common/plugin/DirectoryEntry.js +define("cordova/plugin/DirectoryEntry", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + Entry = require('cordova/plugin/Entry'), + FileError = require('cordova/plugin/FileError'), + DirectoryReader = require('cordova/plugin/DirectoryReader'); + +/** + * An interface representing a directory on the file system. + * + * {boolean} isFile always false (readonly) + * {boolean} isDirectory always true (readonly) + * {DOMString} name of the directory, excluding the path leading to it (readonly) + * {DOMString} fullPath the absolute full path to the directory (readonly) + * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly) + */ +var DirectoryEntry = function(name, fullPath) { + DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]); +}; + +utils.extend(DirectoryEntry, Entry); + +/** + * Creates a new DirectoryReader to read entries from this directory + */ +DirectoryEntry.prototype.createReader = function() { + return new DirectoryReader(this.fullPath); +}; + +/** + * Creates or looks up a directory + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory + * @param {Flags} options to create or excluively create the directory + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var entry = new DirectoryEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getDirectory", [this.fullPath, path, options]); +}; + +/** + * Deletes a directory and all of it's contents + * + * @param {Function} successCallback is called with no parameters + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) { + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]); +}; + +/** + * Creates or looks up a file + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file + * @param {Flags} options to create or excluively create the file + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var FileEntry = require('cordova/plugin/FileEntry'); + var entry = new FileEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getFile", [this.fullPath, path, options]); +}; + +module.exports = DirectoryEntry; + +}); + +// file: lib/common/plugin/DirectoryReader.js +define("cordova/plugin/DirectoryReader", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError') ; + +/** + * An interface that lists the files and directories in a directory. + */ +function DirectoryReader(path) { + this.path = path || null; +} + +/** + * Returns a list of entries from a directory. + * + * @param {Function} successCallback is called with a list of entries + * @param {Function} errorCallback is called with a FileError + */ +DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var retVal = []; + for (var i=0; i][;base64], + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsDataURL = function(file) { + this.fileName = ""; + if (typeof file.fullPath === "undefined") { + this.fileName = file; + } else { + this.fileName = file.fullPath; + } + + // Already loading something + if (this.readyState == FileReader.LOADING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // LOADING state + this.readyState = FileReader.LOADING; + + // If loadstart callback + if (typeof this.onloadstart === "function") { + this.onloadstart(new ProgressEvent("loadstart", {target:this})); + } + + var me = this; + + // Read file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + // Save result + me.result = r; + + // If onload callback + if (typeof me.onload === "function") { + me.onload(new ProgressEvent("load", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + me.result = null; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, "File", "readAsDataURL", [this.fileName]); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsBinaryString = function(file) { + // TODO - Can't return binary data to browser. + console.log('method "readAsBinaryString" is not supported at this time.'); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsArrayBuffer = function(file) { + // TODO - Can't return binary data to browser. + console.log('This method is not supported at this time.'); +}; + +module.exports = FileReader; +}); + +// file: lib/common/plugin/FileSystem.js +define("cordova/plugin/FileSystem", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'); + +/** + * An interface representing a file system + * + * @constructor + * {DOMString} name the unique name of the file system (readonly) + * {DirectoryEntry} root directory of the file system (readonly) + */ +var FileSystem = function(name, root) { + this.name = name || null; + if (root) { + this.root = new DirectoryEntry(root.name, root.fullPath); + } +}; + +module.exports = FileSystem; + +}); + +// file: lib/common/plugin/FileTransfer.js +define("cordova/plugin/FileTransfer", function(require, exports, module) { +var exec = require('cordova/exec'), + FileTransferError = require('cordova/plugin/FileTransferError'); + +/** + * FileTransfer uploads a file to a remote server. + * @constructor + */ +var FileTransfer = function() {}; + +/** +* Given an absolute file path, uploads a file on the device to a remote server +* using a multipart HTTP request. +* @param filePath {String} Full path of the file on the device +* @param server {String} URL of the server to receive the file +* @param successCallback (Function} Callback to be invoked when upload has completed +* @param errorCallback {Function} Callback to be invoked upon error +* @param options {FileUploadOptions} Optional parameters such as file name and mimetype +* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false +*/ +FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) { + // sanity parameter checking + if (!filePath || !server) throw new Error("FileTransfer.upload requires filePath and server URL parameters at the minimum."); + // check for options + var fileKey = null; + var fileName = null; + var mimeType = null; + var params = null; + var chunkedMode = true; + var headers = null; + if (options) { + fileKey = options.fileKey; + fileName = options.fileName; + mimeType = options.mimeType; + headers = options.headers; + if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") { + chunkedMode = options.chunkedMode; + } + if (options.params) { + params = options.params; + } + else { + params = {}; + } + } + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(successCallback, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers]); +}; + +/** + * Downloads a file form a given URL and saves it to the specified directory. + * @param source {String} URL of the server to receive the file + * @param target {String} Full path of the file on the device + * @param successCallback (Function} Callback to be invoked when upload has completed + * @param errorCallback {Function} Callback to be invoked upon error + */ +FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) { + // sanity parameter checking + if (!source || !target) throw new Error("FileTransfer.download requires source URI and target URI parameters at the minimum."); + var win = function(result) { + var entry = null; + if (result.isDirectory) { + entry = new (require('cordova/plugin/DirectoryEntry'))(); + } + else if (result.isFile) { + entry = new (require('cordova/plugin/FileEntry'))(); + } + entry.isDirectory = result.isDirectory; + entry.isFile = result.isFile; + entry.name = result.name; + entry.fullPath = result.fullPath; + successCallback(entry); + }; + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(win, errorCallback, 'FileTransfer', 'download', [source, target]); +}; + +module.exports = FileTransfer; + +}); + +// file: lib/common/plugin/FileTransferError.js +define("cordova/plugin/FileTransferError", function(require, exports, module) { +/** + * FileTransferError + * @constructor + */ +var FileTransferError = function(code, source, target, status) { + this.code = code || null; + this.source = source || null; + this.target = target || null; + this.http_status = status || null; +}; + +FileTransferError.FILE_NOT_FOUND_ERR = 1; +FileTransferError.INVALID_URL_ERR = 2; +FileTransferError.CONNECTION_ERR = 3; + +module.exports = FileTransferError; + +}); + +// file: lib/common/plugin/FileUploadOptions.js +define("cordova/plugin/FileUploadOptions", function(require, exports, module) { +/** + * Options to customize the HTTP request used to upload files. + * @constructor + * @param fileKey {String} Name of file request parameter. + * @param fileName {String} Filename to be used by the server. Defaults to image.jpg. + * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg. + * @param params {Object} Object with key: value params to send to the server. + * @param headers {Object} Keys are header names, values are header values. Multiple + * headers of the same name are not supported. + */ +var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers) { + this.fileKey = fileKey || null; + this.fileName = fileName || null; + this.mimeType = mimeType || null; + this.params = params || null; + this.headers = headers || null; +}; + +module.exports = FileUploadOptions; + +}); + +// file: lib/common/plugin/FileUploadResult.js +define("cordova/plugin/FileUploadResult", function(require, exports, module) { +/** + * FileUploadResult + * @constructor + */ +var FileUploadResult = function() { + this.bytesSent = 0; + this.responseCode = null; + this.response = null; +}; + +module.exports = FileUploadResult; +}); + +// file: lib/common/plugin/FileWriter.js +define("cordova/plugin/FileWriter", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError'), + ProgressEvent = require('cordova/plugin/ProgressEvent'); + +/** + * This class writes to the mobile device file system. + * + * For Android: + * The root directory is the root of the file system. + * To write to the SD card, the file name is "sdcard/my_file.txt" + * + * @constructor + * @param file {File} File object containing file properties + * @param append if true write to the end of the file, otherwise overwrite the file + */ +var FileWriter = function(file) { + this.fileName = ""; + this.length = 0; + if (file) { + this.fileName = file.fullPath || file; + this.length = file.size || 0; + } + // default is to write at the beginning of the file + this.position = 0; + + this.readyState = 0; // EMPTY + + this.result = null; + + // Error + this.error = null; + + // Event handlers + this.onwritestart = null; // When writing starts + this.onprogress = null; // While writing the file, and reporting partial file data + this.onwrite = null; // When the write has successfully completed. + this.onwriteend = null; // When the request has completed (either in success or failure). + this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method. + this.onerror = null; // When the write has failed (see errors). +}; + +// States +FileWriter.INIT = 0; +FileWriter.WRITING = 1; +FileWriter.DONE = 2; + +/** + * Abort writing file. + */ +FileWriter.prototype.abort = function() { + // check for invalid state + if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // set error + this.error = new FileError(FileError.ABORT_ERR); + + this.readyState = FileWriter.DONE; + + // If abort callback + if (typeof this.onabort === "function") { + this.onabort(new ProgressEvent("abort", {"target":this})); + } + + // If write end callback + if (typeof this.onwriteend === "function") { + this.onwriteend(new ProgressEvent("writeend", {"target":this})); + } +}; + +/** + * Writes data to the file + * + * @param text to be written + */ +FileWriter.prototype.write = function(text) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":me})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // position always increases by bytes written because file would be extended + me.position += r; + // The length of the file is now where we are done writing. + + me.length = me.position; + + // DONE state + me.readyState = FileWriter.DONE; + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "write", [this.fileName, text, this.position]); +}; + +/** + * Moves the file pointer to the location specified. + * + * If the offset is a negative number the position of the file + * pointer is rewound. If the offset is greater than the file + * size the position is set to the end of the file. + * + * @param offset is the location to move the file pointer to. + */ +FileWriter.prototype.seek = function(offset) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + if (!offset && offset !== 0) { + return; + } + + // See back from end of file. + if (offset < 0) { + this.position = Math.max(offset + this.length, 0); + } + // Offset is bigger than file size so set position + // to the end of the file. + else if (offset > this.length) { + this.position = this.length; + } + // Offset is between 0 and file size so set the position + // to start writing. + else { + this.position = offset; + } +}; + +/** + * Truncates the file to the size specified. + * + * @param size to chop the file at. + */ +FileWriter.prototype.truncate = function(size) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":this})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Update the length of the file + me.length = r; + me.position = Math.min(me.position, r); + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "truncate", [this.fileName, size]); +}; + +module.exports = FileWriter; + +}); + +// file: lib/common/plugin/Flags.js +define("cordova/plugin/Flags", function(require, exports, module) { +/** + * Supplies arguments to methods that lookup or create files and directories. + * + * @param create + * {boolean} file or directory if it doesn't exist + * @param exclusive + * {boolean} used with create; if true the command will fail if + * target path exists + */ +function Flags(create, exclusive) { + this.create = create || false; + this.exclusive = exclusive || false; +} + +module.exports = Flags; +}); + +// file: lib/common/plugin/LocalFileSystem.js +define("cordova/plugin/LocalFileSystem", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Represents a local file system. + */ +var LocalFileSystem = function() { + +}; + +LocalFileSystem.TEMPORARY = 0; //temporary, with no guarantee of persistence +LocalFileSystem.PERSISTENT = 1; //persistent + +module.exports = LocalFileSystem; +}); + +// file: lib/common/plugin/Media.js +define("cordova/plugin/Media", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'); + +var mediaObjects = {}; + +/** + * This class provides access to the device media, interfaces to both sound and video + * + * @constructor + * @param src The file name or url to play + * @param successCallback The callback to be called when the file is done playing or recording. + * successCallback() + * @param errorCallback The callback to be called if there is an error. + * errorCallback(int errorCode) - OPTIONAL + * @param statusCallback The callback to be called when media status has changed. + * statusCallback(int statusCode) - OPTIONAL + */ +var Media = function(src, successCallback, errorCallback, statusCallback) { + + // successCallback optional + if (successCallback && (typeof successCallback !== "function")) { + console.log("Media Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Media Error: errorCallback is not a function"); + return; + } + + // statusCallback optional + if (statusCallback && (typeof statusCallback !== "function")) { + console.log("Media Error: statusCallback is not a function"); + return; + } + + this.id = utils.createUUID(); + mediaObjects[this.id] = this; + this.src = src; + this.successCallback = successCallback; + this.errorCallback = errorCallback; + this.statusCallback = statusCallback; + this._duration = -1; + this._position = -1; + exec(null, this.errorCallback, "Media", "create", [this.id, this.src]); +}; + +// Media messages +Media.MEDIA_STATE = 1; +Media.MEDIA_DURATION = 2; +Media.MEDIA_POSITION = 3; +Media.MEDIA_ERROR = 9; + +// Media states +Media.MEDIA_NONE = 0; +Media.MEDIA_STARTING = 1; +Media.MEDIA_RUNNING = 2; +Media.MEDIA_PAUSED = 3; +Media.MEDIA_STOPPED = 4; +Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"]; + +// "static" function to return existing objs. +Media.get = function(id) { + return mediaObjects[id]; +}; + +/** + * Start or resume playing audio file. + */ +Media.prototype.play = function(options) { + exec(null, null, "Media", "startPlayingAudio", [this.id, this.src, options]); +}; + +/** + * Stop playing audio file. + */ +Media.prototype.stop = function() { + var me = this; + exec(function() { + me._position = 0; + }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]); +}; + +/** + * Seek or jump to a new time in the track.. + */ +Media.prototype.seekTo = function(milliseconds) { + var me = this; + exec(function(p) { + me._position = p; + }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]); +}; + +/** + * Pause playing audio file. + */ +Media.prototype.pause = function() { + exec(null, this.errorCallback, "Media", "pausePlayingAudio", [this.id]); +}; + +/** + * Get duration of an audio file. + * The duration is only set for audio that is playing, paused or stopped. + * + * @return duration or -1 if not known. + */ +Media.prototype.getDuration = function() { + return this._duration; +}; + +/** + * Get position of audio. + */ +Media.prototype.getCurrentPosition = function(success, fail) { + var me = this; + exec(function(p) { + me._position = p; + success(p); + }, fail, "Media", "getCurrentPositionAudio", [this.id]); +}; + +/** + * Start recording audio file. + */ +Media.prototype.startRecord = function() { + exec(null, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]); +}; + +/** + * Stop recording audio file. + */ +Media.prototype.stopRecord = function() { + exec(null, this.errorCallback, "Media", "stopRecordingAudio", [this.id]); +}; + +/** + * Release the resources. + */ +Media.prototype.release = function() { + exec(null, this.errorCallback, "Media", "release", [this.id]); +}; + +/** + * Adjust the volume. + */ +Media.prototype.setVolume = function(volume) { + exec(null, null, "Media", "setVolume", [this.id, volume]); +}; + +/** + * Audio has status update. + * PRIVATE + * + * @param id The media object id (string) + * @param msgType The 'type' of update this is + * @param value Use of value is determined by the msgType + */ +Media.onStatus = function(id, msgType, value) { + + var media = mediaObjects[id]; + + if(media) { + switch(msgType) { + case Media.MEDIA_STATE : + media.statusCallback && media.statusCallback(value); + if(value == Media.MEDIA_STOPPED) { + media.successCallback && media.successCallback(); + } + break; + case Media.MEDIA_DURATION : + media._duration = value; + break; + case Media.MEDIA_ERROR : + media.errorCallback && media.errorCallback(value); + break; + case Media.MEDIA_POSITION : + media._position = Number(value); + break; + default : + console && console.error && console.error("Unhandled Media.onStatus :: " + msgType); + break; + } + } + else { + console && console.error && console.error("Received Media.onStatus callback for unknown media :: " + id); + } + +}; + +module.exports = Media; +}); + +// file: lib/common/plugin/MediaError.js +define("cordova/plugin/MediaError", function(require, exports, module) { +/** + * This class contains information about any Media errors. +*/ +/* + According to :: http://dev.w3.org/html5/spec-author-view/video.html#mediaerror + We should never be creating these objects, we should just implement the interface + which has 1 property for an instance, 'code' + + instead of doing : + errorCallbackFunction( new MediaError(3,'msg') ); +we should simply use a literal : + errorCallbackFunction( {'code':3} ); + */ + +if(!MediaError) { + var MediaError = function(code, msg) { + this.code = (typeof code != 'undefined') ? code : null; + this.message = msg || ""; // message is NON-standard! do not use! + }; +} + +MediaError.MEDIA_ERR_NONE_ACTIVE = MediaError.MEDIA_ERR_NONE_ACTIVE || 0; +MediaError.MEDIA_ERR_ABORTED = MediaError.MEDIA_ERR_ABORTED || 1; +MediaError.MEDIA_ERR_NETWORK = MediaError.MEDIA_ERR_NETWORK || 2; +MediaError.MEDIA_ERR_DECODE = MediaError.MEDIA_ERR_DECODE || 3; +MediaError.MEDIA_ERR_NONE_SUPPORTED = MediaError.MEDIA_ERR_NONE_SUPPORTED || 4; +// TODO: MediaError.MEDIA_ERR_NONE_SUPPORTED is legacy, the W3 spec now defines it as below. +// as defined by http://dev.w3.org/html5/spec-author-view/video.html#error-codes +MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4; + +module.exports = MediaError; + +}); + +// file: lib/common/plugin/MediaFile.js +define("cordova/plugin/MediaFile", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + File = require('cordova/plugin/File'), + CaptureError = require('cordova/plugin/CaptureError'); +/** + * Represents a single file. + * + * name {DOMString} name of the file, without path information + * fullPath {DOMString} the full path of the file, including the name + * type {DOMString} mime type + * lastModifiedDate {Date} last modified date + * size {Number} size of the file in bytes + */ +var MediaFile = function(name, fullPath, type, lastModifiedDate, size){ + MediaFile.__super__.constructor.apply(this, arguments); +}; + +utils.extend(MediaFile, File); + +/** + * Request capture format data for a specific file and type + * + * @param {Function} successCB + * @param {Function} errorCB + */ +MediaFile.prototype.getFormatData = function(successCallback, errorCallback) { + if (typeof this.fullPath === "undefined" || this.fullPath === null) { + errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)); + } else { + exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); + } +}; + +module.exports = MediaFile; + +}); + +// file: lib/common/plugin/MediaFileData.js +define("cordova/plugin/MediaFileData", function(require, exports, module) { +/** + * MediaFileData encapsulates format information of a media file. + * + * @param {DOMString} codecs + * @param {long} bitrate + * @param {long} height + * @param {long} width + * @param {float} duration + */ +var MediaFileData = function(codecs, bitrate, height, width, duration){ + this.codecs = codecs || null; + this.bitrate = bitrate || 0; + this.height = height || 0; + this.width = width || 0; + this.duration = duration || 0; +}; + +module.exports = MediaFileData; +}); + +// file: lib/common/plugin/Metadata.js +define("cordova/plugin/Metadata", function(require, exports, module) { +/** + * Information about the state of the file or directory + * + * {Date} modificationTime (readonly) + */ +var Metadata = function(time) { + this.modificationTime = (typeof time != 'undefined'?new Date(time):null); +}; + +module.exports = Metadata; +}); + +// file: lib/common/plugin/Position.js +define("cordova/plugin/Position", function(require, exports, module) { +var Coordinates = require('cordova/plugin/Coordinates'); + +var Position = function(coords, timestamp) { + if (coords) { + this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); + } else { + this.coords = new Coordinates(); + } + this.timestamp = (timestamp !== undefined) ? timestamp : new Date(); +}; + +module.exports = Position; + +}); + +// file: lib/common/plugin/PositionError.js +define("cordova/plugin/PositionError", function(require, exports, module) { +/** + * Position error object + * + * @constructor + * @param code + * @param message + */ +var PositionError = function(code, message) { + this.code = code || null; + this.message = message || ''; +}; + +PositionError.PERMISSION_DENIED = 1; +PositionError.POSITION_UNAVAILABLE = 2; +PositionError.TIMEOUT = 3; + +module.exports = PositionError; +}); + +// file: lib/common/plugin/ProgressEvent.js +define("cordova/plugin/ProgressEvent", function(require, exports, module) { +// If ProgressEvent exists in global context, use it already, otherwise use our own polyfill +// Feature test: See if we can instantiate a native ProgressEvent; +// if so, use that approach, +// otherwise fill-in with our own implementation. +// +// NOTE: right now we always fill in with our own. Down the road would be nice if we can use whatever is native in the webview. +var ProgressEvent = (function() { + /* + var createEvent = function(data) { + var event = document.createEvent('Events'); + event.initEvent('ProgressEvent', false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + if (data.target) { + // TODO: cannot call .dispatchEvent + // need to first figure out how to implement EventTarget + } + } + return event; + }; + try { + var ev = createEvent({type:"abort",target:document}); + return function ProgressEvent(type, data) { + data.type = type; + return createEvent(data); + }; + } catch(e){ + */ + return function ProgressEvent(type, dict) { + this.type = type; + this.bubbles = false; + this.cancelBubble = false; + this.cancelable = false; + this.lengthComputable = false; + this.loaded = dict && dict.loaded ? dict.loaded : 0; + this.total = dict && dict.total ? dict.total : 0; + this.target = dict && dict.target ? dict.target : null; + }; + //} +})(); + +module.exports = ProgressEvent; +}); + +// file: lib/common/plugin/accelerometer.js +define("cordova/plugin/accelerometer", function(require, exports, module) { +/** + * This class provides access to device accelerometer data. + * @constructor + */ +var utils = require("cordova/utils"), + exec = require("cordova/exec"), + Acceleration = require('cordova/plugin/Acceleration'); + +// Is the accel sensor running? +var running = false; + +// Keeps reference to watchAcceleration calls. +var timers = {}; + +// Array of listeners; used to keep track of when we should call start and stop. +var listeners = []; + +// Last returned acceleration object from native +var accel = null; + +// Tells native to start. +function start() { + exec(function(a) { + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } + }, function(e) { + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } + }, "Accelerometer", "start", []); + running = true; +} + +// Tells native to stop. +function stop() { + exec(null, null, "Accelerometer", "stop", []); + running = false; +} + +// Adds a callback pair to the listeners array +function createCallbackPair(win, fail) { + return {win:win, fail:fail}; +} + +// Removes a win/fail listener pair from the listeners array +function removeListeners(l) { + var idx = listeners.indexOf(l); + if (idx > -1) { + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } + } +} + +var accelerometer = { + /** + * Asynchronously aquires the current acceleration. + * + * @param {Function} successCallback The function to call when the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + */ + getCurrentAcceleration: function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; + } + + var p; + var win = function(a) { + removeListeners(p); + successCallback(a); + }; + var fail = function(e) { + removeListeners(p); + errorCallback(e); + }; + + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } + }, + + /** + * Asynchronously aquires the acceleration repeatedly at a given interval. + * + * @param {Function} successCallback The function to call each time the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchAcceleration: function(successCallback, errorCallback, options) { + // Default interval (10 sec) + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; + + // successCallback required + if (typeof successCallback !== "function") { + throw "watchAcceleration must be called with at least a success callback function as first parameter."; + } + + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); + + var p = createCallbackPair(function(){}, function(e) { + removeListeners(p); + errorCallback(e); + }); + listeners.push(p); + + timers[id] = { + timer:window.setInterval(function() { + if (accel) { + successCallback(accel); + } + }, frequency), + listeners:p + }; + + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retrieved a value, sample code does not check for null ... + if(accel) { + successCallback(accel); + } + } else { + start(); + } + + return id; + }, + + /** + * Clears the specified accelerometer watch. + * + * @param {String} id The id of the watch returned from #watchAcceleration. + */ + clearWatch: function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); + delete timers[id]; + } + } +}; + +module.exports = accelerometer; + +}); + +// file: lib/android/plugin/android/app.js +define("cordova/plugin/android/app", function(require, exports, module) { +var exec = require('cordova/exec'); + +module.exports = { + /** + * Clear the resource cache. + */ + clearCache:function() { + exec(null, null, "App", "clearCache", []); + }, + + /** + * Load the url into the webview or into new browser instance. + * + * @param url The URL to load + * @param props Properties that can be passed in to the activity: + * wait: int => wait msec before loading URL + * loadingDialog: "Title,Message" => display a native loading dialog + * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error + * clearHistory: boolean => clear webview history (default=false) + * openExternal: boolean => open in a new browser (default=false) + * + * Example: + * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); + */ + loadUrl:function(url, props) { + exec(null, null, "App", "loadUrl", [url, props]); + }, + + /** + * Cancel loadUrl that is waiting to be loaded. + */ + cancelLoadUrl:function() { + exec(null, null, "App", "cancelLoadUrl", []); + }, + + /** + * Clear web history in this web view. + * Instead of BACK button loading the previous web page, it will exit the app. + */ + clearHistory:function() { + exec(null, null, "App", "clearHistory", []); + }, + + /** + * Go to previous page displayed. + * This is the same as pressing the backbutton on Android device. + */ + backHistory:function() { + exec(null, null, "App", "backHistory", []); + }, + + /** + * Override the default behavior of the Android back button. + * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "backbutton" event, this is automatically done. + * + * @param override T=override, F=cancel override + */ + overrideBackbutton:function(override) { + exec(null, null, "App", "overrideBackbutton", [override]); + }, + + /** + * Exit and terminate the application. + */ + exitApp:function() { + return exec(null, null, "App", "exitApp", []); + } +}; +}); + +// file: lib/android/plugin/android/callback.js +define("cordova/plugin/android/callback", function(require, exports, module) { +var port = null, + token = null, + xmlhttp; + +function startXhr() { + // cordova/exec depends on this module, so we can't require cordova/exec on the module level. + var exec = require('cordova/exec'), + xmlhttp = new XMLHttpRequest(); + + // Callback function when XMLHttpRequest is ready + xmlhttp.onreadystatechange=function(){ + if (!xmlhttp) { + return; + } + if (xmlhttp.readyState === 4){ + // If callback has JavaScript statement to execute + if (xmlhttp.status === 200) { + + // Need to url decode the response + var msg = decodeURIComponent(xmlhttp.responseText); + setTimeout(function() { + try { + var t = eval(msg); + } + catch (e) { + // If we're getting an error here, seeing the message will help in debugging + console.log("JSCallback: Message from Server: " + msg); + console.log("JSCallback Error: "+e); + } + }, 1); + setTimeout(startXhr, 1); + } + + // If callback ping (used to keep XHR request from timing out) + else if (xmlhttp.status === 404) { + setTimeout(startXhr, 10); + } + + // 0 == Page is unloading. + // 400 == Bad request. + // 403 == invalid token. + // 503 == server stopped. + else { + console.log("JSCallback Error: Request failed with status " + xmlhttp.status); + exec.setNativeToJsBridgeMode(exec.nativeToJsModes.POLLING); + } + } + }; + + if (port === null) { + port = prompt("getPort", "gap_callbackServer:"); + } + if (token === null) { + token = prompt("getToken", "gap_callbackServer:"); + } + xmlhttp.open("GET", "http://127.0.0.1:"+port+"/"+token , true); + xmlhttp.send(); +} + +module.exports = { + start: function() { + startXhr(); + }, + + stop: function() { + if (xmlhttp) { + var tmp = xmlhttp; + xmlhttp = null; + tmp.abort(); + } + }, + + isAvailable: function() { + return ("true" != prompt("usePolling", "gap_callbackServer:")); + } +}; + + +}); + +// file: lib/android/plugin/android/device.js +define("cordova/plugin/android/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + app = require('cordova/plugin/android/app'); + +module.exports = { + /* + * DEPRECATED + * This is only for Android. + * + * You must explicitly override the back button. + */ + overrideBackButton:function() { + console.log("Device.overrideBackButton() is deprecated. Use App.overrideBackbutton(true)."); + app.overrideBackbutton(true); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This resets the back button to the default behaviour + */ + resetBackButton:function() { + console.log("Device.resetBackButton() is deprecated. Use App.overrideBackbutton(false)."); + app.overrideBackbutton(false); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This terminates the activity! + */ + exitApp:function() { + console.log("Device.exitApp() is deprecated. Use App.exitApp()."); + app.exitApp(); + } +}; + +}); + +// file: lib/android/plugin/android/notification.js +define("cordova/plugin/android/notification", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Provides Android enhanced notification API. + */ +module.exports = { + activityStart : function(title, message) { + // If title and message not specified then mimic Android behavior of + // using default strings. + if (typeof title === "undefined" && typeof message == "undefined") { + title = "Busy"; + message = 'Please wait...'; + } + + exec(null, null, 'Notification', 'activityStart', [ title, message ]); + }, + + /** + * Close an activity dialog + */ + activityStop : function() { + exec(null, null, 'Notification', 'activityStop', []); + }, + + /** + * Display a progress dialog with progress bar that goes from 0 to 100. + * + * @param {String} + * title Title of the progress dialog. + * @param {String} + * message Message to display in the dialog. + */ + progressStart : function(title, message) { + exec(null, null, 'Notification', 'progressStart', [ title, message ]); + }, + + /** + * Close the progress dialog. + */ + progressStop : function() { + exec(null, null, 'Notification', 'progressStop', []); + }, + + /** + * Set the progress dialog value. + * + * @param {Number} + * value 0-100 + */ + progressValue : function(value) { + exec(null, null, 'Notification', 'progressValue', [ value ]); + } +}; +}); + +// file: lib/android/plugin/android/polling.js +define("cordova/plugin/android/polling", function(require, exports, module) { +var cordova = require('cordova'), + POLL_INTERVAL = 50, + enabled = false; + +function pollOnce() { + var msg = prompt("", "gap_poll:"); + if (msg) { + try { + eval(""+msg); + } + catch (e) { + console.log("JSCallbackPolling: Message from Server: " + msg); + console.log("JSCallbackPolling Error: "+e); + } + return true; + } + return false; +} + +function doPoll() { + if (!enabled) { + return; + } + var nextDelay = POLL_INTERVAL; + if (pollOnce()) { + nextDelay = 0; + } + setTimeout(doPoll, nextDelay); +} + +module.exports = { + start: function() { + enabled = true; + setTimeout(doPoll, 1); + }, + stop: function() { + enabled = false; + }, + pollOnce: pollOnce +}; + + +}); + +// file: lib/android/plugin/android/storage.js +define("cordova/plugin/android/storage", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + channel = require('cordova/channel'); + +var queryQueue = {}; + +/** + * SQL result set object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Rows = function() { + this.resultSet = []; // results array + this.length = 0; // number of rows +}; + +/** + * Get item from SQL result set + * + * @param row The row number to return + * @return The row object + */ +DroidDB_Rows.prototype.item = function(row) { + return this.resultSet[row]; +}; + +/** + * SQL result set that is returned to user. + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Result = function() { + this.rows = new DroidDB_Rows(); +}; + +/** + * Callback from native code when query is complete. + * PRIVATE METHOD + * + * @param id Query id + */ +function completeQuery(id, data) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + + // Save query results + var r = new DroidDB_Result(); + r.rows.resultSet = data; + r.rows.length = data.length; + try { + if (typeof query.successCallback === 'function') { + query.successCallback(query.tx, r); + } + } catch (ex) { + console.log("executeSql error calling user success callback: "+ex); + } + + tx.queryComplete(id); + } + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * Callback from native code when query fails + * PRIVATE METHOD + * + * @param reason Error message + * @param id Query id + */ +function failQuery(reason, id) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + tx.queryList = {}; + + try { + if (typeof query.errorCallback === 'function') { + query.errorCallback(query.tx, reason); + } + } catch (ex) { + console.log("executeSql error calling user error callback: "+ex); + } + + tx.queryFailed(id, reason); + } + + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * SQL query object + * PRIVATE METHOD + * + * @constructor + * @param tx The transaction object that this query belongs to + */ +var DroidDB_Query = function(tx) { + + // Set the id of the query + this.id = utils.createUUID(); + + // Add this query to the queue + queryQueue[this.id] = this; + + // Init result + this.resultSet = []; + + // Set transaction that this query belongs to + this.tx = tx; + + // Add this query to transaction list + this.tx.queryList[this.id] = this; + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + +}; + +/** + * Transaction object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Tx = function() { + + // Set the id of the transaction + this.id = utils.createUUID(); + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + + // Query list + this.queryList = {}; +}; + +/** + * Mark query in transaction as complete. + * If all queries are complete, call the user's transaction success callback. + * + * @param id Query id + */ +DroidDB_Tx.prototype.queryComplete = function(id) { + delete this.queryList[id]; + + // If no more outstanding queries, then fire transaction success + if (this.successCallback) { + var count = 0; + var i; + for (i in this.queryList) { + if (this.queryList.hasOwnProperty(i)) { + count++; + } + } + if (count === 0) { + try { + this.successCallback(); + } catch(e) { + console.log("Transaction error calling user success callback: " + e); + } + } + } +}; + +/** + * Mark query in transaction as failed. + * + * @param id Query id + * @param reason Error message + */ +DroidDB_Tx.prototype.queryFailed = function(id, reason) { + + // The sql queries in this transaction have already been run, since + // we really don't have a real transaction implemented in native code. + // However, the user callbacks for the remaining sql queries in transaction + // will not be called. + this.queryList = {}; + + if (this.errorCallback) { + try { + this.errorCallback(reason); + } catch(e) { + console.log("Transaction error calling user error callback: " + e); + } + } +}; + +/** + * Execute SQL statement + * + * @param sql SQL statement to execute + * @param params Statement parameters + * @param successCallback Success callback + * @param errorCallback Error callback + */ +DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) { + + // Init params array + if (typeof params === 'undefined') { + params = []; + } + + // Create query and add to queue + var query = new DroidDB_Query(this); + queryQueue[query.id] = query; + + // Save callbacks + query.successCallback = successCallback; + query.errorCallback = errorCallback; + + // Call native code + exec(null, null, "Storage", "executeSql", [sql, params, query.id]); +}; + +var DatabaseShell = function() { +}; + +/** + * Start a transaction. + * Does not support rollback in event of failure. + * + * @param process {Function} The transaction function + * @param successCallback {Function} + * @param errorCallback {Function} + */ +DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) { + var tx = new DroidDB_Tx(); + tx.successCallback = successCallback; + tx.errorCallback = errorCallback; + try { + process(tx); + } catch (e) { + console.log("Transaction error: "+e); + if (tx.errorCallback) { + try { + tx.errorCallback(e); + } catch (ex) { + console.log("Transaction error calling user error callback: "+e); + } + } + } +}; + +/** + * Open database + * + * @param name Database name + * @param version Database version + * @param display_name Database display name + * @param size Database size in bytes + * @return Database object + */ +var DroidDB_openDatabase = function(name, version, display_name, size) { + exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]); + var db = new DatabaseShell(); + return db; +}; + +/** + * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api. + * TODO: Do similar for sessionStorage. + * @constructor + */ +var CupcakeLocalStorage = function() { + channel.waitForInitialization("cupcakeStorage"); + + try { + + this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440); + var storage = {}; + this.length = 0; + function setLength (length) { + this.length = length; + localStorage.length = length; + } + this.db.transaction( + function (transaction) { + var i; + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('SELECT * FROM storage', [], function(tx, result) { + for(var i = 0; i < result.rows.length; i++) { + storage[result.rows.item(i).id] = result.rows.item(i).body; + } + setLength(result.rows.length); + channel.initializationComplete("cupcakeStorage"); + }); + + }, + function (err) { + utils.alert(err.message); + } + ); + this.setItem = function(key, val) { + if (typeof(storage[key])=='undefined') { + this.length++; + } + storage[key] = val; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]); + } + ); + }; + this.getItem = function(key) { + return storage[key]; + }; + this.removeItem = function(key) { + delete storage[key]; + this.length--; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage where id=?', [key]); + } + ); + }; + this.clear = function() { + storage = {}; + this.length = 0; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage', []); + } + ); + }; + this.key = function(index) { + var i = 0; + for (var j in storage) { + if (i==index) { + return j; + } else { + i++; + } + } + return null; + }; + + } catch(e) { + utils.alert("Database error "+e+"."); + return; + } +}; + +module.exports = { + openDatabase:DroidDB_openDatabase, + CupcakeLocalStorage:CupcakeLocalStorage, + failQuery:failQuery, + completeQuery:completeQuery +}; + +}); + +// file: lib/common/plugin/battery.js +define("cordova/plugin/battery", function(require, exports, module) { +/** + * This class contains information about the current battery status. + * @constructor + */ +var cordova = require('cordova'), + exec = require('cordova/exec'); + +function handlers() { + return battery.channels.batterystatus.numHandlers + + battery.channels.batterylow.numHandlers + + battery.channels.batterycritical.numHandlers; +} + +var Battery = function() { + this._level = null; + this._isPlugged = null; + // Create new event handlers on the window (returns a channel instance) + var subscriptionEvents = { + onSubscribe:this.onSubscribe, + onUnsubscribe:this.onUnsubscribe + }; + this.channels = { + batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents), + batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents), + batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents) + }; +}; +/** + * Event handlers for when callbacks get registered for the battery. + * Keep track of how many handlers we have so we can start and stop the native battery listener + * appropriately (and hopefully save on battery life!). + */ +Battery.prototype.onSubscribe = function() { + var me = battery; + // If we just registered the first handler, make sure native listener is started. + if (handlers() === 1) { + exec(me._status, me._error, "Battery", "start", []); + } +}; + +Battery.prototype.onUnsubscribe = function() { + var me = battery; + + // If we just unregistered the last handler, make sure native listener is stopped. + if (handlers() === 0) { + exec(null, null, "Battery", "stop", []); + } +}; + +/** + * Callback for battery status + * + * @param {Object} info keys: level, isPlugged + */ +Battery.prototype._status = function(info) { + if (info) { + var me = battery; + var level = info.level; + if (me._level !== level || me._isPlugged !== info.isPlugged) { + // Fire batterystatus event + cordova.fireWindowEvent("batterystatus", info); + + // Fire low battery event + if (level === 20 || level === 5) { + if (level === 20) { + cordova.fireWindowEvent("batterylow", info); + } + else { + cordova.fireWindowEvent("batterycritical", info); + } + } + } + me._level = level; + me._isPlugged = info.isPlugged; + } +}; + +/** + * Error callback for battery start + */ +Battery.prototype._error = function(e) { + console.log("Error initializing Battery: " + e); +}; + +var battery = new Battery(); + +module.exports = battery; +}); + +// file: lib/common/plugin/capture.js +define("cordova/plugin/capture", function(require, exports, module) { +var exec = require('cordova/exec'), + MediaFile = require('cordova/plugin/MediaFile'); + +/** + * Launches a capture of different types. + * + * @param (DOMString} type + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +function _capture(type, successCallback, errorCallback, options) { + var win = function(pluginResult) { + var mediaFiles = []; + var i; + for (i = 0; i < pluginResult.length; i++) { + var mediaFile = new MediaFile(); + mediaFile.name = pluginResult[i].name; + mediaFile.fullPath = pluginResult[i].fullPath; + mediaFile.type = pluginResult[i].type; + mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate; + mediaFile.size = pluginResult[i].size; + mediaFiles.push(mediaFile); + } + successCallback(mediaFiles); + }; + exec(win, errorCallback, "Capture", type, [options]); +} +/** + * The Capture interface exposes an interface to the camera and microphone of the hosting device. + */ +function Capture() { + this.supportedAudioModes = []; + this.supportedImageModes = []; + this.supportedVideoModes = []; +} + +/** + * Launch audio recorder application for recording audio clip(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureAudioOptions} options + */ +Capture.prototype.captureAudio = function(successCallback, errorCallback, options){ + _capture("captureAudio", successCallback, errorCallback, options); +}; + +/** + * Launch camera application for taking image(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureImageOptions} options + */ +Capture.prototype.captureImage = function(successCallback, errorCallback, options){ + _capture("captureImage", successCallback, errorCallback, options); +}; + +/** + * Launch device camera application for recording video(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +Capture.prototype.captureVideo = function(successCallback, errorCallback, options){ + _capture("captureVideo", successCallback, errorCallback, options); +}; + + +module.exports = new Capture(); + +}); + +// file: lib/common/plugin/compass.js +define("cordova/plugin/compass", function(require, exports, module) { +var exec = require('cordova/exec'), + utils = require('cordova/utils'), + CompassHeading = require('cordova/plugin/CompassHeading'), + CompassError = require('cordova/plugin/CompassError'), + timers = {}, + compass = { + /** + * Asynchronously acquires the current heading. + * @param {Function} successCallback The function to call when the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {CompassOptions} options The options for getting the heading data (not used). + */ + getCurrentHeading:function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var win = function(result) { + var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); + successCallback(ch); + }; + var fail = function(code) { + var ce = new CompassError(code); + errorCallback(ce); + }; + + // Get heading + exec(win, fail, "Compass", "getHeading", [options]); + }, + + /** + * Asynchronously acquires the heading repeatedly at a given interval. + * @param {Function} successCallback The function to call each time the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {HeadingOptions} options The options for getting the heading data + * such as timeout and the frequency of the watch. For iOS, filter parameter + * specifies to watch via a distance filter rather than time. + */ + watchHeading:function(successCallback, errorCallback, options) { + // Default interval (100 msec) + var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; + var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var id = utils.createUUID(); + if (filter > 0) { + // is an iOS request for watch by filter, no timer needed + timers[id] = "iOS"; + compass.getCurrentHeading(successCallback, errorCallback, options); + } else { + // Start watch timer to get headings + timers[id] = window.setInterval(function() { + compass.getCurrentHeading(successCallback, errorCallback); + }, frequency); + } + + return id; + }, + + /** + * Clears the specified heading watch. + * @param {String} watchId The ID of the watch returned from #watchHeading. + */ + clearWatch:function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + if (timers[id] != "iOS") { + clearInterval(timers[id]); + } else { + // is iOS watch by filter so call into device to stop + exec(null, null, "Compass", "stopHeading", []); + } + delete timers[id]; + } + } + }; + +module.exports = compass; +}); + +// file: lib/common/plugin/console-via-logger.js +define("cordova/plugin/console-via-logger", function(require, exports, module) { +//------------------------------------------------------------------------------ + +var logger = require("cordova/plugin/logger"); +var utils = require("cordova/utils"); + +//------------------------------------------------------------------------------ +// object that we're exporting +//------------------------------------------------------------------------------ +var console = module.exports; + +//------------------------------------------------------------------------------ +// copy of the original console object +//------------------------------------------------------------------------------ +var WinConsole = window.console; + +//------------------------------------------------------------------------------ +// whether to use the logger +//------------------------------------------------------------------------------ +var UseLogger = false; + +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ +var Timers = {}; + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +function noop() {} + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +console.useLogger = function (value) { + if (arguments.length) UseLogger = !!value; + + if (UseLogger) { + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } + } + + return UseLogger; +}; + +//------------------------------------------------------------------------------ +console.log = function() { + if (logger.useConsole()) return; + logger.log.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.error = function() { + if (logger.useConsole()) return; + logger.error.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.warn = function() { + if (logger.useConsole()) return; + logger.warn.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.info = function() { + if (logger.useConsole()) return; + logger.info.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.debug = function() { + if (logger.useConsole()) return; + logger.debug.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.assert = function(expression) { + if (expression) return; + + var message = utils.vformat(arguments[1], [].slice.call(arguments, 2)); + console.log("ASSERT: " + message); +}; + +//------------------------------------------------------------------------------ +console.clear = function() {}; + +//------------------------------------------------------------------------------ +console.dir = function(object) { + console.log("%o", object); +}; + +//------------------------------------------------------------------------------ +console.dirxml = function(node) { + console.log(node.innerHTML); +}; + +//------------------------------------------------------------------------------ +console.trace = noop; + +//------------------------------------------------------------------------------ +console.group = console.log; + +//------------------------------------------------------------------------------ +console.groupCollapsed = console.log; + +//------------------------------------------------------------------------------ +console.groupEnd = noop; + +//------------------------------------------------------------------------------ +console.time = function(name) { + Timers[name] = new Date().valueOf(); +}; + +//------------------------------------------------------------------------------ +console.timeEnd = function(name) { + var timeStart = Timers[name]; + if (!timeStart) { + console.warn("unknown timer: " + name); + return; + } + + var timeElapsed = new Date().valueOf() - timeStart; + console.log(name + ": " + timeElapsed + "ms"); +}; + +//------------------------------------------------------------------------------ +console.timeStamp = noop; + +//------------------------------------------------------------------------------ +console.profile = noop; + +//------------------------------------------------------------------------------ +console.profileEnd = noop; + +//------------------------------------------------------------------------------ +console.count = noop; + +//------------------------------------------------------------------------------ +console.exception = console.log; + +//------------------------------------------------------------------------------ +console.table = function(data, columns) { + console.log("%o", data); +}; + +//------------------------------------------------------------------------------ +// return a new function that calls both functions passed as args +//------------------------------------------------------------------------------ +function wrapperedOrigCall(orgFunc, newFunc) { + return function() { + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} + }; +} + +//------------------------------------------------------------------------------ +// For every function that exists in the original console object, that +// also exists in the new console object, wrap the new console method +// with one that calls both +//------------------------------------------------------------------------------ +for (var key in console) { + if (typeof WinConsole[key] == "function") { + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + } +} + +}); + +// file: lib/common/plugin/contacts.js +define("cordova/plugin/contacts", function(require, exports, module) { +var exec = require('cordova/exec'), + ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'), + Contact = require('cordova/plugin/Contact'); + +/** +* Represents a group of Contacts. +* @constructor +*/ +var contacts = { + /** + * Returns an array of Contacts matching the search criteria. + * @param fields that should be searched + * @param successCB success callback + * @param errorCB error callback + * @param {ContactFindOptions} options that can be applied to contact searching + * @return array of Contacts matching search criteria + */ + find:function(fields, successCB, errorCB, options) { + if (!successCB) { + throw new TypeError("You must specify a success callback for the find command."); + } + if (!fields || (utils.isArray(fields) && fields.length === 0)) { + if (typeof errorCB === "function") { + errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); + } + } else { + var win = function(result) { + var cs = []; + for (var i = 0, l = result.length; i < l; i++) { + cs.push(contacts.create(result[i])); + } + successCB(cs); + }; + exec(win, errorCB, "Contacts", "search", [fields, options]); + } + }, + + /** + * This function creates a new contact, but it does not persist the contact + * to device storage. To persist the contact to device storage, invoke + * contact.save(). + * @param properties an object whose properties will be examined to create a new Contact + * @returns new Contact object + */ + create:function(properties) { + var i; + var contact = new Contact(); + for (i in properties) { + if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { + contact[i] = properties[i]; + } + } + return contact; + } +}; + +module.exports = contacts; + +}); + +// file: lib/common/plugin/device.js +define("cordova/plugin/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'); + +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.name = null; + this.uuid = null; + this.cordova = null; + + var me = this; + + channel.onCordovaReady.subscribeOnce(function() { + me.getInfo(function(info) { + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.name = info.name; + me.uuid = info.uuid; + me.cordova = info.cordova; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Device Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Device Error: errorCallback is not a function"); + return; + } + + // Get info + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); + +}); + +// file: lib/common/plugin/echo.js +define("cordova/plugin/echo", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Sends the given message through exec() to the Echo plugink, which sends it back to the successCallback. + * @param successCallback invoked with a FileSystem object + * @param errorCallback invoked if error occurs retrieving file system + * @param message The string to be echoed. + * @param forceAsync Whether to force an async return value (for testing native->js bridge). + */ +module.exports = function(successCallback, errorCallback, message, forceAsync) { + var action = forceAsync ? 'echoAsync' : 'echo'; + exec(successCallback, errorCallback, "Echo", action, [message]); +}; + + +}); + +// file: lib/common/plugin/geolocation.js +define("cordova/plugin/geolocation", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + PositionError = require('cordova/plugin/PositionError'), + Position = require('cordova/plugin/Position'); + +var timers = {}; // list of timers in use + +// Returns default params, overrides if provided with values +function parseParameters(options) { + var opt = { + maximumAge: 0, + enableHighAccuracy: false, + timeout: Infinity + }; + + if (options) { + if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { + opt.maximumAge = options.maximumAge; + } + if (options.enableHighAccuracy !== undefined) { + opt.enableHighAccuracy = options.enableHighAccuracy; + } + if (options.timeout !== undefined && !isNaN(options.timeout)) { + if (options.timeout < 0) { + opt.timeout = 0; + } else { + opt.timeout = options.timeout; + } + } + } + + return opt; +} + +// Returns a timeout failure, closed over a specified timeout value and error callback. +function createTimeout(errorCallback, timeout) { + var t = setTimeout(function() { + clearTimeout(t); + t = null; + errorCallback({ + code:PositionError.TIMEOUT, + message:"Position retrieval timed out." + }); + }, timeout); + return t; +} + +var geolocation = { + lastPosition:null, // reference to last known (cached) position returned + /** + * Asynchronously aquires the current position. + * + * @param {Function} successCallback The function to call when the position data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL) + * @param {PositionOptions} options The options for getting the position data. (OPTIONAL) + */ + getCurrentPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("getCurrentPosition must be called with at least one argument."); + } + options = parseParameters(options); + + // Timer var that will fire an error callback if no position is retrieved from native + // before the "timeout" param provided expires + var timeoutTimer = null; + + var win = function(p) { + clearTimeout(timeoutTimer); + if (!timeoutTimer) { + // Timeout already happened, or native fired error callback for + // this geo request. + // Don't continue with success callback. + return; + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + var fail = function(e) { + clearTimeout(timeoutTimer); + timeoutTimer = null; + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just + // fire the success callback with the cached position. + if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { + successCallback(geolocation.lastPosition); + // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. + } else if (options.timeout === 0) { + fail({ + code:PositionError.TIMEOUT, + message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter." + }); + // Otherwise we have to call into native to retrieve a position. + } else { + if (options.timeout !== Infinity) { + // If the timeout value was not set to Infinity (default), then + // set up a timeout function that will fire the error callback + // if no successful position was retrieved before timeout expired. + timeoutTimer = createTimeout(fail, options.timeout); + } else { + // This is here so the check in the win function doesn't mess stuff up + // may seem weird but this guarantees timeoutTimer is + // always truthy before we call into native + timeoutTimer = true; + } + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + } + return timeoutTimer; + }, + /** + * Asynchronously watches the geolocation for changes to geolocation. When a change occurs, + * the successCallback is called with the new location. + * + * @param {Function} successCallback The function to call each time the location data is available + * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL) + * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("watchPosition must be called with at least one argument."); + } + options = parseParameters(options); + + var id = utils.createUUID(); + + // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition + timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); + + var fail = function(e) { + clearTimeout(timers[id]); + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + var win = function(p) { + clearTimeout(timers[id]); + if (options.timeout !== Infinity) { + timers[id] = createTimeout(fail, options.timeout); + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + + exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); + + return id; + }, + /** + * Clears the specified heading watch. + * + * @param {String} id The ID of the watch returned from #watchPosition + */ + clearWatch:function(id) { + if (id && timers[id] !== undefined) { + clearTimeout(timers[id]); + delete timers[id]; + exec(null, null, "Geolocation", "clearWatch", [id]); + } + } +}; + +module.exports = geolocation; + +}); + +// file: lib/common/plugin/logger.js +define("cordova/plugin/logger", function(require, exports, module) { +//------------------------------------------------------------------------------ +// The logger module exports the following properties/functions: +// +// LOG - constant for the level LOG +// ERROR - constant for the level ERROR +// WARN - constant for the level WARN +// INFO - constant for the level INFO +// DEBUG - constant for the level DEBUG +// logLevel() - returns current log level +// logLevel(value) - sets and returns a new log level +// useConsole() - returns whether logger is using console +// useConsole(value) - sets and returns whether logger is using console +// log(message,...) - logs a message at level LOG +// error(message,...) - logs a message at level ERROR +// warn(message,...) - logs a message at level WARN +// info(message,...) - logs a message at level INFO +// debug(message,...) - logs a message at level DEBUG +// logLevel(level,message,...) - logs a message specified level +// +//------------------------------------------------------------------------------ + +var logger = exports; + +var exec = require('cordova/exec'); +var utils = require('cordova/utils'); + +var UseConsole = true; +var Queued = []; +var DeviceReady = false; +var CurrentLevel; + +/** + * Logging levels + */ + +var Levels = [ + "LOG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +]; + +/* + * add the logging levels to the logger object and + * to a separate levelsMap object for testing + */ + +var LevelsMap = {}; +for (var i=0; i CurrentLevel) return; + + // queue the message if not yet at deviceready + if (!DeviceReady && !UseConsole) { + Queued.push([level, message]); + return; + } + + // if not using the console, use the native logger + if (!UseConsole) { + exec(null, null, "Logger", "logLevel", [level, message]); + return; + } + + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } + + // log to the console + switch (level) { + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; + } +}; + +// when deviceready fires, log queued messages +logger.__onDeviceReady = function() { + if (DeviceReady) return; + + DeviceReady = true; + + for (var i=0; i 3) { + fail(FileError.SYNTAX_ERR); + } else { + // if successful, return a FileSystem object + var success = function(file_system) { + if (file_system) { + if (typeof successCallback === 'function') { + // grab the name and root from the file system object + var result = new FileSystem(file_system.name, file_system.root); + successCallback(result); + } + } + else { + // no FileSystem object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + exec(success, fail, "File", "requestFileSystem", [type, size]); + } +}; + +module.exports = requestFileSystem; +}); + +// file: lib/common/plugin/resolveLocalFileSystemURI.js +define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), + FileEntry = require('cordova/plugin/FileEntry'), + FileError = require('cordova/plugin/FileError'), + exec = require('cordova/exec'); + +/** + * Look up file system Entry referred to by local URI. + * @param {DOMString} uri URI referring to a local file or directory + * @param successCallback invoked with Entry object corresponding to URI + * @param errorCallback invoked if error occurs retrieving file system entry + */ +module.exports = function(uri, successCallback, errorCallback) { + // error callback + var fail = function(error) { + if (typeof errorCallback === 'function') { + errorCallback(new FileError(error)); + } + }; + // sanity check for 'not:valid:filename' + if(!uri || uri.split(":").length > 2) { + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; + } + // if successful, return either a file or directory entry + var success = function(entry) { + var result; + if (entry) { + if (typeof successCallback === 'function') { + // create appropriate Entry object + result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath); + try { + successCallback(result); + } + catch (e) { + console.log('Error invoking callback: ' + e); + } + } + } + else { + // no Entry object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + + exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]); +}; + +}); + +// file: lib/common/plugin/splashscreen.js +define("cordova/plugin/splashscreen", function(require, exports, module) { +var exec = require('cordova/exec'); + +var splashscreen = { + show:function() { + exec(null, null, "SplashScreen", "show", []); + }, + hide:function() { + exec(null, null, "SplashScreen", "hide", []); + } +}; + +module.exports = splashscreen; +}); + +// file: lib/common/utils.js +define("cordova/utils", function(require, exports, module) { +var utils = exports; + +/** + * Returns an indication of whether the argument is an array or not + */ +utils.isArray = function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +/** + * Returns an indication of whether the argument is a Date or not + */ +utils.isDate = function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; +}; + +/** + * Does a deep clone of the object. + */ +utils.clone = function(obj) { + if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { + return obj; + } + + var retVal, i; + + if(utils.isArray(obj)){ + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.clone(obj[i])); + } + return retVal; + } + + retVal = {}; + for(i in obj){ + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); + } + } + return retVal; +}; + +/** + * Returns a wrappered version of the function + */ +utils.close = function(context, func, params) { + if (typeof params == 'undefined') { + return function() { + return func.apply(context, arguments); + }; + } else { + return function() { + return func.apply(context, params); + }; + } +}; + +/** + * Create a UUID + */ +utils.createUUID = function() { + return UUIDcreatePart(4) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(6); +}; + +/** + * Extends a child object from a parent object using classical inheritance + * pattern. + */ +utils.extend = (function() { + // proxy used to establish prototype chain + var F = function() {}; + // extend Child from Parent + return function(Child, Parent) { + F.prototype = Parent.prototype; + Child.prototype = new F(); + Child.__super__ = Parent.prototype; + Child.prototype.constructor = Child; + }; +}()); + +/** + * Alerts a message in any available way: alert or console.log. + */ +utils.alert = function(msg) { + if (alert) { + alert(msg); + } else if (console && console.log) { + console.log(msg); + } +}; + +/** + * Formats a string and arguments following it ala sprintf() + * + * see utils.vformat() for more information + */ +utils.format = function(formatString /* ,... */) { + var args = [].slice.call(arguments, 1); + return utils.vformat(formatString, args); +}; + +/** + * Formats a string and arguments following it ala vsprintf() + * + * format chars: + * %j - format arg as JSON + * %o - format arg as JSON + * %c - format arg as '' + * %% - replace with '%' + * any other char following % will format it's + * arg via toString(). + * + * for rationale, see FireBug's Console API: + * http://getfirebug.com/wiki/index.php/Console_API + */ +utils.vformat = function(formatString, args) { + if (formatString === null || formatString === undefined) return ""; + if (arguments.length == 1) return formatString.toString(); + if (typeof formatString != "string") return formatString.toString(); + + var pattern = /(.*?)%(.)(.*)/; + var rest = formatString; + var result = []; + + while (args.length) { + var arg = args.shift(); + var match = pattern.exec(rest); + + if (!match) break; + + rest = match[3]; + + result.push(match[1]); + + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; + } + + result.push(formatted(arg, match[2])); + } + + result.push(rest); + + return result.join(''); +}; + +//------------------------------------------------------------------------------ +function UUIDcreatePart(length) { + var uuidpart = ""; + for (var i=0; i + + + + + + + +
+ + + \ No newline at end of file diff --git a/Android/ForegroundCamera/strings.xml b/Android/ForegroundCamera/strings.xml new file mode 100644 index 00000000..f5d85c59 --- /dev/null +++ b/Android/ForegroundCamera/strings.xml @@ -0,0 +1,22 @@ + + + + Hello Foreground Camera Plugin! + Foreground Camera Plugin + Capture + Cancel + diff --git a/Android/ForegroundGallery/CameraActivity.java b/Android/ForegroundGallery/CameraActivity.java new file mode 100644 index 00000000..27b9923a --- /dev/null +++ b/Android/ForegroundGallery/CameraActivity.java @@ -0,0 +1,136 @@ +/* + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package com.foregroundcameraplugin; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.FileOutputStream; +import java.io.IOException; + +import android.app.Activity; +import android.hardware.Camera; +import android.hardware.Camera.AutoFocusCallback; +import android.hardware.Camera.PictureCallback; +import android.net.Uri; +import android.os.Bundle; +import android.provider.MediaStore; +import android.util.Log; +import android.view.View; +import android.widget.Button; +import android.widget.FrameLayout; + +/** + * Camera Activity Class. Configures Android camera to take picture and show it. + */ +public class CameraActivity extends Activity { + + private static final String TAG = "CameraActivity"; + + private Camera mCamera; + private ForegroundCameraPreview mPreview; + private boolean pressed = false; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.foregroundcameraplugin); + + // Create an instance of Camera + mCamera = getCameraInstance(); + + // Create a Preview and set it as the content of activity. + mPreview = new ForegroundCameraPreview(this, mCamera); + FrameLayout preview = (FrameLayout) findViewById(R.id.camera_preview); + preview.addView(mPreview); + + // Add a listener to the Capture button + Button captureButton = (Button) findViewById(R.id.button_capture); + captureButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + + if (pressed) + return; + + // Set pressed = true to prevent freezing. + // Issue 1 at + // http://code.google.com/p/foreground-camera-plugin/issues/detail?id=1 + pressed = true; + + // get an image from the camera + mCamera.autoFocus(new AutoFocusCallback() { + + public void onAutoFocus(boolean success, Camera camera) { + mCamera.takePicture(null, null, mPicture); + } + }); + } + }); + + Button cancelButton = (Button) findViewById(R.id.button_cancel); + cancelButton.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + pressed = false; + setResult(RESULT_CANCELED); + finish(); + } + }); + } + + @Override + protected void onPause() { + if (mCamera != null) { + mCamera.release(); // release the camera for other applications + mCamera = null; + } + super.onPause(); + } + + /** A safe way to get an instance of the Camera object. */ + public static Camera getCameraInstance() { + Camera c = null; + try { + c = Camera.open(); // attempt to get a Camera instance + } catch (Exception e) { + // Camera is not available (in use or does not exist) + } + return c; // returns null if camera is unavailable + } + + private PictureCallback mPicture = new PictureCallback() { + + public void onPictureTaken(byte[] data, Camera camera) { + + Uri fileUri = (Uri) getIntent().getExtras().get( + MediaStore.EXTRA_OUTPUT); + + File pictureFile = new File(fileUri.getPath()); + + try { + FileOutputStream fos = new FileOutputStream(pictureFile); + fos.write(data); + fos.close(); + } catch (FileNotFoundException e) { + Log.d(TAG, "File not found: " + e.getMessage()); + } catch (IOException e) { + Log.d(TAG, "Error accessing file: " + e.getMessage()); + } + setResult(RESULT_OK); + pressed = false; + finish(); + } + }; +} \ No newline at end of file diff --git a/Android/ForegroundGallery/ForegroundCameraLauncher.java b/Android/ForegroundGallery/ForegroundCameraLauncher.java new file mode 100644 index 00000000..62b3a4dd --- /dev/null +++ b/Android/ForegroundGallery/ForegroundCameraLauncher.java @@ -0,0 +1,380 @@ +/* + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vin�cius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + */ + +package com.foregroundcameraplugin; + +import java.io.File; +import java.io.FileNotFoundException; +import java.io.IOException; +import java.io.OutputStream; + +import org.apache.cordova.CameraLauncher; +import org.apache.cordova.ExifHelper; +import org.apache.cordova.api.CordovaInterface; +import org.apache.cordova.api.LOG; +import org.apache.cordova.api.Plugin; +import org.apache.cordova.api.PluginResult; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import android.app.Activity; +import android.content.ContentValues; +import android.content.Context; +import android.content.Intent; +import android.database.Cursor; +import android.graphics.Bitmap; +import android.net.Uri; +import android.os.Environment; +import android.provider.MediaStore; + +/** + * This class launches the camera view, allows the user to take a picture, + * closes the camera view, and returns the captured image. When the camera view + * is closed, the screen displayed before the camera view was shown is + * redisplayed. + */ +public class ForegroundCameraLauncher extends CameraLauncher { + + private static final String LOG_TAG = "ForegroundCameraLauncher"; + + private int mQuality; + private int targetWidth; + private int targetHeight; + + private Uri imageUri; + private File photo; + + public String callbackId; + private int numPics; + + private static final String _DATA = "_data"; + + /** + * Constructor. + */ + public ForegroundCameraLauncher() { + } + + /** + * Executes the request and returns PluginResult. + * + * @param action + * The action to execute. + * @param args + * JSONArry of arguments for the plugin. + * @param callbackId + * The callback id used when calling back into JavaScript. + * @return A PluginResult object with a status and message. + */ + public PluginResult execute(String action, JSONArray args, String callbackId) { + PluginResult.Status status = PluginResult.Status.OK; + String result = ""; + this.callbackId = callbackId; + + try { + if (action.equals("takePicture")) { + this.targetHeight = 0; + this.targetWidth = 0; + this.mQuality = 80; + + JSONObject options = args.optJSONObject(0); + if (options != null) { + this.targetHeight = options.getInt("targetHeight"); + this.targetWidth = options.getInt("targetWidth"); + this.mQuality = options.getInt("quality"); + } + + this.takePicture(); + + PluginResult r = new PluginResult(PluginResult.Status.NO_RESULT); + r.setKeepCallback(true); + return r; + } + return new PluginResult(status, result); + } catch (JSONException e) { + e.printStackTrace(); + return new PluginResult(PluginResult.Status.JSON_EXCEPTION); + } + } + + // -------------------------------------------------------------------------- + // LOCAL METHODS + // -------------------------------------------------------------------------- + + /** + * Take a picture with the camera. When an image is captured or the camera + * view is cancelled, the result is returned in + * CordovaActivity.onActivityResult, which forwards the result to + * this.onActivityResult. + * + * The image can either be returned as a base64 string or a URI that points + * to the file. To display base64 string in an img tag, set the source to: + * img.src="data:image/jpeg;base64,"+result; or to display URI in an img tag + * img.src=result; + * + */ + public void takePicture() { + // Save the number of images currently on disk for later + this.numPics = queryImgDB().getCount(); + + Intent intent = new Intent(this.cordova.getActivity().getApplicationContext(), CameraActivity.class); + this.photo = createCaptureFile(); + this.imageUri = Uri.fromFile(photo); + intent.putExtra(MediaStore.EXTRA_OUTPUT, this.imageUri); + + this.cordova.startActivityForResult((Plugin) this, intent, 1); + } + + /** + * Create a file in the applications temporary directory based upon the + * supplied encoding. + * + * @return a File object pointing to the temporary picture + */ + private File createCaptureFile() { + File photo = new File(getTempDirectoryPath(this.cordova.getActivity().getApplicationContext()), "Pic.jpg"); + return photo; + } + + /** + * Called when the camera view exits. + * + * @param requestCode + * The request code originally supplied to + * startActivityForResult(), allowing you to identify who this + * result came from. + * @param resultCode + * The integer result code returned by the child activity through + * its setResult(). + * @param intent + * An Intent, which can return result data to the caller (various + * data can be attached to Intent "extras"). + */ + public void onActivityResult(int requestCode, int resultCode, Intent intent) { + + // If image available + if (resultCode == Activity.RESULT_OK) { + try { + // Create an ExifHelper to save the exif data that is lost + // during compression + ExifHelper exif = new ExifHelper(); + exif.createInFile(getTempDirectoryPath(this.cordova.getActivity().getApplicationContext()) + + "/Pic.jpg"); + exif.readExifData(); + + // Read in bitmap of captured image + Bitmap bitmap; + try { + bitmap = android.provider.MediaStore.Images.Media + .getBitmap(this.cordova.getActivity().getContentResolver(), imageUri); + } catch (FileNotFoundException e) { + Uri uri = intent.getData(); + android.content.ContentResolver resolver = this.cordova.getActivity().getContentResolver(); + bitmap = android.graphics.BitmapFactory + .decodeStream(resolver.openInputStream(uri)); + } + + bitmap = scaleBitmap(bitmap); + + // Create entry in media store for image + // (Don't use insertImage() because it uses default compression + // setting of 50 - no way to change it) + ContentValues values = new ContentValues(); + values.put(android.provider.MediaStore.Images.Media.MIME_TYPE, + "image/jpeg"); + Uri uri = null; + try { + uri = this.cordova.getActivity().getContentResolver() + .insert(android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, + values); + } catch (UnsupportedOperationException e) { + LOG.d(LOG_TAG, "Can't write to external media storage."); + try { + uri = this.cordova.getActivity().getContentResolver() + .insert(android.provider.MediaStore.Images.Media.INTERNAL_CONTENT_URI, + values); + } catch (UnsupportedOperationException ex) { + LOG.d(LOG_TAG, "Can't write to internal media storage."); + this.failPicture("Error capturing image - no media storage found."); + return; + } + } + + // Add compressed version of captured image to returned media + // store Uri + OutputStream os = this.cordova.getActivity().getContentResolver() + .openOutputStream(uri); + bitmap.compress(Bitmap.CompressFormat.JPEG, this.mQuality, os); + os.close(); + + // Restore exif data to file + exif.createOutFile(getRealPathFromURI(uri, this.ctx)); + exif.writeExifData(); + + // Send Uri back to JavaScript for viewing image + this.success(new PluginResult(PluginResult.Status.OK, + getRealPathFromURI(uri, this.ctx)), this.callbackId); + + bitmap.recycle(); + bitmap = null; + System.gc(); + + checkForDuplicateImage(); + } catch (IOException e) { + e.printStackTrace(); + this.failPicture("Error capturing image."); + } + } + + // If cancelled + else if (resultCode == Activity.RESULT_CANCELED) { + this.failPicture("Camera cancelled."); + } + + // If something else + else { + this.failPicture("Did not complete!"); + } + } + + /** + * Scales the bitmap according to the requested size. + * + * @param bitmap + * The bitmap to scale. + * @return Bitmap A new Bitmap object of the same bitmap after scaling. + */ + public Bitmap scaleBitmap(Bitmap bitmap) { + int newWidth = this.targetWidth; + int newHeight = this.targetHeight; + int origWidth = bitmap.getWidth(); + int origHeight = bitmap.getHeight(); + + // If no new width or height were specified return the original bitmap + if (newWidth <= 0 && newHeight <= 0) { + return bitmap; + } + // Only the width was specified + else if (newWidth > 0 && newHeight <= 0) { + newHeight = (newWidth * origHeight) / origWidth; + } + // only the height was specified + else if (newWidth <= 0 && newHeight > 0) { + newWidth = (newHeight * origWidth) / origHeight; + } + // If the user specified both a positive width and height + // (potentially different aspect ratio) then the width or height is + // scaled so that the image fits while maintaining aspect ratio. + // Alternatively, the specified width and height could have been + // kept and Bitmap.SCALE_TO_FIT specified when scaling, but this + // would result in whitespace in the new image. + else { + double newRatio = newWidth / (double) newHeight; + double origRatio = origWidth / (double) origHeight; + + if (origRatio > newRatio) { + newHeight = (newWidth * origHeight) / origWidth; + } else if (origRatio < newRatio) { + newWidth = (newHeight * origWidth) / origHeight; + } + } + + return Bitmap.createScaledBitmap(bitmap, newWidth, newHeight, true); + } + + /** + * Creates a cursor that can be used to determine how many images we have. + * + * @return a cursor + */ + private Cursor queryImgDB() { + return this.cordova.getActivity().getContentResolver().query( + android.provider.MediaStore.Images.Media.EXTERNAL_CONTENT_URI, + new String[] { MediaStore.Images.Media._ID }, null, null, null); + } + + /** + * Used to find out if we are in a situation where the Camera Intent adds to + * images to the content store. If we are using a FILE_URI and the number of + * images in the DB increases by 2 we have a duplicate, when using a + * DATA_URL the number is 1. + */ + private void checkForDuplicateImage() { + int diff = 2; + Cursor cursor = queryImgDB(); + int currentNumOfImages = cursor.getCount(); + + // delete the duplicate file if the difference is 2 for file URI or 1 + // for Data URL + if ((currentNumOfImages - numPics) == diff) { + cursor.moveToLast(); + int id = Integer.valueOf(cursor.getString(cursor + .getColumnIndex(MediaStore.Images.Media._ID))) - 1; + Uri uri = Uri.parse(MediaStore.Images.Media.EXTERNAL_CONTENT_URI + + "/" + id); + this.cordova.getActivity().getContentResolver().delete(uri, null, null); + } + } + + /** + * Determine if we can use the SD Card to store the temporary file. If not + * then use the internal cache directory. + * + * @return the absolute path of where to store the file + */ + private String getTempDirectoryPath(Context ctx) { + File cache = null; + + // SD Card Mounted + if (Environment.getExternalStorageState().equals( + Environment.MEDIA_MOUNTED)) { + cache = new File(Environment.getExternalStorageDirectory() + .getAbsolutePath() + + "/Android/data/" + + ctx.getPackageName() + "/cache/"); + } + // Use internal storage + else { + cache = ctx.getCacheDir(); + } + + // Create the cache directory if it doesn't exist + if (!cache.exists()) { + cache.mkdirs(); + } + + return cache.getAbsolutePath(); + } + + /** + * Queries the media store to find out what the file path is for the Uri we + * supply + * + * @param contentUri + * the Uri of the audio/image/video + * @param ctx + * the current applicaiton context + * @return the full path to the file + */ + private String getRealPathFromURI(Uri contentUri, CordovaInterface ctx) { + String[] proj = { _DATA }; + Cursor cursor = cordova.getActivity().managedQuery(contentUri, proj, null, null, null); + int column_index = cursor.getColumnIndexOrThrow(_DATA); + cursor.moveToFirst(); + return cursor.getString(column_index); + } +} diff --git a/Android/ForegroundGallery/ForegroundCameraPreview.java b/Android/ForegroundGallery/ForegroundCameraPreview.java new file mode 100644 index 00000000..994b9468 --- /dev/null +++ b/Android/ForegroundGallery/ForegroundCameraPreview.java @@ -0,0 +1,73 @@ +/* + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +package com.foregroundcameraplugin; + +import java.io.IOException; + +import android.content.Context; +import android.hardware.Camera; +import android.util.Log; +import android.view.SurfaceHolder; +import android.view.SurfaceView; + +public class ForegroundCameraPreview extends SurfaceView implements SurfaceHolder.Callback { + private SurfaceHolder mHolder; + private Camera mCamera; + private static final String TAG = "CameraPreview"; + + public ForegroundCameraPreview(Context context, Camera camera) { + super(context); + mCamera = camera; + + mHolder = getHolder(); + mHolder.addCallback(this); + mHolder.setType(SurfaceHolder.SURFACE_TYPE_PUSH_BUFFERS); + } + + public void surfaceCreated(SurfaceHolder holder) { + try { + mCamera.setPreviewDisplay(holder); + mCamera.startPreview(); + } catch (IOException e) { + Log.d(TAG, "Error setting camera preview: " + e.getMessage()); + } + } + + public void surfaceDestroyed(SurfaceHolder holder) { + } + + + public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) { + + if (mHolder.getSurface() == null){ + return; + } + + try { + mCamera.stopPreview(); + } catch (Exception e){ + } + + try { + mCamera.setPreviewDisplay(mHolder); + mCamera.startPreview(); + + } catch (Exception e){ + Log.d(TAG, "Error starting camera preview: " + e.getMessage()); + } + } +} diff --git a/Android/ForegroundGallery/LICENSE b/Android/ForegroundGallery/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/Android/ForegroundGallery/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Android/ForegroundGallery/NOTICE b/Android/ForegroundGallery/NOTICE new file mode 100644 index 00000000..999a0b15 --- /dev/null +++ b/Android/ForegroundGallery/NOTICE @@ -0,0 +1,9 @@ +Foreground Camera Plugin for Phonegap (Cordova) +Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org) + +- src/com/foregroundcameraplugin/ForegroundCameraLauncher.java was based on CameraLauncher.java, found in Phonegap (Apache Cordova) version 1.8.0. +- assets/www/js/camera.js was based on cordova-1.8.0.js, found in Phonegap (Apache Cordova) version 1.8.0. +- res/xml/plugins.xml was adapted from plugins.xml, found in Phonegap (Apache Cordova) version 1.8.0. \ No newline at end of file diff --git a/Android/ForegroundGallery/README.txt b/Android/ForegroundGallery/README.txt new file mode 100644 index 00000000..72e06682 --- /dev/null +++ b/Android/ForegroundGallery/README.txt @@ -0,0 +1,43 @@ + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Foreground Camera Plugin for Phonegap (Cordova). + +Originally by: - Bruno Carreira + - Lucas Farias + - Rafael Luna + - Vinicius Fonseca + +The default Phonegap (Cordova) Camera Plugin calls the native camera and this makes Android Garbage Collector to kill background applications. This plugin avoid your application to go background and be killed by Garbage Collector with other applications. We used the Phonegap source code and modified it to avoid this problem. This plugin works only with File URI. + +Adding the plugin to your project + + 1) To install the plugin, move the file camera.js to your project's www folder and include a reference to it in your html files. + 2) Put the Java files in your src/ folder. + 3) Change the default Camera Plugin into res/xml/plugins.xml file to . + 4) Put the strings.xml in your res/values folder. + 5) Put the foregroundcameraplugin.xml in your res/layout folder. + 6) In you AndroidManifest.xml, put this permissions: + + + And declare the Camera Activity: + + + +Using the plugin + + See the index.xhtml. \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.classpath b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.classpath new file mode 100644 index 00000000..e088a5d5 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.classpath @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.project b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.project new file mode 100644 index 00000000..ac1c0578 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/.project @@ -0,0 +1,33 @@ + + + ForegroundCameraPlugin + + + + + + com.android.ide.eclipse.adt.ResourceManagerBuilder + + + + + com.android.ide.eclipse.adt.PreCompilerBuilder + + + + + org.eclipse.jdt.core.javabuilder + + + + + com.android.ide.eclipse.adt.ApkBuilder + + + + + + com.android.ide.eclipse.adt.AndroidNature + org.eclipse.jdt.core.javanature + + diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/AndroidManifest.xml b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/AndroidManifest.xml new file mode 100644 index 00000000..e5a4eada --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/AndroidManifest.xml @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/LICENSE b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/LICENSE new file mode 100644 index 00000000..d6456956 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/LICENSE @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/NOTICE b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/NOTICE new file mode 100644 index 00000000..999a0b15 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/NOTICE @@ -0,0 +1,9 @@ +Foreground Camera Plugin for Phonegap (Cordova) +Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + +This product includes software developed by +The Apache Software Foundation (http://www.apache.org) + +- src/com/foregroundcameraplugin/ForegroundCameraLauncher.java was based on CameraLauncher.java, found in Phonegap (Apache Cordova) version 1.8.0. +- assets/www/js/camera.js was based on cordova-1.8.0.js, found in Phonegap (Apache Cordova) version 1.8.0. +- res/xml/plugins.xml was adapted from plugins.xml, found in Phonegap (Apache Cordova) version 1.8.0. \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/README.txt b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/README.txt new file mode 100644 index 00000000..00b8b682 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/README.txt @@ -0,0 +1,49 @@ + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vinícius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + +Foreground Camera Plugin for Phonegap (Cordova). + +Originally by: - Bruno Carreira + - Lucas Farias + - Rafael Luna + - Vinicius Fonseca + +The default Phonegap (Cordova) Camera Plugin calls the native camera and this makes Android Garbage Collector to kill background applications. This plugin avoid your application to go background and be killed by Garbage Collector with other applications. We used the Phonegap source code and modified it to avoid this problem. This plugin works only with File URI. + +Adding the plugin to your project + + 1) To install the plugin, move the file camera.js to your project's www folder and include a reference to it in your html files. + 2) Put the Java files in your src/ folder. + 3) Change the default Camera Plugin into res/xml/config.xml file to . + 4) Put the strings.xml in your res/values folder. + 5) Put the foregroundcameraplugin.xml in your res/layout folder. + 6) In you AndroidManifest.xml, put this permissions: + + + + + + + + + And declare the Camera Activity: + + + +Using the plugin + + See the index.xhtml. \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/index.html b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/index.html new file mode 100644 index 00000000..672d5772 --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/index.html @@ -0,0 +1,83 @@ + + + + + Capture Photo + + + + + + +
+ + + \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/camera.js b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/camera.js new file mode 100644 index 00000000..1c246f4c --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/camera.js @@ -0,0 +1,91 @@ +/** + Copyright 2012 Bruno Carreira - Lucas Farias - Rafael Luna - Vin�cius Fonseca. + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. +*/ + +/** + * This class provides access to the device camera. + * + * @constructor + */ +var Camera = function() { + this.successCallback = null; + this.errorCallback = null; + this.options = null; +}; + +/** + * Gets a picture from source defined by "options.sourceType", and returns the + * image as defined by the "options.destinationType" option. + + * The defaults are sourceType=CAMERA and destinationType=DATA_URL. + * + * @param {Function} successCallback + * @param {Function} errorCallback + * @param {Object} options + */ +Camera.prototype.getPicture = function(successCallback, errorCallback, + options) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Camera Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Camera Error: errorCallback is not a function"); + return; + } + + if (options === null || typeof options === "undefined") { + options = {}; + } + if (options.quality === null || typeof options.quality === "undefined") { + options.quality = 80; + } + if (options.maxResolution === null + || typeof options.maxResolution === "undefined") { + options.maxResolution = 0; + } + + if (options.targetWidth === null + || typeof options.targetWidth === "undefined") { + options.targetWidth = -1; + } else if (typeof options.targetWidth === "string") { + var width = new Number(options.targetWidth); + if (isNaN(width) === false) { + options.targetWidth = width.valueOf(); + } + } + if (options.targetHeight === null + || typeof options.targetHeight === "undefined") { + options.targetHeight = -1; + } else if (typeof options.targetHeight === "string") { + var height = new Number(options.targetHeight); + if (isNaN(height) === false) { + options.targetHeight = height.valueOf(); + } + } + + cordova.exec(successCallback, errorCallback, "Camera", "takePicture", + [ options ]); +}; + +cordova.addConstructor(function() { + if (typeof navigator.camera === "undefined") { + navigator.camera = new Camera(); + } +}); \ No newline at end of file diff --git a/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js new file mode 100644 index 00000000..9e7fa8ec --- /dev/null +++ b/Android/ForegroundGallery/Sample/ForegroundCameraPlugin/assets/www/js/cordova-2.1.0.js @@ -0,0 +1,5814 @@ +// commit 143f5221a6251c9cbccdedc57005c61551b97f12 + +// File generated at :: Wed Sep 12 2012 12:51:58 GMT-0700 (PDT) + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +;(function() { + +// file: lib/scripts/require.js +var require, + define; + +(function () { + var modules = {}; + + function build(module) { + var factory = module.factory; + module.exports = {}; + delete module.factory; + factory(require, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw "module " + id + " not found"; + } + return modules[id].factory ? build(modules[id]) : modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + +})(); + +//Export for use in node +if (typeof module === "object" && typeof require === "function") { + module.exports.require = require; + module.exports.define = define; +} +// file: lib/cordova.js +define("cordova", function(require, exports, module) { +var channel = require('cordova/channel'); + +/** + * Listen for DOMContentLoaded and notify our channel subscribers. + */ +document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); +}, false); +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}, + windowEventHandlers = {}; + +document.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] != 'undefined') { + if (evt === 'deviceready') { + documentEventHandlers[e].subscribeOnce(handler); + } else { + documentEventHandlers[e].subscribe(handler); + } + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] != "undefined") { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent(type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + +if(typeof window.console === "undefined") { + window.console = { + log:function(){} + }; +} + +var cordova = { + define:define, + require:require, + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler:function(event, opts) { + return (windowEventHandlers[event] = channel.create(event, opts)); + }, + addDocumentEventHandler:function(event, opts) { + return (documentEventHandlers[event] = channel.create(event, opts)); + }, + removeWindowEventHandler:function(event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler:function(event) { + delete documentEventHandlers[event]; + }, + /** + * Retreive original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function() { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + * bNoDetach is required for events which cause an exception which needs to be caught in native code + */ + fireDocumentEvent: function(type, data, bNoDetach) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + if( bNoDetach ) { + documentEventHandlers[type].fire(evt); + } + else { + setTimeout(function() { + documentEventHandlers[type].fire(evt); + }, 0); + } + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function(type, data) { + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + + // TODO: iOS only + // This queue holds the currently executing command and all pending + // commands executed with cordova.exec(). + commandQueue:[], + // Indicates if we're currently in the middle of flushing the command + // queue on the native side. + commandQueueFlushing:false, + // END TODO + /** + * Plugin callback mechanism. + */ + callbackId: 0, + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + * + * @param callbackId + * @param args + */ + callbackSuccess: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + + // If result is to be sent to callback + if (args.status == cordova.callbackStatus.OK) { + try { + if (cordova.callbacks[callbackId].success) { + cordova.callbacks[callbackId].success(args.message); + } + } + catch (e) { + console.log("Error in success callback: "+callbackId+" = "+e); + } + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + + /** + * Called by native code when returning error result from an action. + * + * @param callbackId + * @param args + */ + callbackError: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + try { + if (cordova.callbacks[callbackId].fail) { + cordova.callbacks[callbackId].fail(args.message); + } + } + catch (e) { + console.log("Error in error callback: "+callbackId+" = "+e); + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + addConstructor: function(func) { + channel.onCordovaReady.subscribeOnce(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); + } +}; + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready'); + +module.exports = cordova; + +}); + +// file: lib/common/builder.js +define("cordova/builder", function(require, exports, module) { +var utils = require('cordova/utils'); + +function each(objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function include(parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + parent[key] = result; + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + parent[key] = result; + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + parent[key] = result; + } else if (merge && typeof obj.path !== 'undefined') { + // If merging, merge parent onto result + recursiveMerge(result, parent[key]); + parent[key] = result; + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge(target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + target.prototype[prop] = src[prop]; + } else { + target[prop] = typeof src[prop] === 'object' ? recursiveMerge( + target[prop], src[prop]) : src[prop]; + } + } + } + return target; +} + +module.exports = { + build: function (objects) { + return { + intoButDontClobber: function (target) { + include(target, objects, false, false); + }, + intoAndClobber: function(target) { + include(target, objects, true, false); + }, + intoAndMerge: function(target) { + include(target, objects, true, true); + } + }; + } +}; + +}); + +// file: lib/common/channel.js +define("cordova/channel", function(require, exports, module) { +var utils = require('cordova/utils'), + nextGuid = 1; + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded Internal event that is received when the web page is loaded and parsed. + * onNativeReady Internal event that indicates the Cordova native side is ready. + * onCordovaReady Internal event fired when all Cordova JavaScript objects have been created. + * onCordovaInfoReady Internal event fired when device properties are available. + * onCordovaConnectionReady Internal event fired when the connection property has been set. + * onDeviceReady User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * onDestroy Internal event fired when app is being destroyed (User should use window.onunload event, not this one). + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + * @param opts Object options to pass into the channel, currently + * supports: + * onSubscribe: callback that fires when + * something subscribes to the Channel. Sets + * context to the Channel. + * onUnsubscribe: callback that fires when + * something unsubscribes to the Channel. Sets + * context to the Channel. + */ +var Channel = function(type, opts) { + this.type = type; + this.handlers = {}; + this.numHandlers = 0; + this.fired = false; + this.enabled = true; + this.events = { + onSubscribe:null, + onUnsubscribe:null + }; + if (opts) { + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + } +}, + channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. + */ + join: function (h, c) { + var i = c.length; + var len = i; + var f = function() { + if (!(--i)) h(); + }; + for (var j=0; j} phoneNumbers array of phone numbers +* @param {Array.} emails array of email addresses +* @param {Array.} addresses array of addresses +* @param {Array.} ims instant messaging user ids +* @param {Array.} organizations +* @param {DOMString} birthday contact's birthday +* @param {DOMString} note user notes about contact +* @param {Array.} photos +* @param {Array.} categories +* @param {Array.} urls contact's web sites +*/ +var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses, + ims, organizations, birthday, note, photos, categories, urls) { + this.id = id || null; + this.rawId = null; + this.displayName = displayName || null; + this.name = name || null; // ContactName + this.nickname = nickname || null; + this.phoneNumbers = phoneNumbers || null; // ContactField[] + this.emails = emails || null; // ContactField[] + this.addresses = addresses || null; // ContactAddress[] + this.ims = ims || null; // ContactField[] + this.organizations = organizations || null; // ContactOrganization[] + this.birthday = birthday || null; + this.note = note || null; + this.photos = photos || null; // ContactField[] + this.categories = categories || null; // ContactField[] + this.urls = urls || null; // ContactField[] +}; + +/** +* Removes contact from device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.remove = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + if (this.id === null) { + fail(ContactError.UNKNOWN_ERROR); + } + else { + exec(successCB, fail, "Contacts", "remove", [this.id]); + } +}; + +/** +* Creates a deep copy of this Contact. +* With the contact ID set to null. +* @return copy of this Contact +*/ +Contact.prototype.clone = function() { + var clonedContact = utils.clone(this); + var i; + clonedContact.id = null; + clonedContact.rawId = null; + // Loop through and clear out any id's in phones, emails, etc. + if (clonedContact.phoneNumbers) { + for (i = 0; i < clonedContact.phoneNumbers.length; i++) { + clonedContact.phoneNumbers[i].id = null; + } + } + if (clonedContact.emails) { + for (i = 0; i < clonedContact.emails.length; i++) { + clonedContact.emails[i].id = null; + } + } + if (clonedContact.addresses) { + for (i = 0; i < clonedContact.addresses.length; i++) { + clonedContact.addresses[i].id = null; + } + } + if (clonedContact.ims) { + for (i = 0; i < clonedContact.ims.length; i++) { + clonedContact.ims[i].id = null; + } + } + if (clonedContact.organizations) { + for (i = 0; i < clonedContact.organizations.length; i++) { + clonedContact.organizations[i].id = null; + } + } + if (clonedContact.categories) { + for (i = 0; i < clonedContact.categories.length; i++) { + clonedContact.categories[i].id = null; + } + } + if (clonedContact.photos) { + for (i = 0; i < clonedContact.photos.length; i++) { + clonedContact.photos[i].id = null; + } + } + if (clonedContact.urls) { + for (i = 0; i < clonedContact.urls.length; i++) { + clonedContact.urls[i].id = null; + } + } + return clonedContact; +}; + +/** +* Persists contact to device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.save = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + var success = function(result) { + if (result) { + if (typeof successCB === 'function') { + var fullContact = require('cordova/plugin/contacts').create(result); + successCB(convertIn(fullContact)); + } + } + else { + // no Entry object returned + fail(ContactError.UNKNOWN_ERROR); + } + }; + var dupContact = convertOut(utils.clone(this)); + exec(success, fail, "Contacts", "save", [dupContact]); +}; + + +module.exports = Contact; + +}); + +// file: lib/common/plugin/ContactAddress.js +define("cordova/plugin/ContactAddress", function(require, exports, module) { +/** +* Contact address. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code +* @param formatted // NOTE: not a W3C standard +* @param streetAddress +* @param locality +* @param region +* @param postalCode +* @param country +*/ + +var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.formatted = formatted || null; + this.streetAddress = streetAddress || null; + this.locality = locality || null; + this.region = region || null; + this.postalCode = postalCode || null; + this.country = country || null; +}; + +module.exports = ContactAddress; +}); + +// file: lib/common/plugin/ContactError.js +define("cordova/plugin/ContactError", function(require, exports, module) { +/** + * ContactError. + * An error code assigned by an implementation when an error has occured + * @constructor + */ +var ContactError = function(err) { + this.code = (typeof err != 'undefined' ? err : null); +}; + +/** + * Error codes + */ +ContactError.UNKNOWN_ERROR = 0; +ContactError.INVALID_ARGUMENT_ERROR = 1; +ContactError.TIMEOUT_ERROR = 2; +ContactError.PENDING_OPERATION_ERROR = 3; +ContactError.IO_ERROR = 4; +ContactError.NOT_SUPPORTED_ERROR = 5; +ContactError.PERMISSION_DENIED_ERROR = 20; + +module.exports = ContactError; +}); + +// file: lib/common/plugin/ContactField.js +define("cordova/plugin/ContactField", function(require, exports, module) { +/** +* Generic contact field. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param type +* @param value +* @param pref +*/ +var ContactField = function(type, value, pref) { + this.id = null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; + this.pref = (typeof pref != 'undefined' ? pref : false); +}; + +module.exports = ContactField; +}); + +// file: lib/common/plugin/ContactFindOptions.js +define("cordova/plugin/ContactFindOptions", function(require, exports, module) { +/** + * ContactFindOptions. + * @constructor + * @param filter used to match contacts against + * @param multiple boolean used to determine if more than one contact should be returned + */ + +var ContactFindOptions = function(filter, multiple) { + this.filter = filter || ''; + this.multiple = (typeof multiple != 'undefined' ? multiple : false); +}; + +module.exports = ContactFindOptions; +}); + +// file: lib/common/plugin/ContactName.js +define("cordova/plugin/ContactName", function(require, exports, module) { +/** +* Contact name. +* @constructor +* @param formatted // NOTE: not part of W3C standard +* @param familyName +* @param givenName +* @param middle +* @param prefix +* @param suffix +*/ +var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) { + this.formatted = formatted || null; + this.familyName = familyName || null; + this.givenName = givenName || null; + this.middleName = middle || null; + this.honorificPrefix = prefix || null; + this.honorificSuffix = suffix || null; +}; + +module.exports = ContactName; +}); + +// file: lib/common/plugin/ContactOrganization.js +define("cordova/plugin/ContactOrganization", function(require, exports, module) { +/** +* Contact organization. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param name +* @param dept +* @param title +* @param startDate +* @param endDate +* @param location +* @param desc +*/ + +var ContactOrganization = function(pref, type, name, dept, title) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.name = name || null; + this.department = dept || null; + this.title = title || null; +}; + +module.exports = ContactOrganization; +}); + +// file: lib/common/plugin/Coordinates.js +define("cordova/plugin/Coordinates", function(require, exports, module) { +/** + * This class contains position information. + * @param {Object} lat + * @param {Object} lng + * @param {Object} alt + * @param {Object} acc + * @param {Object} head + * @param {Object} vel + * @param {Object} altacc + * @constructor + */ +var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { + /** + * The latitude of the position. + */ + this.latitude = lat; + /** + * The longitude of the position, + */ + this.longitude = lng; + /** + * The accuracy of the position. + */ + this.accuracy = acc; + /** + * The altitude of the position. + */ + this.altitude = (alt !== undefined ? alt : null); + /** + * The direction the device is moving at the position. + */ + this.heading = (head !== undefined ? head : null); + /** + * The velocity with which the device is moving at the position. + */ + this.speed = (vel !== undefined ? vel : null); + + if (this.speed === 0 || this.speed === null) { + this.heading = NaN; + } + + /** + * The altitude accuracy of the position. + */ + this.altitudeAccuracy = (altacc !== undefined) ? altacc : null; +}; + +module.exports = Coordinates; + +}); + +// file: lib/common/plugin/DirectoryEntry.js +define("cordova/plugin/DirectoryEntry", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + Entry = require('cordova/plugin/Entry'), + FileError = require('cordova/plugin/FileError'), + DirectoryReader = require('cordova/plugin/DirectoryReader'); + +/** + * An interface representing a directory on the file system. + * + * {boolean} isFile always false (readonly) + * {boolean} isDirectory always true (readonly) + * {DOMString} name of the directory, excluding the path leading to it (readonly) + * {DOMString} fullPath the absolute full path to the directory (readonly) + * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly) + */ +var DirectoryEntry = function(name, fullPath) { + DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]); +}; + +utils.extend(DirectoryEntry, Entry); + +/** + * Creates a new DirectoryReader to read entries from this directory + */ +DirectoryEntry.prototype.createReader = function() { + return new DirectoryReader(this.fullPath); +}; + +/** + * Creates or looks up a directory + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory + * @param {Flags} options to create or excluively create the directory + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var entry = new DirectoryEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getDirectory", [this.fullPath, path, options]); +}; + +/** + * Deletes a directory and all of it's contents + * + * @param {Function} successCallback is called with no parameters + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) { + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]); +}; + +/** + * Creates or looks up a file + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file + * @param {Flags} options to create or excluively create the file + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var FileEntry = require('cordova/plugin/FileEntry'); + var entry = new FileEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getFile", [this.fullPath, path, options]); +}; + +module.exports = DirectoryEntry; + +}); + +// file: lib/common/plugin/DirectoryReader.js +define("cordova/plugin/DirectoryReader", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError') ; + +/** + * An interface that lists the files and directories in a directory. + */ +function DirectoryReader(path) { + this.path = path || null; +} + +/** + * Returns a list of entries from a directory. + * + * @param {Function} successCallback is called with a list of entries + * @param {Function} errorCallback is called with a FileError + */ +DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var retVal = []; + for (var i=0; i][;base64], + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsDataURL = function(file) { + this.fileName = ""; + if (typeof file.fullPath === "undefined") { + this.fileName = file; + } else { + this.fileName = file.fullPath; + } + + // Already loading something + if (this.readyState == FileReader.LOADING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // LOADING state + this.readyState = FileReader.LOADING; + + // If loadstart callback + if (typeof this.onloadstart === "function") { + this.onloadstart(new ProgressEvent("loadstart", {target:this})); + } + + var me = this; + + // Read file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + // Save result + me.result = r; + + // If onload callback + if (typeof me.onload === "function") { + me.onload(new ProgressEvent("load", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + me.result = null; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, "File", "readAsDataURL", [this.fileName]); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsBinaryString = function(file) { + // TODO - Can't return binary data to browser. + console.log('method "readAsBinaryString" is not supported at this time.'); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsArrayBuffer = function(file) { + // TODO - Can't return binary data to browser. + console.log('This method is not supported at this time.'); +}; + +module.exports = FileReader; +}); + +// file: lib/common/plugin/FileSystem.js +define("cordova/plugin/FileSystem", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'); + +/** + * An interface representing a file system + * + * @constructor + * {DOMString} name the unique name of the file system (readonly) + * {DirectoryEntry} root directory of the file system (readonly) + */ +var FileSystem = function(name, root) { + this.name = name || null; + if (root) { + this.root = new DirectoryEntry(root.name, root.fullPath); + } +}; + +module.exports = FileSystem; + +}); + +// file: lib/common/plugin/FileTransfer.js +define("cordova/plugin/FileTransfer", function(require, exports, module) { +var exec = require('cordova/exec'), + FileTransferError = require('cordova/plugin/FileTransferError'); + +/** + * FileTransfer uploads a file to a remote server. + * @constructor + */ +var FileTransfer = function() {}; + +/** +* Given an absolute file path, uploads a file on the device to a remote server +* using a multipart HTTP request. +* @param filePath {String} Full path of the file on the device +* @param server {String} URL of the server to receive the file +* @param successCallback (Function} Callback to be invoked when upload has completed +* @param errorCallback {Function} Callback to be invoked upon error +* @param options {FileUploadOptions} Optional parameters such as file name and mimetype +* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false +*/ +FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) { + // sanity parameter checking + if (!filePath || !server) throw new Error("FileTransfer.upload requires filePath and server URL parameters at the minimum."); + // check for options + var fileKey = null; + var fileName = null; + var mimeType = null; + var params = null; + var chunkedMode = true; + var headers = null; + if (options) { + fileKey = options.fileKey; + fileName = options.fileName; + mimeType = options.mimeType; + headers = options.headers; + if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") { + chunkedMode = options.chunkedMode; + } + if (options.params) { + params = options.params; + } + else { + params = {}; + } + } + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(successCallback, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode, headers]); +}; + +/** + * Downloads a file form a given URL and saves it to the specified directory. + * @param source {String} URL of the server to receive the file + * @param target {String} Full path of the file on the device + * @param successCallback (Function} Callback to be invoked when upload has completed + * @param errorCallback {Function} Callback to be invoked upon error + */ +FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) { + // sanity parameter checking + if (!source || !target) throw new Error("FileTransfer.download requires source URI and target URI parameters at the minimum."); + var win = function(result) { + var entry = null; + if (result.isDirectory) { + entry = new (require('cordova/plugin/DirectoryEntry'))(); + } + else if (result.isFile) { + entry = new (require('cordova/plugin/FileEntry'))(); + } + entry.isDirectory = result.isDirectory; + entry.isFile = result.isFile; + entry.name = result.name; + entry.fullPath = result.fullPath; + successCallback(entry); + }; + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(win, errorCallback, 'FileTransfer', 'download', [source, target]); +}; + +module.exports = FileTransfer; + +}); + +// file: lib/common/plugin/FileTransferError.js +define("cordova/plugin/FileTransferError", function(require, exports, module) { +/** + * FileTransferError + * @constructor + */ +var FileTransferError = function(code, source, target, status) { + this.code = code || null; + this.source = source || null; + this.target = target || null; + this.http_status = status || null; +}; + +FileTransferError.FILE_NOT_FOUND_ERR = 1; +FileTransferError.INVALID_URL_ERR = 2; +FileTransferError.CONNECTION_ERR = 3; + +module.exports = FileTransferError; + +}); + +// file: lib/common/plugin/FileUploadOptions.js +define("cordova/plugin/FileUploadOptions", function(require, exports, module) { +/** + * Options to customize the HTTP request used to upload files. + * @constructor + * @param fileKey {String} Name of file request parameter. + * @param fileName {String} Filename to be used by the server. Defaults to image.jpg. + * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg. + * @param params {Object} Object with key: value params to send to the server. + * @param headers {Object} Keys are header names, values are header values. Multiple + * headers of the same name are not supported. + */ +var FileUploadOptions = function(fileKey, fileName, mimeType, params, headers) { + this.fileKey = fileKey || null; + this.fileName = fileName || null; + this.mimeType = mimeType || null; + this.params = params || null; + this.headers = headers || null; +}; + +module.exports = FileUploadOptions; + +}); + +// file: lib/common/plugin/FileUploadResult.js +define("cordova/plugin/FileUploadResult", function(require, exports, module) { +/** + * FileUploadResult + * @constructor + */ +var FileUploadResult = function() { + this.bytesSent = 0; + this.responseCode = null; + this.response = null; +}; + +module.exports = FileUploadResult; +}); + +// file: lib/common/plugin/FileWriter.js +define("cordova/plugin/FileWriter", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError'), + ProgressEvent = require('cordova/plugin/ProgressEvent'); + +/** + * This class writes to the mobile device file system. + * + * For Android: + * The root directory is the root of the file system. + * To write to the SD card, the file name is "sdcard/my_file.txt" + * + * @constructor + * @param file {File} File object containing file properties + * @param append if true write to the end of the file, otherwise overwrite the file + */ +var FileWriter = function(file) { + this.fileName = ""; + this.length = 0; + if (file) { + this.fileName = file.fullPath || file; + this.length = file.size || 0; + } + // default is to write at the beginning of the file + this.position = 0; + + this.readyState = 0; // EMPTY + + this.result = null; + + // Error + this.error = null; + + // Event handlers + this.onwritestart = null; // When writing starts + this.onprogress = null; // While writing the file, and reporting partial file data + this.onwrite = null; // When the write has successfully completed. + this.onwriteend = null; // When the request has completed (either in success or failure). + this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method. + this.onerror = null; // When the write has failed (see errors). +}; + +// States +FileWriter.INIT = 0; +FileWriter.WRITING = 1; +FileWriter.DONE = 2; + +/** + * Abort writing file. + */ +FileWriter.prototype.abort = function() { + // check for invalid state + if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // set error + this.error = new FileError(FileError.ABORT_ERR); + + this.readyState = FileWriter.DONE; + + // If abort callback + if (typeof this.onabort === "function") { + this.onabort(new ProgressEvent("abort", {"target":this})); + } + + // If write end callback + if (typeof this.onwriteend === "function") { + this.onwriteend(new ProgressEvent("writeend", {"target":this})); + } +}; + +/** + * Writes data to the file + * + * @param text to be written + */ +FileWriter.prototype.write = function(text) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":me})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // position always increases by bytes written because file would be extended + me.position += r; + // The length of the file is now where we are done writing. + + me.length = me.position; + + // DONE state + me.readyState = FileWriter.DONE; + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "write", [this.fileName, text, this.position]); +}; + +/** + * Moves the file pointer to the location specified. + * + * If the offset is a negative number the position of the file + * pointer is rewound. If the offset is greater than the file + * size the position is set to the end of the file. + * + * @param offset is the location to move the file pointer to. + */ +FileWriter.prototype.seek = function(offset) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + if (!offset && offset !== 0) { + return; + } + + // See back from end of file. + if (offset < 0) { + this.position = Math.max(offset + this.length, 0); + } + // Offset is bigger than file size so set position + // to the end of the file. + else if (offset > this.length) { + this.position = this.length; + } + // Offset is between 0 and file size so set the position + // to start writing. + else { + this.position = offset; + } +}; + +/** + * Truncates the file to the size specified. + * + * @param size to chop the file at. + */ +FileWriter.prototype.truncate = function(size) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":this})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Update the length of the file + me.length = r; + me.position = Math.min(me.position, r); + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "truncate", [this.fileName, size]); +}; + +module.exports = FileWriter; + +}); + +// file: lib/common/plugin/Flags.js +define("cordova/plugin/Flags", function(require, exports, module) { +/** + * Supplies arguments to methods that lookup or create files and directories. + * + * @param create + * {boolean} file or directory if it doesn't exist + * @param exclusive + * {boolean} used with create; if true the command will fail if + * target path exists + */ +function Flags(create, exclusive) { + this.create = create || false; + this.exclusive = exclusive || false; +} + +module.exports = Flags; +}); + +// file: lib/common/plugin/LocalFileSystem.js +define("cordova/plugin/LocalFileSystem", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Represents a local file system. + */ +var LocalFileSystem = function() { + +}; + +LocalFileSystem.TEMPORARY = 0; //temporary, with no guarantee of persistence +LocalFileSystem.PERSISTENT = 1; //persistent + +module.exports = LocalFileSystem; +}); + +// file: lib/common/plugin/Media.js +define("cordova/plugin/Media", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'); + +var mediaObjects = {}; + +/** + * This class provides access to the device media, interfaces to both sound and video + * + * @constructor + * @param src The file name or url to play + * @param successCallback The callback to be called when the file is done playing or recording. + * successCallback() + * @param errorCallback The callback to be called if there is an error. + * errorCallback(int errorCode) - OPTIONAL + * @param statusCallback The callback to be called when media status has changed. + * statusCallback(int statusCode) - OPTIONAL + */ +var Media = function(src, successCallback, errorCallback, statusCallback) { + + // successCallback optional + if (successCallback && (typeof successCallback !== "function")) { + console.log("Media Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Media Error: errorCallback is not a function"); + return; + } + + // statusCallback optional + if (statusCallback && (typeof statusCallback !== "function")) { + console.log("Media Error: statusCallback is not a function"); + return; + } + + this.id = utils.createUUID(); + mediaObjects[this.id] = this; + this.src = src; + this.successCallback = successCallback; + this.errorCallback = errorCallback; + this.statusCallback = statusCallback; + this._duration = -1; + this._position = -1; + exec(null, this.errorCallback, "Media", "create", [this.id, this.src]); +}; + +// Media messages +Media.MEDIA_STATE = 1; +Media.MEDIA_DURATION = 2; +Media.MEDIA_POSITION = 3; +Media.MEDIA_ERROR = 9; + +// Media states +Media.MEDIA_NONE = 0; +Media.MEDIA_STARTING = 1; +Media.MEDIA_RUNNING = 2; +Media.MEDIA_PAUSED = 3; +Media.MEDIA_STOPPED = 4; +Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"]; + +// "static" function to return existing objs. +Media.get = function(id) { + return mediaObjects[id]; +}; + +/** + * Start or resume playing audio file. + */ +Media.prototype.play = function(options) { + exec(null, null, "Media", "startPlayingAudio", [this.id, this.src, options]); +}; + +/** + * Stop playing audio file. + */ +Media.prototype.stop = function() { + var me = this; + exec(function() { + me._position = 0; + }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]); +}; + +/** + * Seek or jump to a new time in the track.. + */ +Media.prototype.seekTo = function(milliseconds) { + var me = this; + exec(function(p) { + me._position = p; + }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]); +}; + +/** + * Pause playing audio file. + */ +Media.prototype.pause = function() { + exec(null, this.errorCallback, "Media", "pausePlayingAudio", [this.id]); +}; + +/** + * Get duration of an audio file. + * The duration is only set for audio that is playing, paused or stopped. + * + * @return duration or -1 if not known. + */ +Media.prototype.getDuration = function() { + return this._duration; +}; + +/** + * Get position of audio. + */ +Media.prototype.getCurrentPosition = function(success, fail) { + var me = this; + exec(function(p) { + me._position = p; + success(p); + }, fail, "Media", "getCurrentPositionAudio", [this.id]); +}; + +/** + * Start recording audio file. + */ +Media.prototype.startRecord = function() { + exec(null, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]); +}; + +/** + * Stop recording audio file. + */ +Media.prototype.stopRecord = function() { + exec(null, this.errorCallback, "Media", "stopRecordingAudio", [this.id]); +}; + +/** + * Release the resources. + */ +Media.prototype.release = function() { + exec(null, this.errorCallback, "Media", "release", [this.id]); +}; + +/** + * Adjust the volume. + */ +Media.prototype.setVolume = function(volume) { + exec(null, null, "Media", "setVolume", [this.id, volume]); +}; + +/** + * Audio has status update. + * PRIVATE + * + * @param id The media object id (string) + * @param msgType The 'type' of update this is + * @param value Use of value is determined by the msgType + */ +Media.onStatus = function(id, msgType, value) { + + var media = mediaObjects[id]; + + if(media) { + switch(msgType) { + case Media.MEDIA_STATE : + media.statusCallback && media.statusCallback(value); + if(value == Media.MEDIA_STOPPED) { + media.successCallback && media.successCallback(); + } + break; + case Media.MEDIA_DURATION : + media._duration = value; + break; + case Media.MEDIA_ERROR : + media.errorCallback && media.errorCallback(value); + break; + case Media.MEDIA_POSITION : + media._position = Number(value); + break; + default : + console && console.error && console.error("Unhandled Media.onStatus :: " + msgType); + break; + } + } + else { + console && console.error && console.error("Received Media.onStatus callback for unknown media :: " + id); + } + +}; + +module.exports = Media; +}); + +// file: lib/common/plugin/MediaError.js +define("cordova/plugin/MediaError", function(require, exports, module) { +/** + * This class contains information about any Media errors. +*/ +/* + According to :: http://dev.w3.org/html5/spec-author-view/video.html#mediaerror + We should never be creating these objects, we should just implement the interface + which has 1 property for an instance, 'code' + + instead of doing : + errorCallbackFunction( new MediaError(3,'msg') ); +we should simply use a literal : + errorCallbackFunction( {'code':3} ); + */ + +if(!MediaError) { + var MediaError = function(code, msg) { + this.code = (typeof code != 'undefined') ? code : null; + this.message = msg || ""; // message is NON-standard! do not use! + }; +} + +MediaError.MEDIA_ERR_NONE_ACTIVE = MediaError.MEDIA_ERR_NONE_ACTIVE || 0; +MediaError.MEDIA_ERR_ABORTED = MediaError.MEDIA_ERR_ABORTED || 1; +MediaError.MEDIA_ERR_NETWORK = MediaError.MEDIA_ERR_NETWORK || 2; +MediaError.MEDIA_ERR_DECODE = MediaError.MEDIA_ERR_DECODE || 3; +MediaError.MEDIA_ERR_NONE_SUPPORTED = MediaError.MEDIA_ERR_NONE_SUPPORTED || 4; +// TODO: MediaError.MEDIA_ERR_NONE_SUPPORTED is legacy, the W3 spec now defines it as below. +// as defined by http://dev.w3.org/html5/spec-author-view/video.html#error-codes +MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED = MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED || 4; + +module.exports = MediaError; + +}); + +// file: lib/common/plugin/MediaFile.js +define("cordova/plugin/MediaFile", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + File = require('cordova/plugin/File'), + CaptureError = require('cordova/plugin/CaptureError'); +/** + * Represents a single file. + * + * name {DOMString} name of the file, without path information + * fullPath {DOMString} the full path of the file, including the name + * type {DOMString} mime type + * lastModifiedDate {Date} last modified date + * size {Number} size of the file in bytes + */ +var MediaFile = function(name, fullPath, type, lastModifiedDate, size){ + MediaFile.__super__.constructor.apply(this, arguments); +}; + +utils.extend(MediaFile, File); + +/** + * Request capture format data for a specific file and type + * + * @param {Function} successCB + * @param {Function} errorCB + */ +MediaFile.prototype.getFormatData = function(successCallback, errorCallback) { + if (typeof this.fullPath === "undefined" || this.fullPath === null) { + errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)); + } else { + exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); + } +}; + +module.exports = MediaFile; + +}); + +// file: lib/common/plugin/MediaFileData.js +define("cordova/plugin/MediaFileData", function(require, exports, module) { +/** + * MediaFileData encapsulates format information of a media file. + * + * @param {DOMString} codecs + * @param {long} bitrate + * @param {long} height + * @param {long} width + * @param {float} duration + */ +var MediaFileData = function(codecs, bitrate, height, width, duration){ + this.codecs = codecs || null; + this.bitrate = bitrate || 0; + this.height = height || 0; + this.width = width || 0; + this.duration = duration || 0; +}; + +module.exports = MediaFileData; +}); + +// file: lib/common/plugin/Metadata.js +define("cordova/plugin/Metadata", function(require, exports, module) { +/** + * Information about the state of the file or directory + * + * {Date} modificationTime (readonly) + */ +var Metadata = function(time) { + this.modificationTime = (typeof time != 'undefined'?new Date(time):null); +}; + +module.exports = Metadata; +}); + +// file: lib/common/plugin/Position.js +define("cordova/plugin/Position", function(require, exports, module) { +var Coordinates = require('cordova/plugin/Coordinates'); + +var Position = function(coords, timestamp) { + if (coords) { + this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); + } else { + this.coords = new Coordinates(); + } + this.timestamp = (timestamp !== undefined) ? timestamp : new Date(); +}; + +module.exports = Position; + +}); + +// file: lib/common/plugin/PositionError.js +define("cordova/plugin/PositionError", function(require, exports, module) { +/** + * Position error object + * + * @constructor + * @param code + * @param message + */ +var PositionError = function(code, message) { + this.code = code || null; + this.message = message || ''; +}; + +PositionError.PERMISSION_DENIED = 1; +PositionError.POSITION_UNAVAILABLE = 2; +PositionError.TIMEOUT = 3; + +module.exports = PositionError; +}); + +// file: lib/common/plugin/ProgressEvent.js +define("cordova/plugin/ProgressEvent", function(require, exports, module) { +// If ProgressEvent exists in global context, use it already, otherwise use our own polyfill +// Feature test: See if we can instantiate a native ProgressEvent; +// if so, use that approach, +// otherwise fill-in with our own implementation. +// +// NOTE: right now we always fill in with our own. Down the road would be nice if we can use whatever is native in the webview. +var ProgressEvent = (function() { + /* + var createEvent = function(data) { + var event = document.createEvent('Events'); + event.initEvent('ProgressEvent', false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + if (data.target) { + // TODO: cannot call .dispatchEvent + // need to first figure out how to implement EventTarget + } + } + return event; + }; + try { + var ev = createEvent({type:"abort",target:document}); + return function ProgressEvent(type, data) { + data.type = type; + return createEvent(data); + }; + } catch(e){ + */ + return function ProgressEvent(type, dict) { + this.type = type; + this.bubbles = false; + this.cancelBubble = false; + this.cancelable = false; + this.lengthComputable = false; + this.loaded = dict && dict.loaded ? dict.loaded : 0; + this.total = dict && dict.total ? dict.total : 0; + this.target = dict && dict.target ? dict.target : null; + }; + //} +})(); + +module.exports = ProgressEvent; +}); + +// file: lib/common/plugin/accelerometer.js +define("cordova/plugin/accelerometer", function(require, exports, module) { +/** + * This class provides access to device accelerometer data. + * @constructor + */ +var utils = require("cordova/utils"), + exec = require("cordova/exec"), + Acceleration = require('cordova/plugin/Acceleration'); + +// Is the accel sensor running? +var running = false; + +// Keeps reference to watchAcceleration calls. +var timers = {}; + +// Array of listeners; used to keep track of when we should call start and stop. +var listeners = []; + +// Last returned acceleration object from native +var accel = null; + +// Tells native to start. +function start() { + exec(function(a) { + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } + }, function(e) { + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } + }, "Accelerometer", "start", []); + running = true; +} + +// Tells native to stop. +function stop() { + exec(null, null, "Accelerometer", "stop", []); + running = false; +} + +// Adds a callback pair to the listeners array +function createCallbackPair(win, fail) { + return {win:win, fail:fail}; +} + +// Removes a win/fail listener pair from the listeners array +function removeListeners(l) { + var idx = listeners.indexOf(l); + if (idx > -1) { + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } + } +} + +var accelerometer = { + /** + * Asynchronously aquires the current acceleration. + * + * @param {Function} successCallback The function to call when the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + */ + getCurrentAcceleration: function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; + } + + var p; + var win = function(a) { + removeListeners(p); + successCallback(a); + }; + var fail = function(e) { + removeListeners(p); + errorCallback(e); + }; + + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } + }, + + /** + * Asynchronously aquires the acceleration repeatedly at a given interval. + * + * @param {Function} successCallback The function to call each time the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchAcceleration: function(successCallback, errorCallback, options) { + // Default interval (10 sec) + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; + + // successCallback required + if (typeof successCallback !== "function") { + throw "watchAcceleration must be called with at least a success callback function as first parameter."; + } + + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); + + var p = createCallbackPair(function(){}, function(e) { + removeListeners(p); + errorCallback(e); + }); + listeners.push(p); + + timers[id] = { + timer:window.setInterval(function() { + if (accel) { + successCallback(accel); + } + }, frequency), + listeners:p + }; + + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retrieved a value, sample code does not check for null ... + if(accel) { + successCallback(accel); + } + } else { + start(); + } + + return id; + }, + + /** + * Clears the specified accelerometer watch. + * + * @param {String} id The id of the watch returned from #watchAcceleration. + */ + clearWatch: function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); + delete timers[id]; + } + } +}; + +module.exports = accelerometer; + +}); + +// file: lib/android/plugin/android/app.js +define("cordova/plugin/android/app", function(require, exports, module) { +var exec = require('cordova/exec'); + +module.exports = { + /** + * Clear the resource cache. + */ + clearCache:function() { + exec(null, null, "App", "clearCache", []); + }, + + /** + * Load the url into the webview or into new browser instance. + * + * @param url The URL to load + * @param props Properties that can be passed in to the activity: + * wait: int => wait msec before loading URL + * loadingDialog: "Title,Message" => display a native loading dialog + * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error + * clearHistory: boolean => clear webview history (default=false) + * openExternal: boolean => open in a new browser (default=false) + * + * Example: + * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); + */ + loadUrl:function(url, props) { + exec(null, null, "App", "loadUrl", [url, props]); + }, + + /** + * Cancel loadUrl that is waiting to be loaded. + */ + cancelLoadUrl:function() { + exec(null, null, "App", "cancelLoadUrl", []); + }, + + /** + * Clear web history in this web view. + * Instead of BACK button loading the previous web page, it will exit the app. + */ + clearHistory:function() { + exec(null, null, "App", "clearHistory", []); + }, + + /** + * Go to previous page displayed. + * This is the same as pressing the backbutton on Android device. + */ + backHistory:function() { + exec(null, null, "App", "backHistory", []); + }, + + /** + * Override the default behavior of the Android back button. + * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "backbutton" event, this is automatically done. + * + * @param override T=override, F=cancel override + */ + overrideBackbutton:function(override) { + exec(null, null, "App", "overrideBackbutton", [override]); + }, + + /** + * Exit and terminate the application. + */ + exitApp:function() { + return exec(null, null, "App", "exitApp", []); + } +}; +}); + +// file: lib/android/plugin/android/callback.js +define("cordova/plugin/android/callback", function(require, exports, module) { +var port = null, + token = null, + xmlhttp; + +function startXhr() { + // cordova/exec depends on this module, so we can't require cordova/exec on the module level. + var exec = require('cordova/exec'), + xmlhttp = new XMLHttpRequest(); + + // Callback function when XMLHttpRequest is ready + xmlhttp.onreadystatechange=function(){ + if (!xmlhttp) { + return; + } + if (xmlhttp.readyState === 4){ + // If callback has JavaScript statement to execute + if (xmlhttp.status === 200) { + + // Need to url decode the response + var msg = decodeURIComponent(xmlhttp.responseText); + setTimeout(function() { + try { + var t = eval(msg); + } + catch (e) { + // If we're getting an error here, seeing the message will help in debugging + console.log("JSCallback: Message from Server: " + msg); + console.log("JSCallback Error: "+e); + } + }, 1); + setTimeout(startXhr, 1); + } + + // If callback ping (used to keep XHR request from timing out) + else if (xmlhttp.status === 404) { + setTimeout(startXhr, 10); + } + + // 0 == Page is unloading. + // 400 == Bad request. + // 403 == invalid token. + // 503 == server stopped. + else { + console.log("JSCallback Error: Request failed with status " + xmlhttp.status); + exec.setNativeToJsBridgeMode(exec.nativeToJsModes.POLLING); + } + } + }; + + if (port === null) { + port = prompt("getPort", "gap_callbackServer:"); + } + if (token === null) { + token = prompt("getToken", "gap_callbackServer:"); + } + xmlhttp.open("GET", "http://127.0.0.1:"+port+"/"+token , true); + xmlhttp.send(); +} + +module.exports = { + start: function() { + startXhr(); + }, + + stop: function() { + if (xmlhttp) { + var tmp = xmlhttp; + xmlhttp = null; + tmp.abort(); + } + }, + + isAvailable: function() { + return ("true" != prompt("usePolling", "gap_callbackServer:")); + } +}; + + +}); + +// file: lib/android/plugin/android/device.js +define("cordova/plugin/android/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + app = require('cordova/plugin/android/app'); + +module.exports = { + /* + * DEPRECATED + * This is only for Android. + * + * You must explicitly override the back button. + */ + overrideBackButton:function() { + console.log("Device.overrideBackButton() is deprecated. Use App.overrideBackbutton(true)."); + app.overrideBackbutton(true); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This resets the back button to the default behaviour + */ + resetBackButton:function() { + console.log("Device.resetBackButton() is deprecated. Use App.overrideBackbutton(false)."); + app.overrideBackbutton(false); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This terminates the activity! + */ + exitApp:function() { + console.log("Device.exitApp() is deprecated. Use App.exitApp()."); + app.exitApp(); + } +}; + +}); + +// file: lib/android/plugin/android/notification.js +define("cordova/plugin/android/notification", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Provides Android enhanced notification API. + */ +module.exports = { + activityStart : function(title, message) { + // If title and message not specified then mimic Android behavior of + // using default strings. + if (typeof title === "undefined" && typeof message == "undefined") { + title = "Busy"; + message = 'Please wait...'; + } + + exec(null, null, 'Notification', 'activityStart', [ title, message ]); + }, + + /** + * Close an activity dialog + */ + activityStop : function() { + exec(null, null, 'Notification', 'activityStop', []); + }, + + /** + * Display a progress dialog with progress bar that goes from 0 to 100. + * + * @param {String} + * title Title of the progress dialog. + * @param {String} + * message Message to display in the dialog. + */ + progressStart : function(title, message) { + exec(null, null, 'Notification', 'progressStart', [ title, message ]); + }, + + /** + * Close the progress dialog. + */ + progressStop : function() { + exec(null, null, 'Notification', 'progressStop', []); + }, + + /** + * Set the progress dialog value. + * + * @param {Number} + * value 0-100 + */ + progressValue : function(value) { + exec(null, null, 'Notification', 'progressValue', [ value ]); + } +}; +}); + +// file: lib/android/plugin/android/polling.js +define("cordova/plugin/android/polling", function(require, exports, module) { +var cordova = require('cordova'), + POLL_INTERVAL = 50, + enabled = false; + +function pollOnce() { + var msg = prompt("", "gap_poll:"); + if (msg) { + try { + eval(""+msg); + } + catch (e) { + console.log("JSCallbackPolling: Message from Server: " + msg); + console.log("JSCallbackPolling Error: "+e); + } + return true; + } + return false; +} + +function doPoll() { + if (!enabled) { + return; + } + var nextDelay = POLL_INTERVAL; + if (pollOnce()) { + nextDelay = 0; + } + setTimeout(doPoll, nextDelay); +} + +module.exports = { + start: function() { + enabled = true; + setTimeout(doPoll, 1); + }, + stop: function() { + enabled = false; + }, + pollOnce: pollOnce +}; + + +}); + +// file: lib/android/plugin/android/storage.js +define("cordova/plugin/android/storage", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + channel = require('cordova/channel'); + +var queryQueue = {}; + +/** + * SQL result set object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Rows = function() { + this.resultSet = []; // results array + this.length = 0; // number of rows +}; + +/** + * Get item from SQL result set + * + * @param row The row number to return + * @return The row object + */ +DroidDB_Rows.prototype.item = function(row) { + return this.resultSet[row]; +}; + +/** + * SQL result set that is returned to user. + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Result = function() { + this.rows = new DroidDB_Rows(); +}; + +/** + * Callback from native code when query is complete. + * PRIVATE METHOD + * + * @param id Query id + */ +function completeQuery(id, data) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + + // Save query results + var r = new DroidDB_Result(); + r.rows.resultSet = data; + r.rows.length = data.length; + try { + if (typeof query.successCallback === 'function') { + query.successCallback(query.tx, r); + } + } catch (ex) { + console.log("executeSql error calling user success callback: "+ex); + } + + tx.queryComplete(id); + } + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * Callback from native code when query fails + * PRIVATE METHOD + * + * @param reason Error message + * @param id Query id + */ +function failQuery(reason, id) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + tx.queryList = {}; + + try { + if (typeof query.errorCallback === 'function') { + query.errorCallback(query.tx, reason); + } + } catch (ex) { + console.log("executeSql error calling user error callback: "+ex); + } + + tx.queryFailed(id, reason); + } + + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * SQL query object + * PRIVATE METHOD + * + * @constructor + * @param tx The transaction object that this query belongs to + */ +var DroidDB_Query = function(tx) { + + // Set the id of the query + this.id = utils.createUUID(); + + // Add this query to the queue + queryQueue[this.id] = this; + + // Init result + this.resultSet = []; + + // Set transaction that this query belongs to + this.tx = tx; + + // Add this query to transaction list + this.tx.queryList[this.id] = this; + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + +}; + +/** + * Transaction object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Tx = function() { + + // Set the id of the transaction + this.id = utils.createUUID(); + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + + // Query list + this.queryList = {}; +}; + +/** + * Mark query in transaction as complete. + * If all queries are complete, call the user's transaction success callback. + * + * @param id Query id + */ +DroidDB_Tx.prototype.queryComplete = function(id) { + delete this.queryList[id]; + + // If no more outstanding queries, then fire transaction success + if (this.successCallback) { + var count = 0; + var i; + for (i in this.queryList) { + if (this.queryList.hasOwnProperty(i)) { + count++; + } + } + if (count === 0) { + try { + this.successCallback(); + } catch(e) { + console.log("Transaction error calling user success callback: " + e); + } + } + } +}; + +/** + * Mark query in transaction as failed. + * + * @param id Query id + * @param reason Error message + */ +DroidDB_Tx.prototype.queryFailed = function(id, reason) { + + // The sql queries in this transaction have already been run, since + // we really don't have a real transaction implemented in native code. + // However, the user callbacks for the remaining sql queries in transaction + // will not be called. + this.queryList = {}; + + if (this.errorCallback) { + try { + this.errorCallback(reason); + } catch(e) { + console.log("Transaction error calling user error callback: " + e); + } + } +}; + +/** + * Execute SQL statement + * + * @param sql SQL statement to execute + * @param params Statement parameters + * @param successCallback Success callback + * @param errorCallback Error callback + */ +DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) { + + // Init params array + if (typeof params === 'undefined') { + params = []; + } + + // Create query and add to queue + var query = new DroidDB_Query(this); + queryQueue[query.id] = query; + + // Save callbacks + query.successCallback = successCallback; + query.errorCallback = errorCallback; + + // Call native code + exec(null, null, "Storage", "executeSql", [sql, params, query.id]); +}; + +var DatabaseShell = function() { +}; + +/** + * Start a transaction. + * Does not support rollback in event of failure. + * + * @param process {Function} The transaction function + * @param successCallback {Function} + * @param errorCallback {Function} + */ +DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) { + var tx = new DroidDB_Tx(); + tx.successCallback = successCallback; + tx.errorCallback = errorCallback; + try { + process(tx); + } catch (e) { + console.log("Transaction error: "+e); + if (tx.errorCallback) { + try { + tx.errorCallback(e); + } catch (ex) { + console.log("Transaction error calling user error callback: "+e); + } + } + } +}; + +/** + * Open database + * + * @param name Database name + * @param version Database version + * @param display_name Database display name + * @param size Database size in bytes + * @return Database object + */ +var DroidDB_openDatabase = function(name, version, display_name, size) { + exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]); + var db = new DatabaseShell(); + return db; +}; + +/** + * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api. + * TODO: Do similar for sessionStorage. + * @constructor + */ +var CupcakeLocalStorage = function() { + channel.waitForInitialization("cupcakeStorage"); + + try { + + this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440); + var storage = {}; + this.length = 0; + function setLength (length) { + this.length = length; + localStorage.length = length; + } + this.db.transaction( + function (transaction) { + var i; + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('SELECT * FROM storage', [], function(tx, result) { + for(var i = 0; i < result.rows.length; i++) { + storage[result.rows.item(i).id] = result.rows.item(i).body; + } + setLength(result.rows.length); + channel.initializationComplete("cupcakeStorage"); + }); + + }, + function (err) { + utils.alert(err.message); + } + ); + this.setItem = function(key, val) { + if (typeof(storage[key])=='undefined') { + this.length++; + } + storage[key] = val; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]); + } + ); + }; + this.getItem = function(key) { + return storage[key]; + }; + this.removeItem = function(key) { + delete storage[key]; + this.length--; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage where id=?', [key]); + } + ); + }; + this.clear = function() { + storage = {}; + this.length = 0; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage', []); + } + ); + }; + this.key = function(index) { + var i = 0; + for (var j in storage) { + if (i==index) { + return j; + } else { + i++; + } + } + return null; + }; + + } catch(e) { + utils.alert("Database error "+e+"."); + return; + } +}; + +module.exports = { + openDatabase:DroidDB_openDatabase, + CupcakeLocalStorage:CupcakeLocalStorage, + failQuery:failQuery, + completeQuery:completeQuery +}; + +}); + +// file: lib/common/plugin/battery.js +define("cordova/plugin/battery", function(require, exports, module) { +/** + * This class contains information about the current battery status. + * @constructor + */ +var cordova = require('cordova'), + exec = require('cordova/exec'); + +function handlers() { + return battery.channels.batterystatus.numHandlers + + battery.channels.batterylow.numHandlers + + battery.channels.batterycritical.numHandlers; +} + +var Battery = function() { + this._level = null; + this._isPlugged = null; + // Create new event handlers on the window (returns a channel instance) + var subscriptionEvents = { + onSubscribe:this.onSubscribe, + onUnsubscribe:this.onUnsubscribe + }; + this.channels = { + batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents), + batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents), + batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents) + }; +}; +/** + * Event handlers for when callbacks get registered for the battery. + * Keep track of how many handlers we have so we can start and stop the native battery listener + * appropriately (and hopefully save on battery life!). + */ +Battery.prototype.onSubscribe = function() { + var me = battery; + // If we just registered the first handler, make sure native listener is started. + if (handlers() === 1) { + exec(me._status, me._error, "Battery", "start", []); + } +}; + +Battery.prototype.onUnsubscribe = function() { + var me = battery; + + // If we just unregistered the last handler, make sure native listener is stopped. + if (handlers() === 0) { + exec(null, null, "Battery", "stop", []); + } +}; + +/** + * Callback for battery status + * + * @param {Object} info keys: level, isPlugged + */ +Battery.prototype._status = function(info) { + if (info) { + var me = battery; + var level = info.level; + if (me._level !== level || me._isPlugged !== info.isPlugged) { + // Fire batterystatus event + cordova.fireWindowEvent("batterystatus", info); + + // Fire low battery event + if (level === 20 || level === 5) { + if (level === 20) { + cordova.fireWindowEvent("batterylow", info); + } + else { + cordova.fireWindowEvent("batterycritical", info); + } + } + } + me._level = level; + me._isPlugged = info.isPlugged; + } +}; + +/** + * Error callback for battery start + */ +Battery.prototype._error = function(e) { + console.log("Error initializing Battery: " + e); +}; + +var battery = new Battery(); + +module.exports = battery; +}); + +// file: lib/common/plugin/capture.js +define("cordova/plugin/capture", function(require, exports, module) { +var exec = require('cordova/exec'), + MediaFile = require('cordova/plugin/MediaFile'); + +/** + * Launches a capture of different types. + * + * @param (DOMString} type + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +function _capture(type, successCallback, errorCallback, options) { + var win = function(pluginResult) { + var mediaFiles = []; + var i; + for (i = 0; i < pluginResult.length; i++) { + var mediaFile = new MediaFile(); + mediaFile.name = pluginResult[i].name; + mediaFile.fullPath = pluginResult[i].fullPath; + mediaFile.type = pluginResult[i].type; + mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate; + mediaFile.size = pluginResult[i].size; + mediaFiles.push(mediaFile); + } + successCallback(mediaFiles); + }; + exec(win, errorCallback, "Capture", type, [options]); +} +/** + * The Capture interface exposes an interface to the camera and microphone of the hosting device. + */ +function Capture() { + this.supportedAudioModes = []; + this.supportedImageModes = []; + this.supportedVideoModes = []; +} + +/** + * Launch audio recorder application for recording audio clip(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureAudioOptions} options + */ +Capture.prototype.captureAudio = function(successCallback, errorCallback, options){ + _capture("captureAudio", successCallback, errorCallback, options); +}; + +/** + * Launch camera application for taking image(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureImageOptions} options + */ +Capture.prototype.captureImage = function(successCallback, errorCallback, options){ + _capture("captureImage", successCallback, errorCallback, options); +}; + +/** + * Launch device camera application for recording video(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +Capture.prototype.captureVideo = function(successCallback, errorCallback, options){ + _capture("captureVideo", successCallback, errorCallback, options); +}; + + +module.exports = new Capture(); + +}); + +// file: lib/common/plugin/compass.js +define("cordova/plugin/compass", function(require, exports, module) { +var exec = require('cordova/exec'), + utils = require('cordova/utils'), + CompassHeading = require('cordova/plugin/CompassHeading'), + CompassError = require('cordova/plugin/CompassError'), + timers = {}, + compass = { + /** + * Asynchronously acquires the current heading. + * @param {Function} successCallback The function to call when the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {CompassOptions} options The options for getting the heading data (not used). + */ + getCurrentHeading:function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var win = function(result) { + var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); + successCallback(ch); + }; + var fail = function(code) { + var ce = new CompassError(code); + errorCallback(ce); + }; + + // Get heading + exec(win, fail, "Compass", "getHeading", [options]); + }, + + /** + * Asynchronously acquires the heading repeatedly at a given interval. + * @param {Function} successCallback The function to call each time the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {HeadingOptions} options The options for getting the heading data + * such as timeout and the frequency of the watch. For iOS, filter parameter + * specifies to watch via a distance filter rather than time. + */ + watchHeading:function(successCallback, errorCallback, options) { + // Default interval (100 msec) + var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; + var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var id = utils.createUUID(); + if (filter > 0) { + // is an iOS request for watch by filter, no timer needed + timers[id] = "iOS"; + compass.getCurrentHeading(successCallback, errorCallback, options); + } else { + // Start watch timer to get headings + timers[id] = window.setInterval(function() { + compass.getCurrentHeading(successCallback, errorCallback); + }, frequency); + } + + return id; + }, + + /** + * Clears the specified heading watch. + * @param {String} watchId The ID of the watch returned from #watchHeading. + */ + clearWatch:function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + if (timers[id] != "iOS") { + clearInterval(timers[id]); + } else { + // is iOS watch by filter so call into device to stop + exec(null, null, "Compass", "stopHeading", []); + } + delete timers[id]; + } + } + }; + +module.exports = compass; +}); + +// file: lib/common/plugin/console-via-logger.js +define("cordova/plugin/console-via-logger", function(require, exports, module) { +//------------------------------------------------------------------------------ + +var logger = require("cordova/plugin/logger"); +var utils = require("cordova/utils"); + +//------------------------------------------------------------------------------ +// object that we're exporting +//------------------------------------------------------------------------------ +var console = module.exports; + +//------------------------------------------------------------------------------ +// copy of the original console object +//------------------------------------------------------------------------------ +var WinConsole = window.console; + +//------------------------------------------------------------------------------ +// whether to use the logger +//------------------------------------------------------------------------------ +var UseLogger = false; + +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ +var Timers = {}; + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +function noop() {} + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +console.useLogger = function (value) { + if (arguments.length) UseLogger = !!value; + + if (UseLogger) { + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } + } + + return UseLogger; +}; + +//------------------------------------------------------------------------------ +console.log = function() { + if (logger.useConsole()) return; + logger.log.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.error = function() { + if (logger.useConsole()) return; + logger.error.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.warn = function() { + if (logger.useConsole()) return; + logger.warn.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.info = function() { + if (logger.useConsole()) return; + logger.info.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.debug = function() { + if (logger.useConsole()) return; + logger.debug.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.assert = function(expression) { + if (expression) return; + + var message = utils.vformat(arguments[1], [].slice.call(arguments, 2)); + console.log("ASSERT: " + message); +}; + +//------------------------------------------------------------------------------ +console.clear = function() {}; + +//------------------------------------------------------------------------------ +console.dir = function(object) { + console.log("%o", object); +}; + +//------------------------------------------------------------------------------ +console.dirxml = function(node) { + console.log(node.innerHTML); +}; + +//------------------------------------------------------------------------------ +console.trace = noop; + +//------------------------------------------------------------------------------ +console.group = console.log; + +//------------------------------------------------------------------------------ +console.groupCollapsed = console.log; + +//------------------------------------------------------------------------------ +console.groupEnd = noop; + +//------------------------------------------------------------------------------ +console.time = function(name) { + Timers[name] = new Date().valueOf(); +}; + +//------------------------------------------------------------------------------ +console.timeEnd = function(name) { + var timeStart = Timers[name]; + if (!timeStart) { + console.warn("unknown timer: " + name); + return; + } + + var timeElapsed = new Date().valueOf() - timeStart; + console.log(name + ": " + timeElapsed + "ms"); +}; + +//------------------------------------------------------------------------------ +console.timeStamp = noop; + +//------------------------------------------------------------------------------ +console.profile = noop; + +//------------------------------------------------------------------------------ +console.profileEnd = noop; + +//------------------------------------------------------------------------------ +console.count = noop; + +//------------------------------------------------------------------------------ +console.exception = console.log; + +//------------------------------------------------------------------------------ +console.table = function(data, columns) { + console.log("%o", data); +}; + +//------------------------------------------------------------------------------ +// return a new function that calls both functions passed as args +//------------------------------------------------------------------------------ +function wrapperedOrigCall(orgFunc, newFunc) { + return function() { + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} + }; +} + +//------------------------------------------------------------------------------ +// For every function that exists in the original console object, that +// also exists in the new console object, wrap the new console method +// with one that calls both +//------------------------------------------------------------------------------ +for (var key in console) { + if (typeof WinConsole[key] == "function") { + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + } +} + +}); + +// file: lib/common/plugin/contacts.js +define("cordova/plugin/contacts", function(require, exports, module) { +var exec = require('cordova/exec'), + ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'), + Contact = require('cordova/plugin/Contact'); + +/** +* Represents a group of Contacts. +* @constructor +*/ +var contacts = { + /** + * Returns an array of Contacts matching the search criteria. + * @param fields that should be searched + * @param successCB success callback + * @param errorCB error callback + * @param {ContactFindOptions} options that can be applied to contact searching + * @return array of Contacts matching search criteria + */ + find:function(fields, successCB, errorCB, options) { + if (!successCB) { + throw new TypeError("You must specify a success callback for the find command."); + } + if (!fields || (utils.isArray(fields) && fields.length === 0)) { + if (typeof errorCB === "function") { + errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); + } + } else { + var win = function(result) { + var cs = []; + for (var i = 0, l = result.length; i < l; i++) { + cs.push(contacts.create(result[i])); + } + successCB(cs); + }; + exec(win, errorCB, "Contacts", "search", [fields, options]); + } + }, + + /** + * This function creates a new contact, but it does not persist the contact + * to device storage. To persist the contact to device storage, invoke + * contact.save(). + * @param properties an object whose properties will be examined to create a new Contact + * @returns new Contact object + */ + create:function(properties) { + var i; + var contact = new Contact(); + for (i in properties) { + if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { + contact[i] = properties[i]; + } + } + return contact; + } +}; + +module.exports = contacts; + +}); + +// file: lib/common/plugin/device.js +define("cordova/plugin/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'); + +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.name = null; + this.uuid = null; + this.cordova = null; + + var me = this; + + channel.onCordovaReady.subscribeOnce(function() { + me.getInfo(function(info) { + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.name = info.name; + me.uuid = info.uuid; + me.cordova = info.cordova; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Device Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Device Error: errorCallback is not a function"); + return; + } + + // Get info + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); + +}); + +// file: lib/common/plugin/echo.js +define("cordova/plugin/echo", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Sends the given message through exec() to the Echo plugink, which sends it back to the successCallback. + * @param successCallback invoked with a FileSystem object + * @param errorCallback invoked if error occurs retrieving file system + * @param message The string to be echoed. + * @param forceAsync Whether to force an async return value (for testing native->js bridge). + */ +module.exports = function(successCallback, errorCallback, message, forceAsync) { + var action = forceAsync ? 'echoAsync' : 'echo'; + exec(successCallback, errorCallback, "Echo", action, [message]); +}; + + +}); + +// file: lib/common/plugin/geolocation.js +define("cordova/plugin/geolocation", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + PositionError = require('cordova/plugin/PositionError'), + Position = require('cordova/plugin/Position'); + +var timers = {}; // list of timers in use + +// Returns default params, overrides if provided with values +function parseParameters(options) { + var opt = { + maximumAge: 0, + enableHighAccuracy: false, + timeout: Infinity + }; + + if (options) { + if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { + opt.maximumAge = options.maximumAge; + } + if (options.enableHighAccuracy !== undefined) { + opt.enableHighAccuracy = options.enableHighAccuracy; + } + if (options.timeout !== undefined && !isNaN(options.timeout)) { + if (options.timeout < 0) { + opt.timeout = 0; + } else { + opt.timeout = options.timeout; + } + } + } + + return opt; +} + +// Returns a timeout failure, closed over a specified timeout value and error callback. +function createTimeout(errorCallback, timeout) { + var t = setTimeout(function() { + clearTimeout(t); + t = null; + errorCallback({ + code:PositionError.TIMEOUT, + message:"Position retrieval timed out." + }); + }, timeout); + return t; +} + +var geolocation = { + lastPosition:null, // reference to last known (cached) position returned + /** + * Asynchronously aquires the current position. + * + * @param {Function} successCallback The function to call when the position data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL) + * @param {PositionOptions} options The options for getting the position data. (OPTIONAL) + */ + getCurrentPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("getCurrentPosition must be called with at least one argument."); + } + options = parseParameters(options); + + // Timer var that will fire an error callback if no position is retrieved from native + // before the "timeout" param provided expires + var timeoutTimer = null; + + var win = function(p) { + clearTimeout(timeoutTimer); + if (!timeoutTimer) { + // Timeout already happened, or native fired error callback for + // this geo request. + // Don't continue with success callback. + return; + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + var fail = function(e) { + clearTimeout(timeoutTimer); + timeoutTimer = null; + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just + // fire the success callback with the cached position. + if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { + successCallback(geolocation.lastPosition); + // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. + } else if (options.timeout === 0) { + fail({ + code:PositionError.TIMEOUT, + message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceeds provided PositionOptions' maximumAge parameter." + }); + // Otherwise we have to call into native to retrieve a position. + } else { + if (options.timeout !== Infinity) { + // If the timeout value was not set to Infinity (default), then + // set up a timeout function that will fire the error callback + // if no successful position was retrieved before timeout expired. + timeoutTimer = createTimeout(fail, options.timeout); + } else { + // This is here so the check in the win function doesn't mess stuff up + // may seem weird but this guarantees timeoutTimer is + // always truthy before we call into native + timeoutTimer = true; + } + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + } + return timeoutTimer; + }, + /** + * Asynchronously watches the geolocation for changes to geolocation. When a change occurs, + * the successCallback is called with the new location. + * + * @param {Function} successCallback The function to call each time the location data is available + * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL) + * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("watchPosition must be called with at least one argument."); + } + options = parseParameters(options); + + var id = utils.createUUID(); + + // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition + timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); + + var fail = function(e) { + clearTimeout(timers[id]); + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + var win = function(p) { + clearTimeout(timers[id]); + if (options.timeout !== Infinity) { + timers[id] = createTimeout(fail, options.timeout); + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + + exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); + + return id; + }, + /** + * Clears the specified heading watch. + * + * @param {String} id The ID of the watch returned from #watchPosition + */ + clearWatch:function(id) { + if (id && timers[id] !== undefined) { + clearTimeout(timers[id]); + delete timers[id]; + exec(null, null, "Geolocation", "clearWatch", [id]); + } + } +}; + +module.exports = geolocation; + +}); + +// file: lib/common/plugin/logger.js +define("cordova/plugin/logger", function(require, exports, module) { +//------------------------------------------------------------------------------ +// The logger module exports the following properties/functions: +// +// LOG - constant for the level LOG +// ERROR - constant for the level ERROR +// WARN - constant for the level WARN +// INFO - constant for the level INFO +// DEBUG - constant for the level DEBUG +// logLevel() - returns current log level +// logLevel(value) - sets and returns a new log level +// useConsole() - returns whether logger is using console +// useConsole(value) - sets and returns whether logger is using console +// log(message,...) - logs a message at level LOG +// error(message,...) - logs a message at level ERROR +// warn(message,...) - logs a message at level WARN +// info(message,...) - logs a message at level INFO +// debug(message,...) - logs a message at level DEBUG +// logLevel(level,message,...) - logs a message specified level +// +//------------------------------------------------------------------------------ + +var logger = exports; + +var exec = require('cordova/exec'); +var utils = require('cordova/utils'); + +var UseConsole = true; +var Queued = []; +var DeviceReady = false; +var CurrentLevel; + +/** + * Logging levels + */ + +var Levels = [ + "LOG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +]; + +/* + * add the logging levels to the logger object and + * to a separate levelsMap object for testing + */ + +var LevelsMap = {}; +for (var i=0; i CurrentLevel) return; + + // queue the message if not yet at deviceready + if (!DeviceReady && !UseConsole) { + Queued.push([level, message]); + return; + } + + // if not using the console, use the native logger + if (!UseConsole) { + exec(null, null, "Logger", "logLevel", [level, message]); + return; + } + + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } + + // log to the console + switch (level) { + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; + } +}; + +// when deviceready fires, log queued messages +logger.__onDeviceReady = function() { + if (DeviceReady) return; + + DeviceReady = true; + + for (var i=0; i 3) { + fail(FileError.SYNTAX_ERR); + } else { + // if successful, return a FileSystem object + var success = function(file_system) { + if (file_system) { + if (typeof successCallback === 'function') { + // grab the name and root from the file system object + var result = new FileSystem(file_system.name, file_system.root); + successCallback(result); + } + } + else { + // no FileSystem object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + exec(success, fail, "File", "requestFileSystem", [type, size]); + } +}; + +module.exports = requestFileSystem; +}); + +// file: lib/common/plugin/resolveLocalFileSystemURI.js +define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), + FileEntry = require('cordova/plugin/FileEntry'), + FileError = require('cordova/plugin/FileError'), + exec = require('cordova/exec'); + +/** + * Look up file system Entry referred to by local URI. + * @param {DOMString} uri URI referring to a local file or directory + * @param successCallback invoked with Entry object corresponding to URI + * @param errorCallback invoked if error occurs retrieving file system entry + */ +module.exports = function(uri, successCallback, errorCallback) { + // error callback + var fail = function(error) { + if (typeof errorCallback === 'function') { + errorCallback(new FileError(error)); + } + }; + // sanity check for 'not:valid:filename' + if(!uri || uri.split(":").length > 2) { + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; + } + // if successful, return either a file or directory entry + var success = function(entry) { + var result; + if (entry) { + if (typeof successCallback === 'function') { + // create appropriate Entry object + result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath); + try { + successCallback(result); + } + catch (e) { + console.log('Error invoking callback: ' + e); + } + } + } + else { + // no Entry object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + + exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]); +}; + +}); + +// file: lib/common/plugin/splashscreen.js +define("cordova/plugin/splashscreen", function(require, exports, module) { +var exec = require('cordova/exec'); + +var splashscreen = { + show:function() { + exec(null, null, "SplashScreen", "show", []); + }, + hide:function() { + exec(null, null, "SplashScreen", "hide", []); + } +}; + +module.exports = splashscreen; +}); + +// file: lib/common/utils.js +define("cordova/utils", function(require, exports, module) { +var utils = exports; + +/** + * Returns an indication of whether the argument is an array or not + */ +utils.isArray = function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +/** + * Returns an indication of whether the argument is a Date or not + */ +utils.isDate = function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; +}; + +/** + * Does a deep clone of the object. + */ +utils.clone = function(obj) { + if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { + return obj; + } + + var retVal, i; + + if(utils.isArray(obj)){ + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.clone(obj[i])); + } + return retVal; + } + + retVal = {}; + for(i in obj){ + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); + } + } + return retVal; +}; + +/** + * Returns a wrappered version of the function + */ +utils.close = function(context, func, params) { + if (typeof params == 'undefined') { + return function() { + return func.apply(context, arguments); + }; + } else { + return function() { + return func.apply(context, params); + }; + } +}; + +/** + * Create a UUID + */ +utils.createUUID = function() { + return UUIDcreatePart(4) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(6); +}; + +/** + * Extends a child object from a parent object using classical inheritance + * pattern. + */ +utils.extend = (function() { + // proxy used to establish prototype chain + var F = function() {}; + // extend Child from Parent + return function(Child, Parent) { + F.prototype = Parent.prototype; + Child.prototype = new F(); + Child.__super__ = Parent.prototype; + Child.prototype.constructor = Child; + }; +}()); + +/** + * Alerts a message in any available way: alert or console.log. + */ +utils.alert = function(msg) { + if (alert) { + alert(msg); + } else if (console && console.log) { + console.log(msg); + } +}; + +/** + * Formats a string and arguments following it ala sprintf() + * + * see utils.vformat() for more information + */ +utils.format = function(formatString /* ,... */) { + var args = [].slice.call(arguments, 1); + return utils.vformat(formatString, args); +}; + +/** + * Formats a string and arguments following it ala vsprintf() + * + * format chars: + * %j - format arg as JSON + * %o - format arg as JSON + * %c - format arg as '' + * %% - replace with '%' + * any other char following % will format it's + * arg via toString(). + * + * for rationale, see FireBug's Console API: + * http://getfirebug.com/wiki/index.php/Console_API + */ +utils.vformat = function(formatString, args) { + if (formatString === null || formatString === undefined) return ""; + if (arguments.length == 1) return formatString.toString(); + if (typeof formatString != "string") return formatString.toString(); + + var pattern = /(.*?)%(.)(.*)/; + var rest = formatString; + var result = []; + + while (args.length) { + var arg = args.shift(); + var match = pattern.exec(rest); + + if (!match) break; + + rest = match[3]; + + result.push(match[1]); + + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; + } + + result.push(formatted(arg, match[2])); + } + + result.push(rest); + + return result.join(''); +}; + +//------------------------------------------------------------------------------ +function UUIDcreatePart(length) { + var uuidpart = ""; + for (var i=0; i + + + + + + + +
+ + + \ No newline at end of file diff --git a/Android/ForegroundGallery/strings.xml b/Android/ForegroundGallery/strings.xml new file mode 100644 index 00000000..f5d85c59 --- /dev/null +++ b/Android/ForegroundGallery/strings.xml @@ -0,0 +1,22 @@ + + + + Hello Foreground Camera Plugin! + Foreground Camera Plugin + Capture + Cancel + diff --git a/Android/FtpClient/README.md b/Android/FtpClient/README.md index 246979a9..b59fc11f 100755 --- a/Android/FtpClient/README.md +++ b/Android/FtpClient/README.md @@ -1,147 +1,2 @@ -# FtpClient plugin for Phonegap # - -The ftp client allows you to upload and download files from within your PhoneGap application. - -A simple use case would be: - -- Downloading a text file from a FTP server in order to be displayed in your application. -- Uploading a text file to a FTP server. - -## Adding the Plugin to your project ## - -Using this plugin requires [Android PhoneGap](http://github.com/phonegap/phonegap-android). - -1. To install the plugin, move www/ftpclient.js to your project's www folder and include a reference to it in your html file after phonegap.js. - - <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
- <script type="text/javascript" charset="utf-8" src="ftpclient.js"></script> - -2. Create a directory within your project called "src/com/phonegap/plugins/ftpclient" and copy src/com/phonegap/plugins/ftpclient/FtpClient.java into it. - -3. Add the following activity to your AndroidManifest.xml file. It should be added inside the <application> tag. - - <activity android:name="com.phonegap.DroidGap" android:label="@string/app_name">
- <intent-filter>
- </intent-filter>
- </activity> - -4. Copy "libs/commons-net-2.2.jar" into the libs directory within your project. You will also need to right click on this file in eclipse and add the jar to the build path. - -5. In your res/xml/plugins.xml file add the following line: - - <plugin name="FtpClient" value="com.phonegap.plugins.ftpclient.FtpClient"/> - -## Using the plugin ## - -The plugin creates the object `window.plugins.ftpclient`. To use, call one of the following, available methods: - -
-  /**
-   * Upload a file with the specified URL.
-   * 
-   * @param file   The file to upload
-   * @param url	   The url of the ftp server
-   * @param win	   The success callback
-   * @param fail   The error callback
-   */
-   
-  put(file, url, win, fail);
-
- -Sample use: - - window.plugins.ftpclient.put("test.txt", "ftp://username:password@ftp.server.com/test.txt;type=i", win, fail); - -
-  /**
-   * Download a file with the specified URL.
-   * 
-   * @param file   The name of the local file to be saved
-   * @param url	   The url of the ftp server
-   * @param win	   The success callback
-   * @param fail   The error callback
-   */
-   
-  get(file, url, win, fail);
-
- -Sample use: - - window.plugins.ftpclient.get("test.txt", "ftp://username:password@ftp.server.com/test.txt;type=i", win, fail); - -## RELEASE NOTES ## - -### Jan 12, 2011 ### - -* Initial release - -## BUGS AND CONTRIBUTIONS ## - - -## LICENSE ## - -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - -The text of the MIT and BSD licenses is reproduced below. - ---- - -### The "New" BSD License - -Copyright (c) 2005-2010, Nitobi Software Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Phonegap/Nitobi nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - -### The MIT License - -Copyright (c) <2010> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - \ No newline at end of file +# Moved to # +https://github.com/macdonst/FtpClient \ No newline at end of file diff --git a/Android/FtpClient/config.xml b/Android/FtpClient/config.xml deleted file mode 100644 index a4c5134b..00000000 --- a/Android/FtpClient/config.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - The ftp client allows you to upload and download files from a FTP server. - - - -The ftp client allows you to upload and download files from a FTP server. - -A simple use case would be: - -- Downloading a text file from a FTP server in order to be displayed in your application. -- Uploading a text file to a FTP server. - - - Simon MacDonald - - - - - -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - - \ No newline at end of file diff --git a/Android/FtpClient/docs/FtpClient.md b/Android/FtpClient/docs/FtpClient.md deleted file mode 100755 index e10b52bc..00000000 --- a/Android/FtpClient/docs/FtpClient.md +++ /dev/null @@ -1,93 +0,0 @@ -FtpClient -========== - -FtpClient is an object that allows you to upload/download files from a FTP server. - -Properties ----------- - -N/A - -Methods -------- - -- __get__: downloads a file from a server. -- __put__: sends a file to a server. - -Details -------- - -The `FtpClient` object is a way to upload/download files to a server using the FTP protocol. - -The first parameter is the name of the file to upload or download. -The second parameter is the URL of the FTP server. -The third parameter is the success callback -The fourth parameter is the error callback [optional] - -Supported Platforms -------------------- - -- Android - -Quick Example ------------------------------- - - var win = function() { - alert("yay"); - } - - var fail = function() { - alert("boo"); - } - - var paths = navigator.fileMgr.getRootPaths(); - var ftpClient = new FtpClient(); - ftpClient.put(paths[0]+"/putfile.txt", "ftp://username:password@server.com:21/putfile.txt;type=i", win, fail); - ftpClient.get(paths[0]+"/getfile.txt", "ftp://username:password@server.com:21/putfile.txt", win, fail); - -Full Example ------------- - - - - - Contact Example - - - - - -

Example

- Put Files - Get Files - - diff --git a/Android/FtpClient/lib/commons-net-2.2.jar b/Android/FtpClient/lib/commons-net-2.2.jar deleted file mode 100644 index 0a01f18e..00000000 Binary files a/Android/FtpClient/lib/commons-net-2.2.jar and /dev/null differ diff --git a/Android/FtpClient/manifest b/Android/FtpClient/manifest deleted file mode 100644 index 945a250c..00000000 --- a/Android/FtpClient/manifest +++ /dev/null @@ -1,3 +0,0 @@ -lib/commons-net-2.2.jar -src/com/phonegap/plugins/FtpClient.java -www/ftpclient.js \ No newline at end of file diff --git a/Android/FtpClient/src/com/phonegap/plugins/ftpclient/FtpClient.java b/Android/FtpClient/src/com/phonegap/plugins/ftpclient/FtpClient.java deleted file mode 100644 index 657be053..00000000 --- a/Android/FtpClient/src/com/phonegap/plugins/ftpclient/FtpClient.java +++ /dev/null @@ -1,160 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2010, IBM Corporation - */ - -package com.phonegap.plugins.ftpclient; - -import java.io.BufferedInputStream; -import java.io.BufferedOutputStream; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.MalformedURLException; -import java.net.URL; -import java.util.StringTokenizer; - -import org.apache.commons.net.ftp.FTP; -import org.apache.commons.net.ftp.FTPClient; -import org.json.JSONArray; -import org.json.JSONException; - -import android.util.Log; - -import com.phonegap.api.PhonegapActivity; -import com.phonegap.api.Plugin; -import com.phonegap.api.PluginResult; - -public class FtpClient extends Plugin { - - private static final String LOG_TAG = "FtpClient"; - - /** - * Executes the request and returns PluginResult. - * - * @param action The action to execute. - * @param args JSONArry of arguments for the plugin. - * @param callbackId The callback id used when calling back into JavaScript. - * @return A PluginResult object with a status and message. - */ - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - JSONArray result = new JSONArray(); - - try { - String filename = args.getString(0); - URL url = new URL(args.getString(1)); - - - if (action.equals("get")) { - get(filename, url); - } - else if (action.equals("put")) { - put(filename, url); - } - return new PluginResult(status, result); - } catch (JSONException e) { - return new PluginResult(PluginResult.Status.JSON_EXCEPTION); - } catch (MalformedURLException e) { - return new PluginResult(PluginResult.Status.MALFORMED_URL_EXCEPTION); - } catch (IOException e) { - return new PluginResult(PluginResult.Status.IO_EXCEPTION); - } - } - - /** - * Uploads a file to a ftp server. - * @param filename the name of the local file to send to the server - * @param url the url of the server - * @throws IOException - */ - private void put(String filename, URL url) throws IOException { - FTPClient f = setup(url); - - BufferedInputStream buffIn=null; - buffIn=new BufferedInputStream(new FileInputStream(filename)); - f.storeFile(extractFileName(url), buffIn); - buffIn.close(); - - teardown(f); - } - - /** - * Downloads a file from a ftp server. - * @param filename the name to store the file locally - * @param url the url of the server - * @throws IOException - */ - private void get(String filename, URL url) throws IOException { - FTPClient f = setup(url); - - BufferedOutputStream buffOut=null; - buffOut=new BufferedOutputStream(new FileOutputStream(filename)); - f.retrieveFile(extractFileName(url), buffOut); - buffOut.flush(); - buffOut.close(); - - teardown(f); - } - - /** - * Tears down the FTP connection - * @param f the FTPClient - * @throws IOException - */ - private void teardown(FTPClient f) throws IOException { - f.logout(); - f.disconnect(); - } - - /** - * Creates, connects and logs into a FTP server - * @param url of the FTP server - * @return an instance of FTPClient - * @throws IOException - */ - private FTPClient setup(URL url) throws IOException { - FTPClient f = new FTPClient(); - f.connect(url.getHost(), extractPort(url)); - - StringTokenizer tok = new StringTokenizer(url.getUserInfo(), ":"); - f.login(tok.nextToken(), tok.nextToken()); - - f.enterLocalPassiveMode(); - f.setFileType(FTP.BINARY_FILE_TYPE); - - return f; - } - - /** - * Extracts the port of the FTP server. Returns 21 by default. - * @param url - * @return - */ - private int extractPort(URL url) { - if (url.getPort() == -1) { - return url.getDefaultPort(); - } - else { - return url.getPort(); - } - } - - /** - * Extracts the file name from the URL. - * @param url of the ftp server, includes the file to upload/download - * @return the filename to upload/download - */ - private String extractFileName(URL url) { - String filename = url.getFile(); - if (filename.endsWith(";type=i") || filename.endsWith(";type=a")) { - filename = filename.substring(0, filename.length() - 7); - } - return filename; - } - -} diff --git a/Android/FtpClient/www/ftpclient.js b/Android/FtpClient/www/ftpclient.js deleted file mode 100644 index f8b155e0..00000000 --- a/Android/FtpClient/www/ftpclient.js +++ /dev/null @@ -1,47 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2010, IBM Corporation - */ - -/** - * Constructor - */ -function FtpClient() { -} - -/** - * Upload a file to a FTP server - * - * @param file The file to be uploaded to the server - * @param url The url of the ftp server - * @param successCallback The success callback - * @param errorCallback The error callback - */ -FtpClient.prototype.put = function(file, url, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "FtpClient", "put", [file, url]); -}; - -/** - * Download a file from a FTP server - * - * @param file The file to be uploaded to the server - * @param url The url of the ftp server - * @param successCallback The success callback - * @param errorCallback The error callback - */ -FtpClient.prototype.get = function(file, url, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "FtpClient", "get", [file, url]); -}; - -/** - * Load FtpClient - */ -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin("ftpclient", new FtpClient()); -// @deprecated: No longer needed in PhoneGap 1.0. Uncomment the addService code for earlier -// PhoneGap releases. -// PluginManager.addService("FtpClient", "com.phonegap.plugins.ftpclient.FtpClient"); -}); diff --git a/Android/GPSDetector/README.md b/Android/GPSDetector/README.md new file mode 100644 index 00000000..59edd28b --- /dev/null +++ b/Android/GPSDetector/README.md @@ -0,0 +1,6 @@ +GPSDetector +=========== + +PhoneGap (2.2.0 and older) plugin for Android. Detects if the GPS is enabled or disabled. + +You can find the plugin and a sample project on https://github.com/BastienL/GPSDetector \ No newline at end of file diff --git a/Android/HttpRequest/readme.md b/Android/HttpRequest/readme.md new file mode 100644 index 00000000..483f9231 --- /dev/null +++ b/Android/HttpRequest/readme.md @@ -0,0 +1,3 @@ +# HTTP request plugin for Phonegap / Cordova # + +Hosted at (https://github.com/bperin/HttpRequest) \ No newline at end of file diff --git a/Android/IMEI/v1.4.1/IMEIPlugin.java b/Android/IMEI/v1.4.1/IMEIPlugin.java deleted file mode 100644 index 30a399a6..00000000 --- a/Android/IMEI/v1.4.1/IMEIPlugin.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.simonmacdonald.imei; - - -import org.json.JSONArray; - -import android.content.Context; -import android.telephony.TelephonyManager; - -import com.phonegap.api.Plugin; -import com.phonegap.api.PluginResult; - -public class IMEIPlugin extends Plugin { - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - if (action.equals("get")) { - TelephonyManager telephonyManager = (TelephonyManager)this.ctx.getSystemService(Context.TELEPHONY_SERVICE); - result = telephonyManager.getDeviceId(); - } - else { - status = PluginResult.Status.INVALID_ACTION; - } - return new PluginResult(status, result); - } - -} diff --git a/Android/IMEI/v1.4.1/imei.js b/Android/IMEI/v1.4.1/imei.js deleted file mode 100644 index fa48b3aa..00000000 --- a/Android/IMEI/v1.4.1/imei.js +++ /dev/null @@ -1,9 +0,0 @@ -var IMEI = function(){}; - -IMEI.prototype.get = function(onSuccess, onFail){ - return PhoneGap.exec(onSuccess, onFail, 'IMEI', 'get', []); -}; - -PhoneGap.addConstructor(function(){ - PhoneGap.addPlugin('imei', new IMEI()); -}); \ No newline at end of file diff --git a/Android/IMEI/v1.4.1/index.html b/Android/IMEI/v1.4.1/index.html deleted file mode 100644 index 7659f5d6..00000000 --- a/Android/IMEI/v1.4.1/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - PhoneGap Events Example - - - - - -

IMEI

- IMEI:
- - diff --git a/Android/IMEI/v1.5.0/IMEIPlugin.java b/Android/IMEI/v1.5.0/IMEIPlugin.java deleted file mode 100644 index 3ba36443..00000000 --- a/Android/IMEI/v1.5.0/IMEIPlugin.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.simonmacdonald.imei; - - -import org.json.JSONArray; - -import android.content.Context; -import android.telephony.TelephonyManager; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -public class IMEIPlugin extends Plugin { - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - if (action.equals("get")) { - TelephonyManager telephonyManager = (TelephonyManager)this.ctx.getSystemService(Context.TELEPHONY_SERVICE); - result = telephonyManager.getDeviceId(); - } - else { - status = PluginResult.Status.INVALID_ACTION; - } - return new PluginResult(status, result); - } - -} diff --git a/Android/IMEI/v1.5.0/imei.js b/Android/IMEI/v1.5.0/imei.js deleted file mode 100644 index 4814bc65..00000000 --- a/Android/IMEI/v1.5.0/imei.js +++ /dev/null @@ -1,9 +0,0 @@ -var IMEI = function(){}; - -IMEI.prototype.get = function(onSuccess, onFail){ - return cordova.exec(onSuccess, onFail, 'IMEI', 'get', []); -}; - -cordova.addConstructor(function(){ - cordova.addPlugin('imei', new IMEI()); -}); \ No newline at end of file diff --git a/Android/IMEI/v1.5.0/index.html b/Android/IMEI/v1.5.0/index.html deleted file mode 100644 index 0a14301f..00000000 --- a/Android/IMEI/v1.5.0/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - PhoneGap Events Example - - - - - -

IMEI v1.5

- IMEI:
- - diff --git a/Android/IMEI/v2.0.0/IMEIPlugin.java b/Android/IMEI/v2.0.0/IMEIPlugin.java deleted file mode 100644 index 47410472..00000000 --- a/Android/IMEI/v2.0.0/IMEIPlugin.java +++ /dev/null @@ -1,29 +0,0 @@ -package com.simonmacdonald.imei; - - -import org.json.JSONArray; - -import android.content.Context; -import android.telephony.TelephonyManager; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -public class IMEIPlugin extends Plugin { - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - if (action.equals("get")) { - TelephonyManager telephonyManager = (TelephonyManager)this.cordova.getActivity().getSystemService(Context.TELEPHONY_SERVICE); - result = telephonyManager.getDeviceId(); - } - else { - status = PluginResult.Status.INVALID_ACTION; - } - return new PluginResult(status, result); - } - -} diff --git a/Android/IMEI/v2.0.0/imei.js b/Android/IMEI/v2.0.0/imei.js deleted file mode 100644 index 19d1085f..00000000 --- a/Android/IMEI/v2.0.0/imei.js +++ /dev/null @@ -1,12 +0,0 @@ -var IMEI = function(){}; - -IMEI.prototype.get = function(onSuccess, onFail){ - return cordova.exec(onSuccess, onFail, 'IMEI', 'get', []); -}; - -if(!window.plugins) { - window.plugins = {}; -} -if (!window.plugins.imei) { - window.plugins.imei = new IMEI(); -} \ No newline at end of file diff --git a/Android/IMEI/v2.0.0/index.html b/Android/IMEI/v2.0.0/index.html deleted file mode 100644 index 0a14301f..00000000 --- a/Android/IMEI/v2.0.0/index.html +++ /dev/null @@ -1,31 +0,0 @@ - - - - - PhoneGap Events Example - - - - - -

IMEI v1.5

- IMEI:
- - diff --git a/Android/InAppBilling/readme.md b/Android/InAppBilling/readme.md new file mode 100644 index 00000000..0c52c5a5 --- /dev/null +++ b/Android/InAppBilling/readme.md @@ -0,0 +1,28 @@ +In app billing plugin +---------------- +Maintained by Guillaume Charhon - Smart Mobile Software + +The repository for this plugin is located at https://github.com/poiuytrez/AndroidInAppBilling + +MIT License +---------------- + +Copyright (c) 2012-2013 Guillaume Charhon - Smart Mobile Software + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. \ No newline at end of file diff --git a/Android/Instagram/README.md b/Android/Instagram/README.md new file mode 100644 index 00000000..2bf2a08a --- /dev/null +++ b/Android/Instagram/README.md @@ -0,0 +1,14 @@ +# Instagram Plugin # +by [Vlad Stirbu](https://github.com/vstirbu). + +## Description ## + +Plugin for sharing the content of a canvas to Instagram. The plugin works with Cordova >= 1.8.1. + +## Source and documentation ## + +This plugin lives at [https://github.com/vstirbu/InstagramPlugin](https://github.com/vstirbu/InstagramPlugin) + +## License ## + +The MIT License \ No newline at end of file diff --git a/Android/NFC/README.md b/Android/NFC/README.md new file mode 100644 index 00000000..9b3a6561 --- /dev/null +++ b/Android/NFC/README.md @@ -0,0 +1,13 @@ +PhoneGap NFC Plugin +========================== + +The PhoneGap NFC Plugin provides access to Near Field Communication (NFC) hardware, allowing applications to read NDEF message from NFC tags and write NDEF messages. A "tag" may actually be another device that appears as a tag. + +Supported Platforms +------------------- +* Android +* Blackberry Webworks (OS 7.0 and higher) + +Source Code +------------------- +[https://github.com/chariotsolutions/phonegap-nfc](https://github.com/chariotsolutions/phonegap-nfc) diff --git a/Android/PayPalPlugin/AndroidManifest.xml b/Android/PayPalPlugin/AndroidManifest.xml index 9ed944dc..00d406af 100644 --- a/Android/PayPalPlugin/AndroidManifest.xml +++ b/Android/PayPalPlugin/AndroidManifest.xml @@ -1,28 +1,41 @@ - - - + - - - + - - - - - - - - - - - - + + + + + + - + + + + + + + + + + + + \ No newline at end of file diff --git a/Android/PayPalPlugin/LICENSE b/Android/PayPalPlugin/LICENSE index 4a778374..3925c9a8 100644 --- a/Android/PayPalPlugin/LICENSE +++ b/Android/PayPalPlugin/LICENSE @@ -3,6 +3,7 @@ The MIT License Copyright (C) 2011 Mobile Developer Solutions Copyright (C) 2011, Appception, Inc. +Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/Android/PayPalPlugin/README.md b/Android/PayPalPlugin/README.md index 72ddb62d..be134a2d 100644 --- a/Android/PayPalPlugin/README.md +++ b/Android/PayPalPlugin/README.md @@ -1,19 +1,20 @@ # PhoneGap PayPal-Plugin # -by Paul Beusterien, Mobile Developer Solutions and Carl Stehle, Appception Inc. +by Paul Beusterien, Mobile Developer Solutions, Carl Stehle, Appception Inc. and Tomaz Kregar, Bucka IT ## Adding the Plugin to your project ## -Using this plugin requires Android PhoneGap and the PayPal Mobile Payments Library. The PayPal Mobile Payments Library can be downloaded [here](https://www.x.com/community/ppx/xspaces/mobile/mep). +Using this plugin requires Android Cordova (PhoneGap) and the PayPal Mobile Payments Library. The PayPal Mobile Payments Library can be downloaded [here](https://www.x.com/community/ppx/xspaces/mobile/mep). -1. Create an Android PhoneGap project. Details at http://www.mobiledevelopersolutions.com/home/start +1. Create an Android Cordova project. Details at http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html 2. Put PayPal_MPL.jar into your project's libs directory and add it to the build path. In Eclipse, right click on PayPal_MPL.jar and select Add to Build Path. 3. Copy assets/www/ files into your project's assets/www/ directory 4. Copy src/com/phonegap/plugin/ files into your project's src/com/phonegap/plugin/ directory 5. Make sure your AndroidManifest.xml includes a superset of the permissions shown in the reference AndroidManifest.xml 6. Add the com.paypal.android.MEP.PayPalActivity as shown in the reference AndroidManifest.xml -7. Make sure the phonegap.{version}.js filename in index.html matches the filename in your www directory. -8. Deploy and test the app. The default environment is ENV_NONE. +7. Include the plugin registration in /res/xml/config.xml as shown in the reference config.xml +8. Make sure the cordova.{version}.js filename in index.html matches the filename in your www directory. +9. Deploy and test the app. The default environment is ENV_NONE. ## Using the PayPal Sandbox ## @@ -24,7 +25,10 @@ Using this plugin requires Android PhoneGap and the PayPal Mobile Payments Libra ## RELEASE NOTES ## -### 201100618 ### +### 20120829 ### +* Added suppport for Cordova 2.0.0 + +### 20110618 ### * Initial release * By default the PayPalPlugin-Host runs in ENV_NONE (offline) with a dummy PayPal ID. Change to ENV_SANDBOX or ENV_LIVE * Only tested with ENV_NONE and ENV_SANDBOX diff --git a/Android/PayPalPlugin/assets/www/index.html b/Android/PayPalPlugin/assets/www/index.html index e7a51b7d..08290dc1 100644 --- a/Android/PayPalPlugin/assets/www/index.html +++ b/Android/PayPalPlugin/assets/www/index.html @@ -1,7 +1,7 @@ - + diff --git a/Android/PayPalPlugin/assets/www/paypal.js b/Android/PayPalPlugin/assets/www/paypal.js index ef6367db..da333ee4 100644 --- a/Android/PayPalPlugin/assets/www/paypal.js +++ b/Android/PayPalPlugin/assets/www/paypal.js @@ -2,13 +2,13 @@ * * Copyright (C) 2011, Appception, Inc.. All Rights Reserved. * Copyright (C) 2011, Mobile Developer Solutions All Rights Reserved. +* Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. All Rights Reserved. */ /* * @return Instance of PayPal */ -var PayPal = function() { -}; +var PayPal = function() {}; /** * @param directory @@ -29,7 +29,7 @@ var fail = function(e) { PayPal.prototype.invoke = function(callee, arg, successFunction) { var succ = successFunction ? successFunction : genericSuccess; - return PhoneGap.exec(succ, + return cordova.exec(succ, fail, 'PayPalPlugin', // Telling PhoneGap that we want to run "PayPal Plugin" callee, // Telling the plugin, which action we want to perform @@ -38,34 +38,40 @@ PayPal.prototype.invoke = function(callee, arg, successFunction) { /** *
    - *
  • Register the Directory Listing Javascript plugin.
  • - *
  • Also register native call which will be called when this plugin runs
  • + *
  • Register native call which will be called when this plugin runs
  • + *
  • Plugin must be registered in /res/xml/config.xml : <plugin name="PayPalPlugin" value="com.phonegap.plugin.PayPalPlugin"/>
  • *
*/ -PhoneGap.addConstructor(function() { - // Register the javascript plugin with PhoneGap - PhoneGap.addPlugin('PayPal', new PayPal()); - // Register the native class of plugin with PhoneGap - PluginManager.addService("PayPalPlugin", "com.phonegap.plugin.PayPalPlugin"); -}); +if(cordova.addPlugin) { //versions before 2.0.0 + cordova.addConstructor(function() { + // Register the javascript plugin with PhoneGap + cordova.addPlugin('PayPal', new PayPal()); + }); +} else { + // Creating the native object of plugin + if(!window.plugins) + window.plugins = {}; + if (!window.plugins.PayPal) + window.plugins.PayPal = new PayPal(); +} var mpl = { - construct : function(str) { - window.plugins.PayPal.invoke('construct', str); - }, - prepare : function(ptype) { - window.plugins.PayPal.invoke('prepare', ptype); - }, - getStatus : function() { - return window.plugins.PayPal.invoke('getStatus', null, getStatusCallback); - }, - setPaymentInfo : function(arg) { - window.plugins.PayPal.invoke('setPaymentInfo', arg); - }, - payButton : function(btype) { - window.plugins.PayPal.invoke('pay', btype); - } + construct : function(str) { + window.plugins.PayPal.invoke('construct', str); + }, + prepare : function(ptype) { + window.plugins.PayPal.invoke('prepare', ptype); + }, + getStatus : function() { + return window.plugins.PayPal.invoke('getStatus', null, getStatusCallback); + }, + setPaymentInfo : function(arg) { + window.plugins.PayPal.invoke('setPaymentInfo', arg); + }, + payButton : function(btype) { + window.plugins.PayPal.invoke('pay', btype); + } }; /* diff --git a/Android/PayPalPlugin/res/xml/config.xml b/Android/PayPalPlugin/res/xml/config.xml new file mode 100644 index 00000000..61b91bbf --- /dev/null +++ b/Android/PayPalPlugin/res/xml/config.xml @@ -0,0 +1,56 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Android/PayPalPlugin/src/com/phonegap/plugin/PayPalPlugin.java b/Android/PayPalPlugin/src/com/phonegap/plugin/PayPalPlugin.java index 2b5e100a..6a7cf971 100644 --- a/Android/PayPalPlugin/src/com/phonegap/plugin/PayPalPlugin.java +++ b/Android/PayPalPlugin/src/com/phonegap/plugin/PayPalPlugin.java @@ -2,6 +2,7 @@ * * Copyright (C) 2011, Appception, Inc.. All Rights Reserved. * Copyright (C) 2011, Mobile Developer Solutions All Rights Reserved. + * Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. All Rights Reserved. */ package com.phonegap.plugin; @@ -12,9 +13,9 @@ import android.util.Log; -import com.phonegap.api.Plugin; -import com.phonegap.api.PluginResult; -import com.phonegap.api.PluginResult.Status; +import org.apache.cordova.api.Plugin; +import org.apache.cordova.api.PluginResult; +import org.apache.cordova.api.PluginResult.Status; public class PayPalPlugin extends Plugin { private static mpl PluginMpl; @@ -29,7 +30,7 @@ public PluginResult execute(String action, JSONArray data, String callbackId) { try { if (action.equals("construct")) { thisPlugin = this; - PluginMpl = new mpl(this.ctx, data.getString(0)); + PluginMpl = new mpl(this.ctx.getContext(), data.getString(0)); // PluginMpl = new mpl(this.ctx, PayPal.ENV_NONE, ""); result = new PluginResult(Status.OK); diff --git a/Android/PayPalPlugin/src/com/phonegap/plugin/mpl.java b/Android/PayPalPlugin/src/com/phonegap/plugin/mpl.java index 42932534..f59db1cf 100644 --- a/Android/PayPalPlugin/src/com/phonegap/plugin/mpl.java +++ b/Android/PayPalPlugin/src/com/phonegap/plugin/mpl.java @@ -2,6 +2,7 @@ * * Copyright (C) 2011, Appception, Inc.. All Rights Reserved. * Copyright (C) 2011, Mobile Developer Solutions All Rights Reserved. + * Copyright (C) 2012, Bucka IT, Tomaz Kregar s.p. All Rights Reserved. */ package com.phonegap.plugin; @@ -23,7 +24,7 @@ import com.paypal.android.MEP.PayPalInvoiceItem; import com.paypal.android.MEP.PayPalPayment; import com.paypal.android.MEP.PayPalPreapproval; -import com.phonegap.DroidGap; +import org.apache.cordova.DroidGap; public class mpl { @@ -88,9 +89,9 @@ public mpl(Context context, int serverType, String serverAppId) { } // Construct new instance with information from main activity - public mpl(Context context, String JSONdata) { - mpl_activity = (Activity) context; - mpl_context = context.getApplicationContext(); + public mpl(Context ctx, String JSONdata) { + mpl_activity = (Activity) ctx; + mpl_context = ctx.getApplicationContext(); parseConstructArg(JSONdata); if (mpjs_server.equals("ENV_NONE")) { server = PayPal.ENV_NONE; diff --git a/Android/PhoneListener/PhoneListener.java b/Android/PhoneListener/PhoneListener.java deleted file mode 100644 index e5fd9228..00000000 --- a/Android/PhoneListener/PhoneListener.java +++ /dev/null @@ -1,156 +0,0 @@ -/** - * PhoneListener.java - * PhoneListener PhoneGap plugin (Android) - * - * Created by Tommy-Carlos Williams on 09/08/2011. - * Copyright 2011 Tommy-Carlos Williams. All rights reserved. - * MIT Licensed - * - * - * Update by Matt McGrath to work with Cordova version of PhoneGap 1.6 upwards - 01/06/2012 - * - */ -package org.devgeeks; - -import org.json.JSONArray; - -import android.content.BroadcastReceiver; -import android.content.Context; -import android.content.Intent; -import android.content.IntentFilter; -import android.telephony.TelephonyManager; -import android.util.Log; - -import org.apache.cordova.api.CordovaInterface; -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -/** - * @author Tommy-Carlos Williams, - * Huge chunks lifted/adapted from the NextworkManager core PhoneGap plugin - */ -public class PhoneListener extends Plugin { - - public static final String TYPE_NONE = "NONE"; - private static final String LOG_TAG = "PhoneListener"; - - private String phoneListenerCallbackId; - - BroadcastReceiver receiver; - - /** - * Constructor. - */ - public PhoneListener() { - this.receiver = null; - } - - /** - * Sets the context of the Command. This can then be used to do things like - * get file paths associated with the Activity. - * - * @param ctx The context of the main Activity. - */ - public void setContext(CordovaInterface ctx) { - super.setContext(ctx); - this.phoneListenerCallbackId = null; - - // We need to listen to connectivity events to update navigator.connection - IntentFilter intentFilter = new IntentFilter() ; - intentFilter.addAction(TelephonyManager.ACTION_PHONE_STATE_CHANGED); - if (this.receiver == null) { - this.receiver = new BroadcastReceiver() { - @Override - public void onReceive(Context context, Intent intent) { - if(intent != null && intent.getAction().equals(TelephonyManager.ACTION_PHONE_STATE_CHANGED)) { - // State has changed - String phoneState = intent.hasExtra(TelephonyManager.EXTRA_STATE) ? intent.getStringExtra(TelephonyManager.EXTRA_STATE) : null; - String state; - // See if the new state is 'ringing', 'off hook' or 'idle' - if(phoneState != null && phoneState.equals(TelephonyManager.EXTRA_STATE_RINGING)) { - // phone is ringing, awaiting either answering or canceling - state = "RINGING"; - Log.i(LOG_TAG,state); - } else if (phoneState != null && phoneState.equals(TelephonyManager.EXTRA_STATE_OFFHOOK)) { - // actually talking on the phone... either making a call or having answered one - state = "OFFHOOK"; - Log.i(LOG_TAG,state); - } else if (phoneState != null && phoneState.equals(TelephonyManager.EXTRA_STATE_IDLE)) { - // idle means back to no calls in or out. default state. - state = "IDLE"; - Log.i(LOG_TAG,state); - } else { - state = TYPE_NONE; - Log.i(LOG_TAG,state); - } - updatePhoneState(state,true); - } - } - }; - // register the receiver... this is so it doesn't have to be added to AndroidManifest.xml - ctx.getContext().registerReceiver(this.receiver, intentFilter); - } - } - - /** - * Create a new plugin result and send it back to JavaScript - * - * @param phone state sent back to the designated success callback - */ - private void updatePhoneState(String phoneState, boolean keepCallback) { - if (this.phoneListenerCallbackId != null) { - PluginResult result = new PluginResult(PluginResult.Status.OK, phoneState); - result.setKeepCallback(keepCallback); - this.success(result, this.phoneListenerCallbackId); - } - } - - /* (non-Javadoc) - * @see com.phonegap.api.Plugin#execute(java.lang.String, org.json.JSONArray, java.lang.String) - */ - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.INVALID_ACTION; - String result = "Unsupported Operation: " + action; - // either start or stop the listener... - if (action.equals("startMonitoringPhoneState")) { - if (this.phoneListenerCallbackId != null) { - return new PluginResult(PluginResult.Status.ERROR, "Phone listener already running."); - } - this.phoneListenerCallbackId = callbackId; - PluginResult pluginResult = new PluginResult(PluginResult.Status.NO_RESULT); - pluginResult.setKeepCallback(true); - return pluginResult; - } - else if (action.equals("stopMonitoringPhoneState")) { - removePhoneListener(); - this.updatePhoneState("", false); // release status callback - this.phoneListenerCallbackId = null; - return new PluginResult(PluginResult.Status.NO_RESULT); - } - - return new PluginResult(status, result); // no valid action called - } - - /** - * Stop the phone listener receiver and set it to null. - */ - private void removePhoneListener() { - if (this.receiver != null) { - try { - this.ctx.getContext().unregisterReceiver(this.receiver); - this.receiver = null; - } catch (Exception e) { - Log.e(LOG_TAG, "Error unregistering phone listener receiver: " + e.getMessage(), e); - } - } - } - - /** - * Stop phone listener receiver. - */ - public void onDestroy() { - removePhoneListener(); - } - -} diff --git a/Android/PhoneListener/PhoneListener.js b/Android/PhoneListener/PhoneListener.js deleted file mode 100644 index 497242df..00000000 --- a/Android/PhoneListener/PhoneListener.js +++ /dev/null @@ -1,30 +0,0 @@ -/** - * PhoneListener.js - * PhoneListener PhoneGap plugin (Android) - * - * Created by Tommy-Carlos Williams on 09/08/2011. - * Copyright 2011 Tommy-Carlos Williams. All rights reserved. - * MIT Licensed - * - * - * Update by Matt McGrath to work with Cordova version of PhoneGap 1.6 upwards - 01/06/2012 - * - */ -var PhoneListener = { - start: function(successCallback, failureCallback) { - return cordova.exec( - successCallback, - failureCallback, - 'PhoneListener', - 'startMonitoringPhoneState', - []); // no arguments required - }, - stop: function(successCallback, failureCallback) { - return cordova.exec( - successCallback, - failureCallback, - 'PhoneListener', - 'stopMonitoringPhoneState', - []); // no arguments required - } -}; diff --git a/Android/PhoneListener/README.md b/Android/PhoneListener/README.md index 3c0fa2cb..195adf45 100644 --- a/Android/PhoneListener/README.md +++ b/Android/PhoneListener/README.md @@ -1,63 +1,8 @@ PhoneListener ============ -Installation ------------- - **Modified by Matt McGrath to work on versions of PhoneGap 1.6 (cordova) upwards** This plugin allows your application to monitor changes in the phone's state (RINGING, OFFHOOK and IDLE) so that you can respond to them appropriately (pause your Media stream, etc). -Add the plugin much like any other: - -1. Add the PhoneListener.js file to your 'assets/www' folder -2. Create an 'org/devgeeks' folder under 'src' and add the PhoneListener.java file to it -3. Add the PhoneListener.js to your html file. eg: `` -4. Add the plugin to the 'res/xml/plugins.xml' file. eg: `` -5. Make sure you have allowed the permission 'READ_PHONE_STATE' in your 'AndroidManifest.xml. eg: `` - -### Example -```javascript -function onDeviceReady() -{ - PhoneListener.start(onPhoneStateChanged,onError); - // or... - // PhoneListener.stop(onSuccess,onError); -} - -function onPhoneStateChanged(phoneState) -{ - switch (phoneState) { - case "RINGING": - console.log('Phone is ringing.'); - break; - case "OFFHOOK": - console.log('Phone is off the hook.'); - break; - case "IDLE": - console.log('Phone has returned to the idle state.'); - break; - default: - // no default... - } -} - -function onError(error) { - // do something... -} -function onSuccess() { - // do something else... -} -``` - -## License - -The MIT License - -Copyright (c) 2011 Tommy-Carlos Williams (github.com/devgeeks) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +This plugin has been moved to [http://github.com/devgeeks/PhoneListener](http://github.com/devgeeks/PhoneListener) diff --git a/Android/PowerManagement/README.md b/Android/PowerManagement/README.md index 1c36035e..59e34fff 100644 --- a/Android/PowerManagement/README.md +++ b/Android/PowerManagement/README.md @@ -1,6 +1,6 @@ PowerManagement =============== -Plugin for Cordova (1.6+) +Plugin for Cordova (2.0+) The PowerManagement plugin offers access to the devices power-management functionality. It should be used for applications which keep running for a long time without any user interaction. @@ -8,29 +8,43 @@ It should be used for applications which keep running for a long time without an For details on power functionality see: * Android: [PowerManager](http://developer.android.com/reference/android/os/PowerManager.html) -* iOS: [idleTimerDisabled](http://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/Reference/Reference.html#//apple_ref/occ/instp/UIApplication/idleTimerDisabled) -Platforms +Installation --------- -Currently available on: +Copy the **PowerManagement.java** file to your *src/org/apache/cordova/plugin* directory. -### Android -Copy the *PowerManagement.java* file to your *src/* directory. +Copy the **powermanagement.js** file to your *assets/www/js* directory. -Edit your *AndroidManifest.xml* and add the following permission: +Edit your **AndroidManifest.xml** and add the following permission: `` -In addition you have to edit your *res/xml/plugins.xml* file to let Cordova know about the plugin: +Edit your **res/xml/config.xml** and add the following plugin: `` -### iOS -Copy the *PowerManagement.h* and *PowerManagement.m* files to your projects "Plugins" folder. +Usage +--------- + +Add this script tag to your **index.html** file, *after* calling your Cordova .js file: +`` + +Add the following code to your app's .js file, inside the function called by [deviceready](http://docs.phonegap.com/en/2.0.0/cordova_events_events.md.html#deviceready): +
+var powerman = window.plugins.powerManagement;
+
-Add the PowerManagement plugin to the *Cordova.plist* file (to the Plugins list). Both Key and Value are "PowerManagement". +There are three available methods to call: +
powerman.acquire(successCallback, failureCallback)
+Acquires a 'wake-lock', preventing the device screen from going to sleep. + +
powerman.dim(successCallback, failureCallback)
+Acquires a partial 'wake-lock', allowing the screen to dim but preventing the device from going to sleep. + +
powerman.release(successCallback, failureCallback)
+Release an acquired 'wake-lock'. Device able to sleep again. License -======= +--------- Copyright (C) 2011-2012 Wolfgang Koller This file is part of GOFG Sports Computer - http://www.gofg.at/. diff --git a/Android/PowerManagement/assets/www/cordova-2.0.0.js b/Android/PowerManagement/assets/www/cordova-2.0.0.js new file mode 100644 index 00000000..ba9e6a9f --- /dev/null +++ b/Android/PowerManagement/assets/www/cordova-2.0.0.js @@ -0,0 +1,5724 @@ +// commit 114cf5304a74ff8f7c9ff1d21cf5652298af04b0 + +// File generated at :: Wed Jul 18 2012 14:44:33 GMT-0700 (PDT) + +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. +*/ + +;(function() { + +// file: lib/scripts/require.js +var require, + define; + +(function () { + var modules = {}; + + function build(module) { + var factory = module.factory; + module.exports = {}; + delete module.factory; + factory(require, module.exports, module); + return module.exports; + } + + require = function (id) { + if (!modules[id]) { + throw "module " + id + " not found"; + } + return modules[id].factory ? build(modules[id]) : modules[id].exports; + }; + + define = function (id, factory) { + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; + }; + + define.remove = function (id) { + delete modules[id]; + }; + +})(); + +//Export for use in node +if (typeof module === "object" && typeof require === "function") { + module.exports.require = require; + module.exports.define = define; +} +// file: lib/cordova.js +define("cordova", function(require, exports, module) { +var channel = require('cordova/channel'); + +/** + * Listen for DOMContentLoaded and notify our channel subscribers. + */ +document.addEventListener('DOMContentLoaded', function() { + channel.onDOMContentLoaded.fire(); +}, false); +if (document.readyState == 'complete' || document.readyState == 'interactive') { + channel.onDOMContentLoaded.fire(); +} + +/** + * Intercept calls to addEventListener + removeEventListener and handle deviceready, + * resume, and pause events. + */ +var m_document_addEventListener = document.addEventListener; +var m_document_removeEventListener = document.removeEventListener; +var m_window_addEventListener = window.addEventListener; +var m_window_removeEventListener = window.removeEventListener; + +/** + * Houses custom event handlers to intercept on document + window event listeners. + */ +var documentEventHandlers = {}, + windowEventHandlers = {}; + +document.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof documentEventHandlers[e] != 'undefined') { + if (evt === 'deviceready') { + documentEventHandlers[e].subscribeOnce(handler); + } else { + documentEventHandlers[e].subscribe(handler); + } + } else { + m_document_addEventListener.call(document, evt, handler, capture); + } +}; + +window.addEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + if (typeof windowEventHandlers[e] != 'undefined') { + windowEventHandlers[e].subscribe(handler); + } else { + m_window_addEventListener.call(window, evt, handler, capture); + } +}; + +document.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof documentEventHandlers[e] != "undefined") { + documentEventHandlers[e].unsubscribe(handler); + } else { + m_document_removeEventListener.call(document, evt, handler, capture); + } +}; + +window.removeEventListener = function(evt, handler, capture) { + var e = evt.toLowerCase(); + // If unsubcribing from an event that is handled by a plugin + if (typeof windowEventHandlers[e] != "undefined") { + windowEventHandlers[e].unsubscribe(handler); + } else { + m_window_removeEventListener.call(window, evt, handler, capture); + } +}; + +function createEvent(type, data) { + var event = document.createEvent('Events'); + event.initEvent(type, false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + } + return event; +} + +if(typeof window.console === "undefined") { + window.console = { + log:function(){} + }; +} + +var cordova = { + define:define, + require:require, + /** + * Methods to add/remove your own addEventListener hijacking on document + window. + */ + addWindowEventHandler:function(event, opts) { + return (windowEventHandlers[event] = channel.create(event, opts)); + }, + addDocumentEventHandler:function(event, opts) { + return (documentEventHandlers[event] = channel.create(event, opts)); + }, + removeWindowEventHandler:function(event) { + delete windowEventHandlers[event]; + }, + removeDocumentEventHandler:function(event) { + delete documentEventHandlers[event]; + }, + /** + * Retreive original event handlers that were replaced by Cordova + * + * @return object + */ + getOriginalHandlers: function() { + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + }, + /** + * Method to fire event from native code + */ + fireDocumentEvent: function(type, data) { + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + setTimeout(function() { + documentEventHandlers[type].fire(evt); + }, 0); + } else { + document.dispatchEvent(evt); + } + }, + fireWindowEvent: function(type, data) { + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } + }, + // TODO: this is Android only; think about how to do this better + shuttingDown:false, + UsePolling:false, + // END TODO + + // TODO: iOS only + // This queue holds the currently executing command and all pending + // commands executed with cordova.exec(). + commandQueue:[], + // Indicates if we're currently in the middle of flushing the command + // queue on the native side. + commandQueueFlushing:false, + // END TODO + /** + * Plugin callback mechanism. + */ + callbackId: 0, + callbacks: {}, + callbackStatus: { + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 + }, + + /** + * Called by native code when returning successful result from an action. + * + * @param callbackId + * @param args + */ + callbackSuccess: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + + // If result is to be sent to callback + if (args.status == cordova.callbackStatus.OK) { + try { + if (cordova.callbacks[callbackId].success) { + cordova.callbacks[callbackId].success(args.message); + } + } + catch (e) { + console.log("Error in success callback: "+callbackId+" = "+e); + } + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + + /** + * Called by native code when returning error result from an action. + * + * @param callbackId + * @param args + */ + callbackError: function(callbackId, args) { + if (cordova.callbacks[callbackId]) { + try { + if (cordova.callbacks[callbackId].fail) { + cordova.callbacks[callbackId].fail(args.message); + } + } + catch (e) { + console.log("Error in error callback: "+callbackId+" = "+e); + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + }, + addConstructor: function(func) { + channel.onCordovaReady.subscribeOnce(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); + } +}; + +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready'); + +module.exports = cordova; + +}); + +// file: lib/common/builder.js +define("cordova/builder", function(require, exports, module) { +var utils = require('cordova/utils'); + +function each(objects, func, context) { + for (var prop in objects) { + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } + } +} + +function include(parent, objects, clobber, merge) { + each(objects, function (obj, key) { + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + parent[key] = result; + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + parent[key] = result; + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + parent[key] = result; + } else if (merge && typeof obj.path !== 'undefined') { + // If merging, merge parent onto result + recursiveMerge(result, parent[key]); + parent[key] = result; + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); + } + }); +} + +/** + * Merge properties from one object onto another recursively. Properties from + * the src object will overwrite existing target property. + * + * @param target Object to merge properties into. + * @param src Object to merge properties from. + */ +function recursiveMerge(target, src) { + for (var prop in src) { + if (src.hasOwnProperty(prop)) { + if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + target.prototype[prop] = src[prop]; + } else { + target[prop] = typeof src[prop] === 'object' ? recursiveMerge( + target[prop], src[prop]) : src[prop]; + } + } + } + return target; +} + +module.exports = { + build: function (objects) { + return { + intoButDontClobber: function (target) { + include(target, objects, false, false); + }, + intoAndClobber: function(target) { + include(target, objects, true, false); + }, + intoAndMerge: function(target) { + include(target, objects, true, true); + } + }; + } +}; + +}); + +// file: lib/common/channel.js +define("cordova/channel", function(require, exports, module) { +var utils = require('cordova/utils'); + +/** + * Custom pub-sub "channel" that can have functions subscribed to it + * This object is used to define and control firing of events for + * cordova initialization. + * + * The order of events during page load and Cordova startup is as follows: + * + * onDOMContentLoaded Internal event that is received when the web page is loaded and parsed. + * onNativeReady Internal event that indicates the Cordova native side is ready. + * onCordovaReady Internal event fired when all Cordova JavaScript objects have been created. + * onCordovaInfoReady Internal event fired when device properties are available. + * onCordovaConnectionReady Internal event fired when the connection property has been set. + * onDeviceReady User event fired to indicate that Cordova is ready + * onResume User event fired to indicate a start/resume lifecycle event + * onPause User event fired to indicate a pause lifecycle event + * onDestroy Internal event fired when app is being destroyed (User should use window.onunload event, not this one). + * + * The only Cordova events that user code should register for are: + * deviceready Cordova native code is initialized and Cordova APIs can be called from JavaScript + * pause App has moved to background + * resume App has returned to foreground + * + * Listeners can be registered as: + * document.addEventListener("deviceready", myDeviceReadyListener, false); + * document.addEventListener("resume", myResumeListener, false); + * document.addEventListener("pause", myPauseListener, false); + * + * The DOM lifecycle events should be used for saving and restoring state + * window.onload + * window.onunload + * + */ + +/** + * Channel + * @constructor + * @param type String the channel name + * @param opts Object options to pass into the channel, currently + * supports: + * onSubscribe: callback that fires when + * something subscribes to the Channel. Sets + * context to the Channel. + * onUnsubscribe: callback that fires when + * something unsubscribes to the Channel. Sets + * context to the Channel. + */ +var Channel = function(type, opts) { + this.type = type; + this.handlers = {}; + this.numHandlers = 0; + this.guid = 1; + this.fired = false; + this.enabled = true; + this.events = { + onSubscribe:null, + onUnsubscribe:null + }; + if (opts) { + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + } +}, + channel = { + /** + * Calls the provided function only after all of the channels specified + * have been fired. + */ + join: function (h, c) { + var i = c.length; + var len = i; + var f = function() { + if (!(--i)) h(); + }; + for (var j=0; j 0) { + var v = JSON.parse(r); + + // If status is OK, then return value back to caller + if (v.status === cordova.callbackStatus.OK) { + + // If there is a success callback, then call it now with + // returned value + if (success) { + try { + success(v.message); + } catch (e) { + console.log("Error in success callback: " + callbackId + " = " + e); + } + + // Clear callback if not expecting any more results + if (!v.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + return v.message; + } + + // If no result + else if (v.status === cordova.callbackStatus.NO_RESULT) { + // Clear callback if not expecting any more results + if (!v.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + + // If error, then display error + else { + console.log("Error: Status="+v.status+" Message="+v.message); + + // If there is a fail callback, then call it now with returned value + if (fail) { + try { + fail(v.message); + } + catch (e1) { + console.log("Error in error callback: "+callbackId+" = "+e1); + } + + // Clear callback if not expecting any more results + if (!v.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } + return null; + } + } + } catch (e2) { + console.log("Error: "+e2); + } +}; + +}); + +// file: lib/android/platform.js +define("cordova/platform", function(require, exports, module) { +module.exports = { + id: "android", + initialize:function() { + var channel = require("cordova/channel"), + cordova = require('cordova'), + callback = require('cordova/plugin/android/callback'), + polling = require('cordova/plugin/android/polling'), + exec = require('cordova/exec'); + + channel.onDestroy.subscribe(function() { + cordova.shuttingDown = true; + }); + + // Start listening for XHR callbacks + // Figure out which bridge approach will work on this Android + // device: polling or XHR-based callbacks + setTimeout(function() { + if (cordova.UsePolling) { + polling(); + } + else { + var isPolling = prompt("usePolling", "gap_callbackServer:"); + cordova.UsePolling = isPolling; + if (isPolling == "true") { + cordova.UsePolling = true; + polling(); + } else { + cordova.UsePolling = false; + callback(); + } + } + }, 1); + + // Inject a listener for the backbutton on the document. + var backButtonChannel = cordova.addDocumentEventHandler('backbutton', { + onSubscribe:function() { + // If we just attached the first handler, let native know we need to override the back button. + if (this.numHandlers === 1) { + exec(null, null, "App", "overrideBackbutton", [true]); + } + }, + onUnsubscribe:function() { + // If we just detached the last handler, let native know we no longer override the back button. + if (this.numHandlers === 0) { + exec(null, null, "App", "overrideBackbutton", [false]); + } + } + }); + + // Add hardware MENU and SEARCH button handlers + cordova.addDocumentEventHandler('menubutton'); + cordova.addDocumentEventHandler('searchbutton'); + + // Figure out if we need to shim-in localStorage and WebSQL + // support from the native side. + var storage = require('cordova/plugin/android/storage'); + + // First patch WebSQL if necessary + if (typeof window.openDatabase == 'undefined') { + // Not defined, create an openDatabase function for all to use! + window.openDatabase = storage.openDatabase; + } else { + // Defined, but some Android devices will throw a SECURITY_ERR - + // so we wrap the whole thing in a try-catch and shim in our own + // if the device has Android bug 16175. + var originalOpenDatabase = window.openDatabase; + window.openDatabase = function(name, version, desc, size) { + var db = null; + try { + db = originalOpenDatabase(name, version, desc, size); + } + catch (ex) { + if (ex.code === 18) { + db = null; + } else { + throw ex; + } + } + + if (db === null) { + return storage.openDatabase(name, version, desc, size); + } + else { + return db; + } + + }; + } + + // Patch localStorage if necessary + if (typeof window.localStorage == 'undefined' || window.localStorage === null) { + window.localStorage = new storage.CupcakeLocalStorage(); + } + + // Let native code know we are all done on the JS side. + // Native code will then un-hide the WebView. + channel.join(function() { + exec(null, null, "App", "show", []); + }, [channel.onCordovaReady]); + }, + objects: { + cordova: { + children: { + JSCallback:{ + path:"cordova/plugin/android/callback" + }, + JSCallbackPolling:{ + path:"cordova/plugin/android/polling" + } + } + }, + navigator: { + children: { + app:{ + path: "cordova/plugin/android/app" + } + } + }, + File: { // exists natively on Android WebView, override + path: "cordova/plugin/File" + }, + FileReader: { // exists natively on Android WebView, override + path: "cordova/plugin/FileReader" + }, + FileError: { //exists natively on Android WebView on Android 4.x + path: "cordova/plugin/FileError" + }, + MediaError: { // exists natively on Android WebView on Android 4.x + path: "cordova/plugin/MediaError" + } + }, + merges: { + device: { + path: 'cordova/plugin/android/device' + }, + navigator: { + children: { + notification: { + path: 'cordova/plugin/android/notification' + } + } + } + } +}; + +}); + +// file: lib/common/plugin/Acceleration.js +define("cordova/plugin/Acceleration", function(require, exports, module) { +var Acceleration = function(x, y, z, timestamp) { + this.x = x; + this.y = y; + this.z = z; + this.timestamp = timestamp || (new Date()).getTime(); +}; + +module.exports = Acceleration; + +}); + +// file: lib/common/plugin/Camera.js +define("cordova/plugin/Camera", function(require, exports, module) { +var exec = require('cordova/exec'), + Camera = require('cordova/plugin/CameraConstants'); + +var cameraExport = {}; + +// Tack on the Camera Constants to the base camera plugin. +for (var key in Camera) { + cameraExport[key] = Camera[key]; +} + +/** + * Gets a picture from source defined by "options.sourceType", and returns the + * image as defined by the "options.destinationType" option. + + * The defaults are sourceType=CAMERA and destinationType=FILE_URI. + * + * @param {Function} successCallback + * @param {Function} errorCallback + * @param {Object} options + */ +cameraExport.getPicture = function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback != "function") { + console.log("Camera Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback != "function")) { + console.log("Camera Error: errorCallback is not a function"); + return; + } + + var quality = 50; + if (options && typeof options.quality == "number") { + quality = options.quality; + } else if (options && typeof options.quality == "string") { + var qlity = parseInt(options.quality, 10); + if (isNaN(qlity) === false) { + quality = qlity.valueOf(); + } + } + + var destinationType = Camera.DestinationType.FILE_URI; + if (typeof options.destinationType == "number") { + destinationType = options.destinationType; + } + + var sourceType = Camera.PictureSourceType.CAMERA; + if (typeof options.sourceType == "number") { + sourceType = options.sourceType; + } + + var targetWidth = -1; + if (typeof options.targetWidth == "number") { + targetWidth = options.targetWidth; + } else if (typeof options.targetWidth == "string") { + var width = parseInt(options.targetWidth, 10); + if (isNaN(width) === false) { + targetWidth = width.valueOf(); + } + } + + var targetHeight = -1; + if (typeof options.targetHeight == "number") { + targetHeight = options.targetHeight; + } else if (typeof options.targetHeight == "string") { + var height = parseInt(options.targetHeight, 10); + if (isNaN(height) === false) { + targetHeight = height.valueOf(); + } + } + + var encodingType = Camera.EncodingType.JPEG; + if (typeof options.encodingType == "number") { + encodingType = options.encodingType; + } + + var mediaType = Camera.MediaType.PICTURE; + if (typeof options.mediaType == "number") { + mediaType = options.mediaType; + } + var allowEdit = false; + if (typeof options.allowEdit == "boolean") { + allowEdit = options.allowEdit; + } else if (typeof options.allowEdit == "number") { + allowEdit = options.allowEdit <= 0 ? false : true; + } + var correctOrientation = false; + if (typeof options.correctOrientation == "boolean") { + correctOrientation = options.correctOrientation; + } else if (typeof options.correctOrientation == "number") { + correctOrientation = options.correctOrientation <=0 ? false : true; + } + var saveToPhotoAlbum = false; + if (typeof options.saveToPhotoAlbum == "boolean") { + saveToPhotoAlbum = options.saveToPhotoAlbum; + } else if (typeof options.saveToPhotoAlbum == "number") { + saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true; + } + var popoverOptions = null; + if (typeof options.popoverOptions == "object") { + popoverOptions = options.popoverOptions; + } + + var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, + mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions]; + + exec(successCallback, errorCallback, "Camera", "takePicture", args); +}; + +cameraExport.cleanup = function(successCallback, errorCallback) { + exec(successCallback, errorCallback, "Camera", "cleanup", []); +}; + +module.exports = cameraExport; +}); + +// file: lib/common/plugin/CameraConstants.js +define("cordova/plugin/CameraConstants", function(require, exports, module) { +module.exports = { + DestinationType:{ + DATA_URL: 0, // Return base64 encoded string + FILE_URI: 1 // Return file uri (content://media/external/images/media/2 for Android) + }, + EncodingType:{ + JPEG: 0, // Return JPEG encoded image + PNG: 1 // Return PNG encoded image + }, + MediaType:{ + PICTURE: 0, // allow selection of still pictures only. DEFAULT. Will return format specified via DestinationType + VIDEO: 1, // allow selection of video only, ONLY RETURNS URL + ALLMEDIA : 2 // allow selection from all media types + }, + PictureSourceType:{ + PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android) + CAMERA : 1, // Take picture from camera + SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android) + }, + PopoverArrowDirection:{ + ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants to specify arrow location on popover + ARROW_DOWN : 2, + ARROW_LEFT : 4, + ARROW_RIGHT : 8, + ARROW_ANY : 15 + } +}; +}); + +// file: lib/common/plugin/CameraPopoverOptions.js +define("cordova/plugin/CameraPopoverOptions", function(require, exports, module) { +var Camera = require('cordova/plugin/CameraConstants'); + +/** + * Encapsulates options for iOS Popover image picker + */ +var CameraPopoverOptions = function(x,y,width,height,arrowDir){ + // information of rectangle that popover should be anchored to + this.x = x || 0; + this.y = y || 32; + this.width = width || 320; + this.height = height || 480; + // The direction of the popover arrow + this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY; +}; + +module.exports = CameraPopoverOptions; +}); + +// file: lib/common/plugin/CaptureAudioOptions.js +define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) { +/** + * Encapsulates all audio capture operation configuration options. + */ +var CaptureAudioOptions = function(){ + // Upper limit of sound clips user can record. Value must be equal or greater than 1. + this.limit = 1; + // Maximum duration of a single sound clip in seconds. + this.duration = 0; + // The selected audio mode. Must match with one of the elements in supportedAudioModes array. + this.mode = null; +}; + +module.exports = CaptureAudioOptions; +}); + +// file: lib/common/plugin/CaptureError.js +define("cordova/plugin/CaptureError", function(require, exports, module) { +/** + * The CaptureError interface encapsulates all errors in the Capture API. + */ +var CaptureError = function(c) { + this.code = c || null; +}; + +// Camera or microphone failed to capture image or sound. +CaptureError.CAPTURE_INTERNAL_ERR = 0; +// Camera application or audio capture application is currently serving other capture request. +CaptureError.CAPTURE_APPLICATION_BUSY = 1; +// Invalid use of the API (e.g. limit parameter has value less than one). +CaptureError.CAPTURE_INVALID_ARGUMENT = 2; +// User exited camera application or audio capture application before capturing anything. +CaptureError.CAPTURE_NO_MEDIA_FILES = 3; +// The requested capture operation is not supported. +CaptureError.CAPTURE_NOT_SUPPORTED = 20; + +module.exports = CaptureError; +}); + +// file: lib/common/plugin/CaptureImageOptions.js +define("cordova/plugin/CaptureImageOptions", function(require, exports, module) { +/** + * Encapsulates all image capture operation configuration options. + */ +var CaptureImageOptions = function(){ + // Upper limit of images user can take. Value must be equal or greater than 1. + this.limit = 1; + // The selected image mode. Must match with one of the elements in supportedImageModes array. + this.mode = null; +}; + +module.exports = CaptureImageOptions; +}); + +// file: lib/common/plugin/CaptureVideoOptions.js +define("cordova/plugin/CaptureVideoOptions", function(require, exports, module) { +/** + * Encapsulates all video capture operation configuration options. + */ +var CaptureVideoOptions = function(){ + // Upper limit of videos user can record. Value must be equal or greater than 1. + this.limit = 1; + // Maximum duration of a single video clip in seconds. + this.duration = 0; + // The selected video mode. Must match with one of the elements in supportedVideoModes array. + this.mode = null; +}; + +module.exports = CaptureVideoOptions; +}); + +// file: lib/common/plugin/CompassError.js +define("cordova/plugin/CompassError", function(require, exports, module) { +/** + * CompassError. + * An error code assigned by an implementation when an error has occured + * @constructor + */ +var CompassError = function(err) { + this.code = (err !== undefined ? err : null); +}; + +CompassError.COMPASS_INTERNAL_ERR = 0; +CompassError.COMPASS_NOT_SUPPORTED = 20; + +module.exports = CompassError; +}); + +// file: lib/common/plugin/CompassHeading.js +define("cordova/plugin/CompassHeading", function(require, exports, module) { +var CompassHeading = function(magneticHeading, trueHeading, headingAccuracy, timestamp) { + this.magneticHeading = (magneticHeading !== undefined ? magneticHeading : null); + this.trueHeading = (trueHeading !== undefined ? trueHeading : null); + this.headingAccuracy = (headingAccuracy !== undefined ? headingAccuracy : null); + this.timestamp = (timestamp !== undefined ? timestamp : new Date().getTime()); +}; + +module.exports = CompassHeading; +}); + +// file: lib/common/plugin/ConfigurationData.js +define("cordova/plugin/ConfigurationData", function(require, exports, module) { +/** + * Encapsulates a set of parameters that the capture device supports. + */ +function ConfigurationData() { + // The ASCII-encoded string in lower case representing the media type. + this.type = null; + // The height attribute represents height of the image or video in pixels. + // In the case of a sound clip this attribute has value 0. + this.height = 0; + // The width attribute represents width of the image or video in pixels. + // In the case of a sound clip this attribute has value 0 + this.width = 0; +} + +module.exports = ConfigurationData; +}); + +// file: lib/common/plugin/Connection.js +define("cordova/plugin/Connection", function(require, exports, module) { +/** + * Network status + */ +module.exports = { + UNKNOWN: "unknown", + ETHERNET: "ethernet", + WIFI: "wifi", + CELL_2G: "2g", + CELL_3G: "3g", + CELL_4G: "4g", + NONE: "none" +}; +}); + +// file: lib/common/plugin/Contact.js +define("cordova/plugin/Contact", function(require, exports, module) { +var exec = require('cordova/exec'), + ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'); + +/** +* Converts primitives into Complex Object +* Currently only used for Date fields +*/ +function convertIn(contact) { + var value = contact.birthday; + try { + contact.birthday = new Date(parseFloat(value)); + } catch (exception){ + console.log("Cordova Contact convertIn error: exception creating date."); + } + return contact; +} + +/** +* Converts Complex objects into primitives +* Only conversion at present is for Dates. +**/ + +function convertOut(contact) { + var value = contact.birthday; + if (value !== null) { + // try to make it a Date object if it is not already + if (!utils.isDate(value)){ + try { + value = new Date(value); + } catch(exception){ + value = null; + } + } + if (utils.isDate(value)){ + value = value.valueOf(); // convert to milliseconds + } + contact.birthday = value; + } + return contact; +} + +/** +* Contains information about a single contact. +* @constructor +* @param {DOMString} id unique identifier +* @param {DOMString} displayName +* @param {ContactName} name +* @param {DOMString} nickname +* @param {Array.} phoneNumbers array of phone numbers +* @param {Array.} emails array of email addresses +* @param {Array.} addresses array of addresses +* @param {Array.} ims instant messaging user ids +* @param {Array.} organizations +* @param {DOMString} birthday contact's birthday +* @param {DOMString} note user notes about contact +* @param {Array.} photos +* @param {Array.} categories +* @param {Array.} urls contact's web sites +*/ +var Contact = function (id, displayName, name, nickname, phoneNumbers, emails, addresses, + ims, organizations, birthday, note, photos, categories, urls) { + this.id = id || null; + this.rawId = null; + this.displayName = displayName || null; + this.name = name || null; // ContactName + this.nickname = nickname || null; + this.phoneNumbers = phoneNumbers || null; // ContactField[] + this.emails = emails || null; // ContactField[] + this.addresses = addresses || null; // ContactAddress[] + this.ims = ims || null; // ContactField[] + this.organizations = organizations || null; // ContactOrganization[] + this.birthday = birthday || null; + this.note = note || null; + this.photos = photos || null; // ContactField[] + this.categories = categories || null; // ContactField[] + this.urls = urls || null; // ContactField[] +}; + +/** +* Removes contact from device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.remove = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + if (this.id === null) { + fail(ContactError.UNKNOWN_ERROR); + } + else { + exec(successCB, fail, "Contacts", "remove", [this.id]); + } +}; + +/** +* Creates a deep copy of this Contact. +* With the contact ID set to null. +* @return copy of this Contact +*/ +Contact.prototype.clone = function() { + var clonedContact = utils.clone(this); + var i; + clonedContact.id = null; + clonedContact.rawId = null; + // Loop through and clear out any id's in phones, emails, etc. + if (clonedContact.phoneNumbers) { + for (i = 0; i < clonedContact.phoneNumbers.length; i++) { + clonedContact.phoneNumbers[i].id = null; + } + } + if (clonedContact.emails) { + for (i = 0; i < clonedContact.emails.length; i++) { + clonedContact.emails[i].id = null; + } + } + if (clonedContact.addresses) { + for (i = 0; i < clonedContact.addresses.length; i++) { + clonedContact.addresses[i].id = null; + } + } + if (clonedContact.ims) { + for (i = 0; i < clonedContact.ims.length; i++) { + clonedContact.ims[i].id = null; + } + } + if (clonedContact.organizations) { + for (i = 0; i < clonedContact.organizations.length; i++) { + clonedContact.organizations[i].id = null; + } + } + if (clonedContact.categories) { + for (i = 0; i < clonedContact.categories.length; i++) { + clonedContact.categories[i].id = null; + } + } + if (clonedContact.photos) { + for (i = 0; i < clonedContact.photos.length; i++) { + clonedContact.photos[i].id = null; + } + } + if (clonedContact.urls) { + for (i = 0; i < clonedContact.urls.length; i++) { + clonedContact.urls[i].id = null; + } + } + return clonedContact; +}; + +/** +* Persists contact to device storage. +* @param successCB success callback +* @param errorCB error callback +*/ +Contact.prototype.save = function(successCB, errorCB) { + var fail = function(code) { + errorCB(new ContactError(code)); + }; + var success = function(result) { + if (result) { + if (typeof successCB === 'function') { + var fullContact = require('cordova/plugin/contacts').create(result); + successCB(convertIn(fullContact)); + } + } + else { + // no Entry object returned + fail(ContactError.UNKNOWN_ERROR); + } + }; + var dupContact = convertOut(utils.clone(this)); + exec(success, fail, "Contacts", "save", [dupContact]); +}; + + +module.exports = Contact; + +}); + +// file: lib/common/plugin/ContactAddress.js +define("cordova/plugin/ContactAddress", function(require, exports, module) { +/** +* Contact address. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code +* @param formatted // NOTE: not a W3C standard +* @param streetAddress +* @param locality +* @param region +* @param postalCode +* @param country +*/ + +var ContactAddress = function(pref, type, formatted, streetAddress, locality, region, postalCode, country) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.formatted = formatted || null; + this.streetAddress = streetAddress || null; + this.locality = locality || null; + this.region = region || null; + this.postalCode = postalCode || null; + this.country = country || null; +}; + +module.exports = ContactAddress; +}); + +// file: lib/common/plugin/ContactError.js +define("cordova/plugin/ContactError", function(require, exports, module) { +/** + * ContactError. + * An error code assigned by an implementation when an error has occured + * @constructor + */ +var ContactError = function(err) { + this.code = (typeof err != 'undefined' ? err : null); +}; + +/** + * Error codes + */ +ContactError.UNKNOWN_ERROR = 0; +ContactError.INVALID_ARGUMENT_ERROR = 1; +ContactError.TIMEOUT_ERROR = 2; +ContactError.PENDING_OPERATION_ERROR = 3; +ContactError.IO_ERROR = 4; +ContactError.NOT_SUPPORTED_ERROR = 5; +ContactError.PERMISSION_DENIED_ERROR = 20; + +module.exports = ContactError; +}); + +// file: lib/common/plugin/ContactField.js +define("cordova/plugin/ContactField", function(require, exports, module) { +/** +* Generic contact field. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param type +* @param value +* @param pref +*/ +var ContactField = function(type, value, pref) { + this.id = null; + this.type = (type && type.toString()) || null; + this.value = (value && value.toString()) || null; + this.pref = (typeof pref != 'undefined' ? pref : false); +}; + +module.exports = ContactField; +}); + +// file: lib/common/plugin/ContactFindOptions.js +define("cordova/plugin/ContactFindOptions", function(require, exports, module) { +/** + * ContactFindOptions. + * @constructor + * @param filter used to match contacts against + * @param multiple boolean used to determine if more than one contact should be returned + */ + +var ContactFindOptions = function(filter, multiple) { + this.filter = filter || ''; + this.multiple = (typeof multiple != 'undefined' ? multiple : false); +}; + +module.exports = ContactFindOptions; +}); + +// file: lib/common/plugin/ContactName.js +define("cordova/plugin/ContactName", function(require, exports, module) { +/** +* Contact name. +* @constructor +* @param formatted // NOTE: not part of W3C standard +* @param familyName +* @param givenName +* @param middle +* @param prefix +* @param suffix +*/ +var ContactName = function(formatted, familyName, givenName, middle, prefix, suffix) { + this.formatted = formatted || null; + this.familyName = familyName || null; + this.givenName = givenName || null; + this.middleName = middle || null; + this.honorificPrefix = prefix || null; + this.honorificSuffix = suffix || null; +}; + +module.exports = ContactName; +}); + +// file: lib/common/plugin/ContactOrganization.js +define("cordova/plugin/ContactOrganization", function(require, exports, module) { +/** +* Contact organization. +* @constructor +* @param {DOMString} id unique identifier, should only be set by native code // NOTE: not a W3C standard +* @param name +* @param dept +* @param title +* @param startDate +* @param endDate +* @param location +* @param desc +*/ + +var ContactOrganization = function(pref, type, name, dept, title) { + this.id = null; + this.pref = (typeof pref != 'undefined' ? pref : false); + this.type = type || null; + this.name = name || null; + this.department = dept || null; + this.title = title || null; +}; + +module.exports = ContactOrganization; +}); + +// file: lib/common/plugin/Coordinates.js +define("cordova/plugin/Coordinates", function(require, exports, module) { +/** + * This class contains position information. + * @param {Object} lat + * @param {Object} lng + * @param {Object} alt + * @param {Object} acc + * @param {Object} head + * @param {Object} vel + * @param {Object} altacc + * @constructor + */ +var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { + /** + * The latitude of the position. + */ + this.latitude = lat; + /** + * The longitude of the position, + */ + this.longitude = lng; + /** + * The accuracy of the position. + */ + this.accuracy = acc; + /** + * The altitude of the position. + */ + this.altitude = (alt !== undefined ? alt : null); + /** + * The direction the device is moving at the position. + */ + this.heading = (head !== undefined ? head : null); + /** + * The velocity with which the device is moving at the position. + */ + this.speed = (vel !== undefined ? vel : null); + + if (this.speed === 0 || this.speed === null) { + this.heading = NaN; + } + + /** + * The altitude accuracy of the position. + */ + this.altitudeAccuracy = (altacc !== undefined) ? altacc : null; +}; + +module.exports = Coordinates; + +}); + +// file: lib/common/plugin/DirectoryEntry.js +define("cordova/plugin/DirectoryEntry", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + Entry = require('cordova/plugin/Entry'), + FileError = require('cordova/plugin/FileError'), + DirectoryReader = require('cordova/plugin/DirectoryReader'); + +/** + * An interface representing a directory on the file system. + * + * {boolean} isFile always false (readonly) + * {boolean} isDirectory always true (readonly) + * {DOMString} name of the directory, excluding the path leading to it (readonly) + * {DOMString} fullPath the absolute full path to the directory (readonly) + * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly) + */ +var DirectoryEntry = function(name, fullPath) { + DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]); +}; + +utils.extend(DirectoryEntry, Entry); + +/** + * Creates a new DirectoryReader to read entries from this directory + */ +DirectoryEntry.prototype.createReader = function() { + return new DirectoryReader(this.fullPath); +}; + +/** + * Creates or looks up a directory + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a directory + * @param {Flags} options to create or excluively create the directory + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getDirectory = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var entry = new DirectoryEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getDirectory", [this.fullPath, path, options]); +}; + +/** + * Deletes a directory and all of it's contents + * + * @param {Function} successCallback is called with no parameters + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.removeRecursively = function(successCallback, errorCallback) { + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(successCallback, fail, "File", "removeRecursively", [this.fullPath]); +}; + +/** + * Creates or looks up a file + * + * @param {DOMString} path either a relative or absolute path from this directory in which to look up or create a file + * @param {Flags} options to create or excluively create the file + * @param {Function} successCallback is called with the new entry + * @param {Function} errorCallback is called with a FileError + */ +DirectoryEntry.prototype.getFile = function(path, options, successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var FileEntry = require('cordova/plugin/FileEntry'); + var entry = new FileEntry(result.name, result.fullPath); + successCallback(entry); + }; + var fail = typeof errorCallback !== 'function' ? null : function(code) { + errorCallback(new FileError(code)); + }; + exec(win, fail, "File", "getFile", [this.fullPath, path, options]); +}; + +module.exports = DirectoryEntry; + +}); + +// file: lib/common/plugin/DirectoryReader.js +define("cordova/plugin/DirectoryReader", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError') ; + +/** + * An interface that lists the files and directories in a directory. + */ +function DirectoryReader(path) { + this.path = path || null; +} + +/** + * Returns a list of entries from a directory. + * + * @param {Function} successCallback is called with a list of entries + * @param {Function} errorCallback is called with a FileError + */ +DirectoryReader.prototype.readEntries = function(successCallback, errorCallback) { + var win = typeof successCallback !== 'function' ? null : function(result) { + var retVal = []; + for (var i=0; i][;base64], + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsDataURL = function(file) { + this.fileName = ""; + if (typeof file.fullPath === "undefined") { + this.fileName = file; + } else { + this.fileName = file.fullPath; + } + + // Already loading something + if (this.readyState == FileReader.LOADING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // LOADING state + this.readyState = FileReader.LOADING; + + // If loadstart callback + if (typeof this.onloadstart === "function") { + this.onloadstart(new ProgressEvent("loadstart", {target:this})); + } + + var me = this; + + // Read file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + // Save result + me.result = r; + + // If onload callback + if (typeof me.onload === "function") { + me.onload(new ProgressEvent("load", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + me.result = null; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, "File", "readAsDataURL", [this.fileName]); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsBinaryString = function(file) { + // TODO - Can't return binary data to browser. + console.log('method "readAsBinaryString" is not supported at this time.'); +}; + +/** + * Read file and return data as a binary data. + * + * @param file {File} File object containing file properties + */ +FileReader.prototype.readAsArrayBuffer = function(file) { + // TODO - Can't return binary data to browser. + console.log('This method is not supported at this time.'); +}; + +module.exports = FileReader; +}); + +// file: lib/common/plugin/FileSystem.js +define("cordova/plugin/FileSystem", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'); + +/** + * An interface representing a file system + * + * @constructor + * {DOMString} name the unique name of the file system (readonly) + * {DirectoryEntry} root directory of the file system (readonly) + */ +var FileSystem = function(name, root) { + this.name = name || null; + if (root) { + this.root = new DirectoryEntry(root.name, root.fullPath); + } +}; + +module.exports = FileSystem; + +}); + +// file: lib/common/plugin/FileTransfer.js +define("cordova/plugin/FileTransfer", function(require, exports, module) { +var exec = require('cordova/exec'), + FileTransferError = require('cordova/plugin/FileTransferError'); + +/** + * FileTransfer uploads a file to a remote server. + * @constructor + */ +var FileTransfer = function() {}; + +/** +* Given an absolute file path, uploads a file on the device to a remote server +* using a multipart HTTP request. +* @param filePath {String} Full path of the file on the device +* @param server {String} URL of the server to receive the file +* @param successCallback (Function} Callback to be invoked when upload has completed +* @param errorCallback {Function} Callback to be invoked upon error +* @param options {FileUploadOptions} Optional parameters such as file name and mimetype +* @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false +*/ +FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) { + // sanity parameter checking + if (!filePath || !server) throw new Error("FileTransfer.upload requires filePath and server URL parameters at the minimum."); + // check for options + var fileKey = null; + var fileName = null; + var mimeType = null; + var params = null; + var chunkedMode = true; + if (options) { + fileKey = options.fileKey; + fileName = options.fileName; + mimeType = options.mimeType; + if (options.chunkedMode !== null || typeof options.chunkedMode != "undefined") { + chunkedMode = options.chunkedMode; + } + if (options.params) { + params = options.params; + } + else { + params = {}; + } + } + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(successCallback, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]); +}; + +/** + * Downloads a file form a given URL and saves it to the specified directory. + * @param source {String} URL of the server to receive the file + * @param target {String} Full path of the file on the device + * @param successCallback (Function} Callback to be invoked when upload has completed + * @param errorCallback {Function} Callback to be invoked upon error + */ +FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) { + // sanity parameter checking + if (!source || !target) throw new Error("FileTransfer.download requires source URI and target URI parameters at the minimum."); + var win = function(result) { + var entry = null; + if (result.isDirectory) { + entry = new (require('cordova/plugin/DirectoryEntry'))(); + } + else if (result.isFile) { + entry = new (require('cordova/plugin/FileEntry'))(); + } + entry.isDirectory = result.isDirectory; + entry.isFile = result.isFile; + entry.name = result.name; + entry.fullPath = result.fullPath; + successCallback(entry); + }; + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(win, errorCallback, 'FileTransfer', 'download', [source, target]); +}; + +module.exports = FileTransfer; + +}); + +// file: lib/common/plugin/FileTransferError.js +define("cordova/plugin/FileTransferError", function(require, exports, module) { +/** + * FileTransferError + * @constructor + */ +var FileTransferError = function(code, source, target, status) { + this.code = code || null; + this.source = source || null; + this.target = target || null; + this.http_status = status || null; +}; + +FileTransferError.FILE_NOT_FOUND_ERR = 1; +FileTransferError.INVALID_URL_ERR = 2; +FileTransferError.CONNECTION_ERR = 3; + +module.exports = FileTransferError; + +}); + +// file: lib/common/plugin/FileUploadOptions.js +define("cordova/plugin/FileUploadOptions", function(require, exports, module) { +/** + * Options to customize the HTTP request used to upload files. + * @constructor + * @param fileKey {String} Name of file request parameter. + * @param fileName {String} Filename to be used by the server. Defaults to image.jpg. + * @param mimeType {String} Mimetype of the uploaded file. Defaults to image/jpeg. + * @param params {Object} Object with key: value params to send to the server. + */ +var FileUploadOptions = function(fileKey, fileName, mimeType, params) { + this.fileKey = fileKey || null; + this.fileName = fileName || null; + this.mimeType = mimeType || null; + this.params = params || null; +}; + +module.exports = FileUploadOptions; +}); + +// file: lib/common/plugin/FileUploadResult.js +define("cordova/plugin/FileUploadResult", function(require, exports, module) { +/** + * FileUploadResult + * @constructor + */ +var FileUploadResult = function() { + this.bytesSent = 0; + this.responseCode = null; + this.response = null; +}; + +module.exports = FileUploadResult; +}); + +// file: lib/common/plugin/FileWriter.js +define("cordova/plugin/FileWriter", function(require, exports, module) { +var exec = require('cordova/exec'), + FileError = require('cordova/plugin/FileError'), + ProgressEvent = require('cordova/plugin/ProgressEvent'); + +/** + * This class writes to the mobile device file system. + * + * For Android: + * The root directory is the root of the file system. + * To write to the SD card, the file name is "sdcard/my_file.txt" + * + * @constructor + * @param file {File} File object containing file properties + * @param append if true write to the end of the file, otherwise overwrite the file + */ +var FileWriter = function(file) { + this.fileName = ""; + this.length = 0; + if (file) { + this.fileName = file.fullPath || file; + this.length = file.size || 0; + } + // default is to write at the beginning of the file + this.position = 0; + + this.readyState = 0; // EMPTY + + this.result = null; + + // Error + this.error = null; + + // Event handlers + this.onwritestart = null; // When writing starts + this.onprogress = null; // While writing the file, and reporting partial file data + this.onwrite = null; // When the write has successfully completed. + this.onwriteend = null; // When the request has completed (either in success or failure). + this.onabort = null; // When the write has been aborted. For instance, by invoking the abort() method. + this.onerror = null; // When the write has failed (see errors). +}; + +// States +FileWriter.INIT = 0; +FileWriter.WRITING = 1; +FileWriter.DONE = 2; + +/** + * Abort writing file. + */ +FileWriter.prototype.abort = function() { + // check for invalid state + if (this.readyState === FileWriter.DONE || this.readyState === FileWriter.INIT) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // set error + this.error = new FileError(FileError.ABORT_ERR); + + this.readyState = FileWriter.DONE; + + // If abort callback + if (typeof this.onabort === "function") { + this.onabort(new ProgressEvent("abort", {"target":this})); + } + + // If write end callback + if (typeof this.onwriteend === "function") { + this.onwriteend(new ProgressEvent("writeend", {"target":this})); + } +}; + +/** + * Writes data to the file + * + * @param text to be written + */ +FileWriter.prototype.write = function(text) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":me})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // position always increases by bytes written because file would be extended + me.position += r; + // The length of the file is now where we are done writing. + + me.length = me.position; + + // DONE state + me.readyState = FileWriter.DONE; + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "write", [this.fileName, text, this.position]); +}; + +/** + * Moves the file pointer to the location specified. + * + * If the offset is a negative number the position of the file + * pointer is rewound. If the offset is greater than the file + * size the position is set to the end of the file. + * + * @param offset is the location to move the file pointer to. + */ +FileWriter.prototype.seek = function(offset) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + if (!offset && offset !== 0) { + return; + } + + // See back from end of file. + if (offset < 0) { + this.position = Math.max(offset + this.length, 0); + } + // Offset is bigger then file size so set position + // to the end of the file. + else if (offset > this.length) { + this.position = this.length; + } + // Offset is between 0 and file size so set the position + // to start writing. + else { + this.position = offset; + } +}; + +/** + * Truncates the file to the size specified. + * + * @param size to chop the file at. + */ +FileWriter.prototype.truncate = function(size) { + // Throw an exception if we are already writing a file + if (this.readyState === FileWriter.WRITING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // WRITING state + this.readyState = FileWriter.WRITING; + + var me = this; + + // If onwritestart callback + if (typeof me.onwritestart === "function") { + me.onwritestart(new ProgressEvent("writestart", {"target":this})); + } + + // Write file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Update the length of the file + me.length = r; + me.position = Math.min(me.position, r); + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "truncate", [this.fileName, size]); +}; + +module.exports = FileWriter; + +}); + +// file: lib/common/plugin/Flags.js +define("cordova/plugin/Flags", function(require, exports, module) { +/** + * Supplies arguments to methods that lookup or create files and directories. + * + * @param create + * {boolean} file or directory if it doesn't exist + * @param exclusive + * {boolean} used with create; if true the command will fail if + * target path exists + */ +function Flags(create, exclusive) { + this.create = create || false; + this.exclusive = exclusive || false; +} + +module.exports = Flags; +}); + +// file: lib/common/plugin/LocalFileSystem.js +define("cordova/plugin/LocalFileSystem", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Represents a local file system. + */ +var LocalFileSystem = function() { + +}; + +LocalFileSystem.TEMPORARY = 0; //temporary, with no guarantee of persistence +LocalFileSystem.PERSISTENT = 1; //persistent + +module.exports = LocalFileSystem; +}); + +// file: lib/common/plugin/Media.js +define("cordova/plugin/Media", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'); + +var mediaObjects = {}; + +/** + * This class provides access to the device media, interfaces to both sound and video + * + * @constructor + * @param src The file name or url to play + * @param successCallback The callback to be called when the file is done playing or recording. + * successCallback() + * @param errorCallback The callback to be called if there is an error. + * errorCallback(int errorCode) - OPTIONAL + * @param statusCallback The callback to be called when media status has changed. + * statusCallback(int statusCode) - OPTIONAL + */ +var Media = function(src, successCallback, errorCallback, statusCallback) { + + // successCallback optional + if (successCallback && (typeof successCallback !== "function")) { + console.log("Media Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Media Error: errorCallback is not a function"); + return; + } + + // statusCallback optional + if (statusCallback && (typeof statusCallback !== "function")) { + console.log("Media Error: statusCallback is not a function"); + return; + } + + this.id = utils.createUUID(); + mediaObjects[this.id] = this; + this.src = src; + this.successCallback = successCallback; + this.errorCallback = errorCallback; + this.statusCallback = statusCallback; + this._duration = -1; + this._position = -1; + exec(null, this.errorCallback, "Media", "create", [this.id, this.src]); +}; + +// Media messages +Media.MEDIA_STATE = 1; +Media.MEDIA_DURATION = 2; +Media.MEDIA_POSITION = 3; +Media.MEDIA_ERROR = 9; + +// Media states +Media.MEDIA_NONE = 0; +Media.MEDIA_STARTING = 1; +Media.MEDIA_RUNNING = 2; +Media.MEDIA_PAUSED = 3; +Media.MEDIA_STOPPED = 4; +Media.MEDIA_MSG = ["None", "Starting", "Running", "Paused", "Stopped"]; + +// "static" function to return existing objs. +Media.get = function(id) { + return mediaObjects[id]; +}; + +/** + * Start or resume playing audio file. + */ +Media.prototype.play = function(options) { + exec(null, null, "Media", "startPlayingAudio", [this.id, this.src, options]); +}; + +/** + * Stop playing audio file. + */ +Media.prototype.stop = function() { + var me = this; + exec(function() { + me._position = 0; + me.successCallback(); + }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]); +}; + +/** + * Seek or jump to a new time in the track.. + */ +Media.prototype.seekTo = function(milliseconds) { + var me = this; + exec(function(p) { + me._position = p; + }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]); +}; + +/** + * Pause playing audio file. + */ +Media.prototype.pause = function() { + exec(null, this.errorCallback, "Media", "pausePlayingAudio", [this.id]); +}; + +/** + * Get duration of an audio file. + * The duration is only set for audio that is playing, paused or stopped. + * + * @return duration or -1 if not known. + */ +Media.prototype.getDuration = function() { + return this._duration; +}; + +/** + * Get position of audio. + */ +Media.prototype.getCurrentPosition = function(success, fail) { + var me = this; + exec(function(p) { + me._position = p; + success(p); + }, fail, "Media", "getCurrentPositionAudio", [this.id]); +}; + +/** + * Start recording audio file. + */ +Media.prototype.startRecord = function() { + exec(this.successCallback, this.errorCallback, "Media", "startRecordingAudio", [this.id, this.src]); +}; + +/** + * Stop recording audio file. + */ +Media.prototype.stopRecord = function() { + exec(this.successCallback, this.errorCallback, "Media", "stopRecordingAudio", [this.id]); +}; + +/** + * Release the resources. + */ +Media.prototype.release = function() { + exec(null, this.errorCallback, "Media", "release", [this.id]); +}; + +/** + * Adjust the volume. + */ +Media.prototype.setVolume = function(volume) { + exec(null, null, "Media", "setVolume", [this.id, volume]); +}; + +/** + * Audio has status update. + * PRIVATE + * + * @param id The media object id (string) + * @param status The status code (int) + * @param msg The status message (string) + */ +Media.onStatus = function(id, msg, value) { + var media = mediaObjects[id]; + // If state update + if (msg === Media.MEDIA_STATE) { + if (value === Media.MEDIA_STOPPED) { + if (media.successCallback) { + media.successCallback(); + } + } + if (media.statusCallback) { + media.statusCallback(value); + } + } + else if (msg === Media.MEDIA_DURATION) { + media._duration = value; + } + else if (msg === Media.MEDIA_ERROR) { + if (media.errorCallback) { + // value should be a MediaError object when msg == MEDIA_ERROR + media.errorCallback(value); + } + } + else if (msg === Media.MEDIA_POSITION) { + media._position = value; + } +}; + +module.exports = Media; +}); + +// file: lib/common/plugin/MediaError.js +define("cordova/plugin/MediaError", function(require, exports, module) { +/** + * This class contains information about any Media errors. + * @constructor + */ +var MediaError = function(code, msg) { + this.code = (code !== undefined ? code : null); + this.message = msg || ""; +}; + +MediaError.MEDIA_ERR_NONE_ACTIVE = 0; +MediaError.MEDIA_ERR_ABORTED = 1; +MediaError.MEDIA_ERR_NETWORK = 2; +MediaError.MEDIA_ERR_DECODE = 3; +MediaError.MEDIA_ERR_NONE_SUPPORTED = 4; + +module.exports = MediaError; +}); + +// file: lib/common/plugin/MediaFile.js +define("cordova/plugin/MediaFile", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + File = require('cordova/plugin/File'), + CaptureError = require('cordova/plugin/CaptureError'); +/** + * Represents a single file. + * + * name {DOMString} name of the file, without path information + * fullPath {DOMString} the full path of the file, including the name + * type {DOMString} mime type + * lastModifiedDate {Date} last modified date + * size {Number} size of the file in bytes + */ +var MediaFile = function(name, fullPath, type, lastModifiedDate, size){ + MediaFile.__super__.constructor.apply(this, arguments); +}; + +utils.extend(MediaFile, File); + +/** + * Request capture format data for a specific file and type + * + * @param {Function} successCB + * @param {Function} errorCB + */ +MediaFile.prototype.getFormatData = function(successCallback, errorCallback) { + if (typeof this.fullPath === "undefined" || this.fullPath === null) { + errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)); + } else { + exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); + } +}; + +// TODO: can we axe this? +/** + * Casts a PluginResult message property (array of objects) to an array of MediaFile objects + * (used in Objective-C and Android) + * + * @param {PluginResult} pluginResult + */ +MediaFile.cast = function(pluginResult) { + var mediaFiles = []; + for (var i=0; i.dispatchEvent + // need to first figure out how to implement EventTarget + } + } + return event; + }; + try { + var ev = createEvent({type:"abort",target:document}); + return function ProgressEvent(type, data) { + data.type = type; + return createEvent(data); + }; + } catch(e){ + */ + return function ProgressEvent(type, dict) { + this.type = type; + this.bubbles = false; + this.cancelBubble = false; + this.cancelable = false; + this.lengthComputable = false; + this.loaded = dict && dict.loaded ? dict.loaded : 0; + this.total = dict && dict.total ? dict.total : 0; + this.target = dict && dict.target ? dict.target : null; + }; + //} +})(); + +module.exports = ProgressEvent; +}); + +// file: lib/common/plugin/accelerometer.js +define("cordova/plugin/accelerometer", function(require, exports, module) { +/** + * This class provides access to device accelerometer data. + * @constructor + */ +var utils = require("cordova/utils"), + exec = require("cordova/exec"), + Acceleration = require('cordova/plugin/Acceleration'); + +// Is the accel sensor running? +var running = false; + +// Keeps reference to watchAcceleration calls. +var timers = {}; + +// Array of listeners; used to keep track of when we should call start and stop. +var listeners = []; + +// Last returned acceleration object from native +var accel = null; + +// Tells native to start. +function start() { + exec(function(a) { + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } + }, function(e) { + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } + }, "Accelerometer", "start", []); + running = true; +} + +// Tells native to stop. +function stop() { + exec(null, null, "Accelerometer", "stop", []); + running = false; +} + +// Adds a callback pair to the listeners array +function createCallbackPair(win, fail) { + return {win:win, fail:fail}; +} + +// Removes a win/fail listener pair from the listeners array +function removeListeners(l) { + var idx = listeners.indexOf(l); + if (idx > -1) { + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } + } +} + +var accelerometer = { + /** + * Asynchronously aquires the current acceleration. + * + * @param {Function} successCallback The function to call when the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + */ + getCurrentAcceleration: function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; + } + + var p; + var win = function(a) { + removeListeners(p); + successCallback(a); + }; + var fail = function(e) { + removeListeners(p); + errorCallback(e); + }; + + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } + }, + + /** + * Asynchronously aquires the acceleration repeatedly at a given interval. + * + * @param {Function} successCallback The function to call each time the acceleration data is available + * @param {Function} errorCallback The function to call when there is an error getting the acceleration data. (OPTIONAL) + * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchAcceleration: function(successCallback, errorCallback, options) { + // Default interval (10 sec) + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; + + // successCallback required + if (typeof successCallback !== "function") { + throw "watchAcceleration must be called with at least a success callback function as first parameter."; + } + + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); + + var p = createCallbackPair(function(){}, function(e) { + removeListeners(p); + errorCallback(e); + }); + listeners.push(p); + + timers[id] = { + timer:window.setInterval(function() { + if (accel) { + successCallback(accel); + } + }, frequency), + listeners:p + }; + + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retreived a value, sample code does not check for null ... + if(accel) { + successCallback(accel); + } + } else { + start(); + } + + return id; + }, + + /** + * Clears the specified accelerometer watch. + * + * @param {String} id The id of the watch returned from #watchAcceleration. + */ + clearWatch: function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); + delete timers[id]; + } + } +}; + +module.exports = accelerometer; + +}); + +// file: lib/android/plugin/android/app.js +define("cordova/plugin/android/app", function(require, exports, module) { +var exec = require('cordova/exec'); + +module.exports = { + /** + * Clear the resource cache. + */ + clearCache:function() { + exec(null, null, "App", "clearCache", []); + }, + + /** + * Load the url into the webview or into new browser instance. + * + * @param url The URL to load + * @param props Properties that can be passed in to the activity: + * wait: int => wait msec before loading URL + * loadingDialog: "Title,Message" => display a native loading dialog + * loadUrlTimeoutValue: int => time in msec to wait before triggering a timeout error + * clearHistory: boolean => clear webview history (default=false) + * openExternal: boolean => open in a new browser (default=false) + * + * Example: + * navigator.app.loadUrl("http://server/myapp/index.html", {wait:2000, loadingDialog:"Wait,Loading App", loadUrlTimeoutValue: 60000}); + */ + loadUrl:function(url, props) { + exec(null, null, "App", "loadUrl", [url, props]); + }, + + /** + * Cancel loadUrl that is waiting to be loaded. + */ + cancelLoadUrl:function() { + exec(null, null, "App", "cancelLoadUrl", []); + }, + + /** + * Clear web history in this web view. + * Instead of BACK button loading the previous web page, it will exit the app. + */ + clearHistory:function() { + exec(null, null, "App", "clearHistory", []); + }, + + /** + * Go to previous page displayed. + * This is the same as pressing the backbutton on Android device. + */ + backHistory:function() { + exec(null, null, "App", "backHistory", []); + }, + + /** + * Override the default behavior of the Android back button. + * If overridden, when the back button is pressed, the "backKeyDown" JavaScript event will be fired. + * + * Note: The user should not have to call this method. Instead, when the user + * registers for the "backbutton" event, this is automatically done. + * + * @param override T=override, F=cancel override + */ + overrideBackbutton:function(override) { + exec(null, null, "App", "overrideBackbutton", [override]); + }, + + /** + * Exit and terminate the application. + */ + exitApp:function() { + return exec(null, null, "App", "exitApp", []); + } +}; +}); + +// file: lib/android/plugin/android/callback.js +define("cordova/plugin/android/callback", function(require, exports, module) { +var port = null, + token = null, + cordova = require('cordova'), + polling = require('cordova/plugin/android/polling'), + callback = function() { + // Exit if shutting down app + if (cordova.shuttingDown) { + return; + } + + // If polling flag was changed, start using polling from now on + if (cordova.UsePolling) { + polling(); + return; + } + + var xmlhttp = new XMLHttpRequest(); + + // Callback function when XMLHttpRequest is ready + xmlhttp.onreadystatechange=function(){ + if(xmlhttp.readyState === 4){ + + // Exit if shutting down app + if (cordova.shuttingDown) { + return; + } + + // If callback has JavaScript statement to execute + if (xmlhttp.status === 200) { + + // Need to url decode the response + var msg = decodeURIComponent(xmlhttp.responseText); + setTimeout(function() { + try { + var t = eval(msg); + } + catch (e) { + // If we're getting an error here, seeing the message will help in debugging + console.log("JSCallback: Message from Server: " + msg); + console.log("JSCallback Error: "+e); + } + }, 1); + setTimeout(callback, 1); + } + + // If callback ping (used to keep XHR request from timing out) + else if (xmlhttp.status === 404) { + setTimeout(callback, 10); + } + + // If security error + else if (xmlhttp.status === 403) { + console.log("JSCallback Error: Invalid token. Stopping callbacks."); + } + + // If server is stopping + else if (xmlhttp.status === 503) { + console.log("JSCallback Server Closed: Stopping callbacks."); + } + + // If request wasn't GET + else if (xmlhttp.status === 400) { + console.log("JSCallback Error: Bad request. Stopping callbacks."); + } + + // If error, revert to polling + else { + console.log("JSCallback Error: Request failed."); + cordova.UsePolling = true; + polling(); + } + } + }; + + if (port === null) { + port = prompt("getPort", "gap_callbackServer:"); + } + if (token === null) { + token = prompt("getToken", "gap_callbackServer:"); + } + xmlhttp.open("GET", "http://127.0.0.1:"+port+"/"+token , true); + xmlhttp.send(); +}; + +module.exports = callback; +}); + +// file: lib/android/plugin/android/device.js +define("cordova/plugin/android/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'), + app = require('cordova/plugin/android/app'); + +module.exports = { + /* + * DEPRECATED + * This is only for Android. + * + * You must explicitly override the back button. + */ + overrideBackButton:function() { + console.log("Device.overrideBackButton() is deprecated. Use App.overrideBackbutton(true)."); + app.overrideBackbutton(true); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This resets the back button to the default behaviour + */ + resetBackButton:function() { + console.log("Device.resetBackButton() is deprecated. Use App.overrideBackbutton(false)."); + app.overrideBackbutton(false); + }, + + /* + * DEPRECATED + * This is only for Android. + * + * This terminates the activity! + */ + exitApp:function() { + console.log("Device.exitApp() is deprecated. Use App.exitApp()."); + app.exitApp(); + } +}; + +}); + +// file: lib/android/plugin/android/notification.js +define("cordova/plugin/android/notification", function(require, exports, module) { +var exec = require('cordova/exec'); + +/** + * Provides Android enhanced notification API. + */ +module.exports = { + activityStart : function(title, message) { + // If title and message not specified then mimic Android behavior of + // using default strings. + if (typeof title === "undefined" && typeof message == "undefined") { + title = "Busy"; + message = 'Please wait...'; + } + + exec(null, null, 'Notification', 'activityStart', [ title, message ]); + }, + + /** + * Close an activity dialog + */ + activityStop : function() { + exec(null, null, 'Notification', 'activityStop', []); + }, + + /** + * Display a progress dialog with progress bar that goes from 0 to 100. + * + * @param {String} + * title Title of the progress dialog. + * @param {String} + * message Message to display in the dialog. + */ + progressStart : function(title, message) { + exec(null, null, 'Notification', 'progressStart', [ title, message ]); + }, + + /** + * Close the progress dialog. + */ + progressStop : function() { + exec(null, null, 'Notification', 'progressStop', []); + }, + + /** + * Set the progress dialog value. + * + * @param {Number} + * value 0-100 + */ + progressValue : function(value) { + exec(null, null, 'Notification', 'progressValue', [ value ]); + } +}; +}); + +// file: lib/android/plugin/android/polling.js +define("cordova/plugin/android/polling", function(require, exports, module) { +var cordova = require('cordova'), + period = 50, + polling = function() { + // Exit if shutting down app + if (cordova.shuttingDown) { + return; + } + + // If polling flag was changed, stop using polling from now on and switch to XHR server / callback + if (!cordova.UsePolling) { + require('cordova/plugin/android/callback')(); + return; + } + + var msg = prompt("", "gap_poll:"); + if (msg) { + setTimeout(function() { + try { + var t = eval(""+msg); + } + catch (e) { + console.log("JSCallbackPolling: Message from Server: " + msg); + console.log("JSCallbackPolling Error: "+e); + } + }, 1); + setTimeout(polling, 1); + } + else { + setTimeout(polling, period); + } +}; + +module.exports = polling; +}); + +// file: lib/android/plugin/android/storage.js +define("cordova/plugin/android/storage", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + channel = require('cordova/channel'); + +var queryQueue = {}; + +/** + * SQL result set object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Rows = function() { + this.resultSet = []; // results array + this.length = 0; // number of rows +}; + +/** + * Get item from SQL result set + * + * @param row The row number to return + * @return The row object + */ +DroidDB_Rows.prototype.item = function(row) { + return this.resultSet[row]; +}; + +/** + * SQL result set that is returned to user. + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Result = function() { + this.rows = new DroidDB_Rows(); +}; + +/** + * Callback from native code when query is complete. + * PRIVATE METHOD + * + * @param id Query id + */ +function completeQuery(id, data) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + + // Save query results + var r = new DroidDB_Result(); + r.rows.resultSet = data; + r.rows.length = data.length; + try { + if (typeof query.successCallback === 'function') { + query.successCallback(query.tx, r); + } + } catch (ex) { + console.log("executeSql error calling user success callback: "+ex); + } + + tx.queryComplete(id); + } + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * Callback from native code when query fails + * PRIVATE METHOD + * + * @param reason Error message + * @param id Query id + */ +function failQuery(reason, id) { + var query = queryQueue[id]; + if (query) { + try { + delete queryQueue[id]; + + // Get transaction + var tx = query.tx; + + // If transaction hasn't failed + // Note: We ignore all query results if previous query + // in the same transaction failed. + if (tx && tx.queryList[id]) { + tx.queryList = {}; + + try { + if (typeof query.errorCallback === 'function') { + query.errorCallback(query.tx, reason); + } + } catch (ex) { + console.log("executeSql error calling user error callback: "+ex); + } + + tx.queryFailed(id, reason); + } + + } catch (e) { + console.log("executeSql error: "+e); + } + } +} + +/** + * SQL query object + * PRIVATE METHOD + * + * @constructor + * @param tx The transaction object that this query belongs to + */ +var DroidDB_Query = function(tx) { + + // Set the id of the query + this.id = utils.createUUID(); + + // Add this query to the queue + queryQueue[this.id] = this; + + // Init result + this.resultSet = []; + + // Set transaction that this query belongs to + this.tx = tx; + + // Add this query to transaction list + this.tx.queryList[this.id] = this; + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + +}; + +/** + * Transaction object + * PRIVATE METHOD + * @constructor + */ +var DroidDB_Tx = function() { + + // Set the id of the transaction + this.id = utils.createUUID(); + + // Callbacks + this.successCallback = null; + this.errorCallback = null; + + // Query list + this.queryList = {}; +}; + +/** + * Mark query in transaction as complete. + * If all queries are complete, call the user's transaction success callback. + * + * @param id Query id + */ +DroidDB_Tx.prototype.queryComplete = function(id) { + delete this.queryList[id]; + + // If no more outstanding queries, then fire transaction success + if (this.successCallback) { + var count = 0; + var i; + for (i in this.queryList) { + if (this.queryList.hasOwnProperty(i)) { + count++; + } + } + if (count === 0) { + try { + this.successCallback(); + } catch(e) { + console.log("Transaction error calling user success callback: " + e); + } + } + } +}; + +/** + * Mark query in transaction as failed. + * + * @param id Query id + * @param reason Error message + */ +DroidDB_Tx.prototype.queryFailed = function(id, reason) { + + // The sql queries in this transaction have already been run, since + // we really don't have a real transaction implemented in native code. + // However, the user callbacks for the remaining sql queries in transaction + // will not be called. + this.queryList = {}; + + if (this.errorCallback) { + try { + this.errorCallback(reason); + } catch(e) { + console.log("Transaction error calling user error callback: " + e); + } + } +}; + +/** + * Execute SQL statement + * + * @param sql SQL statement to execute + * @param params Statement parameters + * @param successCallback Success callback + * @param errorCallback Error callback + */ +DroidDB_Tx.prototype.executeSql = function(sql, params, successCallback, errorCallback) { + + // Init params array + if (typeof params === 'undefined') { + params = []; + } + + // Create query and add to queue + var query = new DroidDB_Query(this); + queryQueue[query.id] = query; + + // Save callbacks + query.successCallback = successCallback; + query.errorCallback = errorCallback; + + // Call native code + exec(null, null, "Storage", "executeSql", [sql, params, query.id]); +}; + +var DatabaseShell = function() { +}; + +/** + * Start a transaction. + * Does not support rollback in event of failure. + * + * @param process {Function} The transaction function + * @param successCallback {Function} + * @param errorCallback {Function} + */ +DatabaseShell.prototype.transaction = function(process, errorCallback, successCallback) { + var tx = new DroidDB_Tx(); + tx.successCallback = successCallback; + tx.errorCallback = errorCallback; + try { + process(tx); + } catch (e) { + console.log("Transaction error: "+e); + if (tx.errorCallback) { + try { + tx.errorCallback(e); + } catch (ex) { + console.log("Transaction error calling user error callback: "+e); + } + } + } +}; + +/** + * Open database + * + * @param name Database name + * @param version Database version + * @param display_name Database display name + * @param size Database size in bytes + * @return Database object + */ +var DroidDB_openDatabase = function(name, version, display_name, size) { + exec(null, null, "Storage", "openDatabase", [name, version, display_name, size]); + var db = new DatabaseShell(); + return db; +}; + +/** + * For browsers with no localStorage we emulate it with SQLite. Follows the w3c api. + * TODO: Do similar for sessionStorage. + * @constructor + */ +var CupcakeLocalStorage = function() { + channel.waitForInitialization("cupcakeStorage"); + + try { + + this.db = openDatabase('localStorage', '1.0', 'localStorage', 2621440); + var storage = {}; + this.length = 0; + function setLength (length) { + this.length = length; + localStorage.length = length; + } + this.db.transaction( + function (transaction) { + var i; + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('SELECT * FROM storage', [], function(tx, result) { + for(var i = 0; i < result.rows.length; i++) { + storage[result.rows.item(i).id] = result.rows.item(i).body; + } + setLength(result.rows.length); + channel.initializationComplete("cupcakeStorage"); + }); + + }, + function (err) { + utils.alert(err.message); + } + ); + this.setItem = function(key, val) { + if (typeof(storage[key])=='undefined') { + this.length++; + } + storage[key] = val; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('REPLACE INTO storage (id, body) values(?,?)', [key,val]); + } + ); + }; + this.getItem = function(key) { + return storage[key]; + }; + this.removeItem = function(key) { + delete storage[key]; + this.length--; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage where id=?', [key]); + } + ); + }; + this.clear = function() { + storage = {}; + this.length = 0; + this.db.transaction( + function (transaction) { + transaction.executeSql('CREATE TABLE IF NOT EXISTS storage (id NVARCHAR(40) PRIMARY KEY, body NVARCHAR(255))'); + transaction.executeSql('DELETE FROM storage', []); + } + ); + }; + this.key = function(index) { + var i = 0; + for (var j in storage) { + if (i==index) { + return j; + } else { + i++; + } + } + return null; + }; + + } catch(e) { + utils.alert("Database error "+e+"."); + return; + } +}; + +module.exports = { + openDatabase:DroidDB_openDatabase, + CupcakeLocalStorage:CupcakeLocalStorage, + failQuery:failQuery, + completeQuery:completeQuery +}; + +}); + +// file: lib/common/plugin/battery.js +define("cordova/plugin/battery", function(require, exports, module) { +/** + * This class contains information about the current battery status. + * @constructor + */ +var cordova = require('cordova'), + exec = require('cordova/exec'); + +function handlers() { + return battery.channels.batterystatus.numHandlers + + battery.channels.batterylow.numHandlers + + battery.channels.batterycritical.numHandlers; +} + +var Battery = function() { + this._level = null; + this._isPlugged = null; + // Create new event handlers on the window (returns a channel instance) + var subscriptionEvents = { + onSubscribe:this.onSubscribe, + onUnsubscribe:this.onUnsubscribe + }; + this.channels = { + batterystatus:cordova.addWindowEventHandler("batterystatus", subscriptionEvents), + batterylow:cordova.addWindowEventHandler("batterylow", subscriptionEvents), + batterycritical:cordova.addWindowEventHandler("batterycritical", subscriptionEvents) + }; +}; +/** + * Event handlers for when callbacks get registered for the battery. + * Keep track of how many handlers we have so we can start and stop the native battery listener + * appropriately (and hopefully save on battery life!). + */ +Battery.prototype.onSubscribe = function() { + var me = battery; + // If we just registered the first handler, make sure native listener is started. + if (handlers() === 1) { + exec(me._status, me._error, "Battery", "start", []); + } +}; + +Battery.prototype.onUnsubscribe = function() { + var me = battery; + + // If we just unregistered the last handler, make sure native listener is stopped. + if (handlers() === 0) { + exec(null, null, "Battery", "stop", []); + } +}; + +/** + * Callback for battery status + * + * @param {Object} info keys: level, isPlugged + */ +Battery.prototype._status = function(info) { + if (info) { + var me = battery; + var level = info.level; + if (me._level !== level || me._isPlugged !== info.isPlugged) { + // Fire batterystatus event + cordova.fireWindowEvent("batterystatus", info); + + // Fire low battery event + if (level === 20 || level === 5) { + if (level === 20) { + cordova.fireWindowEvent("batterylow", info); + } + else { + cordova.fireWindowEvent("batterycritical", info); + } + } + } + me._level = level; + me._isPlugged = info.isPlugged; + } +}; + +/** + * Error callback for battery start + */ +Battery.prototype._error = function(e) { + console.log("Error initializing Battery: " + e); +}; + +var battery = new Battery(); + +module.exports = battery; +}); + +// file: lib/common/plugin/capture.js +define("cordova/plugin/capture", function(require, exports, module) { +var exec = require('cordova/exec'), + MediaFile = require('cordova/plugin/MediaFile'); + +/** + * Launches a capture of different types. + * + * @param (DOMString} type + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +function _capture(type, successCallback, errorCallback, options) { + var win = function(pluginResult) { + var mediaFiles = []; + var i; + for (i = 0; i < pluginResult.length; i++) { + var mediaFile = new MediaFile(); + mediaFile.name = pluginResult[i].name; + mediaFile.fullPath = pluginResult[i].fullPath; + mediaFile.type = pluginResult[i].type; + mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate; + mediaFile.size = pluginResult[i].size; + mediaFiles.push(mediaFile); + } + successCallback(mediaFiles); + }; + exec(win, errorCallback, "Capture", type, [options]); +} +/** + * The Capture interface exposes an interface to the camera and microphone of the hosting device. + */ +function Capture() { + this.supportedAudioModes = []; + this.supportedImageModes = []; + this.supportedVideoModes = []; +} + +/** + * Launch audio recorder application for recording audio clip(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureAudioOptions} options + */ +Capture.prototype.captureAudio = function(successCallback, errorCallback, options){ + _capture("captureAudio", successCallback, errorCallback, options); +}; + +/** + * Launch camera application for taking image(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureImageOptions} options + */ +Capture.prototype.captureImage = function(successCallback, errorCallback, options){ + _capture("captureImage", successCallback, errorCallback, options); +}; + +/** + * Launch device camera application for recording video(s). + * + * @param {Function} successCB + * @param {Function} errorCB + * @param {CaptureVideoOptions} options + */ +Capture.prototype.captureVideo = function(successCallback, errorCallback, options){ + _capture("captureVideo", successCallback, errorCallback, options); +}; + + +module.exports = new Capture(); + +}); + +// file: lib/common/plugin/compass.js +define("cordova/plugin/compass", function(require, exports, module) { +var exec = require('cordova/exec'), + utils = require('cordova/utils'), + CompassHeading = require('cordova/plugin/CompassHeading'), + CompassError = require('cordova/plugin/CompassError'), + timers = {}, + compass = { + /** + * Asynchronously acquires the current heading. + * @param {Function} successCallback The function to call when the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {CompassOptions} options The options for getting the heading data (not used). + */ + getCurrentHeading:function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var win = function(result) { + var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); + successCallback(ch); + }; + var fail = function(code) { + var ce = new CompassError(code); + errorCallback(ce); + }; + + // Get heading + exec(win, fail, "Compass", "getHeading", [options]); + }, + + /** + * Asynchronously acquires the heading repeatedly at a given interval. + * @param {Function} successCallback The function to call each time the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {HeadingOptions} options The options for getting the heading data + * such as timeout and the frequency of the watch. For iOS, filter parameter + * specifies to watch via a distance filter rather than time. + */ + watchHeading:function(successCallback, errorCallback, options) { + // Default interval (100 msec) + var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; + var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var id = utils.createUUID(); + if (filter > 0) { + // is an iOS request for watch by filter, no timer needed + timers[id] = "iOS"; + compass.getCurrentHeading(successCallback, errorCallback, options); + } else { + // Start watch timer to get headings + timers[id] = window.setInterval(function() { + compass.getCurrentHeading(successCallback, errorCallback); + }, frequency); + } + + return id; + }, + + /** + * Clears the specified heading watch. + * @param {String} watchId The ID of the watch returned from #watchHeading. + */ + clearWatch:function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + if (timers[id] != "iOS") { + clearInterval(timers[id]); + } else { + // is iOS watch by filter so call into device to stop + exec(null, null, "Compass", "stopHeading", []); + } + delete timers[id]; + } + } + }; + +module.exports = compass; +}); + +// file: lib/common/plugin/console-via-logger.js +define("cordova/plugin/console-via-logger", function(require, exports, module) { +//------------------------------------------------------------------------------ + +var logger = require("cordova/plugin/logger"); +var utils = require("cordova/utils"); + +//------------------------------------------------------------------------------ +// object that we're exporting +//------------------------------------------------------------------------------ +var console = module.exports; + +//------------------------------------------------------------------------------ +// copy of the original console object +//------------------------------------------------------------------------------ +var WinConsole = window.console; + +//------------------------------------------------------------------------------ +// whether to use the logger +//------------------------------------------------------------------------------ +var UseLogger = false; + +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ +var Timers = {}; + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +function noop() {} + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +console.useLogger = function (value) { + if (arguments.length) UseLogger = !!value; + + if (UseLogger) { + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } + } + + return UseLogger; +}; + +//------------------------------------------------------------------------------ +console.log = function() { + if (logger.useConsole()) return; + logger.log.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.error = function() { + if (logger.useConsole()) return; + logger.error.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.warn = function() { + if (logger.useConsole()) return; + logger.warn.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.info = function() { + if (logger.useConsole()) return; + logger.info.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.debug = function() { + if (logger.useConsole()) return; + logger.debug.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.assert = function(expression) { + if (expression) return; + + var message = utils.vformat(arguments[1], [].slice.call(arguments, 2)); + console.log("ASSERT: " + message); +}; + +//------------------------------------------------------------------------------ +console.clear = function() {}; + +//------------------------------------------------------------------------------ +console.dir = function(object) { + console.log("%o", object); +}; + +//------------------------------------------------------------------------------ +console.dirxml = function(node) { + console.log(node.innerHTML); +}; + +//------------------------------------------------------------------------------ +console.trace = noop; + +//------------------------------------------------------------------------------ +console.group = console.log; + +//------------------------------------------------------------------------------ +console.groupCollapsed = console.log; + +//------------------------------------------------------------------------------ +console.groupEnd = noop; + +//------------------------------------------------------------------------------ +console.time = function(name) { + Timers[name] = new Date().valueOf(); +}; + +//------------------------------------------------------------------------------ +console.timeEnd = function(name) { + var timeStart = Timers[name]; + if (!timeStart) { + console.warn("unknown timer: " + name); + return; + } + + var timeElapsed = new Date().valueOf() - timeStart; + console.log(name + ": " + timeElapsed + "ms"); +}; + +//------------------------------------------------------------------------------ +console.timeStamp = noop; + +//------------------------------------------------------------------------------ +console.profile = noop; + +//------------------------------------------------------------------------------ +console.profileEnd = noop; + +//------------------------------------------------------------------------------ +console.count = noop; + +//------------------------------------------------------------------------------ +console.exception = console.log; + +//------------------------------------------------------------------------------ +console.table = function(data, columns) { + console.log("%o", data); +}; + +//------------------------------------------------------------------------------ +// return a new function that calls both functions passed as args +//------------------------------------------------------------------------------ +function wrapperedOrigCall(orgFunc, newFunc) { + return function() { + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} + }; +} + +//------------------------------------------------------------------------------ +// For every function that exists in the original console object, that +// also exists in the new console object, wrap the new console method +// with one that calls both +//------------------------------------------------------------------------------ +for (var key in console) { + if (typeof WinConsole[key] == "function") { + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + } +} + +}); + +// file: lib/common/plugin/contacts.js +define("cordova/plugin/contacts", function(require, exports, module) { +var exec = require('cordova/exec'), + ContactError = require('cordova/plugin/ContactError'), + utils = require('cordova/utils'), + Contact = require('cordova/plugin/Contact'); + +/** +* Represents a group of Contacts. +* @constructor +*/ +var contacts = { + /** + * Returns an array of Contacts matching the search criteria. + * @param fields that should be searched + * @param successCB success callback + * @param errorCB error callback + * @param {ContactFindOptions} options that can be applied to contact searching + * @return array of Contacts matching search criteria + */ + find:function(fields, successCB, errorCB, options) { + if (!successCB) { + throw new TypeError("You must specify a success callback for the find command."); + } + if (!fields || (utils.isArray(fields) && fields.length === 0)) { + if (typeof errorCB === "function") { + errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); + } + } else { + var win = function(result) { + var cs = []; + for (var i = 0, l = result.length; i < l; i++) { + cs.push(contacts.create(result[i])); + } + successCB(cs); + }; + exec(win, errorCB, "Contacts", "search", [fields, options]); + } + }, + + /** + * This function creates a new contact, but it does not persist the contact + * to device storage. To persist the contact to device storage, invoke + * contact.save(). + * @param properties an object who's properties will be examined to create a new Contact + * @returns new Contact object + */ + create:function(properties) { + var i; + var contact = new Contact(); + for (i in properties) { + if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { + contact[i] = properties[i]; + } + } + return contact; + } +}; + +module.exports = contacts; + +}); + +// file: lib/common/plugin/device.js +define("cordova/plugin/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'); + +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.name = null; + this.uuid = null; + this.cordova = null; + + var me = this; + + channel.onCordovaReady.subscribeOnce(function() { + me.getInfo(function(info) { + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.name = info.name; + me.uuid = info.uuid; + me.cordova = info.cordova; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Device Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Device Error: errorCallback is not a function"); + return; + } + + // Get info + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); + +}); + +// file: lib/common/plugin/geolocation.js +define("cordova/plugin/geolocation", function(require, exports, module) { +var utils = require('cordova/utils'), + exec = require('cordova/exec'), + PositionError = require('cordova/plugin/PositionError'), + Position = require('cordova/plugin/Position'); + +var timers = {}; // list of timers in use + +// Returns default params, overrides if provided with values +function parseParameters(options) { + var opt = { + maximumAge: 0, + enableHighAccuracy: false, + timeout: Infinity + }; + + if (options) { + if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { + opt.maximumAge = options.maximumAge; + } + if (options.enableHighAccuracy !== undefined) { + opt.enableHighAccuracy = options.enableHighAccuracy; + } + if (options.timeout !== undefined && !isNaN(options.timeout)) { + if (options.timeout < 0) { + opt.timeout = 0; + } else { + opt.timeout = options.timeout; + } + } + } + + return opt; +} + +// Returns a timeout failure, closed over a specified timeout value and error callback. +function createTimeout(errorCallback, timeout) { + var t = setTimeout(function() { + clearTimeout(t); + t = null; + errorCallback({ + code:PositionError.TIMEOUT, + message:"Position retrieval timed out." + }); + }, timeout); + return t; +} + +var geolocation = { + lastPosition:null, // reference to last known (cached) position returned + /** + * Asynchronously aquires the current position. + * + * @param {Function} successCallback The function to call when the position data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading position. (OPTIONAL) + * @param {PositionOptions} options The options for getting the position data. (OPTIONAL) + */ + getCurrentPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("getCurrentPosition must be called with at least one argument."); + } + options = parseParameters(options); + + // Timer var that will fire an error callback if no position is retrieved from native + // before the "timeout" param provided expires + var timeoutTimer = null; + + var win = function(p) { + clearTimeout(timeoutTimer); + if (!timeoutTimer) { + // Timeout already happened, or native fired error callback for + // this geo request. + // Don't continue with success callback. + return; + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + var fail = function(e) { + clearTimeout(timeoutTimer); + timeoutTimer = null; + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just + // fire the success callback with the cached position. + if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { + successCallback(geolocation.lastPosition); + // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. + } else if (options.timeout === 0) { + fail({ + code:PositionError.TIMEOUT, + message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceed's provided PositionOptions' maximumAge parameter." + }); + // Otherwise we have to call into native to retrieve a position. + } else { + if (options.timeout !== Infinity) { + // If the timeout value was not set to Infinity (default), then + // set up a timeout function that will fire the error callback + // if no successful position was retrieved before timeout expired. + timeoutTimer = createTimeout(fail, options.timeout); + } else { + // This is here so the check in the win function doesn't mess stuff up + // may seem weird but this guarantees timeoutTimer is + // always truthy before we call into native + timeoutTimer = true; + } + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + } + return timeoutTimer; + }, + /** + * Asynchronously watches the geolocation for changes to geolocation. When a change occurs, + * the successCallback is called with the new location. + * + * @param {Function} successCallback The function to call each time the location data is available + * @param {Function} errorCallback The function to call when there is an error getting the location data. (OPTIONAL) + * @param {PositionOptions} options The options for getting the location data such as frequency. (OPTIONAL) + * @return String The watch id that must be passed to #clearWatch to stop watching. + */ + watchPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("watchPosition must be called with at least one argument."); + } + options = parseParameters(options); + + var id = utils.createUUID(); + + // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition + timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); + + var fail = function(e) { + clearTimeout(timers[id]); + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + var win = function(p) { + clearTimeout(timers[id]); + if (options.timeout !== Infinity) { + timers[id] = createTimeout(fail, options.timeout); + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + + exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); + + return id; + }, + /** + * Clears the specified heading watch. + * + * @param {String} id The ID of the watch returned from #watchPosition + */ + clearWatch:function(id) { + if (id && timers[id] !== undefined) { + clearTimeout(timers[id]); + delete timers[id]; + exec(null, null, "Geolocation", "clearWatch", [id]); + } + } +}; + +module.exports = geolocation; + +}); + +// file: lib/common/plugin/logger.js +define("cordova/plugin/logger", function(require, exports, module) { +//------------------------------------------------------------------------------ +// The logger module exports the following properties/functions: +// +// LOG - constant for the level LOG +// ERROR - constant for the level ERROR +// WARN - constant for the level WARN +// INFO - constant for the level INFO +// DEBUG - constant for the level DEBUG +// logLevel() - returns current log level +// logLevel(value) - sets and returns a new log level +// useConsole() - returns whether logger is using console +// useConsole(value) - sets and returns whether logger is using console +// log(message,...) - logs a message at level LOG +// error(message,...) - logs a message at level ERROR +// warn(message,...) - logs a message at level WARN +// info(message,...) - logs a message at level INFO +// debug(message,...) - logs a message at level DEBUG +// logLevel(level,message,...) - logs a message specified level +// +//------------------------------------------------------------------------------ + +var logger = exports; + +var exec = require('cordova/exec'); +var utils = require('cordova/utils'); + +var UseConsole = true; +var Queued = []; +var DeviceReady = false; +var CurrentLevel; + +/** + * Logging levels + */ + +var Levels = [ + "LOG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +]; + +/* + * add the logging levels to the logger object and + * to a separate levelsMap object for testing + */ + +var LevelsMap = {}; +for (var i=0; i CurrentLevel) return; + + // queue the message if not yet at deviceready + if (!DeviceReady && !UseConsole) { + Queued.push([level, message]); + return; + } + + // if not using the console, use the native logger + if (!UseConsole) { + exec(null, null, "Logger", "logLevel", [level, message]); + return; + } + + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } + + // log to the console + switch (level) { + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; + } +}; + +// when deviceready fires, log queued messages +logger.__onDeviceReady = function() { + if (DeviceReady) return; + + DeviceReady = true; + + for (var i=0; i 3) { + fail(FileError.SYNTAX_ERR); + } else { + // if successful, return a FileSystem object + var success = function(file_system) { + if (file_system) { + if (typeof successCallback === 'function') { + // grab the name and root from the file system object + var result = new FileSystem(file_system.name, file_system.root); + successCallback(result); + } + } + else { + // no FileSystem object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + exec(success, fail, "File", "requestFileSystem", [type, size]); + } +}; + +module.exports = requestFileSystem; +}); + +// file: lib/common/plugin/resolveLocalFileSystemURI.js +define("cordova/plugin/resolveLocalFileSystemURI", function(require, exports, module) { +var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), + FileEntry = require('cordova/plugin/FileEntry'), + FileError = require('cordova/plugin/FileError'), + exec = require('cordova/exec'); + +/** + * Look up file system Entry referred to by local URI. + * @param {DOMString} uri URI referring to a local file or directory + * @param successCallback invoked with Entry object corresponding to URI + * @param errorCallback invoked if error occurs retrieving file system entry + */ +module.exports = function(uri, successCallback, errorCallback) { + // error callback + var fail = function(error) { + if (typeof errorCallback === 'function') { + errorCallback(new FileError(error)); + } + }; + // sanity check for 'not:valid:filename' + if(!uri || uri.split(":").length > 2) { + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; + } + // if successful, return either a file or directory entry + var success = function(entry) { + var result; + if (entry) { + if (typeof successCallback === 'function') { + // create appropriate Entry object + result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath); + try { + successCallback(result); + } + catch (e) { + console.log('Error invoking callback: ' + e); + } + } + } + else { + // no Entry object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + + exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]); +}; + +}); + +// file: lib/common/plugin/splashscreen.js +define("cordova/plugin/splashscreen", function(require, exports, module) { +var exec = require('cordova/exec'); + +var splashscreen = { + show:function() { + exec(null, null, "SplashScreen", "show", []); + }, + hide:function() { + exec(null, null, "SplashScreen", "hide", []); + } +}; + +module.exports = splashscreen; +}); + +// file: lib/common/utils.js +define("cordova/utils", function(require, exports, module) { +var utils = exports; + +/** + * Returns an indication of whether the argument is an array or not + */ +utils.isArray = function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +/** + * Returns an indication of whether the argument is a Date or not + */ +utils.isDate = function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; +}; + +/** + * Does a deep clone of the object. + */ +utils.clone = function(obj) { + if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { + return obj; + } + + var retVal, i; + + if(utils.isArray(obj)){ + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.clone(obj[i])); + } + return retVal; + } + + retVal = {}; + for(i in obj){ + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); + } + } + return retVal; +}; + +/** + * Returns a wrappered version of the function + */ +utils.close = function(context, func, params) { + if (typeof params == 'undefined') { + return function() { + return func.apply(context, arguments); + }; + } else { + return function() { + return func.apply(context, params); + }; + } +}; + +/** + * Create a UUID + */ +utils.createUUID = function() { + return UUIDcreatePart(4) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(6); +}; + +/** + * Extends a child object from a parent object using classical inheritance + * pattern. + */ +utils.extend = (function() { + // proxy used to establish prototype chain + var F = function() {}; + // extend Child from Parent + return function(Child, Parent) { + F.prototype = Parent.prototype; + Child.prototype = new F(); + Child.__super__ = Parent.prototype; + Child.prototype.constructor = Child; + }; +}()); + +/** + * Alerts a message in any available way: alert or console.log. + */ +utils.alert = function(msg) { + if (alert) { + alert(msg); + } else if (console && console.log) { + console.log(msg); + } +}; + +/** + * Formats a string and arguments following it ala sprintf() + * + * see utils.vformat() for more information + */ +utils.format = function(formatString /* ,... */) { + var args = [].slice.call(arguments, 1); + return utils.vformat(formatString, args); +}; + +/** + * Formats a string and arguments following it ala vsprintf() + * + * format chars: + * %j - format arg as JSON + * %o - format arg as JSON + * %c - format arg as '' + * %% - replace with '%' + * any other char following % will format it's + * arg via toString(). + * + * for rationale, see FireBug's Console API: + * http://getfirebug.com/wiki/index.php/Console_API + */ +utils.vformat = function(formatString, args) { + if (formatString === null || formatString === undefined) return ""; + if (arguments.length == 1) return formatString.toString(); + if (typeof formatString != "string") return formatString.toString(); + + var pattern = /(.*?)%(.)(.*)/; + var rest = formatString; + var result = []; + + while (args.length) { + var arg = args.shift(); + var match = pattern.exec(rest); + + if (!match) break; + + rest = match[3]; + + result.push(match[1]); + + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; + } + + result.push(formatted(arg, match[2])); + } + + result.push(rest); + + return result.join(''); +}; + +//------------------------------------------------------------------------------ +function UUIDcreatePart(length) { + var uuidpart = ""; + for (var i=0; i - + ` -3. Create an 'com/urbtek/phonegap' path under 'src' and add the SpeechRecognizer.java file to it +3. Create an 'com/urbtek/phonegap' path under 'src' and add the SpeechRecognizer.java file to it. +3.a on version 2.0.x, this plugin has been update to the new Plugin architecture (Cordova 2.2.0+) +Create a 'com/phonegap/plugins/speech' folder under 'src' and add the SpeechRecognizer.java file to it 4. Add the plugin to the 'res/xml/plugins.xml' file. eg: `` +4.a On 2.0.x, `` ### Example ```html @@ -19,7 +22,7 @@ Of course this plugin requires [Android PhoneGap](http://github.com/phonegap/pho PhoneGap - + - - - - -

TTS Example

-
- - Speak
- test - - \ No newline at end of file diff --git a/Android/TTS/1.8.1/manifest b/Android/TTS/1.8.1/manifest deleted file mode 100644 index 945a250c..00000000 --- a/Android/TTS/1.8.1/manifest +++ /dev/null @@ -1,3 +0,0 @@ -lib/commons-net-2.2.jar -src/com/phonegap/plugins/FtpClient.java -www/ftpclient.js \ No newline at end of file diff --git a/Android/TTS/1.8.1/src/com/phonegap/plugins/speech/TTS.java b/Android/TTS/1.8.1/src/com/phonegap/plugins/speech/TTS.java deleted file mode 100644 index 3a79b02f..00000000 --- a/Android/TTS/1.8.1/src/com/phonegap/plugins/speech/TTS.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2011, IBM Corporation - * - * Modified by Murray Macdonald (murray@workgroup.ca) on 2012/05/30 to add support for stop(), pitch(), speed() and interrupt(); - * - */ - -package com.phonegap.plugins.speech; - -import java.util.HashMap; -import java.util.Locale; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.speech.tts.TextToSpeech; -import android.speech.tts.TextToSpeech.OnInitListener; -import android.speech.tts.TextToSpeech.OnUtteranceCompletedListener; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -public class TTS extends Plugin implements OnInitListener, OnUtteranceCompletedListener { - - private static final String LOG_TAG = "TTS"; - private static final int STOPPED = 0; - private static final int INITIALIZING = 1; - private static final int STARTED = 2; - private TextToSpeech mTts = null; - private int state = STOPPED; - - private String startupCallbackId = ""; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - try { - if (action.equals("speak")) { - String text = args.getString(0); - if (isReady()) { - HashMap map = null; - map = new HashMap(); - map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId); - mTts.speak(text, TextToSpeech.QUEUE_ADD, map); - PluginResult pr = new PluginResult(PluginResult.Status.NO_RESULT); - pr.setKeepCallback(true); - return pr; - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("interrupt")) { - String text = args.getString(0); - if (isReady()) { - HashMap map = null; - map = new HashMap(); - map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId); - mTts.speak(text, TextToSpeech.QUEUE_FLUSH, map); - PluginResult pr = new PluginResult(PluginResult.Status.NO_RESULT); - pr.setKeepCallback(true); - return pr; - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("stop")) { - if (isReady()) { - mTts.stop(); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("silence")) { - if (isReady()) { - mTts.playSilence(args.getLong(0), TextToSpeech.QUEUE_ADD, null); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("speed")) { - if (isReady()) { - float speed= (float) (args.optLong(0, 100)) /(float) 100.0; - mTts.setSpeechRate(speed); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("pitch")) { - if (isReady()) { - float pitch= (float) (args.optLong(0, 100)) /(float) 100.0; - mTts.setPitch(pitch); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("startup")) { - if (mTts == null) { - this.startupCallbackId = callbackId; - state = TTS.INITIALIZING; - mTts = new TextToSpeech(ctx.getApplicationContext(), this); - } - PluginResult pluginResult = new PluginResult(status, TTS.INITIALIZING); - pluginResult.setKeepCallback(true); - return pluginResult; - } - else if (action.equals("shutdown")) { - if (mTts != null) { - mTts.shutdown(); - } - return new PluginResult(status, result); - } - else if (action.equals("getLanguage")) { - if (mTts != null) { - result = mTts.getLanguage().toString(); - return new PluginResult(status, result); - } - } - else if (action.equals("isLanguageAvailable")) { - if (mTts != null) { - Locale loc = new Locale(args.getString(0)); - int available = mTts.isLanguageAvailable(loc); - result = (available < 0) ? "false" : "true"; - return new PluginResult(status, result); - } - } - else if (action.equals("setLanguage")) { - if (mTts != null) { - Locale loc = new Locale(args.getString(0)); - int available = mTts.setLanguage(loc); - result = (available < 0) ? "false" : "true"; - return new PluginResult(status, result); - } - } - return new PluginResult(status, result); - } catch (JSONException e) { - e.printStackTrace(); - return new PluginResult(PluginResult.Status.JSON_EXCEPTION); - } - } - - /** - * Is the TTS service ready to play yet? - * - * @return - */ - private boolean isReady() { - return (state == TTS.STARTED) ? true : false; - } - - /** - * Called when the TTS service is initialized. - * - * @param status - */ - public void onInit(int status) { - if (status == TextToSpeech.SUCCESS) { - state = TTS.STARTED; - PluginResult result = new PluginResult(PluginResult.Status.OK, TTS.STARTED); - result.setKeepCallback(false); - this.success(result, this.startupCallbackId); - mTts.setOnUtteranceCompletedListener(this); - } - else if (status == TextToSpeech.ERROR) { - state = TTS.STOPPED; - PluginResult result = new PluginResult(PluginResult.Status.ERROR, TTS.STOPPED); - result.setKeepCallback(false); - this.error(result, this.startupCallbackId); - } - } - - /** - * Clean up the TTS resources - */ - public void onDestroy() { - if (mTts != null) { - mTts.shutdown(); - } - } - - /** - * Once the utterance has completely been played call the speak's success callback - */ - public void onUtteranceCompleted(String utteranceId) { - PluginResult result = new PluginResult(PluginResult.Status.OK); - result.setKeepCallback(false); - this.success(result, utteranceId); - } -} diff --git a/Android/TTS/1.8.1/www/tts.js b/Android/TTS/1.8.1/www/tts.js deleted file mode 100644 index 65320c78..00000000 --- a/Android/TTS/1.8.1/www/tts.js +++ /dev/null @@ -1,146 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2011, IBM Corporation - * - * Modified by Murray Macdonald (murray@workgroup.ca) on 2012/05/30 to add pitch(), speed(), stop(), and interrupt() methods. - */ - -/** - * Constructor - */ -function TTS() { -} - -TTS.STOPPED = 0; -TTS.INITIALIZING = 1; -TTS.STARTED = 2; - -/** - * Play the passed in text as synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.speak = function(text, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "speak", [text]); -}; - -/** - * Interrupt any existing speech, then speak the passed in text as synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.interrupt = function(text, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "interrupt", [text]); -}; - -/** - * Stop any queued synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.stop= function(successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "stop", []); -}; - -/** - * Play silence for the number of ms passed in as duration - * - * @param {long} duration - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.silence = function(duration, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "silence", [duration]); -}; - -/** - * Set speed of speech. Usable from 30 to 500. Higher values make little difference. - * - * @param {long} speed - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.speed = function(speed, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "speed", [speed]); -}; - -/** - * Set pitch of speech. Useful values are approximately 30 - 300 - * - * @param {long} pitch - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.pitch = function(pitch, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "pitch", [pitch]); -}; - -/** - * Starts up the TTS Service - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.startup = function(successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "startup", []); -}; - -/** - * Shuts down the TTS Service if you no longer need it. - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.shutdown = function(successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "shutdown", []); -}; - -/** - * Finds out if the language is currently supported by the TTS service. - * - * @param {DOMSting} lang - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.isLanguageAvailable = function(lang, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "isLanguageAvailable", [lang]); -}; - -/** - * Finds out the current language of the TTS service. - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.getLanguage = function(successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "getLanguage", []); -}; - -/** - * Sets the language of the TTS service. - * - * @param {DOMString} lang - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.setLanguage = function(lang, successCallback, errorCallback) { - return PhoneGap.exec(successCallback, errorCallback, "TTS", "setLanguage", [lang]); -}; - -/** - * Load TTS - */ -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin("tts", new TTS()); -// @deprecated: No longer needed in PhoneGap 1.0. Uncomment the addService code for earlier -// PhoneGap releases. -// PluginManager.addService("TTS", "com.phonegap.plugins.speech.TTS"); -}); diff --git a/Android/TTS/2.0.0/LICENSE b/Android/TTS/2.0.0/LICENSE deleted file mode 100644 index 3da82a10..00000000 --- a/Android/TTS/2.0.0/LICENSE +++ /dev/null @@ -1,64 +0,0 @@ -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - -The text of the MIT and BSD licenses is reproduced below. - -------------------------------------------------------------------------------- -The "New" BSD License: -********************** - -Copyright (c) 2005-2010, Nitobi Software Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Phonegap/Nitobi nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -------------------------------------------------------------------------------- -The MIT License -***************** - -Copyright (c) <2010> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. \ No newline at end of file diff --git a/Android/TTS/2.0.0/config.xml b/Android/TTS/2.0.0/config.xml deleted file mode 100644 index 55b78c8e..00000000 --- a/Android/TTS/2.0.0/config.xml +++ /dev/null @@ -1,33 +0,0 @@ - - - - - The TTS class that allows you to access the devices TTS services. - - - -The TTS class that allows you to access the devices TTS services. - -A simple use case would be: - -- Playing text passed into the service out as synthesized speech - - - Simon MacDonald - - -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - - \ No newline at end of file diff --git a/Android/TTS/2.0.0/docs/TTS.md b/Android/TTS/2.0.0/docs/TTS.md deleted file mode 100755 index 0729fa88..00000000 --- a/Android/TTS/2.0.0/docs/TTS.md +++ /dev/null @@ -1,127 +0,0 @@ -TTS -========== - -The TTS class that allows you to access the devices TTS services. - -Properties ----------- - -N/A - -Methods -------- - -- __startup__: starts the TTS service. -- __shutdown__: stops the TTS service. -- __speak__: speaks the specified text. -- __silence__: plays silence for the specified number of ms. -- __getLanguage__: gets the current TTS language. -- __setLanguage__: sets the current TTS language. -- __isLanguageAvailable__: finds out if TTS supports the language. - - -Details -------- - -The TTS class is a way to have your application read out text in a machine generated format. - - - -Supported Platforms -------------------- - -- Android - -Quick Example ------------------------------- - - window.plugins.tts.startup(startupWin, startupFail); - - function startupWin(result) { - // When result is equal to STARTED we are ready to play - if (result == TTS.STARTED) { - window.plugins.tts.speak("The text to speech service is ready"); - } - } - - function startupFail(result) { - console.log("Startup failure = " + result); - } - -Full Example ------------- - - - - - PhoneGap Events Example - - - - - - -

TTS Example

-
- - Speak
- test - - \ No newline at end of file diff --git a/Android/TTS/2.0.0/manifest b/Android/TTS/2.0.0/manifest deleted file mode 100644 index 945a250c..00000000 --- a/Android/TTS/2.0.0/manifest +++ /dev/null @@ -1,3 +0,0 @@ -lib/commons-net-2.2.jar -src/com/phonegap/plugins/FtpClient.java -www/ftpclient.js \ No newline at end of file diff --git a/Android/TTS/2.0.0/src/com/phonegap/plugins/speech/TTS.java b/Android/TTS/2.0.0/src/com/phonegap/plugins/speech/TTS.java deleted file mode 100644 index c28101ee..00000000 --- a/Android/TTS/2.0.0/src/com/phonegap/plugins/speech/TTS.java +++ /dev/null @@ -1,210 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2011, IBM Corporation - * - * Modified by Murray Macdonald (murray@workgroup.ca) on 2012/05/30 to add support for stop(), pitch(), speed() and interrupt(); - * - */ - -package com.phonegap.plugins.speech; - -import java.util.HashMap; -import java.util.Locale; - -import org.json.JSONArray; -import org.json.JSONException; -import org.json.JSONObject; - -import android.speech.tts.TextToSpeech; -import android.speech.tts.TextToSpeech.OnInitListener; -import android.speech.tts.TextToSpeech.OnUtteranceCompletedListener; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -public class TTS extends Plugin implements OnInitListener, OnUtteranceCompletedListener { - - private static final String LOG_TAG = "TTS"; - private static final int STOPPED = 0; - private static final int INITIALIZING = 1; - private static final int STARTED = 2; - private TextToSpeech mTts = null; - private int state = STOPPED; - - private String startupCallbackId = ""; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - try { - if (action.equals("speak")) { - String text = args.getString(0); - if (isReady()) { - HashMap map = null; - map = new HashMap(); - map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId); - mTts.speak(text, TextToSpeech.QUEUE_ADD, map); - PluginResult pr = new PluginResult(PluginResult.Status.NO_RESULT); - pr.setKeepCallback(true); - return pr; - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("interrupt")) { - String text = args.getString(0); - if (isReady()) { - HashMap map = null; - map = new HashMap(); - map.put(TextToSpeech.Engine.KEY_PARAM_UTTERANCE_ID, callbackId); - mTts.speak(text, TextToSpeech.QUEUE_FLUSH, map); - PluginResult pr = new PluginResult(PluginResult.Status.NO_RESULT); - pr.setKeepCallback(true); - return pr; - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("stop")) { - if (isReady()) { - mTts.stop(); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("silence")) { - if (isReady()) { - mTts.playSilence(args.getLong(0), TextToSpeech.QUEUE_ADD, null); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("speed")) { - if (isReady()) { - float speed= (float) (args.optLong(0, 100)) /(float) 100.0; - mTts.setSpeechRate(speed); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("pitch")) { - if (isReady()) { - float pitch= (float) (args.optLong(0, 100)) /(float) 100.0; - mTts.setPitch(pitch); - return new PluginResult(status, result); - } else { - JSONObject error = new JSONObject(); - error.put("message","TTS service is still initialzing."); - error.put("code", TTS.INITIALIZING); - return new PluginResult(PluginResult.Status.ERROR, error); - } - } else if (action.equals("startup")) { - if (mTts == null) { - this.startupCallbackId = callbackId; - state = TTS.INITIALIZING; - mTts = new TextToSpeech(cordova.getActivity().getApplicationContext(), this); - } - PluginResult pluginResult = new PluginResult(status, TTS.INITIALIZING); - pluginResult.setKeepCallback(true); - return pluginResult; - } - else if (action.equals("shutdown")) { - if (mTts != null) { - mTts.shutdown(); - } - return new PluginResult(status, result); - } - else if (action.equals("getLanguage")) { - if (mTts != null) { - result = mTts.getLanguage().toString(); - return new PluginResult(status, result); - } - } - else if (action.equals("isLanguageAvailable")) { - if (mTts != null) { - Locale loc = new Locale(args.getString(0)); - int available = mTts.isLanguageAvailable(loc); - result = (available < 0) ? "false" : "true"; - return new PluginResult(status, result); - } - } - else if (action.equals("setLanguage")) { - if (mTts != null) { - Locale loc = new Locale(args.getString(0)); - int available = mTts.setLanguage(loc); - result = (available < 0) ? "false" : "true"; - return new PluginResult(status, result); - } - } - return new PluginResult(status, result); - } catch (JSONException e) { - e.printStackTrace(); - return new PluginResult(PluginResult.Status.JSON_EXCEPTION); - } - } - - /** - * Is the TTS service ready to play yet? - * - * @return - */ - private boolean isReady() { - return (state == TTS.STARTED) ? true : false; - } - - /** - * Called when the TTS service is initialized. - * - * @param status - */ - public void onInit(int status) { - if (status == TextToSpeech.SUCCESS) { - state = TTS.STARTED; - PluginResult result = new PluginResult(PluginResult.Status.OK, TTS.STARTED); - result.setKeepCallback(false); - this.success(result, this.startupCallbackId); - mTts.setOnUtteranceCompletedListener(this); - } - else if (status == TextToSpeech.ERROR) { - state = TTS.STOPPED; - PluginResult result = new PluginResult(PluginResult.Status.ERROR, TTS.STOPPED); - result.setKeepCallback(false); - this.error(result, this.startupCallbackId); - } - } - - /** - * Clean up the TTS resources - */ - public void onDestroy() { - if (mTts != null) { - mTts.shutdown(); - } - } - - /** - * Once the utterance has completely been played call the speak's success callback - */ - public void onUtteranceCompleted(String utteranceId) { - PluginResult result = new PluginResult(PluginResult.Status.OK); - result.setKeepCallback(false); - this.success(result, utteranceId); - } -} \ No newline at end of file diff --git a/Android/TTS/2.0.0/www/tts.js b/Android/TTS/2.0.0/www/tts.js deleted file mode 100644 index b09b5c94..00000000 --- a/Android/TTS/2.0.0/www/tts.js +++ /dev/null @@ -1,153 +0,0 @@ -/* - * cordova is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2011, IBM Corporation - */ -/* - * cordova is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2011, IBM Corporation - * - * Modified by Murray Macdonald (murray@workgroup.ca) on 2012/05/30 to add pitch(), speed(), stop(), and interrupt() methods. - */ - -/** - * Constructor - */ -function TTS() { -} - -TTS.STOPPED = 0; -TTS.INITIALIZING = 1; -TTS.STARTED = 2; - -/** - * Play the passed in text as synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.speak = function(text, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "speak", [text]); -}; - -/** - * Interrupt any existing speech, then speak the passed in text as synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.interrupt = function(text, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "interrupt", [text]); -}; - -/** - * Stop any queued synthesized speech - * - * @param {DOMString} text - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.stop= function(successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "stop", []); -}; - -/** - * Play silence for the number of ms passed in as duration - * - * @param {long} duration - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.silence = function(duration, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "silence", [duration]); -}; - -/** - * Set speed of speech. Usable from 30 to 500. Higher values make little difference. - * - * @param {long} speed - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.speed = function(speed, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "speed", [speed]); -}; - -/** - * Set pitch of speech. Useful values are approximately 30 - 300 - * - * @param {long} pitch - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.pitch = function(pitch, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "pitch", [pitch]); -}; - -/** - * Starts up the TTS Service - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.startup = function(successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "startup", []); -}; - -/** - * Shuts down the TTS Service if you no longer need it. - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.shutdown = function(successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "shutdown", []); -}; - -/** - * Finds out if the language is currently supported by the TTS service. - * - * @param {DOMSting} lang - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.isLanguageAvailable = function(lang, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "isLanguageAvailable", [lang]); -}; - -/** - * Finds out the current language of the TTS service. - * - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.getLanguage = function(successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "getLanguage", []); -}; - -/** - * Sets the language of the TTS service. - * - * @param {DOMString} lang - * @param {Object} successCallback - * @param {Object} errorCallback - */ -TTS.prototype.setLanguage = function(lang, successCallback, errorCallback) { - return cordova.exec(successCallback, errorCallback, "TTS", "setLanguage", [lang]); -}; - -/** - * Load TTS - */ - -if(!window.plugins) { - window.plugins = {}; -} -if (!window.plugins.tts) { - window.plugins.tts = new TTS(); -} diff --git a/Android/TTS/README.md b/Android/TTS/README.md index eb4db75e..644e01f5 100755 --- a/Android/TTS/README.md +++ b/Android/TTS/README.md @@ -1,213 +1,2 @@ -# TTS plugin for Phonegap # - -The TTS class that allows you to access the devices TTS services. - -A simple use case would be: - -- Playing text passed into the service out as synthesized speech - -## Adding the Plugin to your project ## - -Using this plugin requires [Android PhoneGap](http://github.com/phonegap/phonegap-android). - -1. To install the plugin, move www/tts.js to your project's www folder and include a reference to it in your html file after phonegap.{ver}.js. - - <script type="text/javascript" charset="utf-8" src="phonegap.{ver}.js"></script>
- <script type="text/javascript" charset="utf-8" src="tts.js"></script> - -2. Create a directory within your project called "src/com/phonegap/plugins/speech" and copy src/com/phonegap/plugins/speech/TTS.java into it. - -3. Add the following activity to your AndroidManifest.xml file. It should be added inside the <application> tag. - - <activity android:name="com.phonegap.DroidGap" android:label="@string/app_name">
- <intent-filter>
- </intent-filter>
- </activity> - -4. In your res/xml/plugins.xml file add the following line: - - <plugin name="TTS" value="com.phonegap.plugins.speech.TTS"/> - - -## Using the plugin ## - -The plugin creates the object `window.plugins.tts`. To use, call one of the following, available methods: - -
-/**
- * Play the passed in text as synthasized speech
- * 
- * @param {DOMString} text
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-speak(text, successCallback, errorCallback); - -Sample use: - - window.plugins.tts.speak("The TTS service is ready", win, fail); - -
-/** 
- * Play silence for the number of ms passed in as duration
- * 
- * @param {long} duration
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-silence(duration, successCallback, errorCallback); - -Sample use: - - window.plugins.tts.silence(2000, win, fail); - -
-/**
- * Starts up the TTS Service
- * 
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-startup(successCallback, errorCallback); - -Sample use: - - window.plugins.tts.startup(win, fail); - -
-/**
- * Shuts down the TTS Service if you no longer need it.
- * 
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-shutdown(successCallback, errorCallback); - -Sample use: - - window.plugins.tts.shutdown(win, fail); - -
-/**
- * Finds out if the language is currently supported by the TTS service.
- * 
- * @param {DOMSting} lang
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-isLanguageAvailable(lang, successCallback, errorCallback); - -Sample use: - - window.plugins.tts.isLanguageAvailable(lang, win, fail); - -
-/**
- * Finds out the current language of the TTS service.
- * 
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-getLanguage(successCallback, errorCallback); - -Sample use: - - window.plugins.tts.getLanguage(win, fail); - -
-/**
- * Sets the language of the TTS service.
- * 
- * @param {DOMString} lang
- * @param {Object} successCallback
- * @param {Object} errorCallback
- */
-
-setLanguage(lang, successCallback, errorCallback); - -Sample use: - - window.plugins.tts.setLanguage(lang, win, fail); - -## RELEASE NOTES ## - -### May 7, 2011 ### - -* Initial release - -## BUGS AND CONTRIBUTIONS ## - - -## LICENSE ## - -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - -The text of the MIT and BSD licenses is reproduced below. - ---- - -### The "New" BSD License - -Copyright (c) 2005-2010, Nitobi Software Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Phonegap/Nitobi nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - -### The MIT License - -Copyright (c) <2010> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - \ No newline at end of file +# Moved to # +https://github.com/macdonst/TTS \ No newline at end of file diff --git a/Android/Torch/README.md b/Android/Torch/1.9/README.md similarity index 100% rename from Android/Torch/README.md rename to Android/Torch/1.9/README.md diff --git a/Android/Torch/Torch.js b/Android/Torch/1.9/Torch.js similarity index 100% rename from Android/Torch/Torch.js rename to Android/Torch/1.9/Torch.js diff --git a/Android/Torch/TorchPlugin.java b/Android/Torch/1.9/TorchPlugin.java similarity index 100% rename from Android/Torch/TorchPlugin.java rename to Android/Torch/1.9/TorchPlugin.java diff --git a/Android/Torch/2.1/README.md b/Android/Torch/2.1/README.md new file mode 100644 index 00000000..07e85657 --- /dev/null +++ b/Android/Torch/2.1/README.md @@ -0,0 +1,91 @@ +# Torch plugin for Phonegap (Android) # +By Arne de Bree + +## Adding the Plugin to your project ## +1. To install the plugin, move `Torch.js` to your project's www folder and include a reference to it +in your html files. + + <script src="Torch.js"></script> + +2. Create a folder called 'nl/debree/phonegap/plugin/torch' within your project's src folder. +3. And copy the java file into that new folder. + +
+    mkdir -p /src/nl/debree/phonegap/plugin/torch/
+    cp ./TorchPlugin.java /src/nl/debree/phonegap/plugin/torch/
+
+ +4. Add a plugin line to `res/xml/plugins.xml` + + <plugin name="Torch" value="nl.debree.phonegap.plugin.torch.TorchPlugin" /> + +## Using the plugin ## +The plugin creates the object `window.plugins.Torch` within your DOM. This object +exposes the following functions: + +- isOn +- isCapable +- toggle +- turnOn +- turnOff + +
+    window.plugins.Torch.isOn( 
+        function( result ) { console.log( "isOn: " + result.on ) }      // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+    
+    window.plugins.Torch.isCapable( 
+        function( result ) { console.log( "isCapable: " + result.capable ) }      // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+    
+    window.plugins.Torch.toggle( 
+        function() { console.log( "toggle" ) }                          // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+    window.plugins.Torch.turnOn( 
+        function() { console.log( "turnOn" ) }                          // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+    window.plugins.Torch.turnOff( 
+        function() { console.log( "turnOff" ) }                         // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+ + +## BUGS AND CONTRIBUTIONS ## +The latest bleeding-edge version is available [on GitHub](http://github.com/adebrees/phonegap-plugins/tree/master/Android/) +If you have a patch, fork my repo baby and send me a pull request. Submit bug reports on GitHub, please. + +## Licence ## + +The MIT License + +Copyright (c) 2011 Arne de Bree + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + + + \ No newline at end of file diff --git a/Android/Torch/2.1/Torch.js b/Android/Torch/2.1/Torch.js new file mode 100644 index 00000000..90a3ad7c --- /dev/null +++ b/Android/Torch/2.1/Torch.js @@ -0,0 +1,68 @@ +/** + * Phonegap Torch plugin + * Copyright (c) Arne de Bree 2011 + * + */ + +/** + * + * @return Object literal singleton instance of Torch + */ +var Torch = function() {}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isCapable = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "isCapable", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isOn = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "isOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOn = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "turnOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOff = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "turnOff", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.toggle = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "toggle", [] ); +}; + +/** + * Load Analytics + */ + +if(!window.plugins) { + window.plugins = {}; +} + +if (!window.plugins.Torch) { + window.plugins.Torch = new Torch(); +} diff --git a/Android/Torch/2.1/Torch.js~ b/Android/Torch/2.1/Torch.js~ new file mode 100644 index 00000000..a7d4650e --- /dev/null +++ b/Android/Torch/2.1/Torch.js~ @@ -0,0 +1,61 @@ +/** + * Phonegap Torch plugin + * Copyright (c) Arne de Bree 2011 + * + */ + +/** + * + * @return Object literal singleton instance of Torch + */ +var Torch = function() {}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isCapable = function( success, error ) +{ + return Cordova.exec( success, error, "Torch", "isCapable", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isOn = function( success, error ) +{ + return Cordova.exec( success, error, "Torch", "isOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOn = function( success, error ) +{ + return Cordova.exec( success, error, "Torch", "turnOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOff = function( success, error ) +{ + return Cordova.exec( success, error, "Torch", "turnOff", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.toggle = function( success, error ) +{ + return Cordova.exec( success, error, "Torch", "toggle", [] ); +}; + +Cordova.addConstructor( function() +{ + Cordova.addPlugin( "Torch", new Torch() ); +} ); diff --git a/Android/Torch/2.1/TorchPlugin.java b/Android/Torch/2.1/TorchPlugin.java new file mode 100644 index 00000000..09557dd7 --- /dev/null +++ b/Android/Torch/2.1/TorchPlugin.java @@ -0,0 +1,154 @@ +/** + * Phonegap Torch Plugin + * Copyright (c) Arne de Bree 2011 + * + */ +package nl.debree.phonegap.plugin.torch; + +import java.util.List; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import com.phonegap.api.Plugin; +import com.phonegap.api.PluginResult; +import com.phonegap.api.PluginResult.Status; + +import android.hardware.Camera; +import android.util.Log; + +/** + * Plugin to turn on or off the Camera Flashlight of an Android device + * after the capability is tested + */ +public class TorchPlugin extends Plugin { + + public static final String CMD_ON = "turnOn"; + public static final String CMD_OFF = "turnOff"; + public static final String CMD_TOGGLE = "toggle"; + public static final String CMD_IS_ON = "isOn"; + public static final String CMD_HAS_TORCH = "isCapable"; + + // Create camera and parameter objects + private Camera mCamera; + private Camera.Parameters mParameters; + private boolean mbTorchEnabled = false; + + /** + * Constructor + */ + public TorchPlugin() { + Log.d( "TorchPlugin", "Plugin created" ); + + mCamera = Camera.open(); + } + + /* + * Executes the request and returns PluginResult. + * + * @param action action to perform. Allowed values: turnOn, turnOff, toggle, isOn, isCapable + * @param data input data, currently not in use + * @param callbackId The callback id used when calling back into JavaScript. + * @return A PluginResult object with a status and message. + * + * @see com.phonegap.api.Plugin#execute(java.lang.String, + * org.json.JSONArray, java.lang.String) + */ + @Override + public PluginResult execute(String action, JSONArray data, String callbackId) { + Log.d( "TorchPlugin", "Plugin Called " + action ); + + PluginResult result = null; + JSONObject response = new JSONObject(); + + if (action.equals(CMD_ON)) { + + this.toggleTorch( true ); + result = new PluginResult( Status.OK ); + + } else if (action.equals(CMD_OFF)) { + + this.toggleTorch( false ); + result = new PluginResult( Status.OK ); + + } else if (action.equals(CMD_TOGGLE)) { + + this.toggleTorch(); + result = new PluginResult( Status.OK ); + + } else if (action.equals(CMD_IS_ON)) { + try { + response.put( "on", mbTorchEnabled ); + + result = new PluginResult( Status.OK, response ); + } catch( JSONException jsonEx ) { + result = new PluginResult(Status.JSON_EXCEPTION); + } + } else if (action.equals(CMD_HAS_TORCH)) { + try { + response.put( "capable", this.isCapable() ); + + result = new PluginResult( Status.OK, response ); + } catch( JSONException jsonEx ) { + result = new PluginResult(Status.JSON_EXCEPTION); + } + + } else { + result = new PluginResult(Status.INVALID_ACTION); + Log.d( "TorchPlugin", "Invalid action : " + action + " passed"); + } + + return result; + } + + /** + * Test if this device has a Flashlight we can use and put in Torch mode + * + * @return boolean + */ + protected boolean isCapable() { + boolean result = false; + + List flashModes = mParameters.getSupportedFlashModes(); + + if (flashModes != null && flashModes.contains(Camera.Parameters.FLASH_MODE_TORCH)) { + result = true; + } + + return result; + } + + /** + * True toggle function, turns the torch on when off and vise versa + * + */ + protected void toggleTorch() { + toggleTorch( !mbTorchEnabled ); + } + + /** + * Toggle the torch in the requested state + * + * @param state The requested state + * + */ + protected void toggleTorch(boolean state) { + mParameters = mCamera.getParameters(); + + // Make sure that torch mode is supported + // + if ( this.isCapable() ) { + if (state) { + mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); + } else { + mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON); + } + + // Commit the camera parameters + // + mCamera.setParameters(mParameters); + + mbTorchEnabled = state; + } + } +} \ No newline at end of file diff --git a/Android/Torch/2.4/README.md b/Android/Torch/2.4/README.md new file mode 100644 index 00000000..07e85657 --- /dev/null +++ b/Android/Torch/2.4/README.md @@ -0,0 +1,91 @@ +# Torch plugin for Phonegap (Android) # +By Arne de Bree + +## Adding the Plugin to your project ## +1. To install the plugin, move `Torch.js` to your project's www folder and include a reference to it +in your html files. + + <script src="Torch.js"></script> + +2. Create a folder called 'nl/debree/phonegap/plugin/torch' within your project's src folder. +3. And copy the java file into that new folder. + +
+    mkdir -p /src/nl/debree/phonegap/plugin/torch/
+    cp ./TorchPlugin.java /src/nl/debree/phonegap/plugin/torch/
+
+ +4. Add a plugin line to `res/xml/plugins.xml` + + <plugin name="Torch" value="nl.debree.phonegap.plugin.torch.TorchPlugin" /> + +## Using the plugin ## +The plugin creates the object `window.plugins.Torch` within your DOM. This object +exposes the following functions: + +- isOn +- isCapable +- toggle +- turnOn +- turnOff + +
+    window.plugins.Torch.isOn( 
+        function( result ) { console.log( "isOn: " + result.on ) }      // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+    
+    window.plugins.Torch.isCapable( 
+        function( result ) { console.log( "isCapable: " + result.capable ) }      // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+    
+    window.plugins.Torch.toggle( 
+        function() { console.log( "toggle" ) }                          // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+    window.plugins.Torch.turnOn( 
+        function() { console.log( "turnOn" ) }                          // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+    window.plugins.Torch.turnOff( 
+        function() { console.log( "turnOff" ) }                         // success
+    ,   function() { console.log( "error" ) }                           // error
+    );
+
+ + +## BUGS AND CONTRIBUTIONS ## +The latest bleeding-edge version is available [on GitHub](http://github.com/adebrees/phonegap-plugins/tree/master/Android/) +If you have a patch, fork my repo baby and send me a pull request. Submit bug reports on GitHub, please. + +## Licence ## + +The MIT License + +Copyright (c) 2011 Arne de Bree + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + + + + + \ No newline at end of file diff --git a/Android/Torch/2.4/Torch.js b/Android/Torch/2.4/Torch.js new file mode 100644 index 00000000..90a3ad7c --- /dev/null +++ b/Android/Torch/2.4/Torch.js @@ -0,0 +1,68 @@ +/** + * Phonegap Torch plugin + * Copyright (c) Arne de Bree 2011 + * + */ + +/** + * + * @return Object literal singleton instance of Torch + */ +var Torch = function() {}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isCapable = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "isCapable", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.isOn = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "isOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOn = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "turnOn", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.turnOff = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "turnOff", [] ); +}; + +/** + * @param success The callback for success + * @param error The callback for error + */ +Torch.prototype.toggle = function( success, error ) +{ + return cordova.exec( success, error, "Torch", "toggle", [] ); +}; + +/** + * Load Analytics + */ + +if(!window.plugins) { + window.plugins = {}; +} + +if (!window.plugins.Torch) { + window.plugins.Torch = new Torch(); +} diff --git a/Android/Torch/2.4/TorchPlugin.java b/Android/Torch/2.4/TorchPlugin.java new file mode 100644 index 00000000..77d9f11e --- /dev/null +++ b/Android/Torch/2.4/TorchPlugin.java @@ -0,0 +1,153 @@ +/** + * Phonegap Torch Plugin + * Copyright (c) Arne de Bree 2011 + * + */ +package nl.debree.phonegap.plugin.torch; + +import java.util.List; + +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; +import org.apache.cordova.api.Plugin; +import org.apache.cordova.api.PluginResult; + +import android.hardware.Camera; +import android.util.Log; + +/** + * Plugin to turn on or off the Camera Flashlight of an Android device + * after the capability is tested + */ +public class TorchPlugin extends Plugin { + + public static final String CMD_ON = "turnOn"; + public static final String CMD_OFF = "turnOff"; + public static final String CMD_TOGGLE = "toggle"; + public static final String CMD_IS_ON = "isOn"; + public static final String CMD_HAS_TORCH = "isCapable"; + + // Create camera and parameter objects + private Camera mCamera; + private Camera.Parameters mParameters; + private boolean mbTorchEnabled = false; + + /** + * Constructor + */ + public TorchPlugin() { + Log.d( "TorchPlugin", "Plugin created" ); + + mCamera = Camera.open(); + } + + /* + * Executes the request and returns PluginResult. + * + * @param action action to perform. Allowed values: turnOn, turnOff, toggle, isOn, isCapable + * @param data input data, currently not in use + * @param callbackId The callback id used when calling back into JavaScript. + * @return A PluginResult object with a status and message. + * + * @see com.phonegap.api.Plugin#execute(java.lang.String, + * org.json.JSONArray, java.lang.String) + */ + @Override + public PluginResult execute(String action, JSONArray data, String callbackId) { + Log.d( "TorchPlugin", "Plugin Called " + action ); + + PluginResult result = null; + JSONObject response = new JSONObject(); + + if (action.equals(CMD_ON)) { + + this.toggleTorch( true ); + result = new PluginResult( PluginResult.Status.OK ); + + } else if (action.equals(CMD_OFF)) { + + this.toggleTorch( false ); + result = new PluginResult( PluginResult.Status.OK ); + + } else if (action.equals(CMD_TOGGLE)) { + + this.toggleTorch(); + result = new PluginResult( PluginResult.Status.OK ); + + } else if (action.equals(CMD_IS_ON)) { + try { + response.put( "on", mbTorchEnabled ); + + result = new PluginResult( PluginResult.Status.OK, response ); + } catch( JSONException jsonEx ) { + result = new PluginResult(PluginResult.Status.JSON_EXCEPTION); + } + } else if (action.equals(CMD_HAS_TORCH)) { + try { + response.put( "capable", this.isCapable() ); + + result = new PluginResult( PluginResult.Status.OK, response ); + } catch( JSONException jsonEx ) { + result = new PluginResult(PluginResult.Status.JSON_EXCEPTION); + } + + } else { + result = new PluginResult(PluginResult.Status.INVALID_ACTION); + Log.d( "TorchPlugin", "Invalid action : " + action + " passed"); + } + + return result; + } + + /** + * Test if this device has a Flashlight we can use and put in Torch mode + * + * @return boolean + */ + protected boolean isCapable() { + boolean result = false; + + List flashModes = mParameters.getSupportedFlashModes(); + + if (flashModes != null && flashModes.contains(Camera.Parameters.FLASH_MODE_TORCH)) { + result = true; + } + + return result; + } + + /** + * True toggle function, turns the torch on when off and vise versa + * + */ + protected void toggleTorch() { + toggleTorch( !mbTorchEnabled ); + } + + /** + * Toggle the torch in the requested state + * + * @param state The requested state + * + */ + protected void toggleTorch(boolean state) { + mParameters = mCamera.getParameters(); + + // Make sure that torch mode is supported + // + if ( this.isCapable() ) { + if (state) { + mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_TORCH); + } else { + mParameters.setFlashMode(Camera.Parameters.FLASH_MODE_ON); + } + + // Commit the camera parameters + // + mCamera.setParameters(mParameters); + + mbTorchEnabled = state; + } + } +} \ No newline at end of file diff --git a/Android/FtpClient/LICENSE b/Android/Twitter/README similarity index 62% rename from Android/FtpClient/LICENSE rename to Android/Twitter/README index 3da82a10..dfec3d97 100644 --- a/Android/FtpClient/LICENSE +++ b/Android/Twitter/README @@ -1,3 +1,75 @@ +# Twitter plugin for Phonegap # + +This is inspired from the excellent iOS' plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Twitter + +For the moment, only two (major) functions are binding: +1. isTwitterAvailable +2. composeTweet + +## Adding the Plugin to your project ## + +Using this plugin requires [Android PhoneGap](http://github.com/phonegap/phonegap-android). + +1. To install the plugin, move www/twitter.js to your project's www folder and include a reference to it in your html file after phonegap.js. + + + + +2. Create a directory within your project called "src/com/phonegap/plugins/twitter" and move Twitter.java into it. + +3. In your res/xml/plugins.xml file add the following line: + + <plugin name="Twitter" value="com.phonegap.plugins.twitter.Twitter"/> + +## Using the plugin ## + +The plugin creates the object `window.plugins.twitter`. To use, call one of the following, available methods: + +
+  /**
+	* Check if Twitter is installed
+    *
+    */
+  isTwitterAvailable(success, failure)
+
+ +Sample use: + + window.plugins.twitter.isTwitterAvailable( + function(bool){ + if(bool){ + // Do something + + } else { + alert("Twitter is not available"); + } + }, + function(){ + alert("We have a problem with the plugin"); + } + ); + +
+  /**
+	* Compose tweet and open the Twitter application
+    */
+  composeTweet(success, failure, message) {
+
+ +Sample use: + + window.plugins.twitter.composeTweet( + function(){ + }, + function(){ + alert("We have a problem with the plugin"); + }, + "Base of the tweet" + ); + + +## LICENSE ## + PhoneGap is available under *either* the terms of the modified BSD license *or* the MIT License (2008). As a recipient of PhonegGap, you may choose which license to receive this code under (except as noted in per-module LICENSE @@ -9,11 +81,11 @@ with the MIT or BSD licenses that PhoneGap is distributed under. The text of the MIT and BSD licenses is reproduced below. -------------------------------------------------------------------------------- -The "New" BSD License: -********************** +--- -Copyright (c) 2005-2010, Nitobi Software Inc. +### The "New" BSD License + +Copyright (c) 2005-2011, Nitobi Software Inc. All rights reserved. Redistribution and use in source and binary forms, with or without @@ -39,11 +111,11 @@ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -------------------------------------------------------------------------------- -The MIT License -***************** +--- + +### The MIT License -Copyright (c) <2010> +Copyright (c) <2012> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal @@ -61,4 +133,5 @@ Copyright (c) <2010> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. \ No newline at end of file + THE SOFTWARE. + \ No newline at end of file diff --git a/Android/Twitter/src/com/phonegap/plugins/twitter/Twitter.java b/Android/Twitter/src/com/phonegap/plugins/twitter/Twitter.java new file mode 100644 index 00000000..c046e67a --- /dev/null +++ b/Android/Twitter/src/com/phonegap/plugins/twitter/Twitter.java @@ -0,0 +1,149 @@ +package com.phonegap.plugins.twitter; + +import java.util.Arrays; +import java.util.LinkedHashMap; +import java.util.Map; + +import org.json.JSONArray; +import org.json.JSONException; + +import android.content.ComponentName; +import android.content.Intent; +import android.content.pm.ActivityInfo; +import android.content.pm.PackageManager; +import android.content.pm.ResolveInfo; + +import com.phonegap.api.Plugin; +import com.phonegap.api.PluginResult; + +/** + * Twitter plugin for Android + * Inspired of the iOS plugin: https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Twitter + * + * @see http://regis.decamps.info/blog/2011/06/intent-to-open-twitter-client-on-android/ + * @see http://blogrescue.com/2011/12/android-development-send-tweet-action/ + * + * @author Julien Roche + * @version 1.0 + */ +public class Twitter extends Plugin { + // Constants + /** ComposeTweet method's name */ + private static final String METHOD_COMPOSE_TWEET = "composeTweet"; + + /** IsTwitterAvailable method's name */ + private static final String METHOD_IS_TWITTER_AVAILABLE = "isTwitterAvailable"; + + /** List of Twitter's applications with theirs linked send Activity */ + private static Map TWITTER_APPS; + + /** List of available methods */ + private static final String[] AVAILABLE_METHODS = new String[]{ METHOD_COMPOSE_TWEET, METHOD_IS_TWITTER_AVAILABLE }; + + static { + TWITTER_APPS = new LinkedHashMap(); + TWITTER_APPS.put("Twitter", "com.twitter.android.PostActivity"); + TWITTER_APPS.put("TweetCaster", "com.handmark.tweetcaster.NewTwitActivity"); + TWITTER_APPS.put("TweetCaster2", "com.handmark.tweetcaster.ShareSelectorActivity"); + TWITTER_APPS.put("UberSocial", "com.twidroid.activity.SendTweet"); + TWITTER_APPS.put("TweetDeck", "com.tweetdeck.compose.ComposeActivity"); + TWITTER_APPS.put("Seesmic", "com.seesmic.ui.Composer"); + TWITTER_APPS.put("Plume", "com.levelup.touiteur.appwidgets.TouiteurWidgetNewTweet"); + TWITTER_APPS.put("Twicca", "jp.r246.twicca.statuses.Send"); + } + + /** + * @param args + * @param callbackId + * @return A PluginResult object with a status and message. + */ + public PluginResult composeTweet(JSONArray args, String callbackId) { + ResolveInfo resolveInfo = getTwitterResolveInfo(); + String message; + + if(resolveInfo == null){ + return new PluginResult(PluginResult.Status.ERROR, "Twitter is not available"); + } + + if(args.length() <= 0){ + return new PluginResult(PluginResult.Status.ERROR, "No parameter was specified"); + } + + + try { + message = args.getString(0); + + } catch (JSONException e) { + return new PluginResult(PluginResult.Status.ERROR, "Error with the message"); + } + + final ActivityInfo activity = resolveInfo.activityInfo; + final ComponentName name = new ComponentName(activity.applicationInfo.packageName, activity.name); + String p = resolveInfo.activityInfo.packageName; + + Intent intent = new Intent(Intent.ACTION_SEND); + intent.putExtra(Intent.EXTRA_TEXT, message); + intent.setType(p != null && p.startsWith("com.twidroid") ? "application/twitter" : "text/plain"); + intent.addCategory(Intent.CATEGORY_LAUNCHER); + intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_RESET_TASK_IF_NEEDED); + intent.setComponent(name); + this.ctx.startActivity(intent); + + return new PluginResult(PluginResult.Status.OK); + } + + /** + * {@inheritDoc} + * @see com.phonegap.api.Plugin#execute(java.lang.String, org.json.JSONArray, java.lang.String) + */ + @Override + public PluginResult execute(String action, JSONArray args, String callbackId) { + if(action != null && Arrays.binarySearch(AVAILABLE_METHODS, action) >= 0){ + if(METHOD_IS_TWITTER_AVAILABLE.equals(action)){ + return new PluginResult(PluginResult.Status.OK, isTwitterAvailable()); + + } + + if(METHOD_COMPOSE_TWEET.equals(action)) { + return composeTweet(args, callbackId); + } + } + + return new PluginResult(PluginResult.Status.ERROR, "This method is not available"); + } + + /** + * Get the Twitter's {@link ResolveInfo} + * @return the Twitter's {@link ResolveInfo} + */ + public ResolveInfo getTwitterResolveInfo() { + try{ + Intent intent = new Intent(Intent.ACTION_SEND); + intent.putExtra(Intent.EXTRA_TEXT, "Test; please ignore"); + intent.setType("text/plain"); + + final PackageManager pm = this.ctx.getPackageManager(); + for(ResolveInfo resolveInfo: pm.queryIntentActivities(intent, PackageManager.MATCH_DEFAULT_ONLY)){ + ActivityInfo activity = resolveInfo.activityInfo; + if (TWITTER_APPS.containsValue(activity.name)) { + return resolveInfo; + } + } + + } + finally { + + } + + + return null; + } + + /** + * Check if the Twitter is available + * @return true if a Twitter activity is detected + */ + public boolean isTwitterAvailable() { + return getTwitterResolveInfo() != null; + } +} diff --git a/Android/Twitter/www/twitter.js b/Android/Twitter/www/twitter.js new file mode 100644 index 00000000..35239c3a --- /dev/null +++ b/Android/Twitter/www/twitter.js @@ -0,0 +1,22 @@ +/** + * Base of the Android version for Twitter + * @see https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Twitter + */ +var Twitter = +{ + /** + * Check if the serrvice is available + */ + isTwitterAvailable: function( success, failure ) + { + PhoneGap.exec( success, failure, "Twitter", "isTwitterAvailable", []); + }, + + /** + * Try to open Twitter for sending the message + */ + composeTweet: function( success, failure, tweetText, options) + { + PhoneGap.exec(success, failure, "Twitter", "composeTweet", [tweetText]); + } +}; diff --git a/Android/Version/README.md b/Android/Version/README.md new file mode 100644 index 00000000..f7d35892 --- /dev/null +++ b/Android/Version/README.md @@ -0,0 +1,7 @@ +# Version plugin for Phonegap # + +By Giuseppe Catalfamo + +Version allows you to get, display and use the version name and version code of your PhoneGap application. + +The repository for this plugin is located at [https://github.com/gcatalfamo/Version](https://github.com/gcatalfamo/Version). \ No newline at end of file diff --git a/Android/VideoPlayer/1.8.1/src/com/phonegap/plugins/video/VideoPlayer.java b/Android/VideoPlayer/1.8.1/src/com/phonegap/plugins/video/VideoPlayer.java deleted file mode 100644 index 7091fc30..00000000 --- a/Android/VideoPlayer/1.8.1/src/com/phonegap/plugins/video/VideoPlayer.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2011, IBM Corporation - */ - -package com.phonegap.plugins.video; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; - -import com.phonegap.api.Plugin; -import com.phonegap.api.PluginResult; - -public class VideoPlayer extends Plugin { - private static final String YOU_TUBE = "youtube.com"; - private static final String ASSETS = "file:///android_asset/"; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - try { - if (action.equals("playVideo")) { - playVideo(args.getString(0)); - } - else { - status = PluginResult.Status.INVALID_ACTION; - } - return new PluginResult(status, result); - } catch (JSONException e) { - return new PluginResult(PluginResult.Status.JSON_EXCEPTION); - } catch (IOException e) { - return new PluginResult(PluginResult.Status.IO_EXCEPTION); - } - } - - private void playVideo(String url) throws IOException { - // Create URI - Uri uri = Uri.parse(url); - - Intent intent = null; - // Check to see if someone is trying to play a YouTube page. - if (url.contains(YOU_TUBE)) { - // If we don't do it this way you don't have the option for youtube - uri = Uri.parse("vnd.youtube:" + uri.getQueryParameter("v")); - intent = new Intent(Intent.ACTION_VIEW, uri); - } else if(url.contains(ASSETS)) { - // get file path in assets folder - String filepath = url.replace(ASSETS, ""); - // get actual filename from path as command to write to internal storage doesn't like folders - String filename = filepath.substring(filepath.lastIndexOf("/")+1, filepath.length()); - - // Don't copy the file if it already exists - File fp = new File(this.ctx.getContext().getFilesDir() + "/" + filename); - if (!fp.exists()) { - this.copy(filepath, filename); - } - - // change uri to be to the new file in internal storage - uri = Uri.parse("file://" + this.ctx.getContext().getFilesDir() + "/" + filename); - - // Display video player - intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(uri, "video/*"); - } else { - // Display video player - intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(uri, "video/*"); - } - - this.ctx.startActivity(intent); - } - - private void copy(String fileFrom, String fileTo) throws IOException { - // get file to be copied from assets - InputStream in = this.ctx.getAssets().open(fileFrom); - // get file where copied too, in internal storage. - // must be MODE_WORLD_READABLE or Android can't play it - FileOutputStream out = this.ctx.getContext().openFileOutput(fileTo, Context.MODE_WORLD_READABLE); - - // Transfer bytes from in to out - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) - out.write(buf, 0, len); - in.close(); - out.close(); - } -} diff --git a/Android/VideoPlayer/1.8.1/www/video.js b/Android/VideoPlayer/1.8.1/www/video.js deleted file mode 100644 index 6c1ef2af..00000000 --- a/Android/VideoPlayer/1.8.1/www/video.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2011, IBM Corporation - */ - -/** - * Constructor - */ -function VideoPlayer() { -}; - -/** - * Starts the video player intent - * - * @param url The url to play - */ -VideoPlayer.prototype.play = function(url) { - PhoneGap.exec(null, null, "VideoPlayer", "playVideo", [url]); -}; - -/** - * Load VideoPlayer - */ -PhoneGap.addConstructor(function() { - PhoneGap.addPlugin("videoPlayer", new VideoPlayer()); -}); diff --git a/Android/VideoPlayer/2.0.0/src/com/phonegap/plugins/video/VideoPlayer.java b/Android/VideoPlayer/2.0.0/src/com/phonegap/plugins/video/VideoPlayer.java deleted file mode 100644 index 8e1d8102..00000000 --- a/Android/VideoPlayer/2.0.0/src/com/phonegap/plugins/video/VideoPlayer.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2011, IBM Corporation - */ - -package com.phonegap.plugins.video; - -import java.io.File; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStream; - -import org.json.JSONArray; -import org.json.JSONException; - -import android.content.Context; -import android.content.Intent; -import android.net.Uri; - -import org.apache.cordova.api.Plugin; -import org.apache.cordova.api.PluginResult; - -public class VideoPlayer extends Plugin { - private static final String YOU_TUBE = "youtube.com"; - private static final String ASSETS = "file:///android_asset/"; - - @Override - public PluginResult execute(String action, JSONArray args, String callbackId) { - PluginResult.Status status = PluginResult.Status.OK; - String result = ""; - - try { - if (action.equals("playVideo")) { - playVideo(args.getString(0)); - } - else { - status = PluginResult.Status.INVALID_ACTION; - } - return new PluginResult(status, result); - } catch (JSONException e) { - return new PluginResult(PluginResult.Status.JSON_EXCEPTION); - } catch (IOException e) { - return new PluginResult(PluginResult.Status.IO_EXCEPTION); - } - } - - private void playVideo(String url) throws IOException { - // Create URI - Uri uri = Uri.parse(url); - - Intent intent = null; - // Check to see if someone is trying to play a YouTube page. - if (url.contains(YOU_TUBE)) { - // If we don't do it this way you don't have the option for youtube - uri = Uri.parse("vnd.youtube:" + uri.getQueryParameter("v")); - intent = new Intent(Intent.ACTION_VIEW, uri); - } else if(url.contains(ASSETS)) { - // get file path in assets folder - String filepath = url.replace(ASSETS, ""); - // get actual filename from path as command to write to internal storage doesn't like folders - String filename = filepath.substring(filepath.lastIndexOf("/")+1, filepath.length()); - - // Don't copy the file if it already exists - File fp = new File(this.cordova.getActivity().getFilesDir() + "/" + filename); - if (!fp.exists()) { - this.copy(filepath, filename); - } - - // change uri to be to the new file in internal storage - uri = Uri.parse("file://" + this.cordova.getActivity().getFilesDir() + "/" + filename); - - // Display video player - intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(uri, "video/*"); - } else { - // Display video player - intent = new Intent(Intent.ACTION_VIEW); - intent.setDataAndType(uri, "video/*"); - } - - this.cordova.getActivity().startActivity(intent); - } - - private void copy(String fileFrom, String fileTo) throws IOException { - // get file to be copied from assets - InputStream in = this.cordova.getActivity().getAssets().open(fileFrom); - // get file where copied too, in internal storage. - // must be MODE_WORLD_READABLE or Android can't play it - FileOutputStream out = this.cordova.getActivity().openFileOutput(fileTo, Context.MODE_WORLD_READABLE); - - // Transfer bytes from in to out - byte[] buf = new byte[1024]; - int len; - while ((len = in.read(buf)) > 0) - out.write(buf, 0, len); - in.close(); - out.close(); - } -} diff --git a/Android/VideoPlayer/2.0.0/www/video.js b/Android/VideoPlayer/2.0.0/www/video.js deleted file mode 100644 index b92ba5e4..00000000 --- a/Android/VideoPlayer/2.0.0/www/video.js +++ /dev/null @@ -1,33 +0,0 @@ -/* - * PhoneGap is available under *either* the terms of the modified BSD license *or* the - * MIT License (2008). See http://opensource.org/licenses/alphabetical for full text. - * - * Copyright (c) 2005-2010, Nitobi Software Inc. - * Copyright (c) 2011, IBM Corporation - */ - -/** - * Constructor - */ -function VideoPlayer() { -}; - -/** - * Starts the video player intent - * - * @param url The url to play - */ -VideoPlayer.prototype.play = function(url) { - cordova.exec(null, null, "VideoPlayer", "playVideo", [url]); -}; - -/** - * Load VideoPlayer - */ - -if(!window.plugins) { - window.plugins = {}; -} -if (!window.plugins.videoPlayer) { - window.plugins.videoPlayer = new VideoPlayer(); -} diff --git a/Android/VideoPlayer/README.md b/Android/VideoPlayer/README.md index 2c4732be..d43f6991 100755 --- a/Android/VideoPlayer/README.md +++ b/Android/VideoPlayer/README.md @@ -1,119 +1,2 @@ -# VideoPlayer plugin for Phonegap # - -The video player allows you to display videos from your PhoneGap application. - -This command fires an Intent to have your devices video player show the video. - -## Adding the Plugin to your project ## - -Using this plugin requires [Android PhoneGap](https://github.com/apache/incubator-cordova-android). - -1. To install the plugin, move www/video to your project's www folder and include a reference to it in your html file after phonegap.js. - - <script type="text/javascript" charset="utf-8" src="phonegap.js"></script>
- <script type="text/javascript" charset="utf-8" src="video.js"></script> - -2. Create a directory within your project called "src/com/phonegap/plugins/video" and move VideoPlayer.java into it. - -3. In your res/xml/plugins.xml file add the following line: - - <plugin name="VideoPlayer" value="com.phonegap.plugins.video.VideoPlayer"/> - -## Using the plugin ## - -The plugin creates the object `window.plugins.videoPlayer`. To use, call the play() method: - -
-  /**
-	* Display an intent to play the video.
-    *
-    * @param url           The url to play
-    */
-  play(url)
-
- -Sample use: - - window.plugins.videoPlayer.play("http://path.to.my/video.mp4"); - window.plugins.videoPlayer.play("file:///path/to/my/video.mp4"); - window.plugins.videoPlayer.play("file:///android_asset/www/path/to/my/video.mp4"); - -Note: When playing video from the assets folder, the video is first copied to internal storage with MODE_WORLD_READABLE. - -## RELEASE NOTES ## - -### October 2, 2011 ### - -* Initial release - - -## BUGS AND CONTRIBUTIONS ## - - -## LICENSE ## - -PhoneGap is available under *either* the terms of the modified BSD license *or* the -MIT License (2008). As a recipient of PhonegGap, you may choose which -license to receive this code under (except as noted in per-module LICENSE -files). Some modules may not be the copyright of Nitobi. These -modules contain explicit declarations of copyright in both the LICENSE files in -the directories in which they reside and in the code itself. No external -contributions are allowed under licenses which are fundamentally incompatible -with the MIT or BSD licenses that PhoneGap is distributed under. - -The text of the MIT and BSD licenses is reproduced below. - ---- - -### The "New" BSD License - -Copyright (c) 2005-2011, Nitobi Software Inc. -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - * Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - * Neither the name of Phonegap/Nitobi nor the names of its contributors - may be used to endorse or promote products derived from this software - without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND -ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED -WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - ---- - -### The MIT License - -Copyright (c) <2011> - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated documentation files (the "Software"), to deal - in the Software without restriction, including without limitation the rights - to use, copy, modify, merge, publish, distribute, sublicense, and/or sell - copies of the Software, and to permit persons to whom the Software is - furnished to do so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in - all copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN - THE SOFTWARE. - +# Moved to # +https://github.com/macdonst/VideoPlayer \ No newline at end of file diff --git a/Android/WaitingDialog/README.md b/Android/WaitingDialog/README.md new file mode 100644 index 00000000..e0ad81cf --- /dev/null +++ b/Android/WaitingDialog/README.md @@ -0,0 +1,21 @@ +# Waiting dialog for Android applications + +_Created by `Guido Sabatini`_ + +Creates a modal dialog to give a waiting feedback to users +You can only show and dismiss the dialog, it will block user interactions. You can set the text appearing in the dialog + +**NOTE:** this is not a progress dialog, you can not show progress + + // To SHOW a modal waiting dialog + window.plugins.waitingDialog.show("Your dialog text"); + + // To HIDE the dialog + window.plugins.waitingDialog.hide(); + +If you want to show a waiting dialog for a certain amount of time, you can use javascript setTimeout + + // show dialog + window.plugins.waitingDialog.show("Your dialog text"); + // automatically hide dialog after 5 seconds + setTimeout(function() {window.plugins.waitingDialog.hide();}, 5000); \ No newline at end of file diff --git a/Android/WaitingDialog/WaitingDialog.java b/Android/WaitingDialog/WaitingDialog.java new file mode 100644 index 00000000..eecc880a --- /dev/null +++ b/Android/WaitingDialog/WaitingDialog.java @@ -0,0 +1,49 @@ +package org.apache.cordova; + +import org.apache.cordova.api.CallbackContext; +import org.apache.cordova.api.CordovaPlugin; +import org.apache.cordova.api.LOG; +import org.json.JSONArray; +import org.json.JSONException; +import android.app.ProgressDialog; + +public class WaitingDialog extends CordovaPlugin { + + private ProgressDialog waitingDialog = null; + + @Override + public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { + if ("show".equals(action)) { + String text = "Please wait"; + try { + text = args.getString(0); + } catch (Exception e) { + LOG.d("WaitingDialog", "Text parameter not valid, using default"); + } + showWaitingDialog(text); + callbackContext.success(); + return true; + } else if ("hide".equals(action)) { + hideWaitingDialog(); + callbackContext.success(); + return true; + } + return false; + } + + public void showWaitingDialog(String text) { + waitingDialog = ProgressDialog.show(this.cordova.getActivity(), "", text); + LOG.d("WaitingDialog", "Dialog shown, waiting hide command"); + } + + public void hideWaitingDialog() { + if (waitingDialog != null) { + waitingDialog.dismiss(); + LOG.d("WaitingDialog", "Dialog dismissed"); + waitingDialog = null; + } else { + LOG.d("WaitingDialog", "Nothing to dismiss"); + } + } + +} diff --git a/Android/WaitingDialog/WaitingDialog.js b/Android/WaitingDialog/WaitingDialog.js new file mode 100755 index 00000000..3481f0ea --- /dev/null +++ b/Android/WaitingDialog/WaitingDialog.js @@ -0,0 +1,25 @@ +// window.plugins.waitingDialog + +function WaitingDialog() { +} + +WaitingDialog.prototype.show = function(text) { + cordova.exec(null, null, "WaitingDialog", "show", [text]); +} + +WaitingDialog.prototype.hide = function() { + cordova.exec(null, null, "WaitingDialog", "hide", []); +} + +cordova.addConstructor(function() { + if(!window.plugins) { + window.plugins = {}; + } + + // shim to work in 1.5 and 1.6 + if (!window.Cordova) { + window.Cordova = cordova; + }; + + window.plugins.waitingDialog = new WaitingDialog(); +}); \ No newline at end of file diff --git a/Android/WebIntent/README.md b/Android/WebIntent/README.md index ab29ce19..f01d5e03 100644 --- a/Android/WebIntent/README.md +++ b/Android/WebIntent/README.md @@ -3,7 +3,10 @@ By Boris Smus ## Adding the Plugin to your project ## 1. To install the plugin, move webintent.js to your project's www folder and include a reference to it in your html files. -2. Create a folder called "borismus" within your project's src/com/ folder and move the java file into it. +2. Create the path "com/borismus/webintent" within your project's src/ folder and move the java file into it. +3. Add the plugin to your `res/xml/config.xml` file: + +`` ## Using the plugin ## The plugin creates the object `window.plugins.webintent` with five methods: @@ -13,7 +16,7 @@ Launches an Android intent. For example: window.plugins.webintent.startActivity({ - action: WebIntent.ACTION_VIEW, + action: window.plugins.webintent.ACTION_VIEW, url: 'geo:0,0?q=' + address}, function() {}, function() {alert('Failed to open URL via Android Intent')}; diff --git a/Android/WebIntent/WebIntent.java b/Android/WebIntent/WebIntent.java index c6bdee92..c1b2d875 100644 --- a/Android/WebIntent/WebIntent.java +++ b/Android/WebIntent/WebIntent.java @@ -73,7 +73,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) { if (args.length() != 1) { return new PluginResult(PluginResult.Status.INVALID_ACTION); } - Intent i = ((DroidGap)this.cordova.getContext()).getIntent(); + Intent i = ((DroidGap)this.cordova.getActivity()).getIntent(); String extraName = args.getString(0); return new PluginResult(PluginResult.Status.OK, i.hasExtra(extraName)); @@ -81,7 +81,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) { if (args.length() != 1) { return new PluginResult(PluginResult.Status.INVALID_ACTION); } - Intent i = ((DroidGap)this.cordova.getContext()).getIntent(); + Intent i = ((DroidGap)this.cordova.getActivity()).getIntent(); String extraName = args.getString(0); if (i.hasExtra(extraName)) { return new PluginResult(PluginResult.Status.OK, i.getStringExtra(extraName)); @@ -93,7 +93,7 @@ public PluginResult execute(String action, JSONArray args, String callbackId) { return new PluginResult(PluginResult.Status.INVALID_ACTION); } - Intent i = ((DroidGap)this.cordova.getContext()).getIntent(); + Intent i = ((DroidGap)this.cordova.getActivity()).getIntent(); String uri = i.getDataString(); return new PluginResult(PluginResult.Status.OK, uri); } else if (action.equals("onNewIntent")) { @@ -173,7 +173,7 @@ void startActivity(String action, Uri uri, String type, Map extr i.putExtra(key, value); } } - this.cordova.getActivity().startActivity(i); + ((DroidGap)this.cordova.getActivity()).startActivity(i); } void sendBroadcast(String action, Map extras) { @@ -184,6 +184,6 @@ void sendBroadcast(String action, Map extras) { intent.putExtra(key, value); } - ((DroidGap)this.cordova.getContext()).sendBroadcast(intent); + ((DroidGap)this.cordova.getActivity()).sendBroadcast(intent); } } diff --git a/Android/WebIntent/webintent.js b/Android/WebIntent/webintent.js index da22b800..e8183df0 100644 --- a/Android/WebIntent/webintent.js +++ b/Android/WebIntent/webintent.js @@ -3,69 +3,71 @@ * Copyright (c) Boris Smus 2010 * */ -var WebIntent = function() { + (function(cordova){ + var WebIntent = function() { -}; + }; -WebIntent.ACTION_SEND = "android.intent.action.SEND"; -WebIntent.ACTION_VIEW= "android.intent.action.VIEW"; -WebIntent.EXTRA_TEXT = "android.intent.extra.TEXT"; -WebIntent.EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; -WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM"; -WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL"; + WebIntent.ACTION_SEND = "android.intent.action.SEND"; + WebIntent.ACTION_VIEW= "android.intent.action.VIEW"; + WebIntent.EXTRA_TEXT = "android.intent.extra.TEXT"; + WebIntent.EXTRA_SUBJECT = "android.intent.extra.SUBJECT"; + WebIntent.EXTRA_STREAM = "android.intent.extra.STREAM"; + WebIntent.EXTRA_EMAIL = "android.intent.extra.EMAIL"; -WebIntent.prototype.startActivity = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'startActivity', [params]); -}; + WebIntent.prototype.startActivity = function(params, success, fail) { + return cordova.exec(function(args) { + success(args); + }, function(args) { + fail(args); + }, 'WebIntent', 'startActivity', [params]); + }; -WebIntent.prototype.hasExtra = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'hasExtra', [params]); -}; + WebIntent.prototype.hasExtra = function(params, success, fail) { + return cordova.exec(function(args) { + success(args); + }, function(args) { + fail(args); + }, 'WebIntent', 'hasExtra', [params]); + }; -WebIntent.prototype.getUri = function(success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'getUri', []); -}; + WebIntent.prototype.getUri = function(success, fail) { + return cordova.exec(function(args) { + success(args); + }, function(args) { + fail(args); + }, 'WebIntent', 'getUri', []); + }; -WebIntent.prototype.getExtra = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'getExtra', [params]); -}; + WebIntent.prototype.getExtra = function(params, success, fail) { + return cordova.exec(function(args) { + success(args); + }, function(args) { + fail(args); + }, 'WebIntent', 'getExtra', [params]); + }; -WebIntent.prototype.onNewIntent = function(callback) { - return cordova.exec(function(args) { - callback(args); - }, function(args) { - }, 'WebIntent', 'onNewIntent', []); -}; + WebIntent.prototype.onNewIntent = function(callback) { + return cordova.exec(function(args) { + callback(args); + }, function(args) { + }, 'WebIntent', 'onNewIntent', []); + }; -WebIntent.prototype.sendBroadcast = function(params, success, fail) { - return cordova.exec(function(args) { - success(args); - }, function(args) { - fail(args); - }, 'WebIntent', 'sendBroadcast', [params]); -}; + WebIntent.prototype.sendBroadcast = function(params, success, fail) { + return cordova.exec(function(args) { + success(args); + }, function(args) { + fail(args); + }, 'WebIntent', 'sendBroadcast', [params]); + }; -cordova.addConstructor(function() { - window.webintent = new WebIntent(); - - // backwards compatibility - window.plugins = window.plugins || {}; - window.plugins.webintent = window.webintent; -}); + cordova.addConstructor(function() { + window.webintent = new WebIntent(); + + // backwards compatibility + window.plugins = window.plugins || {}; + window.plugins.webintent = window.webintent; + }); +})(window.PhoneGap || window.Cordova || window.cordova); \ No newline at end of file diff --git a/Android/YouTube Player API/README.md b/Android/YouTube Player API/README.md new file mode 100644 index 00000000..7cd4e4c1 --- /dev/null +++ b/Android/YouTube Player API/README.md @@ -0,0 +1,9 @@ +# Cordova / Phonegap YouTube Android Player API # +by [Remco Beugels (RemcoB00)](http://twitter.com/remcob00) + +--- +### [This plugin is hosted by the author](https://github.com/remcob00/cordova-phonegap_youtube_player_api_android) +--- + +## Description ## +With this plugin you can play YouTube video's with your Cordova / Phonegap app. For more info see [the plugin repo](https://github.com/remcob00/cordova-phonegap_youtube_player_api_android). \ No newline at end of file diff --git a/Android/ZeroConf/README.md b/Android/ZeroConf/README.md new file mode 100644 index 00000000..ac819fb8 --- /dev/null +++ b/Android/ZeroConf/README.md @@ -0,0 +1,86 @@ +# ZeroConf plugin for Cordova/Phonegap # +By [Matt Kane](https://github.com/ascorbic) / [Triggertrap Ltd](https://github.com/triggertrap). + +This plugin allows you to browse and publish ZeroConf/Bonjour/mDNS services. +It depends on [the JmDNS library](http://jmdns.sourceforge.net/). + + +## Adding the Plugin to your project ## + +1. To install the plugin, move ZeroConf.js to your project's www folder and include a reference to it in your html files. +2. Create a folder called 'com/triggertrap/' within your project's src folder. +3. And copy the ZeroConf.java file into that new folder. +4. Download [the jmdns.jar file](https://github.com/twitwi/AndroidDnssdDemo/) +and add it to your project's build path. In Eclipse, do this by right-clicking on it and choosing "Add to build path". +5. In your res/xml/plugins.xml file add the following line: + + `` + +## Using the plugin ## + +There are five static methods on the ZeroConf object, as follows: + +### `watch(type, callback)` +Note that `type` is a fully-qualified service type, including the domain, e.g. `"_http._tcp.local."` + +`callback` is a function that is called when services are added and removed. The function is passed +an object with the following structure: + +```javascript +{ + "service": { + "port": 50930, + "protocol": "tcp", + "application": "http", + "urls": ["http://192.168.2.2:50930", "http://fe80::7256:81ff:fe00:99e3:50930"], + "description": "\\00", + "name": "Black iPod", + "domain": "local", + "server": "", + "addresses": ["192.168.2.2", "fe80::7256:81ff:fe00:99e3"], + "type": "_http._tcp.local.", + "qualifiedname": "Black iPod._http._tcp.local." + }, + "action": "added" +} + +``` +For more information on the fields, see [the JmDNS docs](http://jmdns.sourceforge.net/apidocs/javax/jmdns/ServiceInfo.html). +If you edit ZeroConf.java, you can easily add more fields if you need them. + +### `unwatch(type)` +Stops watching for services of the specified type. + +### `close()` +Closes the service browser and stops watching. + +### `register(type, name, port, text)` +Publishes a new service. The fields are as in the structure above. For more information, +see [the JmDNS docs](http://jmdns.sourceforge.net/apidocs/javax/jmdns/ServiceInfo.html). + +### `unregister()` +Unregisters all published services. + +## Licence ## + +The MIT License + +Copyright © 2012 Triggertrap Ltd. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/Android/ZeroConf/ZeroConf.java b/Android/ZeroConf/ZeroConf.java new file mode 100644 index 00000000..ff2035b8 --- /dev/null +++ b/Android/ZeroConf/ZeroConf.java @@ -0,0 +1,214 @@ +/** + * ZeroConf plugin for Cordova/Phonegap + * + * @author Matt Kane + * Copyright (c) Triggertrap Ltd. 2012. All Rights Reserved. + * Available under the terms of the MIT License. + * + */ + +package com.triggertrap; + +import java.io.IOException; + +import org.apache.cordova.api.Plugin; +import org.apache.cordova.api.PluginResult; +import org.apache.cordova.api.PluginResult.Status; +import org.json.JSONArray; +import org.json.JSONException; +import org.json.JSONObject; + +import android.net.wifi.WifiManager; +import android.util.Log; + +import javax.jmdns.JmDNS; +import javax.jmdns.ServiceEvent; +import javax.jmdns.ServiceInfo; +import javax.jmdns.ServiceListener; + +public class ZeroConf extends Plugin { + WifiManager.MulticastLock lock; + private JmDNS jmdns = null; + private ServiceListener listener; + private String callback; + + @Override + public PluginResult execute(String action, JSONArray args, String callbackId) { + this.callback = callbackId; + + if (action.equals("watch")) { + String type = args.optString(0); + if (type != null) { + watch(type); + } else { + return new PluginResult(PluginResult.Status.ERROR, "Service type not specified"); + } + } else if (action.equals("unwatch")) { + String type = args.optString(0); + if (type != null) { + unwatch(type); + } else { + return new PluginResult(PluginResult.Status.ERROR, "Service type not specified"); + } + } else if (action.equals("register")) { + JSONObject obj = args.optJSONObject(0); + if (obj != null) { + String type = obj.optString("type"); + String name = obj.optString("name"); + int port = obj.optInt("port"); + String text = obj.optString("text"); + if(type == null) { + return new PluginResult(PluginResult.Status.ERROR, "Missing required service info"); + } + register(type, name, port, text); + } else { + return new PluginResult(PluginResult.Status.ERROR, "Missing required service info"); + } + + } else if (action.equals("close")) { + if(jmdns != null) { + try { + jmdns.close(); + } catch (IOException e) { + e.printStackTrace(); + } + } + } else if (action.equals("unregister")) { + if(jmdns != null) { + jmdns.unregisterAllServices(); + } + + } else { + Log.e("ZeroConf", "Invalid action: " + action); + return new PluginResult(PluginResult.Status.INVALID_ACTION); + } + PluginResult result = new PluginResult(Status.NO_RESULT); + result.setKeepCallback(true); + return result; + } + + private void watch(String type) { + if(jmdns == null) { + setupWatcher(); + } + Log.d("ZeroConf", "Watch " + type); + Log.d("ZeroConf", "Name: " + jmdns.getName() + " host: " + jmdns.getHostName()); + jmdns.addServiceListener(type, listener); + } + private void unwatch(String type) { + if(jmdns == null) { + return; + } + jmdns.removeServiceListener(type, listener); + } + + private void register (String type, String name, int port, String text) { + if(name == null) { + name = ""; + } + + if(text == null) { + text = ""; + } + + try { + ServiceInfo service = ServiceInfo.create(type, name, port, text); + jmdns.registerService(service); + } catch (IOException e) { + e.printStackTrace(); + } + } + + private void setupWatcher() { + Log.d("ZeroConf", "Setup watcher"); + WifiManager wifi = (WifiManager) this.cordova.getActivity().getSystemService(android.content.Context.WIFI_SERVICE); + lock = wifi.createMulticastLock("ZeroConfPluginLock"); + lock.setReferenceCounted(true); + lock.acquire(); + try { + jmdns = JmDNS.create(); + listener = new ServiceListener() { + + public void serviceResolved(ServiceEvent ev) { + Log.d("ZeroConf", "Resolved"); + + sendCallback("added", ev.getInfo()); + } + + public void serviceRemoved(ServiceEvent ev) { + Log.d("ZeroConf", "Removed"); + + sendCallback("removed", ev.getInfo()); + } + + public void serviceAdded(ServiceEvent event) { + Log.d("ZeroConf", "Added"); + + // Force serviceResolved to be called again + jmdns.requestServiceInfo(event.getType(), event.getName(), 1); + } + }; + + } catch (IOException e) { + e.printStackTrace(); + return; + } + } + + public void sendCallback(String action, ServiceInfo info) { + JSONObject status = new JSONObject(); + try { + status.put("action", action); + status.put("service", jsonifyService(info)); + Log.d("ZeroConf", "Sending result: " + status.toString()); + + PluginResult result = new PluginResult(PluginResult.Status.OK, status); + result.setKeepCallback(true); + this.success(result, this.callback); + + } catch (JSONException e) { + + e.printStackTrace(); + } + + + } + + + public static JSONObject jsonifyService(ServiceInfo info) { + JSONObject obj = new JSONObject(); + try { + obj.put("application", info.getApplication()); + obj.put("domain", info.getDomain()); + obj.put("port", info.getPort()); + obj.put("name", info.getName()); + obj.put("server", info.getServer()); + obj.put("description", info.getNiceTextString()); + obj.put("protocol", info.getProtocol()); + obj.put("qualifiedname", info.getQualifiedName()); + obj.put("type", info.getType()); + + JSONArray addresses = new JSONArray(); + String[] add = info.getHostAddresses(); + for(int i = 0; i < add.length; i++) { + addresses.put(add[i]); + } + obj.put("addresses", addresses); + JSONArray urls = new JSONArray(); + + String[] url = info.getURLs(); + for(int i = 0; i < url.length; i++) { + urls.put(url[i]); + } + obj.put("urls", urls); + + } catch (JSONException e) { + e.printStackTrace(); + return null; + } + + return obj; + + } + +} diff --git a/Android/ZeroConf/ZeroConf.js b/Android/ZeroConf/ZeroConf.js new file mode 100644 index 00000000..1fbc2ea9 --- /dev/null +++ b/Android/ZeroConf/ZeroConf.js @@ -0,0 +1,37 @@ +/** + * ZeroConf plugin for Cordova/Phonegap + * + * @author Matt Kane + * Copyright (c) Triggertrap Ltd. 2012. All Rights Reserved. + * Available under the terms of the MIT License. + * + */ +var ZeroConf = { + watch: function(type, callback) { + return cordova.exec(function(result) { + if(callback) { + callback(result); + } + + }, ZeroConf.fail, "ZeroConf", "watch", [type]); + }, + unwatch: function(type) { + return cordova.exec(null, ZeroConf.fail, "ZeroConf", "unwatch", [type]); + }, + close: function() { + return cordova.exec(null, ZeroConf.fail, "ZeroConf", "close", []) + }, + register: function(type, name, port, text) { + if(!type) { + console.error("'type' is a required field"); + return; + } + return cordova.exec(null, ZeroConf.fail, "ZeroConf", "register", [type, name, port, text]); + } + unregister: function() { + return cordova.exec(null, ZeroConf.fail, "ZeroConf", "unregister", []) + }, + fail: function (o) { + console.error("Error " + JSON.stringify(o)); + } +} \ No newline at end of file diff --git a/BlackBerry/Biblesearch/README.md b/BlackBerry/Biblesearch/README.md new file mode 100644 index 00000000..e3d44e58 --- /dev/null +++ b/BlackBerry/Biblesearch/README.md @@ -0,0 +1,11 @@ +# biblesearch-api-js + +The American Bible Society has produced this javascript library to ease the use of the Bible Search api (http://bibles.org/pages/api) in phonegap mobile applications. The api (and this library) allow you to easily: + +* search the Bible +* locate specific passages +* get information about specific books, chapters, and verses +* do all that in one or more versions +* store nothing locally + +You can find this plugin at https://github.com/americanbible/biblesearch-api-js. diff --git a/BlackBerry/NFC/README.md b/BlackBerry/NFC/README.md new file mode 100644 index 00000000..9b3a6561 --- /dev/null +++ b/BlackBerry/NFC/README.md @@ -0,0 +1,13 @@ +PhoneGap NFC Plugin +========================== + +The PhoneGap NFC Plugin provides access to Near Field Communication (NFC) hardware, allowing applications to read NDEF message from NFC tags and write NDEF messages. A "tag" may actually be another device that appears as a tag. + +Supported Platforms +------------------- +* Android +* Blackberry Webworks (OS 7.0 and higher) + +Source Code +------------------- +[https://github.com/chariotsolutions/phonegap-nfc](https://github.com/chariotsolutions/phonegap-nfc) diff --git a/README.md b/README.md index 9ec98305..e61336b4 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,14 @@ -This code is completely dependent on the Apache Cordova (formerly PhoneGap) project, hosted on GitHub ( github.com/callback ) +**NOTE**: We don’t want to “clutter†this repo with code anymore. Authors should maintain the code in their own repos and just put a pointer in a README.md in this repo. + +It would be best for everyone if the individual authors of the plugins were able to manage issues and pull requests while still allowing this to be an easier way for users to discover the plugins they need. + +This also helps for the future whenever we decide to have a npm-like registry for Cordova plugins. + +http://shazronatadobe.wordpress.com/2012/11/07/cordova-plugins-put-them-in-your-own-repo-2/ + +-- + +This code is completely dependent on the Apache Cordova (formerly PhoneGap) project, hosted on [GitHub](http://github.com/apache) Plugins will (for the time being) reside in this repository as pulling them into the Callback project would require all plugin contributors to meet stricter code licensing requirements pursuant to Apache's guidelines. diff --git a/WindowsPhone/Biblesearch/README.md b/WindowsPhone/Biblesearch/README.md new file mode 100644 index 00000000..e3d44e58 --- /dev/null +++ b/WindowsPhone/Biblesearch/README.md @@ -0,0 +1,11 @@ +# biblesearch-api-js + +The American Bible Society has produced this javascript library to ease the use of the Bible Search api (http://bibles.org/pages/api) in phonegap mobile applications. The api (and this library) allow you to easily: + +* search the Bible +* locate specific passages +* get information about specific books, chapters, and verses +* do all that in one or more versions +* store nothing locally + +You can find this plugin at https://github.com/americanbible/biblesearch-api-js. diff --git a/iOS/ActionSheet/ActionSheet.h b/iOS/ActionSheet/ActionSheet.h deleted file mode 100644 index 788f3535..00000000 --- a/iOS/ActionSheet/ActionSheet.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ActionSheet.h -// -// Created by Olivier Louvignes on 11/27/2011. -// Added Cordova 1.5 support - @RandyMcMillan 2012 -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - - -#ifdef CORDOVA_FRAMEWORK -#import -#else -#import "CDVPlugin.h" -#endif - -@interface ActionSheet : CDVPlugin { - - - NSString* callbackID; - -} - -@property (nonatomic, copy) NSString* callbackID; - -//Instance Method -- (void) create:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end \ No newline at end of file diff --git a/iOS/ActionSheet/ActionSheet.js b/iOS/ActionSheet/ActionSheet.js deleted file mode 100644 index c6dab616..00000000 --- a/iOS/ActionSheet/ActionSheet.js +++ /dev/null @@ -1,45 +0,0 @@ -// -// ActionSheet.js -// -// Created by Olivier Louvignes on 11/27/2011. -// Added Cordova 1.5 support - @RandyMcMillan 2012 -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -function ActionSheet() {} - -ActionSheet.prototype.create = function(title, items, callback, options) { - if(!options) options = {}; - var scope = options.scope || null; - delete options.scope; - - var service = 'ActionSheet', - action = 'create', - callbackId = service + (cordova.callbackId + 1); - - var config = { - title : title || '', - items : items || ['Cancel'], - style : options.style || 'default', - destructiveButtonIndex : options.hasOwnProperty('destructiveButtonIndex') ? options.destructiveButtonIndex : undefined, - cancelButtonIndex : options.hasOwnProperty('cancelButtonIndex') ? options.cancelButtonIndex : undefined - }; - - var _callback = function(result) { - var buttonValue = false, // value for cancelButton - buttonIndex = result.buttonIndex; - if(!config.cancelButtonIndex || buttonIndex != config.cancelButtonIndex) { - buttonValue = config.items[buttonIndex]; - } - callback.call(scope, buttonValue, buttonIndex); - }; - - return cordova.exec(_callback, _callback, service, action, [config]); - -}; - -cordova.addConstructor(function() { - if(!window.plugins) window.plugins = {}; - window.plugins.actionSheet = new ActionSheet(); -}); diff --git a/iOS/ActionSheet/ActionSheet.m b/iOS/ActionSheet/ActionSheet.m deleted file mode 100644 index 458a62dc..00000000 --- a/iOS/ActionSheet/ActionSheet.m +++ /dev/null @@ -1,101 +0,0 @@ -// -// ActionSheet.m -// -// Created by Olivier Louvignes on 11/27/2011. -// Added Cordova 1.5 support - @RandyMcMillan 2012 -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import "ActionSheet.h" - -@implementation ActionSheet - -@synthesize callbackID; - --(void)create:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - - //NSLog(@"options: %@", options); - //NSLog(@"arguments: %@", arguments); - - // The first argument in the arguments parameter is the callbackID. - // We use this to send data back to the successCallback or failureCallback - // through PluginResult. - self.callbackID = [arguments pop]; - - // Compiling options with defaults - NSString *title = [options objectForKey:@"title"] ?: @""; - NSString *style = [options objectForKey:@"style"] ?: @"black-translucent"; - //NSString *style = [options objectForKey:@"style"] ?: @"default"; - NSArray *items = [options objectForKey:@"items"]; - NSInteger cancelButtonIndex = [[options objectForKey:@"cancelButtonIndex"] intValue] ?: false; - NSInteger destructiveButtonIndex = [[options objectForKey:@"destructiveButtonIndex"] intValue] ?: false; - - // Create actionSheet - UIActionSheet *actionSheet = [[UIActionSheet alloc] initWithTitle:title - delegate:self - cancelButtonTitle:nil - destructiveButtonTitle:nil - otherButtonTitles:nil]; - - // Style actionSheet, defaults to UIActionSheetStyleDefault - if([style isEqualToString:@"black-opaque"]) actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; - else if([style isEqualToString:@"black-translucent"]) actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent; - else actionSheet.actionSheetStyle = UIActionSheetStyleDefault; - - // Fill with elements - for(int i = 0; i < [items count]; i++) { - [actionSheet addButtonWithTitle:[items objectAtIndex:i]]; - } - // Handle cancelButtonIndex - if([options objectForKey:@"cancelButtonIndex"]) { - actionSheet.cancelButtonIndex = cancelButtonIndex; - } - // Handle destructiveButtonIndex - if([options objectForKey:@"destructiveButtonIndex"]) { - actionSheet.destructiveButtonIndex = destructiveButtonIndex; - } - - // Toggle ActionSheet - [actionSheet showInView:self.webView.superview]; - -} - -/*-(void)show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - // Toggle ActionSheet - [self.actionSheet showInView:self.webView.superview]; -}*/ - -// ActionSheet generic dismiss -- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex -{ - //NSLog(@"didDismissWithButtonIndex:%d", buttonIndex); - - // Build returned result - NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; - [result setObject:[NSNumber numberWithInteger:buttonIndex] forKey:@"buttonIndex"]; - - // Create Plugin Result - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]; - - // Checking if cancel was clicked - if (buttonIndex != actionSheet.cancelButtonIndex) { - //Call the Failure Javascript function - [self writeJavascript: [pluginResult toErrorCallbackString:self.callbackID]]; - // Checking if destructive was clicked - } else if (buttonIndex != actionSheet.destructiveButtonIndex) { - //Call the Success Javascript function - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - // Other button was clicked - } else { - //Call the Success Javascript function - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - } - - // Release objects - [actionSheet release]; -} - -@end diff --git a/iOS/ActionSheet/README.md b/iOS/ActionSheet/README.md index 77d41775..26d8303d 100644 --- a/iOS/ActionSheet/README.md +++ b/iOS/ActionSheet/README.md @@ -1,69 +1,47 @@ # Cordova ActionSheet Plugin # -by `Olivier Louvignes` +by [Olivier Louvignes](http://olouv.com) + +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-actionsheet/tree/master) +--- ## DESCRIPTION ## -* This plugin provides a simple way to use the `UIActionSheet` native component from IOS. It does comply with the latest (future-2.x) cordova standards. +* This plugin provides a simple way to use the `UIActionSheet` native component from iOS. -* Compared to the `iPhone/NativeControls` plugin, it is more documented & simpler to understand (only handle actionSheets). It does also provide new options (style). +* This plugin is built for Cordova >= v2.1.0 with ARC. * There is a `Sencha Touch 2.0` plugin to easily leverage this plugin [here](https://github.com/mgcrea/sencha-touch-plugins/blob/master/CordovaActionSheet.js) -## SETUP ## - -Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). - -1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) -2. Drag and drop the `ActionSheet` folder from Finder to your Plugins folder in XCode, using "Create groups for any added folders" -3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files using - -4. Add new entry with key `ActionSheet` and value `ActionSheet` to `Plugins` in `Cordova.plist/Cordova.plist` - -## JAVASCRIPT INTERFACE ## - - // After device ready, create a local alias - var actionSheet = window.plugins.actionSheet; - - // Basic with title - actionSheet.create('Title', ['Foo', 'Bar'], function(buttonValue, buttonIndex) { - console.warn('create(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }); - - // Complex - actionSheet.create(null, ['Add', 'Delete', 'Cancel'], function(buttonValue, buttonIndex) { - console.warn('create(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }, {destructiveButtonIndex: 1, cancelButtonIndex: 2}); - -* Check [source](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/ActionSheet/ActionSheet.js) for additional configuration. - -## BUGS AND CONTRIBUTIONS ## - -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires a CLA), this should be easier. - -Post issues on [Github](https://github.com/apache/incubator-cordova-ios/issues) - -The latest code (my fork) will always be [here](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/ActionSheet) +[![Screenshot](https://raw.github.com/mgcrea/cordova-actionsheet/master/samples/ios/sample.png)](https://github.com/mgcrea/cordova-actionsheet/tree/master) ## LICENSE ## -Copyright 2011 Olivier Louvignes. All rights reserved. + The MIT License -The MIT License + Copyright (c) 2012 Olivier Louvignes -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. ## CREDITS ## -@RandyMcMillan - Added Initial Cordova 1.5 support - 2012 - -Inspired by : +Contributors : -* [NativeControls Phonegap plugin](https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/NativeControls) +* [Olivier Louvignes](http://olouv.com), author. -* [ActionSheet Sencha Touch 2.0 class](http://docs.sencha.com/touch/2-0/#!/api/Ext.ActionSheet) diff --git a/iOS/AdPlugin/README.md b/iOS/AdPlugin/README.md index e70f76a0..e72bdeb4 100644 --- a/iOS/AdPlugin/README.md +++ b/iOS/AdPlugin/README.md @@ -1,75 +1 @@ -# Cordova AdPlugin # -by Shazron Abdullah - -## Adding the Plugin to your project ## - -Using this plugin requires [Cordova](http://github.com/apache/incubator-cordova-ios) and iAd. iAd requires at least the [iOS 4 SDK](http://developer.apple.com/iphone). - -1. Make sure your Cordova Xcode project has been [updated for Cordova 1.6.0](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md) -2. Add the "iAd" framework to your Frameworks folder, and set it to be weak linked (see "Weak Linking the iAd Framework" section below) -3. Add the .h and .m files to your Plugins folder in your project (as a Group "yellow folder" not a Reference "blue folder") -4. Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as <script> tags in your html file(s) -5. In **Cordova.plist** (1.5.0 or greater) or **PhoneGap.plist** (1.4.1 or lesser), under the **Plugins** section, add an idential key and value of **"SAiOSAdPlugin"** -6. See the sample index.html -7. Make sure you check the **"RELEASE NOTES"** section below! -8. Your App must be added to [https://iad.apple.com/itcportal/](https://iad.apple.com/itcportal/) to make $ - -## Weak Linking the iAd Framework ## - -1. In your project, under "Targets", double click on the Target item -2. Go to the "General" Tab, under "Linked Libraries" -3. For the iAd Framework, change the value from "Required" to "Weak" - -## FUTURE FEATURES ## -* Landscape mode iAds -* Showing of other ad network ads in place of iAds, if no iAds are available - -## RELEASE NOTES ## - -### 20120409 ### - -- Changed license to Apache 2.0 License -- Updated for Cordova 1.6.0 (backwards compatible to earlier versions as well) -- wrapped object in function closure (to prevent pollution of the global namespace) - -### 20120308 ### - -- Cordova 1.5.0 support (@RandyMcMillan) - -### 20100712 ### -* Initial release -* Only supports portrait iAd banners -* Not tested on a 3.x device -* WebView initial size being oversized is a PhoneGap Core issue, and is not addressed in this plugin. When an ad is shown, it correctly sizes the WebView, and when the ad is hidden, sets the WebView back to its original size. -* Not tested with any other native UI plugins, like TabBar, and will not play nice with them (until we get a better layout management system/plugin) - -### 20110627 ### -* Requires PhoneGap 0.9.6 -* Fixed size issues -* Orientation change handling -* Works on iPad 4.x -* Still does not play nice with other native UI plugins like TabBar (yet) - -## BUGS AND CONTRIBUTIONS ## - -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires an Apache iCLA), this should be easier. - -Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "AdPlugin" or on [Github](http://github.com/phonegap/phoneGap-plugins/issues) -(preferred) - - -## LICENSE ## - -Copyright 2012 Shazron Abdullah - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +This plugin has been moved to [http://github.com/shazron/iAdPlugin](http://github.com/shazron/iAdPlugin) \ No newline at end of file diff --git a/iOS/AdPlugin/SAiOSAdPlugin.h b/iOS/AdPlugin/SAiOSAdPlugin.h deleted file mode 100644 index 3719b877..00000000 --- a/iOS/AdPlugin/SAiOSAdPlugin.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// SAiOSAdPlugin.h -// ADPlugin for PhoneGap/Cordova -// -// Created by shazron on 10-07-12. -// Copyright 2010 Shazron Abdullah. All rights reserved. -// Cordova v1.5.0 Support added 2012 @RandyMcMillan -// - -#import -#import -#import "SAiOSAdPlugin.h" - - -//#ifdef CORDOVA_FRAMEWORK -#import -//#else -//#import "CDVPlugin.h" -//#endif - - -@interface SAiOSAdPlugin : CDVPlugin { - - - ADBannerView* adView; - - BOOL bannerIsVisible; - BOOL bannerIsInitialized; - BOOL bannerIsAtBottom; -} - -@property (nonatomic, retain) ADBannerView* adView; -@property (assign) BOOL bannerIsVisible; -@property (assign) BOOL bannerIsInitialized; -@property (assign) BOOL bannerIsAtBottom; -@property (assign) BOOL isLandscape; - - -- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) showAd:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) orientationChanged:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iOS/AdPlugin/SAiOSAdPlugin.js b/iOS/AdPlugin/SAiOSAdPlugin.js deleted file mode 100644 index dad08b84..00000000 --- a/iOS/AdPlugin/SAiOSAdPlugin.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Cordova v1.5.0 Support added 2012 @RandyMcMillan -README.md for install notes - -Cordova v1.6.0 Support added @shazron -*/ - -// ///////////////////////// -(function() { -// ///////////////////////// - -// get local ref to global PhoneGap/Cordova/cordova object for exec function -var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks - -/** - * Constructor - */ -function SAiOSAdPlugin() -{ -} - -/** - * show - true to show the ad, false to hide the ad - */ -SAiOSAdPlugin.prototype.orientationChanged = function() -{ - cordovaRef.exec("SAiOSAdPlugin.orientationChanged", window.orientation); -} - -/** - * show - true to show the ad, false to hide the ad - */ -SAiOSAdPlugin.prototype.showAd = function(show) -{ - cordovaRef.exec("SAiOSAdPlugin.showAd", show); -} - -/** - * atBottom - true to put the ad at the bottom, false to put the ad at the top - */ -SAiOSAdPlugin.prototype.prepare = function(atBottom) -{ - if (!atBottom) { - atBottom = false; - } - - cordovaRef.exec("SAiOSAdPlugin.prepare", atBottom); -} - -/** - * Install function - */ -SAiOSAdPlugin.install = function() -{ - if ( !window.plugins ) { - window.plugins = {}; - } - if ( !window.plugins.iAdPlugin ) { - window.plugins.iAdPlugin = new SAiOSAdPlugin(); - } -} - -/** - * Add to Cordova constructor - */ -if (cordovaRef && cordovaRef.addConstructor) { - cordovaRef.addConstructor(SAiOSAdPlugin.install); -} else { - console.log("iAd Cordova Plugin could not be installed."); - return null; -} - - -// ///////////////////////// -})(); -// ///////////////////////// diff --git a/iOS/AdPlugin/SAiOSAdPlugin.m b/iOS/AdPlugin/SAiOSAdPlugin.m deleted file mode 100644 index 735628e4..00000000 --- a/iOS/AdPlugin/SAiOSAdPlugin.m +++ /dev/null @@ -1,227 +0,0 @@ -// -// SAiOSAdPlugin.m -// Ad Plugin for PhoneGap -// -// Created by shazron on 10-07-12. -// Copyright 2010 Shazron Abdullah. All rights reserved. -// Cordova v1.5.0 Support added 2012 @RandyMcMillan -// - -#import "SAiOSAdPlugin.h" - -//#ifdef CORDOVA_FRAMEWORK -#import -//#else -//#import "CDVDebug.h" -//#endif - -@interface SAiOSAdPlugin(PrivateMethods) - -- (void) __prepare:(BOOL)atBottom; -- (void) __showAd:(BOOL)show; - -@end - - -@implementation SAiOSAdPlugin - -@synthesize adView; -@synthesize bannerIsVisible, bannerIsInitialized, bannerIsAtBottom, isLandscape; - -#pragma mark - -#pragma mark Public Methods - -- (void) resizeViews -{ - Class adBannerViewClass = NSClassFromString(@"ADBannerView"); - if (adBannerViewClass && self.adView) - { - CGRect webViewFrame = [super webView].frame; - CGRect superViewFrame = [[super webView] superview].frame; - CGRect adViewFrame = self.adView.frame; - - BOOL adIsShowing = [[[super webView] superview].subviews containsObject:self.adView]; - if (adIsShowing) - { - if (self.bannerIsAtBottom) { - webViewFrame.origin.y = 0; - CGRect adViewFrame = self.adView.frame; - CGRect superViewFrame = [[super webView] superview].frame; - adViewFrame.origin.y = (self.isLandscape ? superViewFrame.size.width : superViewFrame.size.height) - adViewFrame.size.height; - self.adView.frame = adViewFrame; - } else { - webViewFrame.origin.y = adViewFrame.size.height; - } - - webViewFrame.size.height = self.isLandscape? (superViewFrame.size.width - adViewFrame.size.height) : (superViewFrame.size.height - adViewFrame.size.height); - } - else - { - webViewFrame.size = self.isLandscape? CGSizeMake(superViewFrame.size.height, superViewFrame.size.width) : superViewFrame.size; - webViewFrame.origin = CGPointZero; - } - - [UIView beginAnimations:@"blah" context:NULL]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; - - [super webView].frame = webViewFrame; - - [UIView commitAnimations]; - } -} - -- (void) orientationChanged:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -{ - NSInteger orientation = [[arguments objectAtIndex:0] integerValue]; - - switch (orientation) { - // landscape - case 90: - case -90: - self.isLandscape = YES; - break; - // portrait - case 0: - case 180: - self.isLandscape = NO; - break; - default: - break; - } - - Class adBannerViewClass = NSClassFromString(@"ADBannerView"); - if (adBannerViewClass && self.adView) - { - self.adView.currentContentSizeIdentifier = self.isLandscape ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait; - [self resizeViews]; - } -} - -- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - if (argc > 1) { - return; - } - - NSString* atBottomValue = [arguments objectAtIndex:0]; - [self __prepare:[atBottomValue boolValue]]; -} - -- (void) showAd:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSUInteger argc = [arguments count]; - if (argc > 1) { - return; - } - - NSString* showValue = [arguments objectAtIndex:0]; - [self __showAd:[showValue boolValue]]; -} - -#pragma mark - -#pragma mark Private Methods - -- (void) __prepare:(BOOL)atBottom -{ - NSLog(@"SAiOSAdPlugin Prepare Ad At Bottom: %d", atBottom); - - Class adBannerViewClass = NSClassFromString(@"ADBannerView"); - if (adBannerViewClass && !self.adView) - { - self.adView = [[ADBannerView alloc] initWithFrame:CGRectMake(0, 0, 320, 50)]; - // we are still using these constants even though they are deprecated - if it is changed, iOS 4 devices < 4.3 will crash. - // will need to do a run-time iOS version check - self.adView.requiredContentSizeIdentifiers = [NSSet setWithObjects: ADBannerContentSizeIdentifierPortrait, ADBannerContentSizeIdentifierLandscape, nil]; - - self.adView.delegate = self; - - NSString* contentSizeId = (self.isLandscape ? ADBannerContentSizeIdentifierLandscape : ADBannerContentSizeIdentifierPortrait); - - self.adView.currentContentSizeIdentifier = contentSizeId; - - if (atBottom) { - self.bannerIsAtBottom = YES; - } - - self.bannerIsVisible = NO; - self.bannerIsInitialized = YES; - } -} - -- (void) __showAd:(BOOL)show -{ - NSLog(@"SAiOSAdPlugin Show Ad: %d", show); - - if (!self.bannerIsInitialized){ - [self __prepare:NO]; - } - - if (!(NSClassFromString(@"ADBannerView") && self.adView)) { // ad classes not available - return; - } - - if (show == self.bannerIsVisible) { // same state, nothing to do - return; - } - - if (show) - { - [UIView beginAnimations:@"blah" context:NULL]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; - - [[[super webView] superview] addSubview:self.adView]; - [[[super webView] superview] bringSubviewToFront:self.adView]; - [self resizeViews]; - - [UIView commitAnimations]; - - self.bannerIsVisible = YES; - } - else - { - [UIView beginAnimations:@"blah" context:NULL]; - [UIView setAnimationCurve:UIViewAnimationCurveEaseInOut]; - - [self.adView removeFromSuperview]; - [self resizeViews]; - - [UIView commitAnimations]; - - self.bannerIsVisible = NO; - } - -} - -#pragma mark - -#pragma ADBannerViewDelegate - -- (void)bannerViewDidLoadAd:(ADBannerView *)banner -{ - Class adBannerViewClass = NSClassFromString(@"ADBannerView"); - if (adBannerViewClass) - { - - [super writeJavascript:@"Cordova.fireEvent('iAdBannerViewDidLoadAdEvent');"]; - - } -} - -- (void)bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError*)error -{ - Class adBannerViewClass = NSClassFromString(@"ADBannerView"); - if (adBannerViewClass) - { - NSString* jsString = - @"(function(){" - "var e = document.createEvent('Events');" - "e.initEvent('iAdBannerViewDidFailToReceiveAdWithErrorEvent');" - "e.error = '%@';" - "document.dispatchEvent(e);" - "})();"; - - [super writeJavascript:[NSString stringWithFormat:jsString, [error description]]]; - } -} - -@end diff --git a/iOS/AdPlugin/index.html b/iOS/AdPlugin/index.html deleted file mode 100755 index 154c09ee..00000000 --- a/iOS/AdPlugin/index.html +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - This is some text at the top of the webview. - -

-
- Show iAd
-
- New Ad Loaded: Waiting.
- Total Ads Loaded: None. -
-
- - This is some text at the bottom of the webview. - - - diff --git a/iOS/AdPlugin/www/SAiOSAdPlugin.js b/iOS/AdPlugin/www/SAiOSAdPlugin.js deleted file mode 100644 index ff6fec21..00000000 --- a/iOS/AdPlugin/www/SAiOSAdPlugin.js +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Cordova v1.5.0 Support added 2012 @RandyMcMillan -README.md for install notes - -Cordova v1.6.0 Support added @shazron -*/ - -// ///////////////////////// -(function() { -// ///////////////////////// - -// get local ref to global PhoneGap/Cordova/cordova object for exec function -var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks - -/** - * Constructor - */ -function SAiOSAdPlugin() -{ -} - -/** - * show - true to show the ad, false to hide the ad - */ -SAiOSAdPlugin.prototype.orientationChanged = function() -{ - cordovaRef.exec("SAiOSAdPlugin.orientationChanged", window.orientation); -} - -/** - * show - true to show the ad, false to hide the ad - */ -SAiOSAdPlugin.prototype.showAd = function(show) -{ - cordovaRef.exec("SAiOSAdPlugin.showAd", show); -} - -/** - * atBottom - true to put the ad at the bottom, false to put the ad at the top - */ -SAiOSAdPlugin.prototype.prepare = function(atBottom) -{ - if (!atBottom) { - atBottom = false; - } - - cordovaRef.exec("SAiOSAdPlugin.prepare", atBottom); -} - -/** - * Install function - */ -SAiOSAdPlugin.install = function() -{ - if ( !window.plugins ) { - window.plugins = {}; - } - if ( !window.plugins.iAdPlugin ) { - window.plugins.iAdPlugin = new SAiOSAdPlugin(); - } -} - -/** - * Add to Cordova constructor - */ -if (cordovaRef && cordovaRef.addConstructor) { - cordovaRef.addConstructor(SAiOSAdPlugin.install); -} else { - console.log("iAd Cordova Plugin could not be installed."); - return null; -} - - -// ///////////////////////// -})(); -// ///////////////////////// diff --git a/iOS/AdPlugin/www/index.html b/iOS/AdPlugin/www/index.html deleted file mode 100644 index 57422316..00000000 --- a/iOS/AdPlugin/www/index.html +++ /dev/null @@ -1,175 +0,0 @@ - - - - - - - - - Hello Cordova - - - - - This is some text at the top of the webview. - - - - -
-

Apache Cordovaâ„¢

-
- - -
-

-
-
-

-
-

- - - -
-
-
- - - - - - - - This is some text at the bottom of the webview. - - - - - - diff --git a/iOS/AdPlugin/www/js/index.js b/iOS/AdPlugin/www/js/index.js deleted file mode 100644 index 3f623866..00000000 --- a/iOS/AdPlugin/www/js/index.js +++ /dev/null @@ -1,36 +0,0 @@ -var app = { - initialize: function() { - this.bind(); - }, - bind: function() { - document.addEventListener('deviceready', this.deviceready, false); - }, - deviceready: function() { - // note that this is an event handler so the scope is that of the event - // so we need to call app.report(), and not this.report() - app.report('deviceready'); - - // listen for orientation changes - window.addEventListener("orientationchange", window.plugins.iAdPlugin.orientationChanged, false); - // listen for the "iAdBannerViewDidLoadAdEvent" that is sent by the iAdPlugin - document.addEventListener("iAdBannerViewDidLoadAdEvent", iAdBannerViewDidLoadAdEventHandler, false); - // listen for the "iAdBannerViewDidFailToReceiveAdWithErrorEvent" that is sent by the iAdPlugin - document.addEventListener("iAdBannerViewDidFailToReceiveAdWithErrorEvent", iAdBannerViewDidFailToReceiveAdWithErrorEventHandler, false); - - var adAtBottom = false; - setTimeout(function() { - window.plugins.iAdPlugin.prepare(adAtBottom); // by default, ad is at Top - }, 1000); - window.plugins.iAdPlugin.orientationChanged(true);//trigger immediately so iAd knows its orientation on first load - - - - }, - report: function(id) { - console.log("report:" + id); - // hide the .pending

and show the .complete

- document.querySelector('#' + id + ' .pending').className += ' hide'; - var completeElem = document.querySelector('#' + id + ' .complete'); - completeElem.className = completeElem.className.split('hide').join(''); - } -}; diff --git a/iOS/AdPlugin/www/spec.html b/iOS/AdPlugin/www/spec.html deleted file mode 100644 index be4103fd..00000000 --- a/iOS/AdPlugin/www/spec.html +++ /dev/null @@ -1,50 +0,0 @@ - - - - Jasmine Spec Runner - - - - - - - - - - - - - - - - - -

- - diff --git a/iOS/AdPlugin/www/spec/index.js b/iOS/AdPlugin/www/spec/index.js deleted file mode 100644 index 0716d1b9..00000000 --- a/iOS/AdPlugin/www/spec/index.js +++ /dev/null @@ -1,49 +0,0 @@ -describe('app', function() { - describe('initialize', function() { - it('should bind deviceready', function() { - runs(function() { - spyOn(app, 'deviceready'); - app.initialize(); - helper.trigger(window.document, 'deviceready'); - }); - - waitsFor(function() { - return (app.deviceready.calls.length > 0); - }, 'deviceready should be called once', 500); - - runs(function() { - expect(app.deviceready).toHaveBeenCalled(); - }); - }); - }); - - describe('deviceready', function() { - it('should report that it fired', function() { - spyOn(app, 'report'); - app.deviceready(); - expect(app.report).toHaveBeenCalledWith('deviceready'); - }); - }); - - describe('report', function() { - beforeEach(function() { - var el = document.getElementById('stage'); - el.innerHTML = ['
', - '

Pending

', - '

Complete

', - '
'].join('\n'); - }); - - it('should show the completion state', function() { - app.report('deviceready'); - var el = document.querySelector('#deviceready .complete:not(.hide)'); - expect(el).toBeTruthy(); - }); - - it('should hide the pending state', function() { - app.report('deviceready'); - var el = document.querySelector('#deviceready .pending.hide'); - expect(el).toBeTruthy(); - }); - }); -}); diff --git a/iOS/AudioEncode/README.md b/iOS/AudioEncode/README.md new file mode 100644 index 00000000..eb96674d --- /dev/null +++ b/iOS/AudioEncode/README.md @@ -0,0 +1,6 @@ +## PhoneGap AudioEncode Plugin ## + +This plugin lets you easily convert/compress/encode WAV audio into M4A audio. It is useful when using Phonegap's audio capture or media recording functionality. Uploading WAV files on via cellular connections is not advised. M4A encoded files are 1/4 to 1/10 the size. + +Project is hosted here. +https://github.com/keenan/cordova-phonegap-audio-encode diff --git a/iOS/AugmentedReality-Wikitude/Documentation/Documentation.md b/iOS/AugmentedReality-Wikitude/Documentation/Documentation.md new file mode 100644 index 00000000..6e4b202d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/Documentation/Documentation.md @@ -0,0 +1,116 @@ +## Wikitude PhoneGap Plugin Documentation +by ``` Wikitude GmbH ``` + + +### DESCRIPTION +*** + +This document describes all available PhoneGap bindings which exists in the Wikitude PhoneGap Plugin. + + +#### Getting information about the device + +###### isDeviceSupported +Call ``` isDeviceSupported ``` to determinate if the current device is capable of launching ARchitect Worlds. + + @param onSuccessCallback - A callback which gets called if the current device supports launching ARchitect Worlds + @param onErrorCallback - An callback which gets called if the current device does not fulfil all needs to lauch ARchitect Worlds + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - No options + + cordova.exec(deviceSupportedCallback, deviceNotSupportedCallback, "WikitudePlugin", "isDeviceSupported", [""]); + + +#### Managing the ARchitectView + + +###### open +Call open to add the ARchitectView to your applications view hierarchy and loads the specified ARchitect World. + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - a dictionary containing two pairs: + @pair apiKey : The Wikitude SDK Key provided to you after you purchased the Wikitude SDK or an empty string if you're using a trial version + @pair filePath : A filepath to a local bundle resource or to a file on e.g. your dropbox + + cordova.exec(architectWorldLaunchedCallback, architectWorldFailedLaunchingCallback, "WikitudePlugin", "open", [{ apiKey: myApiKey, filePath: worldPath}]); + +###### close +This call will remove the ARchitectView from the view hierarchy and also stops all ongoing Wikitude updates. + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - No options + + cordova.exec(onWikitudeOK, onWikitudeError, "WikitudePlugin", "close", [""]); + +###### show +This call hides the ARchitectView, but keeps it alive in memory. + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - No options + + cordova.exec(onWikitudeOK, onWikitudeError, "WikitudePlugin", "hide", [""]); + +###### hide +This call will show the ARchitectView again if it was hidden with the ``` hide ``` call. + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - No options + + cordova.exec(onWikitudeOK, onWikitudeError, "WikitudePlugin", "show", [""]); + + + +#### Interacting with the ARchitectView + +###### callJavaScript +This function will evaluate the passed JavaScript in the current ARchitect World context. + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - A JavaScript array with a JavaScript string at first position + + cordova.exec(onWikitudeOK, onWikitudeError, "WikitudePlugin", "callJavascript", [js]); + +###### onUrlInvoke +This function will set an callback which gets called if you call ``` document.location = architectsdk://aRequestWithParameters?id=5&name=Poi5 ```. + + @param onSuccessCallback - A callback which gets called every time you call ` architectsdk:// ` + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - No options + + cordova.exec(onUrlInvokeCallback, onWikitudeError, "WikitudePlugin", "onUrlInvoke", [""]); + +###### setLocation +This function allows you to set a location for your current ARchitectView + + + @param onSuccessCallback - A success callback + @param onErrorCallback - An error callback + @param Plugin name - The name of the plugin you want to call a function + @param Plugin function - The name of the function you want to call on the plugin + @param options - A dictionary containing the new latitude, longitude, altitude, accuracy + @pair lat : The new latitude + @pair lon : The new longitude + @pair alt : The new altitude + @pair acc : The accuracy of the new locations + + cordova.exec(onUrlInvokeCallback, onWikitudeError, "WikitudePlugin", "setLocation", [""]); + + diff --git a/iOS/AugmentedReality-Wikitude/Plugin/README.md b/iOS/AugmentedReality-Wikitude/Plugin/README.md new file mode 100644 index 00000000..161b7c84 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/Plugin/README.md @@ -0,0 +1,111 @@ +# Augmented Reality - Wikitude SDK Plugin +by Wikitude GmbH - [www.wikitude.com](http://www.wikitude.com) + +Interested in advanced usage of the plugin and need assistance? +[Register as a Wikitude developer](http://developer.wikitude.com) and get support in our forum. + +For further questions visit us on www.wikitude.com or contact us via `phonegap wikitude.com` + +#### Important: This plugin runs on latest [PhoneGap 2.x](http://docs.phonegap.com/en/2.0.0/guide_getting-started_android_index.md.html#Getting%20Started%20with%20Android) only + + +## DESCRIPTION + + +The Wikitude PhoneGap Plugin enables web developers to embed an Augmented Reality view into their PhoneGap project. One can create a fully featured app with advanced Augmented Reality features, including Image Recognition, purely using HTML, CSS and Javascript. + +###The Wikitude PhoneGap Plugin + +* Available for iOS and Android +* Simple and seamless native PhoneGap integration +* Fully customizable Augmented Realty view +* Includes the full feature set of the Wikitude SDK +* AR content is purely written in HTML and JavaScript + +![image](http://www.wikitude.com/wp-content/uploads/2012/09/Plugin_Phonegap.png) + +###The Augmented Reality View +From a technical point of view the SDK adds a UI component, similar to a web view. In contrast to a standard web view this AR view can render Augmented Reality content. + +Note: Content developed for this AR View is written in JavaScript and HTML. The .html and .js files for this view are different from the PhoneGap .js and .html files. The AR engine working in the background is called ARchitect Engine and is powering the SDK. + +###Further developer resources +* [Full documentation and additional tutorials](http://forum.wikitude.com/documentation) +* [Developer Forum](http://forum.wikitude.com/home) +* [Wikitude SDK Download](http://forum.wikitude.com/download) +* [Google+ Page for News](https://plus.google.com/u/0/103004921345651739447/posts) +* [Developer Newsletter](http://www.wikitude.com/developer/newsletter) + + + +## SETUP + +* Create a new PhoneGap project with the command line tool provided by PhoneGap. +* After your created the project, switch to Finder and copy the WikitudePlugin.h and .m file into the Plugins folder of your PhoneGap project. Afterwards, you have to add the files to the Plugins Group in your Xcode project. +* Add a new entry with key ``` WikitudePlugin ``` and value ``` WTWikitudePlugin ``` to ``` Plugins ``` in ``` Cordova.plist ``` +* Copy the Wikitude SDK for iOS (which you can downloaded from [our website](http://www.wikitude.com/developer/sdk)) into a folder like ```[ProjectFolder/"AppName"/WikitudeSDK] ```in your Xcode project. Make sure that you not only copy the files into the correct destination but that you also add the files to the Xcode project. + + * if you want to use Image Recognition within your App, you need to copy the Vuforia SDK folder into a folder like ```[ProjectFolder/"AppName"/Vuforia]```. Also dont forget to add the files to your Xcode project. You can download the Vuforia SDK from [Qualcomm](https://ar.qualcomm.at/sdk/ios). + + +* Add the Following Frameworks to your project: + + * CoreMotion.framework + + * CoreVideo.framework + + * libz.dylib + + * libsqlite3.dylib + + * OpenGLES.framework + + * Security.framework + +* You need to change one linker flag in order to run your App with the WikitudeSDK. Go to your project settings and change the other linker flag ```'-all_load'``` to ```'-force_load $(BUILT_PRODUCTS_DIR)/libCordova.a'```. After that, please add the following linker flag: ```-lstdc++```. + +* If you want to test your application on the iPhone Simulator, you'll need to change an additional Library Serach Path in your Xcode project settings. + + Change ```"$(SRCROOT)/HelloWorld/WikitudeSDK/SDK/lib/Release-iphoneos" ``` + To ```"$(SRCROOT)/HelloWorld/WikitudeSDK/SDK/lib/Release$(EFFECTIVE_PLATFORM_NAME)"``` + + And delete ```"$(SRCROOT)/HelloWorld/WikitudeSDK/SDK/lib/Release-iphonesimulator"``` + + +* The last step is to edit the whitelist entries. Open the Cordova.plist and add a new entry to the 'ExternalHosts' Array: * (single Asterisk) + + +## JAVASCRIPT INTERFACE + +Its simple to use the Wikitude Plugin within your PhoneGap application. + +We wrapped all ``` cordova.exec ``` calls into a separate JavaScript wrapper which handles location updates and some more functionality behind the scenes. + +You will mainly work with the ``` WikitudePlugin ``` where all you have to do is to call ```Wikitude.isDeviceReady(successCallback, errorCallback)``` and in your successCallback, you can call ```WikitudePlugin.loadARchitectWorld(successCallback, errorCallback, "path/to/your/world")```. + +If you want to communicate directly via the ```cordova.exec``` JavaScript calls, have a look at the ```Documentation``` folder which includes more information about that. + + +## Getting STARTED + +To get started, we prepared two sample projects. You can read through this samples to understand how to use the JavaScript wrapper and how you add your ARchitect World into the project. There is also a ReadMe for both projects which explain you what you have to do to get them running. + +Note: +If you have purchased a Wikitude SDK license, you can enter you SDK Key in the ```WikitudePlugin.js``` file at line 9. + + +## LICENSE + + Copyright 2012 [Wikitude GmbH ](http://www.wikitude.com) + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.h b/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.h new file mode 100644 index 00000000..0a71316d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.h @@ -0,0 +1,14 @@ +// +// WTWikitudeSDK.h +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + + +#import + +@interface WTWikitudePlugin : CDVPlugin + +@end diff --git a/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.m b/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.m new file mode 100644 index 00000000..3e54f354 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/Plugin/WTWikitudePlugin.m @@ -0,0 +1,402 @@ +// +// WTWikitudeSDK.m +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + +#import "WTWikitudePlugin.h" + +// Wikitude SDK +#import "WTArchitectView.h" + + + + +@interface WTWikitudePlugin () + +@property (nonatomic, strong) WTArchitectView *architectView; + +@property (nonatomic, strong) NSString *currentARchitectViewCallbackID; +@property (nonatomic, strong) NSString *currentPlugInErrorCallback; + +@property (nonatomic, assign) BOOL isUsingInjectedLocation; + +@end + + +@implementation WTWikitudePlugin +@synthesize architectView=_architectView; + + +#pragma mark - View Lifecycle +/* View Lifecycle */ +- (void)isDeviceSupported:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + BOOL isDeviceSupported = [WTArchitectView isDeviceSupported]; + + if (isDeviceSupported) { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + } else { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)open:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + + BOOL success = [WTArchitectView isDeviceSupported]; + if ( success ) { + + NSString *sdkKey = [options objectForKey:@"apiKey"]; + NSString *architectWorldFilePath = [options objectForKey:@"filePath"]; + + // First, lets check if we need to init a new sdk view + if ( !_architectView ) { + self.architectView = [[WTArchitectView alloc] initWithFrame:self.viewController.view.bounds]; + self.architectView.delegate = self; + [self.architectView initializeWithKey:sdkKey motionManager:nil]; + } + + // then add the view in its own navController to the ui. we need a own navController to have a backButton which can be used to dismiss the view + UIViewController *viewController = [[UIViewController alloc] init]; + viewController.view = self.architectView; + + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; + navController.navigationBar.tintColor = [UIColor blackColor]; + navController.navigationBar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissARchitectView)]; + [self.viewController presentViewController:navController animated:NO completion:^{ + // completion code + }]; + + + + // and finaly load the architect world, specified in the open function in js + if (architectWorldFilePath) { + + NSString *worldName = [architectWorldFilePath lastPathComponent]; + worldName = [worldName stringByDeletingPathExtension]; + NSString *worldNameExtension = [architectWorldFilePath pathExtension]; + + NSString *architectWorldDirectoryPath = [architectWorldFilePath stringByDeletingLastPathComponent]; + + NSString *loadablePath = [[NSBundle mainBundle] pathForResource:worldName ofType:worldNameExtension inDirectory:architectWorldDirectoryPath]; + [self.architectView loadArchitectWorldFromUrl:loadablePath]; + } + } + + // start the sdk view updates + [self.architectView start]; + + + if ( success ) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)close:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + [self.architectView stop]; +// [self.architectView removeFromSuperview]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)show:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = NO; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)hide:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = YES; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onResume:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView start]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onPause:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView stop]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - Location Handling + +- (void)setLocation:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + float latitude = [[options objectForKey:@"lat"] floatValue]; + float longitude = [[options objectForKey:@"lon"] floatValue]; + float altitude = [[options objectForKey:@"alt"] floatValue]; + float accuracy = [[options objectForKey:@"acc"] floatValue]; + + if (!self.isUsingInjectedLocation) { + [self.architectView setUseInjectedLocation:YES]; + self.isUsingInjectedLocation = YES; + } + + [self.architectView injectLocationWithLatitude:latitude longitude:longitude altitude:altitude accuracy:accuracy]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +#pragma mark - Javascript + +- (void)callJavascript:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + + @try { + + if (arguments.count >= 1) { + + NSMutableString *javascriptToCall = [[arguments objectAtIndex:1] mutableCopy]; + for (NSUInteger i = 2; i < arguments.count; i++) { + [javascriptToCall appendString:[arguments objectAtIndex:i]]; + } + + if (self.architectView) { + [self.architectView callJavaScript:javascriptToCall]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + }else + { + // return error no javascript to call found + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)onUrlInvoke:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + + + self.currentARchitectViewCallbackID = callbackId; + self.currentPlugInErrorCallback = callbackId; + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - WTArchitectView Delegate +- (void)urlWasInvoked:(NSString *)url +{ + + CDVPluginResult *pluginResult = nil; + NSString *javaScriptResult = nil; + + + if (url && self.currentARchitectViewCallbackID) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:url]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentARchitectViewCallbackID]; + + + }else + { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentPlugInErrorCallback]; + } + + [self writeJavascript:javaScriptResult]; +} + +- (void)dismissARchitectView +{ + [self.viewController dismissModalViewControllerAnimated:NO]; + [self.architectView stop]; +} + +@end diff --git a/iOS/AugmentedReality-Wikitude/Plugin/WikitudePlugin.js b/iOS/AugmentedReality-Wikitude/Plugin/WikitudePlugin.js new file mode 100644 index 00000000..bd09eb2c --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/Plugin/WikitudePlugin.js @@ -0,0 +1,383 @@ +var WikitudePlugin = { + + /** + * + * This is the SDK Key, provided to you after you purchased the Wikitude SDK from http://www.wikitude.com/developer/sdk + * If you're having a trial version, leave this string empty + * + */ + mySDKKey : "ENTER-YOUR-KEY-HERE", + + /** true if architectview is open */ + isOpened : false, + + /** + * + * called when user pressed back-button on Android device + * + */ + backButtonCallback : null, + + /** + * + * Change the value of this variable to modify the location update rate + * + */ + locationUpdateRate : 3000, + + /** + * + * This variable represents if the current device is capable of running the Wikitude SDK + * + */ + isDeviceSupported : false, + + /** + * + * This watchID is used to shedule location updates + * + */ + watchID : null, + + /** + * + * Callbacks to get device information if ARchitect Worlds can be launched + * + */ + onDeviceSupportedCallback : null, + onDeviceNotSupportedCallback : null, + + /** + * + * Callbacks to get notified if the ARchitect World finished launching or if something went wrong during the World launch + * + */ + onARchitectWorldLaunchedCallback : null, + onARchitectWorldFailedLaunchingCallback : null, + + /** + * + * This function gets called if PhoneGap reports that it has finished loading successfully. + * + */ + isDeviceSupported: function(successCallback, errorCallback) + { + + WikitudePlugin.onDeviceSupportedCallback = successCallback; + WikitudePlugin.onDeviceNotSupportedCallback = errorCallback; + + + // PhoneGap is running, so the first thing we do is to check if the current device is capable of running the Wikitude Plugin + cordova.exec(WikitudePlugin.deviceIsARchitectReady, WikitudePlugin.deviceIsNotARchitectReady, "WikitudePlugin", "isDeviceSupported", [""]); + + }, + + /** + * + * Declare what should happen when user pressed back-button while architect-view is opened. + * If not declared/called or null: ARchitect-View is closed + * + */ + onPressedBackButton : function(callback) + { + WikitudePlugin.backButtonCallback = callback; + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is able to start the Wikitude SDK + * + */ + deviceIsARchitectReady : function() + { + // We keep track of the device status + WikitudePlugin.isDeviceSupported = true; + + + if(WikitudePlugin.onDeviceSupportedCallback) + { + WikitudePlugin.onDeviceSupportedCallback(); + } + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is not able of starting the Wikitude SDK. + * + */ + deviceIsNotARchitectReady : function() + { + WikitudePlugin.isDeviceSupported = false; + + // In this case we notify the user that his device is not supported by the Wikitude SDK + if(WikitudePlugin.onDeviceNotSupportedCallback) + { + WikitudePlugin.onDeviceNotSupportedCallback(); + } + }, + + /* + * ============================================================================================================================= + * + * PUBLIC API + * + * ============================================================================================================================= + */ + + /* Managing ARchitect world loading */ + + /** + * + * Call this function if you want to load an ARchitect World + * + * @param {String} worldPath The path to an ARchitect world ether on the device or on e.g. your dropbox + * + */ + loadARchitectWorld : function(worldPath) + { + + // before we actually call load, we check again if the device is able to open the world + if(WikitudePlugin.isDeviceSupported) + { + + // the 'open' function of the Wikitude Plugin requires a option dictionary with two keys: + // @param {Object} options (required) + // @param {String} options.sdkKey License key for the Wikitude SDK + // @param {String} options.filePath The path to a local ARchitect world or to a ARchitect world on a server or your dropbox + + cordova.exec(WikitudePlugin.worldLaunched, WikitudePlugin.worldFailedLaunching, "WikitudePlugin", "open", [{ sdkKey: WikitudePlugin.mySDKKey, filePath: worldPath}]); + + + // We add an event listener on the resume and pause event of the application lifecycle + document.addEventListener("resume", WikitudePlugin.onResume, false); + document.addEventListener("pause", WikitudePlugin.onPause, false); + + WikitudePlugin.isOpened = true; + document.addEventListener("backbutton", WikitudePlugin.onBackButton, false); + + // After we started loading the world, we start location updates + WikitudePlugin.startLocationUpdates(); + + }else + { + // if the device is not able to start the Wikitude SDK, we notify the user again + WikitudePlugin.deviceNotARchitectReady(); + } + }, + + /* Managing the Wikitude SDK Lifecycle */ + + /** + * + * Use this function to stop the Wikitude SDK and to remove the ARchitectView from the screen + * + */ + close : function() + { + document.removeEventListener("pause", WikitudePlugin.onPause, false); + document.removeEventListener("resume", WikitudePlugin.onResume, false); + + WikitudePlugin.stopLocationUpdates(); + + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "close", [""]); + WikitudePlugin.isOpened = false; + }, + + /** + * + * Use this function to only hide the Wikitude SDK. All location and rendering updates are still active + * + */ + hide : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "hide", [""]); + }, + + /** + * + * Use this function to show the Wikitude SDK if it was hidden before + * + */ + show : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "show", [""]); + }, + + /* Interacting with the Wikitude SDK */ + + /** + * + * Use this function to call javascript which will be executed in the context of your ARchitect World + * + * + * @param js The JavaScript that gets evaluated in context of the ARchitect World + * + */ + callJavaScript : function(js) + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "callJavascript", [js]); + }, + + /** + * + * Use this function to set a callback which will be invoked when the ARchitect World calls for example + * document.location = "architectsdk://opendetailpage?id=9"; + * + * + * @param onUrlInvokeCallback A function which gets called when the ARchitect World invokes a call to "document.location = architectsdk://" + */ + setOnUrlInvokeCallback : function(onUrlInvokeCallback) + { + cordova.exec(onUrlInvokeCallback, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onUrlInvoke", [""]); + }, + + + /* + * ============================================================================================================================= + * + * Callbacks of public functions + * + * ============================================================================================================================= + */ + + /** + * + * Use this callback to get notified if the world loaded successfully + * + */ + worldLaunched : function() + { + if(WikitudePlugin.onARchitectWorldLaunchedCallback) + { + WikitudePlugin.onARchitectWorldLaunchedCallback(); + } + }, + + /** + * + * Use this callback to get notified if the Wikitude SDK wasn't able to load the ARchitect World + * + */ + worldFailedLaunching : function(err) + { + if(WikitudePlugin.onARchitectWorldFailedLaunchingCallback) + { + WikitudePlugin.onARchitectWorldFailedLaunchingCallback(err); + } + }, + + /* Lifecycle updates */ + + /** + * + * This function actually starts the PhoneGap location updates + * + */ + startLocationUpdates : function() + { + + WikitudePlugin.watchID = navigator.geolocation.watchPosition(WikitudePlugin.onReceivedLocation, WikitudePlugin.onWikitudeError, { frequency: WikitudePlugin.locationUpdateRate }); + }, + + /** + * + * This callback gets called everytime the location did update + * + */ + onReceivedLocation : function(position) + { + + // Every time that PhoneGap did received a location update, we pass the location into the Wikitude SDK + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "setLocation", [{ lat: position.coords.latitude, lon: position.coords.longitude, alt: position.coords.altitude, acc: position.coords.accuracy}]); + }, + + /** + * + * Use this function to stop location updates + * + */ + stopLocationUpdates : function() + { + + // We clear the location update watch which was responsible for updating the location in a specific time interval + navigator.geolocation.clearWatch(WikitudePlugin.watchID); + WikitudePlugin.watchID = null; + }, + + /** + * + * This function gets called every time the application did become active. + * + */ + onResume : function() + { + + // Call the Wikitude SDK that the application did become active again + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onResume", [""]); + + // And start continuing updating the user location + WikitudePlugin.startLocationUpdates(); + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onPause : function() + { + + // Call the Wikitude SDK that the application did resign active + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onPause", [""]); + + // And stop all ongoing location updates + WikitudePlugin.stopLocationUpdates(); + }, + + /** + * + * Android specific! + * This function gets called if the user presses the back button. + * You may define your own implementation by using WikitudePlugin.onPressedBackButton(method) + * + */ + onBackButton : function() + { + if (WikitudePlugin.isOpened) { + if (WikitudePlugin.backButtonCallback==null) { + WikitudePlugin.close(); + document.removeEventListener("backbutton", WikitudePlugin.onBackButton, false); + } else { + WikitudePlugin.backButtonCallback(); + } + } + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeOK : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeError : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + report: function(id) + { + console.log("app report: " + id); + } +}; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateIcon.icns b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateIcon.icns new file mode 100644 index 00000000..47f85e56 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateIcon.icns differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateInfo.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateInfo.plist new file mode 100644 index 00000000..6e6b2718 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/TemplateInfo.plist @@ -0,0 +1,28 @@ + + + + + + Description + This template provides a starting point for a Cordova based application. Just modify the www folder contents with your HTML, CSS and Javascript. + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.pbxproj b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.pbxproj new file mode 100644 index 00000000..a0fab64a --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.pbxproj @@ -0,0 +1,732 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; }; + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 1F766FE113BBADB100FB74C0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F766FDC13BBADB100FB74C0 /* Localizable.strings */; }; + 1F766FE213BBADB100FB74C0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F766FDF13BBADB100FB74C0 /* Localizable.strings */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 301BF552109A68D80062928A /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libCordova.a */; }; + 301BF570109A69640062928A /* www in Resources */ = {isa = PBXBuildFile; fileRef = 301BF56E109A69640062928A /* www */; }; + 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B4109A6A2B0062928A /* AddressBook.framework */; }; + 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */; }; + 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */; }; + 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BA109A6A2B0062928A /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BC109A6A2B0062928A /* CFNetwork.framework */; }; + 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BE109A6A2B0062928A /* CoreLocation.framework */; }; + 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */; }; + 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C2109A6A2B0062928A /* QuartzCore.framework */; }; + 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */; }; + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D95EF14D2391D003F00A1 /* MainViewController.m */; }; + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; }; + 3053AC6F109B7857006FCFE7 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 3053AC6E109B7857006FCFE7 /* VERSION */; }; + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; }; + 3072F99713A8081B00425683 /* Capture.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3072F99613A8081B00425683 /* Capture.bundle */; }; + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */; }; + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */; }; + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */; }; + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */; }; + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */; }; + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBC154F3926009F9C59 /* Default~iphone.png */; }; + 308D05371370CCF300D202BF /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052E1370CCF300D202BF /* icon-72.png */; }; + 308D05381370CCF300D202BF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052F1370CCF300D202BF /* icon.png */; }; + 308D05391370CCF300D202BF /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D05301370CCF300D202BF /* icon@2x.png */; }; + 30A0434814DC770100060A13 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30A0434314DC770100060A13 /* Localizable.strings */; }; + 30A0434914DC770100060A13 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30A0434614DC770100060A13 /* Localizable.strings */; }; + 30E1352710E2C1420031B30D /* Cordova.plist in Resources */ = {isa = PBXBuildFile; fileRef = 30E1352610E2C1420031B30D /* Cordova.plist */; }; + 30E5649213A7FCAF007403D8 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30E5649113A7FCAF007403D8 /* CoreMedia.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + A93EDE2C16022ECD00FF615F /* assets in Resources */ = {isa = PBXBuildFile; fileRef = A93EDE2B16022ECD00FF615F /* assets */; }; + A93EDE301602307200FF615F /* WTWikitudePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A93EDE2F1602307200FF615F /* WTWikitudePlugin.m */; }; + A93EDE501602315500FF615F /* libWikitudeSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE4C1602315500FF615F /* libWikitudeSDK.a */; }; + A93EDE511602315600FF615F /* libWikitudeSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE4E1602315500FF615F /* libWikitudeSDK.a */; }; + A93EDE7D1602348700FF615F /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE771602348700FF615F /* CoreMotion.framework */; }; + A93EDE7E1602348700FF615F /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE781602348700FF615F /* CoreVideo.framework */; }; + A93EDE7F1602348700FF615F /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE791602348700FF615F /* libsqlite3.dylib */; }; + A93EDE801602348700FF615F /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE7A1602348700FF615F /* libz.dylib */; }; + A93EDE811602348700FF615F /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE7B1602348700FF615F /* OpenGLES.framework */; }; + A93EDE821602348700FF615F /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93EDE7C1602348700FF615F /* Security.framework */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 301BF534109A57CC0062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D2AAC07E0554694100DB518D; + remoteInfo = CordovaLib; + }; + 301BF550109A68C00062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = CordovaLib; + }; + 302D95EB14D23909003F00A1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 686357A9141002F100DF4CF2; + remoteInfo = CordovaLibTests; + }; + 3088BBB4154F38EF009F9C59 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 303A4068152124BB00182201; + remoteInfo = CordovaLibApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 1D6058910D05DD3D006BFB54 /* HelloWorld.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloWorld.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 1F766FDD13BBADB100FB74C0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; + 1F766FE013BBADB100FB74C0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = Localizable.strings; sourceTree = ""; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = CordovaLib.xcodeproj; sourceTree = CORDOVALIB; }; + 301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; }; + 301BF5B4109A6A2B0062928A /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; + 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 301BF5BA109A6A2B0062928A /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 301BF5BC109A6A2B0062928A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + 301BF5BE109A6A2B0062928A /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; + 301BF5C2109A6A2B0062928A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 302D95EE14D2391D003F00A1 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; + 302D95EF14D2391D003F00A1 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; + 302D95F014D2391D003F00A1 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = ""; }; + 3053AC6E109B7857006FCFE7 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = CORDOVALIB; }; + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + 3072F99613A8081B00425683 /* Capture.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Capture.bundle; sourceTree = ""; }; + 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CordovaBuildSettings.xcconfig; path = ../CordovaBuildSettings.xcconfig; sourceTree = ""; }; + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = ""; }; + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = ""; }; + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = ""; }; + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = ""; }; + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x~iphone.png"; sourceTree = ""; }; + 3088BBBC154F3926009F9C59 /* Default~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default~iphone.png"; sourceTree = ""; }; + 308D052E1370CCF300D202BF /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72.png"; sourceTree = ""; }; + 308D052F1370CCF300D202BF /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; + 308D05301370CCF300D202BF /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = ""; }; + 30A0434414DC770100060A13 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Localizable.strings; sourceTree = ""; }; + 30A0434714DC770100060A13 /* se */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = se; path = Localizable.strings; sourceTree = ""; }; + 30E1352610E2C1420031B30D /* Cordova.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Cordova.plist; path = ../Cordova.plist; sourceTree = ""; }; + 30E5649113A7FCAF007403D8 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* HelloWorld-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HelloWorld-Prefix.pch"; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* HelloWorld-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "HelloWorld-Info.plist"; path = "../HelloWorld-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + A93EDE2B16022ECD00FF615F /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = ""; }; + A93EDE2E1602307200FF615F /* WTWikitudePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTWikitudePlugin.h; sourceTree = ""; }; + A93EDE2F1602307200FF615F /* WTWikitudePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WTWikitudePlugin.m; sourceTree = ""; }; + A93EDE491602315500FF615F /* WTArchitectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTArchitectView.h; sourceTree = ""; }; + A93EDE4C1602315500FF615F /* libWikitudeSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWikitudeSDK.a; sourceTree = ""; }; + A93EDE4E1602315500FF615F /* libWikitudeSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWikitudeSDK.a; sourceTree = ""; }; + A93EDE771602348700FF615F /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + A93EDE781602348700FF615F /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + A93EDE791602348700FF615F /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; + A93EDE7A1602348700FF615F /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + A93EDE7B1602348700FF615F /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + A93EDE7C1602348700FF615F /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A93EDE7D1602348700FF615F /* CoreMotion.framework in Frameworks */, + A93EDE7E1602348700FF615F /* CoreVideo.framework in Frameworks */, + A93EDE7F1602348700FF615F /* libsqlite3.dylib in Frameworks */, + A93EDE801602348700FF615F /* libz.dylib in Frameworks */, + A93EDE811602348700FF615F /* OpenGLES.framework in Frameworks */, + A93EDE821602348700FF615F /* Security.framework in Frameworks */, + 301BF552109A68D80062928A /* libCordova.a in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */, + 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */, + 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */, + 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */, + 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */, + 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */, + 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */, + 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */, + 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */, + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */, + 30E5649213A7FCAF007403D8 /* CoreMedia.framework in Frameworks */, + A93EDE501602315500FF615F /* libWikitudeSDK.a in Frameworks */, + A93EDE511602315600FF615F /* libWikitudeSDK.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 302D95EE14D2391D003F00A1 /* MainViewController.h */, + 302D95EF14D2391D003F00A1 /* MainViewController.m */, + 302D95F014D2391D003F00A1 /* MainViewController.xib */, + 1D3623240D0F684500981E51 /* AppDelegate.h */, + 1D3623250D0F684500981E51 /* AppDelegate.m */, + ); + name = Classes; + path = HelloWorld/Classes; + sourceTree = SOURCE_ROOT; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* HelloWorld.app */, + ); + name = Products; + sourceTree = ""; + }; + 1F766FDB13BBADB100FB74C0 /* en.lproj */ = { + isa = PBXGroup; + children = ( + 1F766FDC13BBADB100FB74C0 /* Localizable.strings */, + ); + path = en.lproj; + sourceTree = ""; + }; + 1F766FDE13BBADB100FB74C0 /* es.lproj */ = { + isa = PBXGroup; + children = ( + 1F766FDF13BBADB100FB74C0 /* Localizable.strings */, + ); + path = es.lproj; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + A93EDE2B16022ECD00FF615F /* assets */, + 301BF56E109A69640062928A /* www */, + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */, + A93EDE421602315500FF615F /* WikitudeSDK */, + 080E96DDFE201D6D7F000001 /* Classes */, + 307C750510C5A3420062BCA9 /* Plugins */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* HelloWorld-Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + path = HelloWorld; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 30A0434214DC770100060A13 /* de.lproj */, + 30A0434514DC770100060A13 /* se.lproj */, + 1F766FDB13BBADB100FB74C0 /* en.lproj */, + 1F766FDE13BBADB100FB74C0 /* es.lproj */, + 3072F99613A8081B00425683 /* Capture.bundle */, + 308D052D1370CCF300D202BF /* icons */, + 308D05311370CCF300D202BF /* splash */, + 30E1352610E2C1420031B30D /* Cordova.plist */, + 3053AC6E109B7857006FCFE7 /* VERSION */, + 8D1107310486CEB800E47090 /* HelloWorld-Info.plist */, + 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */, + ); + name = Resources; + path = HelloWorld/Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + A93EDE771602348700FF615F /* CoreMotion.framework */, + A93EDE781602348700FF615F /* CoreVideo.framework */, + A93EDE791602348700FF615F /* libsqlite3.dylib */, + A93EDE7A1602348700FF615F /* libz.dylib */, + A93EDE7B1602348700FF615F /* OpenGLES.framework */, + A93EDE7C1602348700FF615F /* Security.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 301BF5B4109A6A2B0062928A /* AddressBook.framework */, + 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */, + 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */, + 301BF5BA109A6A2B0062928A /* AVFoundation.framework */, + 301BF5BC109A6A2B0062928A /* CFNetwork.framework */, + 301BF5BE109A6A2B0062928A /* CoreLocation.framework */, + 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */, + 301BF5C2109A6A2B0062928A /* QuartzCore.framework */, + 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */, + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */, + 30E5649113A7FCAF007403D8 /* CoreMedia.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 301BF52E109A57CC0062928A /* Products */ = { + isa = PBXGroup; + children = ( + 301BF535109A57CC0062928A /* libCordova.a */, + 302D95EC14D23909003F00A1 /* CordovaLibTests.octest */, + 3088BBB5154F38EF009F9C59 /* CordovaLibApp.app */, + ); + name = Products; + sourceTree = ""; + }; + 307C750510C5A3420062BCA9 /* Plugins */ = { + isa = PBXGroup; + children = ( + A93EDE2D1602307200FF615F /* Wikitude */, + ); + name = Plugins; + path = HelloWorld/Plugins; + sourceTree = SOURCE_ROOT; + }; + 308D052D1370CCF300D202BF /* icons */ = { + isa = PBXGroup; + children = ( + 308D052E1370CCF300D202BF /* icon-72.png */, + 308D052F1370CCF300D202BF /* icon.png */, + 308D05301370CCF300D202BF /* icon@2x.png */, + ); + path = icons; + sourceTree = ""; + }; + 308D05311370CCF300D202BF /* splash */ = { + isa = PBXGroup; + children = ( + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */, + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */, + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */, + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */, + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */, + 3088BBBC154F3926009F9C59 /* Default~iphone.png */, + ); + path = splash; + sourceTree = ""; + }; + 30A0434214DC770100060A13 /* de.lproj */ = { + isa = PBXGroup; + children = ( + 30A0434314DC770100060A13 /* Localizable.strings */, + ); + path = de.lproj; + sourceTree = ""; + }; + 30A0434514DC770100060A13 /* se.lproj */ = { + isa = PBXGroup; + children = ( + 30A0434614DC770100060A13 /* Localizable.strings */, + ); + path = se.lproj; + sourceTree = ""; + }; + A93EDE2D1602307200FF615F /* Wikitude */ = { + isa = PBXGroup; + children = ( + A93EDE2E1602307200FF615F /* WTWikitudePlugin.h */, + A93EDE2F1602307200FF615F /* WTWikitudePlugin.m */, + ); + path = Wikitude; + sourceTree = ""; + }; + A93EDE421602315500FF615F /* WikitudeSDK */ = { + isa = PBXGroup; + children = ( + A93EDE471602315500FF615F /* SDK */, + ); + name = WikitudeSDK; + path = HelloWorld/WikitudeSDK; + sourceTree = ""; + }; + A93EDE471602315500FF615F /* SDK */ = { + isa = PBXGroup; + children = ( + A93EDE481602315500FF615F /* inc */, + A93EDE4A1602315500FF615F /* lib */, + ); + path = SDK; + sourceTree = ""; + }; + A93EDE481602315500FF615F /* inc */ = { + isa = PBXGroup; + children = ( + A93EDE491602315500FF615F /* WTArchitectView.h */, + ); + path = inc; + sourceTree = ""; + }; + A93EDE4A1602315500FF615F /* lib */ = { + isa = PBXGroup; + children = ( + A93EDE4B1602315500FF615F /* Release-iphoneos */, + A93EDE4D1602315500FF615F /* Release-iphonesimulator */, + ); + path = lib; + sourceTree = ""; + }; + A93EDE4B1602315500FF615F /* Release-iphoneos */ = { + isa = PBXGroup; + children = ( + A93EDE4C1602315500FF615F /* libWikitudeSDK.a */, + ); + path = "Release-iphoneos"; + sourceTree = ""; + }; + A93EDE4D1602315500FF615F /* Release-iphonesimulator */ = { + isa = PBXGroup; + children = ( + A93EDE4E1602315500FF615F /* libWikitudeSDK.a */, + ); + path = "Release-iphonesimulator"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* HelloWorld */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */; + buildPhases = ( + 304B58A110DAC018002A0835 /* Touch www folder */, + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 301BF551109A68C00062928A /* PBXTargetDependency */, + ); + name = HelloWorld; + productName = HelloWorld; + productReference = 1D6058910D05DD3D006BFB54 /* HelloWorld.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + en, + es, + de, + se, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 301BF52E109A57CC0062928A /* Products */; + ProjectRef = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* HelloWorld */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 301BF535109A57CC0062928A /* libCordova.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libCordova.a; + remoteRef = 301BF534109A57CC0062928A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 302D95EC14D23909003F00A1 /* CordovaLibTests.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = CordovaLibTests.octest; + remoteRef = 302D95EB14D23909003F00A1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3088BBB5154F38EF009F9C59 /* CordovaLibApp.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = CordovaLibApp.app; + remoteRef = 3088BBB4154F38EF009F9C59 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 301BF570109A69640062928A /* www in Resources */, + 3053AC6F109B7857006FCFE7 /* VERSION in Resources */, + 30E1352710E2C1420031B30D /* Cordova.plist in Resources */, + 308D05371370CCF300D202BF /* icon-72.png in Resources */, + 308D05381370CCF300D202BF /* icon.png in Resources */, + 308D05391370CCF300D202BF /* icon@2x.png in Resources */, + 3072F99713A8081B00425683 /* Capture.bundle in Resources */, + 1F766FE113BBADB100FB74C0 /* Localizable.strings in Resources */, + 1F766FE213BBADB100FB74C0 /* Localizable.strings in Resources */, + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */, + 30A0434814DC770100060A13 /* Localizable.strings in Resources */, + 30A0434914DC770100060A13 /* Localizable.strings in Resources */, + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */, + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */, + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */, + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */, + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */, + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */, + A93EDE2C16022ECD00FF615F /* assets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 304B58A110DAC018002A0835 /* Touch www folder */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Touch www folder"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "touch -cm ${PROJECT_DIR}/www"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */, + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */, + A93EDE301602307200FF615F /* WTWikitudePlugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 301BF551109A68C00062928A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CordovaLib; + targetProxy = 301BF550109A68C00062928A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 1F766FDC13BBADB100FB74C0 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 1F766FDD13BBADB100FB74C0 /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 1F766FDF13BBADB100FB74C0 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 1F766FE013BBADB100FB74C0 /* es */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 30A0434314DC770100060A13 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 30A0434414DC770100060A13 /* de */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 30A0434614DC770100060A13 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 30A0434714DC770100060A13 /* se */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloWorld/HelloWorld-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "HelloWorld/HelloWorld-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/HelloWorld/WikitudeSDK/SDK/lib/Release$(EFFECTIVE_PLATFORM_NAME)\"", + ); + PRODUCT_NAME = HelloWorld; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloWorld/HelloWorld-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "HelloWorld/HelloWorld-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/HelloWorld/WikitudeSDK/SDK/lib/Release$(EFFECTIVE_PLATFORM_NAME)\"", + ); + PRODUCT_NAME = HelloWorld; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-force_load", + "$(BUILT_PRODUCTS_DIR)/libCordova.a", + "-ObjC", + "-lstdc++", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-force_load$(BUILT_PRODUCTS_DIR)/libCordova.a)", + "-Obj-C", + "-lstdc++", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloWorld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloWorld" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..174a04ec --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..280a3dd9 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloWorld.xcscheme b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloWorld.xcscheme new file mode 100644 index 00000000..ab518cf7 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloWorld.xcscheme @@ -0,0 +1,86 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..14dd04a8 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + HelloWorld.xcscheme + + orderHint + 2 + + + SuppressBuildableAutocreation + + 1D6058900D05DD3D006BFB54 + + primary + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/.gitignore b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/.gitignore new file mode 100644 index 00000000..d30c0b08 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/.gitignore @@ -0,0 +1,6 @@ +*.mode1v3 +*.perspectivev3 +*.pbxuser +.DS_Store +build +www/phonegap.js diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.h new file mode 100644 index 00000000..2ffeb086 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.h @@ -0,0 +1,45 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// AppDelegate.h +// HelloWorld +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +#import + +@interface AppDelegate : NSObject < UIApplicationDelegate > { + +} + +// invoke string is passed to your app on launch, this is only valid if you +// edit HelloWorld-Info.plist to add a protocol +// a simple tutorial can be found here : +// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html + +@property (nonatomic, retain) IBOutlet UIWindow* window; +@property (nonatomic, retain) IBOutlet CDVViewController* viewController; + +@end + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.m new file mode 100644 index 00000000..141e0b33 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/AppDelegate.m @@ -0,0 +1,135 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// AppDelegate.m +// HelloWorld +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import "AppDelegate.h" +#import "MainViewController.h" + +#import +#import + + +@implementation AppDelegate + +@synthesize window, viewController; + +- (id) init +{ + /** If you need to do any extra app-specific initialization, you can do it here + * -jm + **/ + NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; + + [CDVURLProtocol registerURLProtocol]; + + return [super init]; +} + +#pragma UIApplicationDelegate implementation + +/** + * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up) + */ +- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions +{ + NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; + NSString* invokeString = nil; + + if (url && [url isKindOfClass:[NSURL class]]) { + invokeString = [url absoluteString]; + NSLog(@"HelloWorld launchOptions = %@", url); + } + + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; + self.window.autoresizesSubviews = YES; + + CGRect viewBounds = [[UIScreen mainScreen] applicationFrame]; + + self.viewController = [[[MainViewController alloc] init] autorelease]; + self.viewController.useSplashScreen = YES; + self.viewController.wwwFolderName = @"www"; + self.viewController.startPage = @"index.html"; + self.viewController.invokeString = invokeString; + self.viewController.view.frame = viewBounds; + + // check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation + BOOL forceStartupRotation = YES; + UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation]; + + if (UIDeviceOrientationUnknown == curDevOrientation) { + // UIDevice isn't firing orientation notifications yet… go look at the status bar + curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; + } + + if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) { + for (NSNumber *orient in self.viewController.supportedOrientations) { + if ([orient intValue] == curDevOrientation) { + forceStartupRotation = NO; + break; + } + } + } + + if (forceStartupRotation) { + NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations); + // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait) + UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue]; + NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation); + [[UIApplication sharedApplication] setStatusBarOrientation:newOrient]; + } + + [self.window addSubview:self.viewController.view]; + [self.window makeKeyAndVisible]; + + return YES; +} + +// this happens while we are running ( in the background, or from within our own app ) +// only valid if HelloWorld-Info.plist specifies a protocol to handle +- (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url +{ + if (!url) { + return NO; + } + + // calls into javascript global function 'handleOpenURL' + NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url]; + [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString]; + + // all plugins will get the notification, and their handlers will be called + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; + + return YES; +} + +- (void) dealloc +{ + [super dealloc]; +} + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.h new file mode 100644 index 00000000..0f5577c9 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.h @@ -0,0 +1,32 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// MainViewController.h +// HelloWorld +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +@interface MainViewController : CDVViewController + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.m new file mode 100644 index 00000000..86497c3c --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.m @@ -0,0 +1,141 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// MainViewController.h +// HelloWorld +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import "MainViewController.h" + +@implementation MainViewController + +- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void) didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +#pragma mark - View lifecycle + +- (void) viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void) viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; +} + +/* Comment out the block below to over-ride */ +/* +- (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds +{ + return[super newCordovaViewWithFrame:bounds]; +} +*/ + +/* Comment out the block below to over-ride */ +/* +#pragma CDVCommandDelegate implementation + +- (id) getCommandInstance:(NSString*)className +{ + return [super getCommandInstance:className]; +} + +- (BOOL) execute:(CDVInvokedUrlCommand*)command +{ + return [super execute:command]; +} + +- (NSString*) pathForResource:(NSString*)resourcepath; +{ + return [super pathForResource:resourcepath]; +} + +- (void) registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className +{ + return [super registerPlugin:plugin withClassName:className]; +} +*/ + +#pragma UIWebDelegate implementation + +- (void) webViewDidFinishLoad:(UIWebView*) theWebView +{ + // only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle + if (self.invokeString) + { + // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready + NSLog(@"DEPRECATED: window.invokeString - use the window.handleOpenURL(url) function instead, which is always called when the app is launched through a custom scheme url."); + NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString]; + [theWebView stringByEvaluatingJavaScriptFromString:jsString]; + } + + // Black base color for background matches the native apps + theWebView.backgroundColor = [UIColor blackColor]; + + return [super webViewDidFinishLoad:theWebView]; +} + +/* Comment out the block below to over-ride */ +/* + +- (void) webViewDidStartLoad:(UIWebView*)theWebView +{ + return [super webViewDidStartLoad:theWebView]; +} + +- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error +{ + return [super webView:theWebView didFailLoadWithError:error]; +} + +- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; +} +*/ + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.xib b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.xib new file mode 100644 index 00000000..e45d65c6 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Classes/MainViewController.xib @@ -0,0 +1,138 @@ + + + + + 1280 + 11C25 + 1919 + 1138.11 + 566.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 916 + + + IBProxyObject + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 460}} + + + + 3 + MQA + + 2 + + + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + -1 + + + File's Owner + + + -2 + + + + + + + MainViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 3 + + + + + MainViewController + UIViewController + + IBProjectSource + ./Classes/MainViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + 916 + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Cordova.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Cordova.plist new file mode 100644 index 00000000..01a59d6d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Cordova.plist @@ -0,0 +1,67 @@ + + + + + UIWebViewBounce + + TopActivityIndicator + gray + EnableLocation + + EnableViewportScale + + AutoHideSplashScreen + + ShowSplashScreenSpinner + + MediaPlaybackRequiresUserAction + + AllowInlineMediaPlayback + + OpenAllWhitelistURLsInWebView + + BackupWebStorage + + ExternalHosts + + * + + Plugins + + WikitudePlugin + WTWikitudePlugin + Device + CDVDevice + Logger + CDVLogger + Compass + CDVLocation + Accelerometer + CDVAccelerometer + Camera + CDVCamera + NetworkStatus + CDVConnection + Contacts + CDVContacts + Debug Console + CDVDebugConsole + File + CDVFile + FileTransfer + CDVFileTransfer + Geolocation + CDVLocation + Notification + CDVNotification + Media + CDVSound + Capture + CDVCapture + SplashScreen + CDVSplashScreen + Battery + CDVBattery + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/CordovaBuildSettings.xcconfig b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/CordovaBuildSettings.xcconfig new file mode 100644 index 00000000..c70086c7 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/CordovaBuildSettings.xcconfig @@ -0,0 +1,26 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +// Cordova.xcconfig +// __TESTING__ +// + +// Override this to use your project specific CORDOVALIB. +// You can base it off the current project path, $(PROJECT_DIR) +CORDOVALIB = $(CORDOVALIB) diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Info.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Info.plist new file mode 100644 index 00000000..ef7c161b --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Info.plist @@ -0,0 +1,58 @@ + + + + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + icon.png + icon@2x.png + icon-72.png + icon-72@2x.png + + UIPrerenderedIcon + + + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + icon.png + CFBundleIdentifier + com.wikitude.phonegapsamplehelloworld + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + + NSMainNibFile~ipad + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Prefix.pch b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Prefix.pch new file mode 100644 index 00000000..4105f6a9 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/HelloWorld-Prefix.pch @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ +// +// Prefix header for all source files of the 'HelloWorld' target in the 'HelloWorld' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/README b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/README new file mode 100644 index 00000000..f6e19d70 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/README @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder. \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.h new file mode 100644 index 00000000..0a71316d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.h @@ -0,0 +1,14 @@ +// +// WTWikitudeSDK.h +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + + +#import + +@interface WTWikitudePlugin : CDVPlugin + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.m new file mode 100644 index 00000000..3e54f354 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Plugins/Wikitude/WTWikitudePlugin.m @@ -0,0 +1,402 @@ +// +// WTWikitudeSDK.m +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + +#import "WTWikitudePlugin.h" + +// Wikitude SDK +#import "WTArchitectView.h" + + + + +@interface WTWikitudePlugin () + +@property (nonatomic, strong) WTArchitectView *architectView; + +@property (nonatomic, strong) NSString *currentARchitectViewCallbackID; +@property (nonatomic, strong) NSString *currentPlugInErrorCallback; + +@property (nonatomic, assign) BOOL isUsingInjectedLocation; + +@end + + +@implementation WTWikitudePlugin +@synthesize architectView=_architectView; + + +#pragma mark - View Lifecycle +/* View Lifecycle */ +- (void)isDeviceSupported:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + BOOL isDeviceSupported = [WTArchitectView isDeviceSupported]; + + if (isDeviceSupported) { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + } else { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)open:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + + BOOL success = [WTArchitectView isDeviceSupported]; + if ( success ) { + + NSString *sdkKey = [options objectForKey:@"apiKey"]; + NSString *architectWorldFilePath = [options objectForKey:@"filePath"]; + + // First, lets check if we need to init a new sdk view + if ( !_architectView ) { + self.architectView = [[WTArchitectView alloc] initWithFrame:self.viewController.view.bounds]; + self.architectView.delegate = self; + [self.architectView initializeWithKey:sdkKey motionManager:nil]; + } + + // then add the view in its own navController to the ui. we need a own navController to have a backButton which can be used to dismiss the view + UIViewController *viewController = [[UIViewController alloc] init]; + viewController.view = self.architectView; + + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; + navController.navigationBar.tintColor = [UIColor blackColor]; + navController.navigationBar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissARchitectView)]; + [self.viewController presentViewController:navController animated:NO completion:^{ + // completion code + }]; + + + + // and finaly load the architect world, specified in the open function in js + if (architectWorldFilePath) { + + NSString *worldName = [architectWorldFilePath lastPathComponent]; + worldName = [worldName stringByDeletingPathExtension]; + NSString *worldNameExtension = [architectWorldFilePath pathExtension]; + + NSString *architectWorldDirectoryPath = [architectWorldFilePath stringByDeletingLastPathComponent]; + + NSString *loadablePath = [[NSBundle mainBundle] pathForResource:worldName ofType:worldNameExtension inDirectory:architectWorldDirectoryPath]; + [self.architectView loadArchitectWorldFromUrl:loadablePath]; + } + } + + // start the sdk view updates + [self.architectView start]; + + + if ( success ) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)close:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + [self.architectView stop]; +// [self.architectView removeFromSuperview]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)show:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = NO; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)hide:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = YES; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onResume:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView start]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onPause:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView stop]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - Location Handling + +- (void)setLocation:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + float latitude = [[options objectForKey:@"lat"] floatValue]; + float longitude = [[options objectForKey:@"lon"] floatValue]; + float altitude = [[options objectForKey:@"alt"] floatValue]; + float accuracy = [[options objectForKey:@"acc"] floatValue]; + + if (!self.isUsingInjectedLocation) { + [self.architectView setUseInjectedLocation:YES]; + self.isUsingInjectedLocation = YES; + } + + [self.architectView injectLocationWithLatitude:latitude longitude:longitude altitude:altitude accuracy:accuracy]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +#pragma mark - Javascript + +- (void)callJavascript:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + + @try { + + if (arguments.count >= 1) { + + NSMutableString *javascriptToCall = [[arguments objectAtIndex:1] mutableCopy]; + for (NSUInteger i = 2; i < arguments.count; i++) { + [javascriptToCall appendString:[arguments objectAtIndex:i]]; + } + + if (self.architectView) { + [self.architectView callJavaScript:javascriptToCall]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + }else + { + // return error no javascript to call found + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)onUrlInvoke:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + + + self.currentARchitectViewCallbackID = callbackId; + self.currentPlugInErrorCallback = callbackId; + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - WTArchitectView Delegate +- (void)urlWasInvoked:(NSString *)url +{ + + CDVPluginResult *pluginResult = nil; + NSString *javaScriptResult = nil; + + + if (url && self.currentARchitectViewCallbackID) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:url]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentARchitectViewCallbackID]; + + + }else + { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentPlugInErrorCallback]; + } + + [self writeJavascript:javaScriptResult]; +} + +- (void)dismissARchitectView +{ + [self.viewController dismissModalViewControllerAnimated:NO]; + [self.architectView stop]; +} + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg.png new file mode 100644 index 00000000..784e9c7d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x.png new file mode 100644 index 00000000..1e28c6db Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x~ipad.png new file mode 100644 index 00000000..d4e34836 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg~ipad.png new file mode 100644 index 00000000..efbef8aa Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/controls_bg~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone.png new file mode 100644 index 00000000..155b88ca Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x.png new file mode 100644 index 00000000..79ef16ba Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x~ipad.png new file mode 100644 index 00000000..af1bbb21 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone~ipad.png new file mode 100644 index 00000000..ef1c472b Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/microphone~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button.png new file mode 100644 index 00000000..ceb95898 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x.png new file mode 100644 index 00000000..d6ce3028 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x~ipad.png new file mode 100644 index 00000000..0ac2e679 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button~ipad.png new file mode 100644 index 00000000..d8e24a4d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/record_button~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg.png new file mode 100644 index 00000000..bafc087e Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x.png new file mode 100644 index 00000000..798490b0 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x~ipad.png new file mode 100644 index 00000000..a1b7208f Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg~ipad.png new file mode 100644 index 00000000..3b467f63 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/recording_bg~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button.png new file mode 100644 index 00000000..9c31838a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x.png new file mode 100644 index 00000000..8cf657ea Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x~ipad.png new file mode 100644 index 00000000..88b606c8 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button~ipad.png new file mode 100644 index 00000000..59bb7a57 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/Capture.bundle/stop_button~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/de.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/de.lproj/Localizable.strings new file mode 100644 index 00000000..f1cdb42d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/de.lproj/Localizable.strings @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + + +// accessibility label for recording button +"toggle audio recording" = "starten/beenden der Tonaufnahme"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "programmierte Aufnahme beendet"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/en.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/en.lproj/Localizable.strings new file mode 100644 index 00000000..89726844 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/en.lproj/Localizable.strings @@ -0,0 +1,25 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// accessibility label for recording button +"toggle audio recording" = "toggle audio recording"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "timed recording complete"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "recorded time in minutes and seconds"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/es.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/es.lproj/Localizable.strings new file mode 100644 index 00000000..23831e66 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/es.lproj/Localizable.strings @@ -0,0 +1,25 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// accessibility label for recording button +"toggle audio recording" = "grabación de audio cambiar"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "tiempo de grabación completo"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon-72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon-72.png new file mode 100644 index 00000000..8c6e5df3 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon-72.png differ diff --git a/iOS/AdPlugin/www/res/icon/cordova_ios_144.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon-72@2x.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_ios_144.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon-72@2x.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon.png new file mode 100644 index 00000000..b2571a71 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon@2x.png new file mode 100644 index 00000000..d75098f5 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/icons/icon@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/se.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/se.lproj/Localizable.strings new file mode 100644 index 00000000..0af96468 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/se.lproj/Localizable.strings @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + + +// accessibility label for recording button +"toggle audio recording" = "börja/avsluta inspelning"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "inspelning har avslutad"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; \ No newline at end of file diff --git a/iOS/AdPlugin/www/res/screen/ipad_retina_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Landscape@2x~ipad.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/ipad_retina_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Landscape@2x~ipad.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Landscape~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Landscape~ipad.png new file mode 100644 index 00000000..f8e2b52d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Landscape~ipad.png differ diff --git a/iOS/AdPlugin/www/res/screen/ipad_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Portrait@2x~ipad.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/ipad_retina_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Portrait@2x~ipad.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Portrait~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Portrait~ipad.png new file mode 100644 index 00000000..af9158ac Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default-Portrait~ipad.png differ diff --git a/iOS/AdPlugin/www/res/screen/iphone_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default@2x~iphone.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/iphone_retina_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default@2x~iphone.png diff --git a/iOS/AdPlugin/www/res/screen/iphone_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default~iphone.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/iphone_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/Resources/splash/Default~iphone.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/main.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/main.m new file mode 100644 index 00000000..25e83db7 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/HelloWorld/main.m @@ -0,0 +1,35 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ +// +// main.m +// HelloWorld +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); + [pool release]; + return retVal; +} diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/assets/world/HelloWorld.html b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/assets/world/HelloWorld.html new file mode 100644 index 00000000..3ae64428 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/assets/world/HelloWorld.html @@ -0,0 +1,52 @@ + + + + + + +My ARchitect World + + + + + + + + + + + + + + \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/debug b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/debug new file mode 100755 index 00000000..37b0d637 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/debug @@ -0,0 +1,47 @@ +#!/bin/bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# compile and launch a Cordova/iOS project to the simulator +# + +set -e + +CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) +PROJECT_PATH=$CORDOVA_PATH/.. + +for file in $PROJECT_PATH/*.xcodeproj; do + PROJECT_NAME=$(basename "$file" .xcodeproj) +done; + +cd $PROJECT_PATH + +APP=build/$PROJECT_NAME.app +SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` + +xcodebuild -project $PROJECT_NAME.xcodeproj -arch i386 -target $PROJECT_NAME -configuration Debug -sdk $SDK clean build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR=$PROJECT_PATH/build + +# launch using emulate + +$CORDOVA_PATH/emulate $PROJECT_PATH/$APP + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/emulate b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/emulate new file mode 100755 index 00000000..3822121c --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/emulate @@ -0,0 +1,58 @@ +#! /bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -e + +CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) +PROJECT_PATH=$CORDOVA_PATH/.. + +function getAppPath() { + for file in $PROJECT_PATH/*.xcodeproj; do + PROJECT_NAME=$(basename "$file" .xcodeproj) + done; + APP=build/$PROJECT_NAME.app + APP_PATH=$PROJECT_PATH/$APP +} + +APP_PATH=$1 + +if [ $# -lt 1 ]; then + getAppPath +fi + +if [ ! -d "$APP_PATH" ]; then + read -p "Project '$APP_PATH' is not built. Build? [y/n]: " REPLY + if [ "$REPLY" == "y" ]; then + $CORDOVA_PATH/debug + exit 0 + else + echo "$APP_PATH not found to emulate." + exit 1 + fi +fi + +# launch using ios-sim + +if which ios-sim >/dev/null; then + ios-sim launch $APP_PATH --stderr console.log --stdout console.log & +else + echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1; +fi + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/log b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/log new file mode 100755 index 00000000..fd1261c5 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/cordova/log @@ -0,0 +1,26 @@ +#! /bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# USAGE +# +# ./log [path] +# +tail -f ${1:-".."}/console.log diff --git a/iOS/AdPlugin/www/config.xml b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/config.xml similarity index 93% rename from iOS/AdPlugin/www/config.xml rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/config.xml index 1df36974..a7e35db9 100644 --- a/iOS/AdPlugin/www/config.xml +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/config.xml @@ -1,16 +1,16 @@ + xmlns:gap = "http://phonegap.com/ns/1.0" + id = "io.cordova.hello-cordova" + version = "2.0.0"> Hello Cordova - A sample Apache Cordova application that responds to the deviceready event. + A sample Apache Cordova application that responds to the deviceready event. - Apache Cordova Team + Apache Cordova Team diff --git a/iOS/OCRPlugin/www/cordova-1.7.0.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/cordova-2.0.0.js similarity index 80% rename from iOS/OCRPlugin/www/cordova-1.7.0.js rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/cordova-2.0.0.js index 64da7278..c2caa2ff 100644 --- a/iOS/OCRPlugin/www/cordova-1.7.0.js +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/cordova-2.0.0.js @@ -1,6 +1,6 @@ -// commit 9cfdc134f83b5d51f655e52ec7d4ddab167437c7 +// commit 114cf5304a74ff8f7c9ff1d21cf5652298af04b0 -// File generated at :: Tue May 01 2012 14:06:43 GMT-0700 (PDT) +// File generated at :: Wed Jul 18 2012 16:47:25 GMT-0700 (PDT) /* Licensed to the Apache Software Foundation (ASF) under one @@ -77,7 +77,7 @@ var channel = require('cordova/channel'); document.addEventListener('DOMContentLoaded', function() { channel.onDOMContentLoaded.fire(); }, false); -if (document.readyState == 'complete') { +if (document.readyState == 'complete' || document.readyState == 'interactive') { channel.onDOMContentLoaded.fire(); } @@ -98,18 +98,12 @@ var documentEventHandlers = {}, document.addEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); - if (e == 'deviceready') { - channel.onDeviceReady.subscribeOnce(handler); - } else if (e == 'resume') { - channel.onResume.subscribe(handler); - // if subscribing listener after event has already fired, invoke the handler - if (channel.onResume.fired && typeof handler == 'function') { - handler(); + if (typeof documentEventHandlers[e] != 'undefined') { + if (evt === 'deviceready') { + documentEventHandlers[e].subscribeOnce(handler); + } else { + documentEventHandlers[e].subscribe(handler); } - } else if (e == 'pause') { - channel.onPause.subscribe(handler); - } else if (typeof documentEventHandlers[e] != 'undefined') { - documentEventHandlers[e].subscribe(handler); } else { m_document_addEventListener.call(document, evt, handler, capture); } @@ -126,13 +120,8 @@ window.addEventListener = function(evt, handler, capture) { document.removeEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); - // Check for pause/resume events first. - if (e == 'resume') { - channel.onResume.unsubscribe(handler); - } else if (e == 'pause') { - channel.onPause.unsubscribe(handler); // If unsubcribing from an event that is handled by a plugin - } else if (typeof documentEventHandlers[e] != "undefined") { + if (typeof documentEventHandlers[e] != "undefined") { documentEventHandlers[e].unsubscribe(handler); } else { m_document_removeEventListener.call(document, evt, handler, capture); @@ -201,7 +190,9 @@ var cordova = { fireDocumentEvent: function(type, data) { var evt = createEvent(type, data); if (typeof documentEventHandlers[type] != 'undefined') { - documentEventHandlers[type].fire(evt); + setTimeout(function() { + documentEventHandlers[type].fire(evt); + }, 0); } else { document.dispatchEvent(evt); } @@ -209,7 +200,9 @@ var cordova = { fireWindowEvent: function(type, data) { var evt = createEvent(type,data); if (typeof windowEventHandlers[type] != 'undefined') { - windowEventHandlers[type].fire(evt); + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); } else { window.dispatchEvent(evt); } @@ -296,17 +289,6 @@ var cordova = { } } }, - // TODO: remove in 2.0. - addPlugin: function(name, obj) { - console.log("[DEPRECATION NOTICE] window.addPlugin and window.plugins will be removed in version 2.0."); - if (!window.plugins[name]) { - window.plugins[name] = obj; - } - else { - console.log("Error: Plugin "+name+" already exists."); - } - }, - addConstructor: function(func) { channel.onCordovaReady.subscribeOnce(function() { try { @@ -318,50 +300,10 @@ var cordova = { } }; -// Adds deprecation warnings to functions of an object (but only logs a message once) -function deprecateFunctions(obj, objLabel) { - var newObj = {}; - var logHash = {}; - for (var i in obj) { - if (obj.hasOwnProperty(i)) { - if (typeof obj[i] == 'function') { - newObj[i] = (function(prop){ - var oldFunk = obj[prop]; - var funkId = objLabel + '_' + prop; - return function() { - if (!logHash[funkId]) { - console.log('[DEPRECATION NOTICE] The "' + objLabel + '" global will be removed in version 2.0, please use lowercase "cordova".'); - logHash[funkId] = true; - } - oldFunk.apply(obj, arguments); - }; - })(i); - } else { - newObj[i] = (function(prop) { return obj[prop]; })(i); - } - } - } - return newObj; -} - -/** - * Legacy variable for plugin support - * TODO: remove in 2.0. - */ -if (!window.PhoneGap) { - window.PhoneGap = deprecateFunctions(cordova, 'PhoneGap'); -} -if (!window.Cordova) { - window.Cordova = deprecateFunctions(cordova, 'Cordova'); -} - -/** - * Plugins object - * TODO: remove in 2.0. - */ -if (!window.plugins) { - window.plugins = {}; -} +// Register pause, resume and deviceready channels as events on document. +channel.onPause = cordova.addDocumentEventHandler('pause'); +channel.onResume = cordova.addDocumentEventHandler('resume'); +channel.onDeviceReady = cordova.addDocumentEventHandler('deviceready'); module.exports = cordova; @@ -514,7 +456,7 @@ var Channel = function(type, opts) { this.type = type; this.handlers = {}; this.numHandlers = 0; - this.guid = 0; + this.guid = 1; this.fired = false; this.enabled = true; this.events = { @@ -605,12 +547,21 @@ Channel.prototype.subscribe = function(f, c, g) { var func = f; if (typeof c == "object") { func = utils.close(c, f); } - g = g || func.observer_guid || f.observer_guid || this.guid++; + g = g || func.observer_guid || f.observer_guid; + if (!g) { + // first time we've seen this subscriber + g = this.guid++; + } + else { + // subscriber already handled; dont set it twice + return g; + } func.observer_guid = g; f.observer_guid = g; this.handlers[g] = func; this.numHandlers++; if (this.events.onSubscribe) this.events.onSubscribe.call(this); + if (this.fired) func.call(this); return g; }; @@ -645,10 +596,14 @@ Channel.prototype.unsubscribe = function(g) { if (g === null || g === undefined) { throw "You must pass _something_ into Channel.unsubscribe"; } if (typeof g == 'function') { g = g.observer_guid; } - this.handlers[g] = null; - delete this.handlers[g]; - this.numHandlers--; - if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this); + var handler = this.handlers[g]; + if (handler) { + if (handler.observer_guid) handler.observer_guid=null; + this.handlers[g] = null; + delete this.handlers[g]; + this.numHandlers--; + if (this.events.onUnsubscribe) this.events.onUnsubscribe.call(this); + } }; /** @@ -702,7 +657,6 @@ channel.create('onDestroy'); // Channels that must fire before "deviceready" is fired. channel.waitForInitialization('onCordovaReady'); -channel.waitForInitialization('onCordovaInfoReady'); channel.waitForInitialization('onCordovaConnectionReady'); module.exports = channel; @@ -718,6 +672,9 @@ module.exports = { children: { exec: { path: 'cordova/exec' + }, + logger: { + path: 'cordova/plugin/logger' } } }, @@ -771,6 +728,9 @@ module.exports = { path: 'cordova/plugin/network' } } + }, + splashscreen: { + path: 'cordova/plugin/splashscreen' } } }, @@ -780,6 +740,9 @@ module.exports = { Camera:{ path: 'cordova/plugin/CameraConstants' }, + CameraPopoverOptions: { + path: 'cordova/plugin/CameraPopoverOptions' + }, CaptureError: { path: 'cordova/plugin/CaptureError' }, @@ -828,6 +791,9 @@ module.exports = { Coordinates: { path: 'cordova/plugin/Coordinates' }, + device: { + path: 'cordova/plugin/device' + }, DirectoryEntry: { path: 'cordova/plugin/DirectoryEntry' }, @@ -920,6 +886,7 @@ var cordova = require('cordova'), utils = require('cordova/utils'), gapBridge, createGapBridge = function() { + gapBridge = document.createElement("iframe"); gapBridge.setAttribute("style", "display:none;"); gapBridge.setAttribute("height","0px"); @@ -930,7 +897,7 @@ var cordova = require('cordova'), channel = require('cordova/channel'); module.exports = function() { - if (!channel.onCordovaInfoReady.fired) { + if (!channel.onCordovaReady.fired) { utils.alert("ERROR: Attempting to call cordova.exec()" + " before 'deviceready'. Ignoring."); return; @@ -1027,9 +994,6 @@ module.exports = { MediaError: { // exists natively, override path: "cordova/plugin/MediaError" }, - device: { - path: 'cordova/plugin/ios/device' - }, console: { path: 'cordova/plugin/ios/console' } @@ -1056,18 +1020,24 @@ module.exports = { } } }; + +// use the native logger +var logger = require("cordova/plugin/logger"); +logger.useConsole(false); + }); // file: lib/common/plugin/Acceleration.js define("cordova/plugin/Acceleration", function(require, exports, module) { var Acceleration = function(x, y, z, timestamp) { - this.x = x; - this.y = y; - this.z = z; - this.timestamp = timestamp || (new Date()).getTime(); + this.x = x; + this.y = y; + this.z = z; + this.timestamp = timestamp || (new Date()).getTime(); }; module.exports = Acceleration; + }); // file: lib/common/plugin/Camera.js @@ -1086,7 +1056,7 @@ for (var key in Camera) { * Gets a picture from source defined by "options.sourceType", and returns the * image as defined by the "options.destinationType" option. - * The defaults are sourceType=CAMERA and destinationType=FILE_URL. + * The defaults are sourceType=CAMERA and destinationType=FILE_URI. * * @param {Function} successCallback * @param {Function} errorCallback @@ -1172,8 +1142,19 @@ cameraExport.getPicture = function(successCallback, errorCallback, options) { } else if (typeof options.saveToPhotoAlbum == "number") { saveToPhotoAlbum = options.saveToPhotoAlbum <=0 ? false : true; } + var popoverOptions = null; + if (typeof options.popoverOptions == "object") { + popoverOptions = options.popoverOptions; + } + + var args = [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, + mediaType, allowEdit, correctOrientation, saveToPhotoAlbum, popoverOptions]; + + exec(successCallback, errorCallback, "Camera", "takePicture", args); +}; - exec(successCallback, errorCallback, "Camera", "takePicture", [quality, destinationType, sourceType, targetWidth, targetHeight, encodingType, mediaType, allowEdit, correctOrientation, saveToPhotoAlbum]); +cameraExport.cleanup = function(successCallback, errorCallback) { + exec(successCallback, errorCallback, "Camera", "cleanup", []); }; module.exports = cameraExport; @@ -1199,10 +1180,37 @@ module.exports = { PHOTOLIBRARY : 0, // Choose image from picture library (same as SAVEDPHOTOALBUM for Android) CAMERA : 1, // Take picture from camera SAVEDPHOTOALBUM : 2 // Choose image from picture library (same as PHOTOLIBRARY for Android) + }, + PopoverArrowDirection:{ + ARROW_UP : 1, // matches iOS UIPopoverArrowDirection constants to specify arrow location on popover + ARROW_DOWN : 2, + ARROW_LEFT : 4, + ARROW_RIGHT : 8, + ARROW_ANY : 15 } }; }); +// file: lib/common/plugin/CameraPopoverOptions.js +define("cordova/plugin/CameraPopoverOptions", function(require, exports, module) { +var Camera = require('cordova/plugin/CameraConstants'); + +/** + * Encapsulates options for iOS Popover image picker + */ +var CameraPopoverOptions = function(x,y,width,height,arrowDir){ + // information of rectangle that popover should be anchored to + this.x = x || 0; + this.y = y || 32; + this.width = width || 320; + this.height = height || 480; + // The direction of the popover arrow + this.arrowDir = arrowDir || Camera.PopoverArrowDirection.ARROW_ANY; +}; + +module.exports = CameraPopoverOptions; +}); + // file: lib/common/plugin/CaptureAudioOptions.js define("cordova/plugin/CaptureAudioOptions", function(require, exports, module) { /** @@ -1692,15 +1700,20 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { /** * The altitude of the position. */ - this.altitude = alt; + this.altitude = (alt !== undefined ? alt : null); /** * The direction the device is moving at the position. */ - this.heading = head; + this.heading = (head !== undefined ? head : null); /** * The velocity with which the device is moving at the position. */ - this.speed = vel; + this.speed = (vel !== undefined ? vel : null); + + if (this.speed === 0 || this.speed === null) { + this.heading = NaN; + } + /** * The altitude accuracy of the position. */ @@ -1708,6 +1721,7 @@ var Coordinates = function(lat, lng, alt, acc, head, vel, altacc) { }; module.exports = Coordinates; + }); // file: lib/common/plugin/DirectoryEntry.js @@ -1725,7 +1739,7 @@ var utils = require('cordova/utils'), * {boolean} isDirectory always true (readonly) * {DOMString} name of the directory, excluding the path leading to it (readonly) * {DOMString} fullPath the absolute full path to the directory (readonly) - * {FileSystem} filesystem on which the directory resides (readonly) + * TODO: implement this!!! {FileSystem} filesystem on which the directory resides (readonly) */ var DirectoryEntry = function(name, fullPath) { DirectoryEntry.__super__.constructor.apply(this, [false, true, name, fullPath]); @@ -1891,6 +1905,21 @@ Entry.prototype.getMetadata = function(successCallback, errorCallback) { exec(success, fail, "File", "getMetadata", [this.fullPath]); }; +/** + * Set the metadata of the entry. + * + * @param successCallback + * {Function} is called with a Metadata object + * @param errorCallback + * {Function} is called with a FileError + * @param metadataObject + * {Object} keys and values to set + */ +Entry.prototype.setMetadata = function(successCallback, errorCallback, metadataObject) { + + exec(successCallback, errorCallback, "File", "setMetadata", [this.fullPath, metadataObject]); +}; + /** * Move a file or directory to a new location. * @@ -2011,7 +2040,7 @@ Entry.prototype.toURL = function() { Entry.prototype.toURI = function(mimeType) { console.log("DEPRECATED: Update your code to use 'toURL'"); // fullPath attribute contains the full URI - return this.fullPath; + return this.toURL(); }; /** @@ -2440,11 +2469,13 @@ var FileSystem = function(name, root) { }; module.exports = FileSystem; + }); // file: lib/common/plugin/FileTransfer.js define("cordova/plugin/FileTransfer", function(require, exports, module) { -var exec = require('cordova/exec'); +var exec = require('cordova/exec'), + FileTransferError = require('cordova/plugin/FileTransferError'); /** * FileTransfer uploads a file to a remote server. @@ -2463,6 +2494,8 @@ var FileTransfer = function() {}; * @param trustAllHosts {Boolean} Optional trust all hosts (e.g. for self-signed certs), defaults to false */ FileTransfer.prototype.upload = function(filePath, server, successCallback, errorCallback, options, trustAllHosts) { + // sanity parameter checking + if (!filePath || !server) throw new Error("FileTransfer.upload requires filePath and server URL parameters at the minimum."); // check for options var fileKey = null; var fileName = null; @@ -2484,7 +2517,12 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro } } - exec(successCallback, errorCallback, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]); + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + + exec(successCallback, fail, 'FileTransfer', 'upload', [filePath, server, fileKey, fileName, mimeType, params, trustAllHosts, chunkedMode]); }; /** @@ -2495,6 +2533,8 @@ FileTransfer.prototype.upload = function(filePath, server, successCallback, erro * @param errorCallback {Function} Callback to be invoked upon error */ FileTransfer.prototype.download = function(source, target, successCallback, errorCallback) { + // sanity parameter checking + if (!source || !target) throw new Error("FileTransfer.download requires source URI and target URI parameters at the minimum."); var win = function(result) { var entry = null; if (result.isDirectory) { @@ -2509,6 +2549,12 @@ FileTransfer.prototype.download = function(source, target, successCallback, erro entry.fullPath = result.fullPath; successCallback(entry); }; + + var fail = function(e) { + var error = new FileTransferError(e.code, e.source, e.target, e.http_status); + errorCallback(error); + }; + exec(win, errorCallback, 'FileTransfer', 'download', [source, target]); }; @@ -2522,8 +2568,11 @@ define("cordova/plugin/FileTransferError", function(require, exports, module) { * FileTransferError * @constructor */ -var FileTransferError = function(code) { +var FileTransferError = function(code, source, target, status) { this.code = code || null; + this.source = source || null; + this.target = target || null; + this.http_status = status || null; }; FileTransferError.FILE_NOT_FOUND_ERR = 1; @@ -2531,6 +2580,7 @@ FileTransferError.INVALID_URL_ERR = 2; FileTransferError.CONNECTION_ERR = 3; module.exports = FileTransferError; + }); // file: lib/common/plugin/FileUploadOptions.js @@ -3175,11 +3225,16 @@ define("cordova/plugin/Position", function(require, exports, module) { var Coordinates = require('cordova/plugin/Coordinates'); var Position = function(coords, timestamp) { - this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); - this.timestamp = (timestamp !== undefined) ? timestamp : new Date().getTime(); + if (coords) { + this.coords = new Coordinates(coords.latitude, coords.longitude, coords.altitude, coords.accuracy, coords.heading, coords.velocity, coords.altitudeAccuracy); + } else { + this.coords = new Coordinates(); + } + this.timestamp = (timestamp !== undefined) ? timestamp : new Date(); }; module.exports = Position; + }); // file: lib/common/plugin/PositionError.js @@ -3260,11 +3315,60 @@ define("cordova/plugin/accelerometer", function(require, exports, module) { * @constructor */ var utils = require("cordova/utils"), - exec = require("cordova/exec"); + exec = require("cordova/exec"), + Acceleration = require('cordova/plugin/Acceleration'); + +// Is the accel sensor running? +var running = false; -// Local singleton variables. +// Keeps reference to watchAcceleration calls. var timers = {}; +// Array of listeners; used to keep track of when we should call start and stop. +var listeners = []; + +// Last returned acceleration object from native +var accel = null; + +// Tells native to start. +function start() { + exec(function(a) { + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } + }, function(e) { + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } + }, "Accelerometer", "start", []); + running = true; +} + +// Tells native to stop. +function stop() { + exec(null, null, "Accelerometer", "stop", []); + running = false; +} + +// Adds a callback pair to the listeners array +function createCallbackPair(win, fail) { + return {win:win, fail:fail}; +} + +// Removes a win/fail listener pair from the listeners array +function removeListeners(l) { + var idx = listeners.indexOf(l); + if (idx > -1) { + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } + } +} + var accelerometer = { /** * Asynchronously aquires the current acceleration. @@ -3274,21 +3378,27 @@ var accelerometer = { * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) */ getCurrentAcceleration: function(successCallback, errorCallback, options) { - // successCallback required if (typeof successCallback !== "function") { - console.log("Accelerometer Error: successCallback is not a function"); - return; + throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; } - // errorCallback optional - if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Accelerometer Error: errorCallback is not a function"); - return; - } + var p; + var win = function(a) { + removeListeners(p); + successCallback(a); + }; + var fail = function(e) { + removeListeners(p); + errorCallback(e); + }; - // Get acceleration - exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } }, /** @@ -3300,36 +3410,41 @@ var accelerometer = { * @return String The watch id that must be passed to #clearWatch to stop watching. */ watchAcceleration: function(successCallback, errorCallback, options) { - // Default interval (10 sec) - var frequency = (options !== undefined && options.frequency !== undefined)? options.frequency : 10000; + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; // successCallback required if (typeof successCallback !== "function") { - console.log("Accelerometer Error: successCallback is not a function"); - return; + throw "watchAcceleration must be called with at least a success callback function as first parameter."; } - // errorCallback optional - if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Accelerometer Error: errorCallback is not a function"); - return; - } + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); - // Make sure accelerometer timeout > frequency + 10 sec - exec( - function(timeout) { - if (timeout < (frequency + 10000)) { - exec(null, null, "Accelerometer", "setTimeout", [frequency + 10000]); + var p = createCallbackPair(function(){}, function(e) { + removeListeners(p); + errorCallback(e); + }); + listeners.push(p); + + timers[id] = { + timer:window.setInterval(function() { + if (accel) { + successCallback(accel); } - }, - function(e) { }, "Accelerometer", "getTimeout", []); + }, frequency), + listeners:p + }; - // Start watch timer - var id = utils.createUUID(); - timers[id] = window.setInterval(function() { - exec(successCallback, errorCallback, "Accelerometer", "getAcceleration", []); - }, (frequency ? frequency : 1)); + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retreived a value, sample code does not check for null ... + if(accel) { + successCallback(accel); + } + } else { + start(); + } return id; }, @@ -3340,16 +3455,17 @@ var accelerometer = { * @param {String} id The id of the watch returned from #watchAcceleration. */ clearWatch: function(id) { - // Stop javascript timer & remove from timer list - if (id && timers[id] !== undefined) { - window.clearInterval(timers[id]); + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); delete timers[id]; } } }; module.exports = accelerometer; + }); // file: lib/common/plugin/battery.js @@ -3625,6 +3741,177 @@ var exec = require('cordova/exec'), module.exports = compass; }); +// file: lib/common/plugin/console-via-logger.js +define("cordova/plugin/console-via-logger", function(require, exports, module) { +//------------------------------------------------------------------------------ + +var logger = require("cordova/plugin/logger"); +var utils = require("cordova/utils"); + +//------------------------------------------------------------------------------ +// object that we're exporting +//------------------------------------------------------------------------------ +var console = module.exports; + +//------------------------------------------------------------------------------ +// copy of the original console object +//------------------------------------------------------------------------------ +var WinConsole = window.console; + +//------------------------------------------------------------------------------ +// whether to use the logger +//------------------------------------------------------------------------------ +var UseLogger = false; + +//------------------------------------------------------------------------------ +// Timers +//------------------------------------------------------------------------------ +var Timers = {}; + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +function noop() {} + +//------------------------------------------------------------------------------ +// used for unimplemented methods +//------------------------------------------------------------------------------ +console.useLogger = function (value) { + if (arguments.length) UseLogger = !!value; + + if (UseLogger) { + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } + } + + return UseLogger; +}; + +//------------------------------------------------------------------------------ +console.log = function() { + if (logger.useConsole()) return; + logger.log.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.error = function() { + if (logger.useConsole()) return; + logger.error.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.warn = function() { + if (logger.useConsole()) return; + logger.warn.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.info = function() { + if (logger.useConsole()) return; + logger.info.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.debug = function() { + if (logger.useConsole()) return; + logger.debug.apply(logger, [].slice.call(arguments)); +}; + +//------------------------------------------------------------------------------ +console.assert = function(expression) { + if (expression) return; + + var message = utils.vformat(arguments[1], [].slice.call(arguments, 2)); + console.log("ASSERT: " + message); +}; + +//------------------------------------------------------------------------------ +console.clear = function() {}; + +//------------------------------------------------------------------------------ +console.dir = function(object) { + console.log("%o", object); +}; + +//------------------------------------------------------------------------------ +console.dirxml = function(node) { + console.log(node.innerHTML); +}; + +//------------------------------------------------------------------------------ +console.trace = noop; + +//------------------------------------------------------------------------------ +console.group = console.log; + +//------------------------------------------------------------------------------ +console.groupCollapsed = console.log; + +//------------------------------------------------------------------------------ +console.groupEnd = noop; + +//------------------------------------------------------------------------------ +console.time = function(name) { + Timers[name] = new Date().valueOf(); +}; + +//------------------------------------------------------------------------------ +console.timeEnd = function(name) { + var timeStart = Timers[name]; + if (!timeStart) { + console.warn("unknown timer: " + name); + return; + } + + var timeElapsed = new Date().valueOf() - timeStart; + console.log(name + ": " + timeElapsed + "ms"); +}; + +//------------------------------------------------------------------------------ +console.timeStamp = noop; + +//------------------------------------------------------------------------------ +console.profile = noop; + +//------------------------------------------------------------------------------ +console.profileEnd = noop; + +//------------------------------------------------------------------------------ +console.count = noop; + +//------------------------------------------------------------------------------ +console.exception = console.log; + +//------------------------------------------------------------------------------ +console.table = function(data, columns) { + console.log("%o", data); +}; + +//------------------------------------------------------------------------------ +// return a new function that calls both functions passed as args +//------------------------------------------------------------------------------ +function wrapperedOrigCall(orgFunc, newFunc) { + return function() { + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} + }; +} + +//------------------------------------------------------------------------------ +// For every function that exists in the original console object, that +// also exists in the new console object, wrap the new console method +// with one that calls both +//------------------------------------------------------------------------------ +for (var key in console) { + if (typeof WinConsole[key] == "function") { + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + } +} + +}); + // file: lib/common/plugin/contacts.js define("cordova/plugin/contacts", function(require, exports, module) { var exec = require('cordova/exec'), @@ -3688,6 +3975,74 @@ module.exports = contacts; }); +// file: lib/common/plugin/device.js +define("cordova/plugin/device", function(require, exports, module) { +var channel = require('cordova/channel'), + utils = require('cordova/utils'), + exec = require('cordova/exec'); + +// Tell cordova channel to wait on the CordovaInfoReady event +channel.waitForInitialization('onCordovaInfoReady'); + +/** + * This represents the mobile device, and provides properties for inspecting the model, version, UUID of the + * phone, etc. + * @constructor + */ +function Device() { + this.available = false; + this.platform = null; + this.version = null; + this.name = null; + this.uuid = null; + this.cordova = null; + + var me = this; + + channel.onCordovaReady.subscribeOnce(function() { + me.getInfo(function(info) { + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.name = info.name; + me.uuid = info.uuid; + me.cordova = info.cordova; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); + }); +} + +/** + * Get device info + * + * @param {Function} successCallback The function to call when the heading data is available + * @param {Function} errorCallback The function to call when there is an error getting the heading data. (OPTIONAL) + */ +Device.prototype.getInfo = function(successCallback, errorCallback) { + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Device Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Device Error: errorCallback is not a function"); + return; + } + + // Get info + exec(successCallback, errorCallback, "Device", "getDeviceInfo", []); +}; + +module.exports = new Device(); + +}); + // file: lib/common/plugin/geolocation.js define("cordova/plugin/geolocation", function(require, exports, module) { var utils = require('cordova/utils'), @@ -3700,27 +4055,45 @@ var timers = {}; // list of timers in use // Returns default params, overrides if provided with values function parseParameters(options) { var opt = { - maximumAge: 10000, + maximumAge: 0, enableHighAccuracy: false, - timeout: 10000 + timeout: Infinity }; if (options) { - if (options.maximumAge !== undefined) { + if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { opt.maximumAge = options.maximumAge; } if (options.enableHighAccuracy !== undefined) { opt.enableHighAccuracy = options.enableHighAccuracy; } - if (options.timeout !== undefined) { - opt.timeout = options.timeout; + if (options.timeout !== undefined && !isNaN(options.timeout)) { + if (options.timeout < 0) { + opt.timeout = 0; + } else { + opt.timeout = options.timeout; + } } } return opt; } +// Returns a timeout failure, closed over a specified timeout value and error callback. +function createTimeout(errorCallback, timeout) { + var t = setTimeout(function() { + clearTimeout(t); + t = null; + errorCallback({ + code:PositionError.TIMEOUT, + message:"Position retrieval timed out." + }); + }, timeout); + return t; +} + var geolocation = { + lastPosition:null, // reference to last known (cached) position returned /** * Asynchronously aquires the current position. * @@ -3729,10 +4102,24 @@ var geolocation = { * @param {PositionOptions} options The options for getting the position data. (OPTIONAL) */ getCurrentPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("getCurrentPosition must be called with at least one argument."); + } options = parseParameters(options); + // Timer var that will fire an error callback if no position is retrieved from native + // before the "timeout" param provided expires + var timeoutTimer = null; + var win = function(p) { - successCallback(new Position( + clearTimeout(timeoutTimer); + if (!timeoutTimer) { + // Timeout already happened, or native fired error callback for + // this geo request. + // Don't continue with success callback. + return; + } + var pos = new Position( { latitude:p.latitude, longitude:p.longitude, @@ -3742,14 +4129,46 @@ var geolocation = { velocity:p.velocity, altitudeAccuracy:p.altitudeAccuracy }, - p.timestamp || new Date() - )); + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); }; var fail = function(e) { - errorCallback(new PositionError(e.code, e.message)); + clearTimeout(timeoutTimer); + timeoutTimer = null; + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } }; - exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.timeout, options.maximumAge]); + // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just + // fire the success callback with the cached position. + if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { + successCallback(geolocation.lastPosition); + // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. + } else if (options.timeout === 0) { + fail({ + code:PositionError.TIMEOUT, + message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceed's provided PositionOptions' maximumAge parameter." + }); + // Otherwise we have to call into native to retrieve a position. + } else { + if (options.timeout !== Infinity) { + // If the timeout value was not set to Infinity (default), then + // set up a timeout function that will fire the error callback + // if no successful position was retrieved before timeout expired. + timeoutTimer = createTimeout(fail, options.timeout); + } else { + // This is here so the check in the win function doesn't mess stuff up + // may seem weird but this guarantees timeoutTimer is + // always truthy before we call into native + timeoutTimer = true; + } + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + } + return timeoutTimer; }, /** * Asynchronously watches the geolocation for changes to geolocation. When a change occurs, @@ -3761,12 +4180,46 @@ var geolocation = { * @return String The watch id that must be passed to #clearWatch to stop watching. */ watchPosition:function(successCallback, errorCallback, options) { + if (arguments.length === 0) { + throw new Error("watchPosition must be called with at least one argument."); + } options = parseParameters(options); var id = utils.createUUID(); - timers[id] = window.setInterval(function() { - geolocation.getCurrentPosition(successCallback, errorCallback, options); - }, options.timeout); + + // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition + timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); + + var fail = function(e) { + clearTimeout(timers[id]); + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + var win = function(p) { + clearTimeout(timers[id]); + if (options.timeout !== Infinity) { + timers[id] = createTimeout(fail, options.timeout); + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + + exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); return id; }, @@ -3777,13 +4230,15 @@ var geolocation = { */ clearWatch:function(id) { if (id && timers[id] !== undefined) { - window.clearInterval(timers[id]); + clearTimeout(timers[id]); delete timers[id]; + exec(null, null, "Geolocation", "clearWatch", [id]); } } }; module.exports = geolocation; + }); // file: lib/ios/plugin/ios/Contact.js @@ -3953,7 +4408,12 @@ DebugConsole.prototype.setLevel = function(level) { var stringify = function(message) { try { if (typeof message === "object" && JSON && JSON.stringify) { - return JSON.stringify(message); + try { + return JSON.stringify(message); + } + catch (e) { + return "error JSON.stringify()ing argument: " + e; + } } else { return message.toString(); } @@ -4039,42 +4499,6 @@ module.exports = { }; }); -// file: lib/ios/plugin/ios/device.js -define("cordova/plugin/ios/device", function(require, exports, module) { -/** - * this represents the mobile device, and provides properties for inspecting the model, version, UUID of the - * phone, etc. - * @constructor - */ -var exec = require('cordova/exec'), - utils = require('cordova/utils'), - channel = require('cordova/channel'); - -var Device = function() { - this.platform = null; - this.version = null; - this.name = null; - this.cordova = null; - this.uuid = null; -}; - -Device.prototype.setInfo = function(info) { - try { - this.platform = info.platform; - this.version = info.version; - this.name = info.name; - this.cordova = info.cordova; - this.uuid = info.uuid; - channel.onCordovaInfoReady.fire(); - } catch(e) { - utils.alert('Error during device info setting in cordova/plugin/ios/device!'); - } -}; - -module.exports = new Device(); - -}); - // file: lib/ios/plugin/ios/nativecomm.js define("cordova/plugin/ios/nativecomm", function(require, exports, module) { var cordova = require('cordova'); @@ -4100,6 +4524,233 @@ module.exports = { }; }); +// file: lib/common/plugin/logger.js +define("cordova/plugin/logger", function(require, exports, module) { +//------------------------------------------------------------------------------ +// The logger module exports the following properties/functions: +// +// LOG - constant for the level LOG +// ERROR - constant for the level ERROR +// WARN - constant for the level WARN +// INFO - constant for the level INFO +// DEBUG - constant for the level DEBUG +// logLevel() - returns current log level +// logLevel(value) - sets and returns a new log level +// useConsole() - returns whether logger is using console +// useConsole(value) - sets and returns whether logger is using console +// log(message,...) - logs a message at level LOG +// error(message,...) - logs a message at level ERROR +// warn(message,...) - logs a message at level WARN +// info(message,...) - logs a message at level INFO +// debug(message,...) - logs a message at level DEBUG +// logLevel(level,message,...) - logs a message specified level +// +//------------------------------------------------------------------------------ + +var logger = exports; + +var exec = require('cordova/exec'); +var utils = require('cordova/utils'); + +var UseConsole = true; +var Queued = []; +var DeviceReady = false; +var CurrentLevel; + +/** + * Logging levels + */ + +var Levels = [ + "LOG", + "ERROR", + "WARN", + "INFO", + "DEBUG" +]; + +/* + * add the logging levels to the logger object and + * to a separate levelsMap object for testing + */ + +var LevelsMap = {}; +for (var i=0; i CurrentLevel) return; + + // queue the message if not yet at deviceready + if (!DeviceReady && !UseConsole) { + Queued.push([level, message]); + return; + } + + // if not using the console, use the native logger + if (!UseConsole) { + exec(null, null, "Logger", "logLevel", [level, message]); + return; + } + + // make sure console is not using logger + if (console.__usingCordovaLogger) { + throw new Error("console and logger are too intertwingly"); + } + + // log to the console + switch (level) { + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; + } +}; + +// when deviceready fires, log queued messages +logger.__onDeviceReady = function() { + if (DeviceReady) return; + + DeviceReady = true; + + for (var i=0; i 2) { + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; + } // if successful, return either a file or directory entry var success = function(entry) { var result; - if (entry) { if (typeof successCallback === 'function') { // create appropriate Entry object @@ -4315,8 +4972,178 @@ module.exports = function(uri, successCallback, errorCallback) { }); +// file: lib/common/plugin/splashscreen.js +define("cordova/plugin/splashscreen", function(require, exports, module) { +var exec = require('cordova/exec'); + +var splashscreen = { + show:function() { + exec(null, null, "SplashScreen", "show", []); + }, + hide:function() { + exec(null, null, "SplashScreen", "hide", []); + } +}; + +module.exports = splashscreen; +}); + // file: lib/common/utils.js define("cordova/utils", function(require, exports, module) { +var utils = exports; + +/** + * Returns an indication of whether the argument is an array or not + */ +utils.isArray = function(a) { + return Object.prototype.toString.call(a) == '[object Array]'; +}; + +/** + * Returns an indication of whether the argument is a Date or not + */ +utils.isDate = function(d) { + return Object.prototype.toString.call(d) == '[object Date]'; +}; + +/** + * Does a deep clone of the object. + */ +utils.clone = function(obj) { + if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { + return obj; + } + + var retVal, i; + + if(utils.isArray(obj)){ + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.clone(obj[i])); + } + return retVal; + } + + retVal = {}; + for(i in obj){ + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); + } + } + return retVal; +}; + +/** + * Returns a wrappered version of the function + */ +utils.close = function(context, func, params) { + if (typeof params == 'undefined') { + return function() { + return func.apply(context, arguments); + }; + } else { + return function() { + return func.apply(context, params); + }; + } +}; + +/** + * Create a UUID + */ +utils.createUUID = function() { + return UUIDcreatePart(4) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(6); +}; + +/** + * Extends a child object from a parent object using classical inheritance + * pattern. + */ +utils.extend = (function() { + // proxy used to establish prototype chain + var F = function() {}; + // extend Child from Parent + return function(Child, Parent) { + F.prototype = Parent.prototype; + Child.prototype = new F(); + Child.__super__ = Parent.prototype; + Child.prototype.constructor = Child; + }; +}()); + +/** + * Alerts a message in any available way: alert or console.log. + */ +utils.alert = function(msg) { + if (alert) { + alert(msg); + } else if (console && console.log) { + console.log(msg); + } +}; + +/** + * Formats a string and arguments following it ala sprintf() + * + * see utils.vformat() for more information + */ +utils.format = function(formatString /* ,... */) { + var args = [].slice.call(arguments, 1); + return utils.vformat(formatString, args); +}; + +/** + * Formats a string and arguments following it ala vsprintf() + * + * format chars: + * %j - format arg as JSON + * %o - format arg as JSON + * %c - format arg as '' + * %% - replace with '%' + * any other char following % will format it's + * arg via toString(). + * + * for rationale, see FireBug's Console API: + * http://getfirebug.com/wiki/index.php/Console_API + */ +utils.vformat = function(formatString, args) { + if (formatString === null || formatString === undefined) return ""; + if (arguments.length == 1) return formatString.toString(); + if (typeof formatString != "string") return formatString.toString(); + + var pattern = /(.*?)%(.)(.*)/; + var rest = formatString; + var result = []; + + while (args.length) { + var arg = args.shift(); + var match = pattern.exec(rest); + + if (!match) break; + + rest = match[3]; + + result.push(match[1]); + + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; + } + + result.push(formatted(arg, match[2])); + } + + result.push(rest); + + return result.join(''); +}; + +//------------------------------------------------------------------------------ function UUIDcreatePart(length) { var uuidpart = ""; for (var i=0; i + + + + + + + + Hello Cordova + + +
+

Apache Cordovaâ„¢

+
+ + +
+
+ + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/WikitudePlugin.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/WikitudePlugin.js new file mode 100644 index 00000000..997558e3 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/WikitudePlugin.js @@ -0,0 +1,353 @@ +var WikitudePlugin = { + + /** + * + * This is the SDK Key, provided to you after you purchased the Wikitude SDK from http://www.wikitude.com/developer/sdk + * If you're having a trial version, leave this string empty + * + */ + mySDKKey : "ENTER-YOUR-KEY-HERE", + + /** + * + * Change the value of this variable to modify the location update rate + * + */ + locationUpdateRate : 3000, + + /** + * + * This variable represents if the current device is capable of running the Wikitude SDK + * + */ + isDeviceSupported : false, + + /** + * + * This watchID is used to shedule location updates + * + */ + watchID : null, + + /** + * + * Callbacks to get device information if ARchitect Worlds can be launched + * + */ + onDeviceSupportedCallback : null, + onDeviceNotSupportedCallback : null, + + /** + * + * Callbacks to get notified if the ARchitect World finished launching or if something went wrong during the World launch + * + */ + onARchitectWorldLaunchedCallback : null, + onARchitectWorldFailedLaunchingCallback : null, + + /** + * + * This function gets called if PhoneGap reports that it has finished loading successfully. + * + */ + isDeviceSupported: function(successCallback, errorCallback) + { + + WikitudePlugin.onDeviceSupportedCallback = successCallback; + WikitudePlugin.onDeviceNotSupportedCallback = errorCallback; + + + // PhoneGap is running, so the first thing we do is to check if the current device is capable of running the Wikitude Plugin + cordova.exec(WikitudePlugin.deviceIsARchitectReady, WikitudePlugin.deviceIsNotARchitectReady, "WikitudePlugin", "isDeviceSupported", [""]); + + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is able to start the Wikitude SDK + * + */ + deviceIsARchitectReady : function() + { + // We keep track of the device status + WikitudePlugin.isDeviceSupported = true; + + + if(WikitudePlugin.onDeviceSupportedCallback) + { + WikitudePlugin.onDeviceSupportedCallback(); + } + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is not able of starting the Wikitude SDK. + * + */ + deviceIsNotARchitectReady : function() + { + WikitudePlugin.isDeviceSupported = false; + + // In this case we notify the user that his device is not supported by the Wikitude SDK + if(WikitudePlugin.onDeviceNotSupportedCallback) + { + WikitudePlugin.onDeviceNotSupportedCallback(); + } + }, + + + /* + * ============================================================================================================================= + * + * PUBLIC API + * + * ============================================================================================================================= + */ + + /* Managing ARchitect world loading */ + + /** + * + * Call this function if you want to load an ARchitect World + * + * @param {String} worldPath The path to an ARchitect world ether on the device or on e.g. your dropbox + * + */ + loadARchitectWorld : function(worldPath) + { + + // before we actually call load, we check again if the device is able to open the world + if(WikitudePlugin.isDeviceSupported) + { + + // the 'open' function of the Wikitude Plugin requires a option dictionary with two keys: + // @param {Object} options (required) + // @param {String} options.sdkKey License key for the Wikitude SDK + // @param {String} options.filePath The path to a local ARchitect world or to a ARchitect world on a server or your dropbox + + cordova.exec(WikitudePlugin.worldLaunched, WikitudePlugin.worldFailedLaunching, "WikitudePlugin", "open", [{ sdkKey: WikitudePlugin.mySDKKey, filePath: worldPath}]); + + + // We add an event listener on the resume and pause event of the application lifecycle + document.addEventListener("resume", WikitudePlugin.onResume, false); + document.addEventListener("pause", WikitudePlugin.onPause, false); + + // After we started loading the world, we start location updates + WikitudePlugin.startLocationUpdates(); + + }else + { + // if the device is not able to start the Wikitude SDK, we notify the user again + WikitudePlugin.deviceNotARchitectReady(); + } + }, + + /* Managing the Wikitude SDK Lifecycle */ + + /** + * + * Use this function to stop the Wikitude SDK and to remove the ARchitectView from the screen + * + */ + close : function() + { + document.removeEventListener("pause", WikitudePlugin.onPause, false); + document.removeEventListener("resume", WikitudePlugin.onResume, false); + + WikitudePlugin.stopLocationUpdates(); + + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "close", [""]); + }, + + /** + * + * Use this function to only hide the Wikitude SDK. All location and rendering updates are still active + * + */ + hide : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "hide", [""]); + }, + + /** + * + * Use this function to show the Wikitude SDK if it was hidden before + * + */ + show : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "show", [""]); + }, + + /* Interacting with the Wikitude SDK */ + + /** + * + * Use this function to call javascript which will be executed in the context of your ARchitect World + * + * + * @param js The JavaScript that gets evaluated in context of the ARchitect World + * + */ + callJavaScript : function(js) + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "callJavascript", [js]); + }, + + /** + * + * Use this function to set a callback which will be invoked when the ARchitect World calls for example + * document.location = "architectsdk://opendetailpage?id=9"; + * + * + * @param onUrlInvokeCallback A function which gets called when the ARchitect World invokes a call to "document.location = architectsdk://" + */ + setOnUrlInvokeCallback : function(onUrlInvokeCallback) + { + cordova.exec(onUrlInvokeCallback, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onUrlInvoke", [""]); + }, + + + /* + * ============================================================================================================================= + * + * Callbacks of public functions + * + * ============================================================================================================================= + */ + + /** + * + * Use this callback to get notified if the world loaded successfully + * + */ + worldLaunched : function() + { + if(WikitudePlugin.onARchitectWorldLaunchedCallback) + { + WikitudePlugin.onARchitectWorldLaunchedCallback(); + } + }, + + /** + * + * Use this callback to get notified if the Wikitude SDK wasn't able to load the ARchitect World + * + */ + worldFailedLaunching : function(err) + { + if(WikitudePlugin.onARchitectWorldFailedLaunchingCallback) + { + WikitudePlugin.onARchitectWorldFailedLaunchingCallback(err); + } + }, + + /* Lifecycle updates */ + + /** + * + * This function actually starts the PhoneGap location updates + * + */ + startLocationUpdates : function() + { + + WikitudePlugin.watchID = navigator.geolocation.watchPosition(WikitudePlugin.onReceivedLocation, WikitudePlugin.onWikitudeError, { frequency: WikitudePlugin.locationUpdateRate }); + }, + + /** + * + * This callback gets called everytime the location did update + * + */ + onReceivedLocation : function(position) + { + + // Every time that PhoneGap did received a location update, we pass the location into the Wikitude SDK + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "setLocation", [{ lat: position.coords.latitude, lon: position.coords.longitude, alt: position.coords.altitude, acc: position.coords.accuracy}]); + }, + + /** + * + * Use this function to stop location updates + * + */ + stopLocationUpdates : function() + { + + // We clear the location update watch which was responsible for updating the location in a specific time interval + navigator.geolocation.clearWatch(WikitudePlugin.watchID); + WikitudePlugin.watchID = null; + }, + + /** + * + * This function gets called every time the application did become active. + * + */ + onResume : function() + { + + // Call the Wikitude SDK that the application did become active again + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onResume", [""]); + + // And start continuing updating the user location + WikitudePlugin.startLocationUpdates(); + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onPause : function() + { + + // Call the Wikitude SDK that the application did resign active + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onPause", [""]); + + // And stop all ongoing location updates + WikitudePlugin.stopLocationUpdates(); + }, + + /** + * + * Android specific! + * This function gets called if the user presses the back button + * + */ + onBackButton : function() + { + + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "close", [""]); + WikitudePlugin.stopLocationUpdates(); + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeOK : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeError : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + report: function(id) + { + console.log("app report: " + id); + } +}; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/index.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/index.js new file mode 100644 index 00000000..412a0fed --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/js/index.js @@ -0,0 +1,116 @@ +var app = { + initialize: function() { + this.bind(); + }, + bind: function() { + document.addEventListener('deviceready', this.deviceready, false); + }, + + /** + * + * This function extracts an url parameter + * + */ + getUrlParameterForKey : function( url, requestedParam ) + { + requestedParam = requestedParam.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]"); + var regexS = "[\\?&]"+requestedParam+"=([^&#]*)"; + var regex = new RegExp( regexS ); + var results = regex.exec( url ); + if( results == null ) + return ""; + else + { + var result = decodeURIComponent(results[1]); + return result; + } + + }, + + /** + * + * This function gets called if you call "document.location = architectsdk://" in your ARchitect World + * + * + * @param url The url which was called in ARchitect World + * + */ + onClickInARchitectWorld : function(url) + { + + app.report("you clicked on a label with text: " + app.getUrlParameterForKey(url, 'text')); + }, + + /** + * + * This function gets called it the Wikitude SDK is able to start an ARchitect World (the current device is supported by the Wikitude SDK) + * + */ + onDeviceIsReadyCallback : function() + { + // The device is able to launch ARchitect World, so we load the 'Hello World' example + WikitudePlugin.loadARchitectWorld("assets/world/HelloWorld.html"); + + // To be able to respond on events inside the ARchitect World, we set a onURLInvoke callback + WikitudePlugin.setOnUrlInvokeCallback(app.onClickInARchitectWorld); + + // This is a example how you can interact with the ARchitect World to pass in additional information + // In this example, a JavaScript function gets called which sets a new text for a label + WikitudePlugin.callJavaScript("didReceivedNewTextForLabel('Hello World')"); + }, + + /** + * + * This function gets if the current device is not capable of running ARchitect Worlds + * + */ + onDeviceIsUnsupportedCallback : function() + { + app.report('device is not supported'); + }, + + /** + * + * This function gets if the ARchitect World finished loading + * + */ + onARchitectWorldLaunchedCallback : function() + { + app.report('ARchitect World launched'); + }, + + /** + * + * This function gets if the ARchitect failed loading + * + */ + onARchitectWorldFailedLaunchingCallback : function(err) + { + app.report('ARchitect World failed launching'); + }, + + /** + * + * This function gets called when the Wikitude SDK is ready to start an ARchitect World (the current device is supported by the Wikitude SDK) + * + */ + deviceready: function() { + // note that this is an event handler so the scope is that of the event + // so we need to call app.report(), and not this.report() + app.report('deviceready'); + + // When PhoneGap finished loading we forward this event into the Wikitude SDK wrapper. + // @param {function} A function which gets called if the device is able to launch ARchitect Worlds + // @param {function} A function which gets called if the device is not able to launch ARchitect Worlds + WikitudePlugin.isDeviceSupported(app.onDeviceIsReadyCallback, app.onDeviceIsUnsupportedCallback); + + // set a callback on the WikitudePlugin to get informed when the ARchitect World finished loading + WikitudePlugin.onARchitectWorldLaunchedCallback = app.onARchitectWorldLaunchedCallback; + + // Set a callback on the WikitudePlugin to get informed when the ARchitect World failed loading + WikitudePlugin.onARchitectWorldFailedLaunchingCallback = app.onARchitectWorldFailedLaunchingCallback; + }, + report: function(id) { + console.log("report:" + id); + } +}; diff --git a/iOS/AdPlugin/www/res/icon/cordova_128.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_128.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_128.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_128.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_16.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_16.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_16.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_16.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_24.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_24.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_24.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_24.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_256.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_256.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_256.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_256.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_32.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_32.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_32.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_32.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_48.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_48.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_48.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_48.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_512.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_512.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_512.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_512.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_64.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_64.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_64.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_64.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_android_36.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_36.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_android_36.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_36.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_android_48.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_48.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_android_48.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_48.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_android_72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_72.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_android_72.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_72.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_android_96.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_96.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_android_96.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_android_96.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_bb_80.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_bb_80.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_bb_80.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_bb_80.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_ios_114.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_114.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_ios_114.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_114.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_144.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_144.png new file mode 100644 index 00000000..dd819da6 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_144.png differ diff --git a/iOS/AdPlugin/www/res/icon/cordova_ios_57.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_57.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_ios_57.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_57.png diff --git a/iOS/AdPlugin/www/res/icon/cordova_ios_72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_72.png similarity index 100% rename from iOS/AdPlugin/www/res/icon/cordova_ios_72.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/icon/cordova_ios_72.png diff --git a/iOS/AdPlugin/www/res/screen/android_hdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_hdpi_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_hdpi_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_hdpi_landscape.png diff --git a/iOS/AdPlugin/www/res/screen/android_hdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_hdpi_portrait.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_hdpi_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_hdpi_portrait.png diff --git a/iOS/AdPlugin/www/res/screen/android_ldpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_ldpi_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_ldpi_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_ldpi_landscape.png diff --git a/iOS/AdPlugin/www/res/screen/android_ldpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_ldpi_portrait.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_ldpi_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_ldpi_portrait.png diff --git a/iOS/AdPlugin/www/res/screen/android_mdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_mdpi_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_mdpi_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_mdpi_landscape.png diff --git a/iOS/AdPlugin/www/res/screen/android_mdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_mdpi_portrait.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_mdpi_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_mdpi_portrait.png diff --git a/iOS/AdPlugin/www/res/screen/android_xhdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_xhdpi_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_xhdpi_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_xhdpi_landscape.png diff --git a/iOS/AdPlugin/www/res/screen/android_xhdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_xhdpi_portrait.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/android_xhdpi_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/android_xhdpi_portrait.png diff --git a/iOS/AdPlugin/www/res/screen/blackberry_transparent_300.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/blackberry_transparent_300.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/blackberry_transparent_300.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/blackberry_transparent_300.png diff --git a/iOS/AdPlugin/www/res/screen/blackberry_transparent_400.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/blackberry_transparent_400.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/blackberry_transparent_400.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/blackberry_transparent_400.png diff --git a/iOS/AdPlugin/www/res/screen/ipad_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/ipad_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_landscape.png diff --git a/iOS/AdPlugin/www/res/screen/ipad_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_portrait.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/ipad_portrait.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_portrait.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_landscape.png new file mode 100644 index 00000000..95c542dc Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_portrait.png new file mode 100644 index 00000000..aae1862c Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/ipad_retina_portrait.png differ diff --git a/iOS/AdPlugin/www/res/screen/iphone_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/iphone_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_landscape.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_portrait.png new file mode 100644 index 00000000..6fcba565 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_portrait.png differ diff --git a/iOS/AdPlugin/www/res/screen/iphone_retina_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_retina_landscape.png similarity index 100% rename from iOS/AdPlugin/www/res/screen/iphone_retina_landscape.png rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_retina_landscape.png diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_retina_portrait.png new file mode 100644 index 00000000..bd24886a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/iphone_retina_portrait.png differ diff --git a/iOS/AdPlugin/www/res/screen/windows_phone_portrait.jpg b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/windows_phone_portrait.jpg similarity index 100% rename from iOS/AdPlugin/www/res/screen/windows_phone_portrait.jpg rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/res/screen/windows_phone_portrait.jpg diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec.html b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec.html new file mode 100644 index 00000000..83d7d2e3 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec.html @@ -0,0 +1,50 @@ + + + + Jasmine Spec Runner + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/AdPlugin/www/spec/helper.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/helper.js similarity index 54% rename from iOS/AdPlugin/www/spec/helper.js rename to iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/helper.js index e3a5e034..9f994450 100644 --- a/iOS/AdPlugin/www/spec/helper.js +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/helper.js @@ -4,8 +4,8 @@ afterEach(function() { var helper = { trigger: function(obj, name) { - var e = document.createEvent('Event'); - e.initEvent(name, true, true); - obj.dispatchEvent(e); + var e = document.createEvent('Event'); + e.initEvent(name, true, true); + obj.dispatchEvent(e); } }; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/index.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/index.js new file mode 100644 index 00000000..121cf631 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/HelloWorld/www/spec/index.js @@ -0,0 +1,49 @@ +describe('app', function() { + describe('initialize', function() { + it('should bind deviceready', function() { + runs(function() { + spyOn(app, 'deviceready'); + app.initialize(); + helper.trigger(window.document, 'deviceready'); + }); + + waitsFor(function() { + return (app.deviceready.calls.length > 0); + }, 'deviceready should be called once', 500); + + runs(function() { + expect(app.deviceready).toHaveBeenCalled(); + }); + }); + }); + + describe('deviceready', function() { + it('should report that it fired', function() { + spyOn(app, 'report'); + app.deviceready(); + expect(app.report).toHaveBeenCalledWith('deviceready'); + }); + }); + + describe('report', function() { + beforeEach(function() { + var el = document.getElementById('stage'); + el.innerHTML = ['
', + '

Pending

', + '

Complete

', + '
'].join('\n'); + }); + + it('should show the completion state', function() { + app.report('deviceready'); + var el = document.querySelector('#deviceready .complete:not(.hide)'); + expect(el).toBeTruthy(); + }); + + it('should hide the pending state', function() { + app.report('deviceready'); + var el = document.querySelector('#deviceready .pending.hide'); + expect(el).toBeTruthy(); + }); + }); +}); diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/README.md b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/README.md new file mode 100644 index 00000000..985ec76a --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Basic/README.md @@ -0,0 +1,13 @@ +# Hello World iOS + +This document describes all necessary steps to get the sample running. + + +###Setup +*** + + +* Download the Wikitude SDK from [our website](http://www.wikitude.com/developer/sdk) (You need to register yourself as a Wikitude developer) + +* Copy the SDK folder from ``` [DownloadedSDKRoot/iOS/SDK/SDK] ``` into ``` [ProjectFolder/"AppName"/WikitudeSDK] ``` + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateIcon.icns b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateIcon.icns new file mode 100644 index 00000000..47f85e56 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateIcon.icns differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateInfo.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateInfo.plist new file mode 100644 index 00000000..6e6b2718 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/TemplateInfo.plist @@ -0,0 +1,28 @@ + + + + + + Description + This template provides a starting point for a Cordova based application. Just modify the www folder contents with your HTML, CSS and Javascript. + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.pbxproj b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.pbxproj new file mode 100644 index 00000000..fcfa7c8c --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.pbxproj @@ -0,0 +1,870 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 1D3623250D0F684500981E51 /* AppDelegate.m */; }; + 1D60589B0D05DD56006BFB54 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; }; + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; }; + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 1F766FE113BBADB100FB74C0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F766FDC13BBADB100FB74C0 /* Localizable.strings */; }; + 1F766FE213BBADB100FB74C0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 1F766FDF13BBADB100FB74C0 /* Localizable.strings */; }; + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288765FC0DF74451002DB57D /* CoreGraphics.framework */; }; + 301BF552109A68D80062928A /* libCordova.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF535109A57CC0062928A /* libCordova.a */; }; + 301BF570109A69640062928A /* www in Resources */ = {isa = PBXBuildFile; fileRef = 301BF56E109A69640062928A /* www */; }; + 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B4109A6A2B0062928A /* AddressBook.framework */; }; + 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */; }; + 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */; }; + 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BA109A6A2B0062928A /* AVFoundation.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BC109A6A2B0062928A /* CFNetwork.framework */; }; + 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5BE109A6A2B0062928A /* CoreLocation.framework */; }; + 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */; }; + 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C2109A6A2B0062928A /* QuartzCore.framework */; }; + 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */; }; + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 302D95EF14D2391D003F00A1 /* MainViewController.m */; }; + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 302D95F014D2391D003F00A1 /* MainViewController.xib */; }; + 3053AC6F109B7857006FCFE7 /* VERSION in Resources */ = {isa = PBXBuildFile; fileRef = 3053AC6E109B7857006FCFE7 /* VERSION */; }; + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */; }; + 3072F99713A8081B00425683 /* Capture.bundle in Resources */ = {isa = PBXBuildFile; fileRef = 3072F99613A8081B00425683 /* Capture.bundle */; }; + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */; }; + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */; }; + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */; }; + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */; }; + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */; }; + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */ = {isa = PBXBuildFile; fileRef = 3088BBBC154F3926009F9C59 /* Default~iphone.png */; }; + 308D05371370CCF300D202BF /* icon-72.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052E1370CCF300D202BF /* icon-72.png */; }; + 308D05381370CCF300D202BF /* icon.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D052F1370CCF300D202BF /* icon.png */; }; + 308D05391370CCF300D202BF /* icon@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 308D05301370CCF300D202BF /* icon@2x.png */; }; + 30A0434814DC770100060A13 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30A0434314DC770100060A13 /* Localizable.strings */; }; + 30A0434914DC770100060A13 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 30A0434614DC770100060A13 /* Localizable.strings */; }; + 30E1352710E2C1420031B30D /* Cordova.plist in Resources */ = {isa = PBXBuildFile; fileRef = 30E1352610E2C1420031B30D /* Cordova.plist */; }; + 30E5649213A7FCAF007403D8 /* CoreMedia.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 30E5649113A7FCAF007403D8 /* CoreMedia.framework */; settings = {ATTRIBUTES = (Weak, ); }; }; + A93E85C516034FEE0004D29A /* WTWikitudePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = A93E85C416034FEE0004D29A /* WTWikitudePlugin.m */; }; + A93E85F7160351690004D29A /* libQCAR.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85E9160351690004D29A /* libQCAR.a */; }; + A93E85F8160351690004D29A /* libExtensionVuforia.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85EE160351690004D29A /* libExtensionVuforia.a */; }; + A93E85F9160351690004D29A /* libWikitudeSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85F4160351690004D29A /* libWikitudeSDK.a */; }; + A93E85FA1603516A0004D29A /* libWikitudeSDK.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85F6160351690004D29A /* libWikitudeSDK.a */; }; + A93E8601160352820004D29A /* CoreMotion.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85FB160352820004D29A /* CoreMotion.framework */; }; + A93E8602160352820004D29A /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85FC160352820004D29A /* CoreVideo.framework */; }; + A93E8603160352820004D29A /* libsqlite3.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85FD160352820004D29A /* libsqlite3.dylib */; }; + A93E8604160352820004D29A /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85FE160352820004D29A /* libz.dylib */; }; + A93E8605160352820004D29A /* OpenGLES.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E85FF160352820004D29A /* OpenGLES.framework */; }; + A93E8606160352820004D29A /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A93E8600160352820004D29A /* Security.framework */; }; + A93E8608160352BE0004D29A /* assets in Resources */ = {isa = PBXBuildFile; fileRef = A93E8607160352BE0004D29A /* assets */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 301BF534109A57CC0062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = D2AAC07E0554694100DB518D; + remoteInfo = CordovaLib; + }; + 301BF550109A68C00062928A /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = D2AAC07D0554694100DB518D; + remoteInfo = CordovaLib; + }; + 302D95EB14D23909003F00A1 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 686357A9141002F100DF4CF2; + remoteInfo = CordovaLibTests; + }; + 3088BBB4154F38EF009F9C59 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = 303A4068152124BB00182201; + remoteInfo = CordovaLibApp; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 1D30AB110D05D00D00671497 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; }; + 1D3623240D0F684500981E51 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; + 1D3623250D0F684500981E51 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; + 1D6058910D05DD3D006BFB54 /* HelloImageRecognition.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = HelloImageRecognition.app; sourceTree = BUILT_PRODUCTS_DIR; }; + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = UIKit.framework; path = System/Library/Frameworks/UIKit.framework; sourceTree = SDKROOT; }; + 1F766FDD13BBADB100FB74C0 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = Localizable.strings; sourceTree = ""; }; + 1F766FE013BBADB100FB74C0 /* es */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = es; path = Localizable.strings; sourceTree = ""; }; + 288765FC0DF74451002DB57D /* CoreGraphics.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreGraphics.framework; path = System/Library/Frameworks/CoreGraphics.framework; sourceTree = SDKROOT; }; + 29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; path = CordovaLib.xcodeproj; sourceTree = CORDOVALIB; }; + 301BF56E109A69640062928A /* www */ = {isa = PBXFileReference; lastKnownFileType = folder; path = www; sourceTree = SOURCE_ROOT; }; + 301BF5B4109A6A2B0062928A /* AddressBook.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBook.framework; path = System/Library/Frameworks/AddressBook.framework; sourceTree = SDKROOT; }; + 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AddressBookUI.framework; path = System/Library/Frameworks/AddressBookUI.framework; sourceTree = SDKROOT; }; + 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AudioToolbox.framework; path = System/Library/Frameworks/AudioToolbox.framework; sourceTree = SDKROOT; }; + 301BF5BA109A6A2B0062928A /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; + 301BF5BC109A6A2B0062928A /* CFNetwork.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CFNetwork.framework; path = System/Library/Frameworks/CFNetwork.framework; sourceTree = SDKROOT; }; + 301BF5BE109A6A2B0062928A /* CoreLocation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreLocation.framework; path = System/Library/Frameworks/CoreLocation.framework; sourceTree = SDKROOT; }; + 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MediaPlayer.framework; path = System/Library/Frameworks/MediaPlayer.framework; sourceTree = SDKROOT; }; + 301BF5C2109A6A2B0062928A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; + 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = SystemConfiguration.framework; path = System/Library/Frameworks/SystemConfiguration.framework; sourceTree = SDKROOT; }; + 302D95EE14D2391D003F00A1 /* MainViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MainViewController.h; sourceTree = ""; }; + 302D95EF14D2391D003F00A1 /* MainViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MainViewController.m; sourceTree = ""; }; + 302D95F014D2391D003F00A1 /* MainViewController.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainViewController.xib; sourceTree = ""; }; + 3053AC6E109B7857006FCFE7 /* VERSION */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = VERSION; sourceTree = CORDOVALIB; }; + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = MobileCoreServices.framework; path = System/Library/Frameworks/MobileCoreServices.framework; sourceTree = SDKROOT; }; + 3072F99613A8081B00425683 /* Capture.bundle */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.plug-in"; path = Capture.bundle; sourceTree = ""; }; + 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; name = CordovaBuildSettings.xcconfig; path = ../CordovaBuildSettings.xcconfig; sourceTree = ""; }; + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape@2x~ipad.png"; sourceTree = ""; }; + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Landscape~ipad.png"; sourceTree = ""; }; + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait@2x~ipad.png"; sourceTree = ""; }; + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default-Portrait~ipad.png"; sourceTree = ""; }; + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default@2x~iphone.png"; sourceTree = ""; }; + 3088BBBC154F3926009F9C59 /* Default~iphone.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "Default~iphone.png"; sourceTree = ""; }; + 308D052E1370CCF300D202BF /* icon-72.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon-72.png"; sourceTree = ""; }; + 308D052F1370CCF300D202BF /* icon.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = icon.png; sourceTree = ""; }; + 308D05301370CCF300D202BF /* icon@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "icon@2x.png"; sourceTree = ""; }; + 30A0434414DC770100060A13 /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = Localizable.strings; sourceTree = ""; }; + 30A0434714DC770100060A13 /* se */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = se; path = Localizable.strings; sourceTree = ""; }; + 30E1352610E2C1420031B30D /* Cordova.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Cordova.plist; path = ../Cordova.plist; sourceTree = ""; }; + 30E5649113A7FCAF007403D8 /* CoreMedia.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMedia.framework; path = System/Library/Frameworks/CoreMedia.framework; sourceTree = SDKROOT; }; + 32CA4F630368D1EE00C91783 /* HelloImageRecognition-Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "HelloImageRecognition-Prefix.pch"; sourceTree = ""; }; + 8D1107310486CEB800E47090 /* HelloImageRecognition-Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = "HelloImageRecognition-Info.plist"; path = "../HelloImageRecognition-Info.plist"; plistStructureDefinitionIdentifier = "com.apple.xcode.plist.structure-definition.iphone.info-plist"; sourceTree = ""; }; + A93E85C316034FEE0004D29A /* WTWikitudePlugin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTWikitudePlugin.h; sourceTree = ""; }; + A93E85C416034FEE0004D29A /* WTWikitudePlugin.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WTWikitudePlugin.m; sourceTree = ""; }; + A93E85C9160351690004D29A /* Area.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Area.h; sourceTree = ""; }; + A93E85CA160351690004D29A /* CameraCalibration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CameraCalibration.h; sourceTree = ""; }; + A93E85CB160351690004D29A /* CameraDevice.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CameraDevice.h; sourceTree = ""; }; + A93E85CC160351690004D29A /* DataSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataSet.h; sourceTree = ""; }; + A93E85CD160351690004D29A /* Frame.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Frame.h; sourceTree = ""; }; + A93E85CE160351690004D29A /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; + A93E85CF160351690004D29A /* ImageTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTarget.h; sourceTree = ""; }; + A93E85D0160351690004D29A /* ImageTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageTracker.h; sourceTree = ""; }; + A93E85D1160351690004D29A /* Marker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Marker.h; sourceTree = ""; }; + A93E85D2160351690004D29A /* MarkerTracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MarkerTracker.h; sourceTree = ""; }; + A93E85D3160351690004D29A /* Matrices.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Matrices.h; sourceTree = ""; }; + A93E85D4160351690004D29A /* MultiTarget.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MultiTarget.h; sourceTree = ""; }; + A93E85D5160351690004D29A /* NonCopyable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NonCopyable.h; sourceTree = ""; }; + A93E85D6160351690004D29A /* QCAR.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QCAR.h; sourceTree = ""; }; + A93E85D7160351690004D29A /* QCAR_iOS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = QCAR_iOS.h; sourceTree = ""; }; + A93E85D8160351690004D29A /* Rectangle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Rectangle.h; sourceTree = ""; }; + A93E85D9160351690004D29A /* Renderer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Renderer.h; sourceTree = ""; }; + A93E85DA160351690004D29A /* State.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = State.h; sourceTree = ""; }; + A93E85DB160351690004D29A /* System.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = System.h; sourceTree = ""; }; + A93E85DC160351690004D29A /* Tool.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tool.h; sourceTree = ""; }; + A93E85DD160351690004D29A /* Trackable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Trackable.h; sourceTree = ""; }; + A93E85DE160351690004D29A /* Tracker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Tracker.h; sourceTree = ""; }; + A93E85DF160351690004D29A /* TrackerManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TrackerManager.h; sourceTree = ""; }; + A93E85E0160351690004D29A /* UIGLViewProtocol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UIGLViewProtocol.h; sourceTree = ""; }; + A93E85E1160351690004D29A /* UpdateCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UpdateCallback.h; sourceTree = ""; }; + A93E85E2160351690004D29A /* Vectors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Vectors.h; sourceTree = ""; }; + A93E85E3160351690004D29A /* VideoBackgroundConfig.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoBackgroundConfig.h; sourceTree = ""; }; + A93E85E4160351690004D29A /* VideoBackgroundTextureInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoBackgroundTextureInfo.h; sourceTree = ""; }; + A93E85E5160351690004D29A /* VideoMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VideoMode.h; sourceTree = ""; }; + A93E85E6160351690004D29A /* VirtualButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = VirtualButton.h; sourceTree = ""; }; + A93E85E9160351690004D29A /* libQCAR.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libQCAR.a; sourceTree = ""; }; + A93E85EE160351690004D29A /* libExtensionVuforia.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libExtensionVuforia.a; sourceTree = ""; }; + A93E85F1160351690004D29A /* WTArchitectView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WTArchitectView.h; sourceTree = ""; }; + A93E85F4160351690004D29A /* libWikitudeSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWikitudeSDK.a; sourceTree = ""; }; + A93E85F6160351690004D29A /* libWikitudeSDK.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libWikitudeSDK.a; sourceTree = ""; }; + A93E85FB160352820004D29A /* CoreMotion.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreMotion.framework; path = System/Library/Frameworks/CoreMotion.framework; sourceTree = SDKROOT; }; + A93E85FC160352820004D29A /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; + A93E85FD160352820004D29A /* libsqlite3.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libsqlite3.dylib; path = usr/lib/libsqlite3.dylib; sourceTree = SDKROOT; }; + A93E85FE160352820004D29A /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = usr/lib/libz.dylib; sourceTree = SDKROOT; }; + A93E85FF160352820004D29A /* OpenGLES.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = OpenGLES.framework; path = System/Library/Frameworks/OpenGLES.framework; sourceTree = SDKROOT; }; + A93E8600160352820004D29A /* Security.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Security.framework; path = System/Library/Frameworks/Security.framework; sourceTree = SDKROOT; }; + A93E8607160352BE0004D29A /* assets */ = {isa = PBXFileReference; lastKnownFileType = folder; path = assets; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 1D60588F0D05DD3D006BFB54 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + A93E8601160352820004D29A /* CoreMotion.framework in Frameworks */, + A93E8602160352820004D29A /* CoreVideo.framework in Frameworks */, + A93E8603160352820004D29A /* libsqlite3.dylib in Frameworks */, + A93E8604160352820004D29A /* libz.dylib in Frameworks */, + A93E8605160352820004D29A /* OpenGLES.framework in Frameworks */, + A93E8606160352820004D29A /* Security.framework in Frameworks */, + 301BF552109A68D80062928A /* libCordova.a in Frameworks */, + 1D60589F0D05DD5A006BFB54 /* Foundation.framework in Frameworks */, + 1DF5F4E00D08C38300B7A737 /* UIKit.framework in Frameworks */, + 288765FD0DF74451002DB57D /* CoreGraphics.framework in Frameworks */, + 301BF5B5109A6A2B0062928A /* AddressBook.framework in Frameworks */, + 301BF5B7109A6A2B0062928A /* AddressBookUI.framework in Frameworks */, + 301BF5B9109A6A2B0062928A /* AudioToolbox.framework in Frameworks */, + 301BF5BB109A6A2B0062928A /* AVFoundation.framework in Frameworks */, + 301BF5BD109A6A2B0062928A /* CFNetwork.framework in Frameworks */, + 301BF5BF109A6A2B0062928A /* CoreLocation.framework in Frameworks */, + 301BF5C1109A6A2B0062928A /* MediaPlayer.framework in Frameworks */, + 301BF5C3109A6A2B0062928A /* QuartzCore.framework in Frameworks */, + 301BF5C5109A6A2B0062928A /* SystemConfiguration.framework in Frameworks */, + 305D5FD1115AB8F900A74A75 /* MobileCoreServices.framework in Frameworks */, + 30E5649213A7FCAF007403D8 /* CoreMedia.framework in Frameworks */, + A93E85F7160351690004D29A /* libQCAR.a in Frameworks */, + A93E85F8160351690004D29A /* libExtensionVuforia.a in Frameworks */, + A93E85F9160351690004D29A /* libWikitudeSDK.a in Frameworks */, + A93E85FA1603516A0004D29A /* libWikitudeSDK.a in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 080E96DDFE201D6D7F000001 /* Classes */ = { + isa = PBXGroup; + children = ( + 302D95EE14D2391D003F00A1 /* MainViewController.h */, + 302D95EF14D2391D003F00A1 /* MainViewController.m */, + 302D95F014D2391D003F00A1 /* MainViewController.xib */, + 1D3623240D0F684500981E51 /* AppDelegate.h */, + 1D3623250D0F684500981E51 /* AppDelegate.m */, + ); + name = Classes; + path = HelloImageRecognition/Classes; + sourceTree = SOURCE_ROOT; + }; + 19C28FACFE9D520D11CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + 1D6058910D05DD3D006BFB54 /* HelloImageRecognition.app */, + ); + name = Products; + sourceTree = ""; + }; + 1F766FDB13BBADB100FB74C0 /* en.lproj */ = { + isa = PBXGroup; + children = ( + 1F766FDC13BBADB100FB74C0 /* Localizable.strings */, + ); + path = en.lproj; + sourceTree = ""; + }; + 1F766FDE13BBADB100FB74C0 /* es.lproj */ = { + isa = PBXGroup; + children = ( + 1F766FDF13BBADB100FB74C0 /* Localizable.strings */, + ); + path = es.lproj; + sourceTree = ""; + }; + 29B97314FDCFA39411CA2CEA /* CustomTemplate */ = { + isa = PBXGroup; + children = ( + A93E8607160352BE0004D29A /* assets */, + 301BF56E109A69640062928A /* www */, + 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */, + A93E85C6160351690004D29A /* Vuforia */, + A93E85EA160351690004D29A /* WikitudeSDK */, + 080E96DDFE201D6D7F000001 /* Classes */, + 307C750510C5A3420062BCA9 /* Plugins */, + 29B97315FDCFA39411CA2CEA /* Other Sources */, + 29B97317FDCFA39411CA2CEA /* Resources */, + 29B97323FDCFA39411CA2CEA /* Frameworks */, + 19C28FACFE9D520D11CA2CBB /* Products */, + ); + name = CustomTemplate; + sourceTree = ""; + }; + 29B97315FDCFA39411CA2CEA /* Other Sources */ = { + isa = PBXGroup; + children = ( + 32CA4F630368D1EE00C91783 /* HelloImageRecognition-Prefix.pch */, + 29B97316FDCFA39411CA2CEA /* main.m */, + ); + name = "Other Sources"; + path = HelloImageRecognition; + sourceTree = ""; + }; + 29B97317FDCFA39411CA2CEA /* Resources */ = { + isa = PBXGroup; + children = ( + 30A0434214DC770100060A13 /* de.lproj */, + 30A0434514DC770100060A13 /* se.lproj */, + 1F766FDB13BBADB100FB74C0 /* en.lproj */, + 1F766FDE13BBADB100FB74C0 /* es.lproj */, + 3072F99613A8081B00425683 /* Capture.bundle */, + 308D052D1370CCF300D202BF /* icons */, + 308D05311370CCF300D202BF /* splash */, + 30E1352610E2C1420031B30D /* Cordova.plist */, + 3053AC6E109B7857006FCFE7 /* VERSION */, + 8D1107310486CEB800E47090 /* HelloImageRecognition-Info.plist */, + 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */, + ); + name = Resources; + path = HelloImageRecognition/Resources; + sourceTree = ""; + }; + 29B97323FDCFA39411CA2CEA /* Frameworks */ = { + isa = PBXGroup; + children = ( + A93E85FB160352820004D29A /* CoreMotion.framework */, + A93E85FC160352820004D29A /* CoreVideo.framework */, + A93E85FD160352820004D29A /* libsqlite3.dylib */, + A93E85FE160352820004D29A /* libz.dylib */, + A93E85FF160352820004D29A /* OpenGLES.framework */, + A93E8600160352820004D29A /* Security.framework */, + 1DF5F4DF0D08C38300B7A737 /* UIKit.framework */, + 1D30AB110D05D00D00671497 /* Foundation.framework */, + 288765FC0DF74451002DB57D /* CoreGraphics.framework */, + 301BF5B4109A6A2B0062928A /* AddressBook.framework */, + 301BF5B6109A6A2B0062928A /* AddressBookUI.framework */, + 301BF5B8109A6A2B0062928A /* AudioToolbox.framework */, + 301BF5BA109A6A2B0062928A /* AVFoundation.framework */, + 301BF5BC109A6A2B0062928A /* CFNetwork.framework */, + 301BF5BE109A6A2B0062928A /* CoreLocation.framework */, + 301BF5C0109A6A2B0062928A /* MediaPlayer.framework */, + 301BF5C2109A6A2B0062928A /* QuartzCore.framework */, + 301BF5C4109A6A2B0062928A /* SystemConfiguration.framework */, + 305D5FD0115AB8F900A74A75 /* MobileCoreServices.framework */, + 30E5649113A7FCAF007403D8 /* CoreMedia.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + 301BF52E109A57CC0062928A /* Products */ = { + isa = PBXGroup; + children = ( + 301BF535109A57CC0062928A /* libCordova.a */, + 302D95EC14D23909003F00A1 /* CordovaLibTests.octest */, + 3088BBB5154F38EF009F9C59 /* CordovaLibApp.app */, + ); + name = Products; + sourceTree = ""; + }; + 307C750510C5A3420062BCA9 /* Plugins */ = { + isa = PBXGroup; + children = ( + A93E85C216034FEE0004D29A /* Wikitude */, + ); + name = Plugins; + path = HelloImageRecognition/Plugins; + sourceTree = SOURCE_ROOT; + }; + 308D052D1370CCF300D202BF /* icons */ = { + isa = PBXGroup; + children = ( + 308D052E1370CCF300D202BF /* icon-72.png */, + 308D052F1370CCF300D202BF /* icon.png */, + 308D05301370CCF300D202BF /* icon@2x.png */, + ); + path = icons; + sourceTree = ""; + }; + 308D05311370CCF300D202BF /* splash */ = { + isa = PBXGroup; + children = ( + 3088BBB7154F3926009F9C59 /* Default-Landscape@2x~ipad.png */, + 3088BBB8154F3926009F9C59 /* Default-Landscape~ipad.png */, + 3088BBB9154F3926009F9C59 /* Default-Portrait@2x~ipad.png */, + 3088BBBA154F3926009F9C59 /* Default-Portrait~ipad.png */, + 3088BBBB154F3926009F9C59 /* Default@2x~iphone.png */, + 3088BBBC154F3926009F9C59 /* Default~iphone.png */, + ); + path = splash; + sourceTree = ""; + }; + 30A0434214DC770100060A13 /* de.lproj */ = { + isa = PBXGroup; + children = ( + 30A0434314DC770100060A13 /* Localizable.strings */, + ); + path = de.lproj; + sourceTree = ""; + }; + 30A0434514DC770100060A13 /* se.lproj */ = { + isa = PBXGroup; + children = ( + 30A0434614DC770100060A13 /* Localizable.strings */, + ); + path = se.lproj; + sourceTree = ""; + }; + A93E85C216034FEE0004D29A /* Wikitude */ = { + isa = PBXGroup; + children = ( + A93E85C316034FEE0004D29A /* WTWikitudePlugin.h */, + A93E85C416034FEE0004D29A /* WTWikitudePlugin.m */, + ); + path = Wikitude; + sourceTree = ""; + }; + A93E85C6160351690004D29A /* Vuforia */ = { + isa = PBXGroup; + children = ( + A93E85C7160351690004D29A /* include */, + A93E85E7160351690004D29A /* lib */, + ); + name = Vuforia; + path = HelloImageRecognition/Vuforia; + sourceTree = ""; + }; + A93E85C7160351690004D29A /* include */ = { + isa = PBXGroup; + children = ( + A93E85C8160351690004D29A /* QCAR */, + ); + path = include; + sourceTree = ""; + }; + A93E85C8160351690004D29A /* QCAR */ = { + isa = PBXGroup; + children = ( + A93E85C9160351690004D29A /* Area.h */, + A93E85CA160351690004D29A /* CameraCalibration.h */, + A93E85CB160351690004D29A /* CameraDevice.h */, + A93E85CC160351690004D29A /* DataSet.h */, + A93E85CD160351690004D29A /* Frame.h */, + A93E85CE160351690004D29A /* Image.h */, + A93E85CF160351690004D29A /* ImageTarget.h */, + A93E85D0160351690004D29A /* ImageTracker.h */, + A93E85D1160351690004D29A /* Marker.h */, + A93E85D2160351690004D29A /* MarkerTracker.h */, + A93E85D3160351690004D29A /* Matrices.h */, + A93E85D4160351690004D29A /* MultiTarget.h */, + A93E85D5160351690004D29A /* NonCopyable.h */, + A93E85D6160351690004D29A /* QCAR.h */, + A93E85D7160351690004D29A /* QCAR_iOS.h */, + A93E85D8160351690004D29A /* Rectangle.h */, + A93E85D9160351690004D29A /* Renderer.h */, + A93E85DA160351690004D29A /* State.h */, + A93E85DB160351690004D29A /* System.h */, + A93E85DC160351690004D29A /* Tool.h */, + A93E85DD160351690004D29A /* Trackable.h */, + A93E85DE160351690004D29A /* Tracker.h */, + A93E85DF160351690004D29A /* TrackerManager.h */, + A93E85E0160351690004D29A /* UIGLViewProtocol.h */, + A93E85E1160351690004D29A /* UpdateCallback.h */, + A93E85E2160351690004D29A /* Vectors.h */, + A93E85E3160351690004D29A /* VideoBackgroundConfig.h */, + A93E85E4160351690004D29A /* VideoBackgroundTextureInfo.h */, + A93E85E5160351690004D29A /* VideoMode.h */, + A93E85E6160351690004D29A /* VirtualButton.h */, + ); + path = QCAR; + sourceTree = ""; + }; + A93E85E7160351690004D29A /* lib */ = { + isa = PBXGroup; + children = ( + A93E85E8160351690004D29A /* arm */, + ); + path = lib; + sourceTree = ""; + }; + A93E85E8160351690004D29A /* arm */ = { + isa = PBXGroup; + children = ( + A93E85E9160351690004D29A /* libQCAR.a */, + ); + path = arm; + sourceTree = ""; + }; + A93E85EA160351690004D29A /* WikitudeSDK */ = { + isa = PBXGroup; + children = ( + A93E85EB160351690004D29A /* Extensions */, + A93E85EF160351690004D29A /* SDK */, + ); + name = WikitudeSDK; + path = HelloImageRecognition/WikitudeSDK; + sourceTree = ""; + }; + A93E85EB160351690004D29A /* Extensions */ = { + isa = PBXGroup; + children = ( + A93E85EC160351690004D29A /* VuforiaExtension */, + ); + path = Extensions; + sourceTree = ""; + }; + A93E85EC160351690004D29A /* VuforiaExtension */ = { + isa = PBXGroup; + children = ( + A93E85ED160351690004D29A /* lib */, + ); + path = VuforiaExtension; + sourceTree = ""; + }; + A93E85ED160351690004D29A /* lib */ = { + isa = PBXGroup; + children = ( + A93E85EE160351690004D29A /* libExtensionVuforia.a */, + ); + path = lib; + sourceTree = ""; + }; + A93E85EF160351690004D29A /* SDK */ = { + isa = PBXGroup; + children = ( + A93E85F0160351690004D29A /* inc */, + A93E85F2160351690004D29A /* lib */, + ); + path = SDK; + sourceTree = ""; + }; + A93E85F0160351690004D29A /* inc */ = { + isa = PBXGroup; + children = ( + A93E85F1160351690004D29A /* WTArchitectView.h */, + ); + path = inc; + sourceTree = ""; + }; + A93E85F2160351690004D29A /* lib */ = { + isa = PBXGroup; + children = ( + A93E85F3160351690004D29A /* Release-iphoneos */, + A93E85F5160351690004D29A /* Release-iphonesimulator */, + ); + path = lib; + sourceTree = ""; + }; + A93E85F3160351690004D29A /* Release-iphoneos */ = { + isa = PBXGroup; + children = ( + A93E85F4160351690004D29A /* libWikitudeSDK.a */, + ); + path = "Release-iphoneos"; + sourceTree = ""; + }; + A93E85F5160351690004D29A /* Release-iphonesimulator */ = { + isa = PBXGroup; + children = ( + A93E85F6160351690004D29A /* libWikitudeSDK.a */, + ); + path = "Release-iphonesimulator"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + 1D6058900D05DD3D006BFB54 /* HelloImageRecognition */ = { + isa = PBXNativeTarget; + buildConfigurationList = 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloImageRecognition" */; + buildPhases = ( + 304B58A110DAC018002A0835 /* Touch www folder */, + 1D60588D0D05DD3D006BFB54 /* Resources */, + 1D60588E0D05DD3D006BFB54 /* Sources */, + 1D60588F0D05DD3D006BFB54 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + 301BF551109A68C00062928A /* PBXTargetDependency */, + ); + name = HelloImageRecognition; + productName = HelloImageRecognition; + productReference = 1D6058910D05DD3D006BFB54 /* HelloImageRecognition.app */; + productType = "com.apple.product-type.application"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 29B97313FDCFA39411CA2CEA /* Project object */ = { + isa = PBXProject; + attributes = { + LastUpgradeCheck = 0420; + }; + buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloImageRecognition" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + en, + es, + de, + se, + ); + mainGroup = 29B97314FDCFA39411CA2CEA /* CustomTemplate */; + projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 301BF52E109A57CC0062928A /* Products */; + ProjectRef = 301BF52D109A57CC0062928A /* CordovaLib.xcodeproj */; + }, + ); + projectRoot = ""; + targets = ( + 1D6058900D05DD3D006BFB54 /* HelloImageRecognition */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXReferenceProxy section */ + 301BF535109A57CC0062928A /* libCordova.a */ = { + isa = PBXReferenceProxy; + fileType = archive.ar; + path = libCordova.a; + remoteRef = 301BF534109A57CC0062928A /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 302D95EC14D23909003F00A1 /* CordovaLibTests.octest */ = { + isa = PBXReferenceProxy; + fileType = wrapper.cfbundle; + path = CordovaLibTests.octest; + remoteRef = 302D95EB14D23909003F00A1 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 3088BBB5154F38EF009F9C59 /* CordovaLibApp.app */ = { + isa = PBXReferenceProxy; + fileType = wrapper.application; + path = CordovaLibApp.app; + remoteRef = 3088BBB4154F38EF009F9C59 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + +/* Begin PBXResourcesBuildPhase section */ + 1D60588D0D05DD3D006BFB54 /* Resources */ = { + isa = PBXResourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 301BF570109A69640062928A /* www in Resources */, + 3053AC6F109B7857006FCFE7 /* VERSION in Resources */, + 30E1352710E2C1420031B30D /* Cordova.plist in Resources */, + 308D05371370CCF300D202BF /* icon-72.png in Resources */, + 308D05381370CCF300D202BF /* icon.png in Resources */, + 308D05391370CCF300D202BF /* icon@2x.png in Resources */, + 3072F99713A8081B00425683 /* Capture.bundle in Resources */, + 1F766FE113BBADB100FB74C0 /* Localizable.strings in Resources */, + 1F766FE213BBADB100FB74C0 /* Localizable.strings in Resources */, + 302D95F214D2391D003F00A1 /* MainViewController.xib in Resources */, + 30A0434814DC770100060A13 /* Localizable.strings in Resources */, + 30A0434914DC770100060A13 /* Localizable.strings in Resources */, + 3088BBBD154F3926009F9C59 /* Default-Landscape@2x~ipad.png in Resources */, + 3088BBBE154F3926009F9C59 /* Default-Landscape~ipad.png in Resources */, + 3088BBBF154F3926009F9C59 /* Default-Portrait@2x~ipad.png in Resources */, + 3088BBC0154F3926009F9C59 /* Default-Portrait~ipad.png in Resources */, + 3088BBC1154F3926009F9C59 /* Default@2x~iphone.png in Resources */, + 3088BBC2154F3926009F9C59 /* Default~iphone.png in Resources */, + A93E8608160352BE0004D29A /* assets in Resources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXResourcesBuildPhase section */ + +/* Begin PBXShellScriptBuildPhase section */ + 304B58A110DAC018002A0835 /* Touch www folder */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Touch www folder"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "touch -cm ${PROJECT_DIR}/www"; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + 1D60588E0D05DD3D006BFB54 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 1D60589B0D05DD56006BFB54 /* main.m in Sources */, + 1D3623260D0F684500981E51 /* AppDelegate.m in Sources */, + 302D95F114D2391D003F00A1 /* MainViewController.m in Sources */, + A93E85C516034FEE0004D29A /* WTWikitudePlugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 301BF551109A68C00062928A /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = CordovaLib; + targetProxy = 301BF550109A68C00062928A /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin PBXVariantGroup section */ + 1F766FDC13BBADB100FB74C0 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 1F766FDD13BBADB100FB74C0 /* en */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 1F766FDF13BBADB100FB74C0 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 1F766FE013BBADB100FB74C0 /* es */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 30A0434314DC770100060A13 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 30A0434414DC770100060A13 /* de */, + ); + name = Localizable.strings; + sourceTree = ""; + }; + 30A0434614DC770100060A13 /* Localizable.strings */ = { + isa = PBXVariantGroup; + children = ( + 30A0434714DC770100060A13 /* se */, + ); + name = Localizable.strings; + sourceTree = ""; + }; +/* End PBXVariantGroup section */ + +/* Begin XCBuildConfiguration section */ + 1D6058940D05DD3E006BFB54 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = NO; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloImageRecognition/HelloImageRecognition-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "HelloImageRecognition/HelloImageRecognition-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/HelloImageRecognition/Vuforia/lib/arm\"", + "\"$(SRCROOT)/HelloImageRecognition/WikitudeSDK/Extensions/VuforiaExtension/lib\"", + "\"$(SRCROOT)/HelloImageRecognition/WikitudeSDK/SDK/lib/Release$(EFFECTIVE_PLATFORM_NAME)\"", + ); + PRODUCT_NAME = HelloImageRecognition; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Debug; + }; + 1D6058950D05DD3E006BFB54 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + COPY_PHASE_STRIP = YES; + GCC_PRECOMPILE_PREFIX_HEADER = YES; + GCC_PREFIX_HEADER = "HelloImageRecognition/HelloImageRecognition-Prefix.pch"; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + INFOPLIST_FILE = "HelloImageRecognition/HelloImageRecognition-Info.plist"; + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "\"$(SRCROOT)/HelloImageRecognition/Vuforia/lib/arm\"", + "\"$(SRCROOT)/HelloImageRecognition/WikitudeSDK/Extensions/VuforiaExtension/lib\"", + "\"$(SRCROOT)/HelloImageRecognition/WikitudeSDK/SDK/lib/Release$(EFFECTIVE_PLATFORM_NAME)\"", + ); + PRODUCT_NAME = HelloImageRecognition; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = Release; + }; + C01FCF4F08A954540054247B /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-force_load", + "$(BUILT_PRODUCTS_DIR)/libCordova.a", + "-ObjC", + "-lstdc++", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Debug; + }; + C01FCF5008A954540054247B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 307D28A1123043350040C0FA /* CordovaBuildSettings.xcconfig */; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + GCC_C_LANGUAGE_STANDARD = c99; + GCC_VERSION = com.apple.compilers.llvm.clang.1_0; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + HEADER_SEARCH_PATHS = ( + "\"$(TARGET_BUILD_DIR)/usr/local/lib/include\"", + "\"$(OBJROOT)/UninstalledProducts/include\"", + "\"$(BUILT_PRODUCTS_DIR)\"", + ); + IPHONEOS_DEPLOYMENT_TARGET = 4.2; + OTHER_LDFLAGS = ( + "-weak_framework", + CoreFoundation, + "-weak_framework", + UIKit, + "-weak_framework", + AVFoundation, + "-weak_framework", + CoreMedia, + "-weak-lSystem", + "-force_load", + "$(BUILT_PRODUCTS_DIR)/libCordova.a", + "-ObjC", + "-lstdc++", + ); + SDKROOT = iphoneos; + SKIP_INSTALL = NO; + USER_HEADER_SEARCH_PATHS = ""; + }; + name = Release; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1D6058960D05DD3E006BFB54 /* Build configuration list for PBXNativeTarget "HelloImageRecognition" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1D6058940D05DD3E006BFB54 /* Debug */, + 1D6058950D05DD3E006BFB54 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C01FCF4E08A954540054247B /* Build configuration list for PBXProject "HelloImageRecognition" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C01FCF4F08A954540054247B /* Debug */, + C01FCF5008A954540054247B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 29B97313FDCFA39411CA2CEA /* Project object */; +} diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/contents.xcworkspacedata new file mode 100644 index 00000000..5ee0a53f --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/contents.xcworkspacedata @@ -0,0 +1,7 @@ + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 00000000..348184b7 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/project.xcworkspace/xcuserdata/Andi.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloImageRecognition.xcscheme b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloImageRecognition.xcscheme new file mode 100644 index 00000000..363f6313 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/HelloImageRecognition.xcscheme @@ -0,0 +1,87 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 00000000..b0747165 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition.xcodeproj/xcuserdata/Andi.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,22 @@ + + + + + SchemeUserState + + HelloImageRecognition.xcscheme + + orderHint + 0 + + + SuppressBuildableAutocreation + + 1D6058900D05DD3D006BFB54 + + primary + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/.gitignore b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/.gitignore new file mode 100644 index 00000000..d30c0b08 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/.gitignore @@ -0,0 +1,6 @@ +*.mode1v3 +*.perspectivev3 +*.pbxuser +.DS_Store +build +www/phonegap.js diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.h new file mode 100644 index 00000000..6f0c82f4 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.h @@ -0,0 +1,45 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// AppDelegate.h +// HelloImageRecognition +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +#import + +@interface AppDelegate : NSObject < UIApplicationDelegate > { + +} + +// invoke string is passed to your app on launch, this is only valid if you +// edit HelloImageRecognition-Info.plist to add a protocol +// a simple tutorial can be found here : +// http://iphonedevelopertips.com/cocoa/launching-your-own-application-via-a-custom-url-scheme.html + +@property (nonatomic, retain) IBOutlet UIWindow* window; +@property (nonatomic, retain) IBOutlet CDVViewController* viewController; + +@end + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.m new file mode 100644 index 00000000..0cfe1fd2 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/AppDelegate.m @@ -0,0 +1,135 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// AppDelegate.m +// HelloImageRecognition +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import "AppDelegate.h" +#import "MainViewController.h" + +#import +#import + + +@implementation AppDelegate + +@synthesize window, viewController; + +- (id) init +{ + /** If you need to do any extra app-specific initialization, you can do it here + * -jm + **/ + NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage sharedHTTPCookieStorage]; + [cookieStorage setCookieAcceptPolicy:NSHTTPCookieAcceptPolicyAlways]; + + [CDVURLProtocol registerURLProtocol]; + + return [super init]; +} + +#pragma UIApplicationDelegate implementation + +/** + * This is main kick off after the app inits, the views and Settings are setup here. (preferred - iOS4 and up) + */ +- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions +{ + NSURL* url = [launchOptions objectForKey:UIApplicationLaunchOptionsURLKey]; + NSString* invokeString = nil; + + if (url && [url isKindOfClass:[NSURL class]]) { + invokeString = [url absoluteString]; + NSLog(@"HelloImageRecognition launchOptions = %@", url); + } + + CGRect screenBounds = [[UIScreen mainScreen] bounds]; + self.window = [[[UIWindow alloc] initWithFrame:screenBounds] autorelease]; + self.window.autoresizesSubviews = YES; + + CGRect viewBounds = [[UIScreen mainScreen] applicationFrame]; + + self.viewController = [[[MainViewController alloc] init] autorelease]; + self.viewController.useSplashScreen = YES; + self.viewController.wwwFolderName = @"www"; + self.viewController.startPage = @"index.html"; + self.viewController.invokeString = invokeString; + self.viewController.view.frame = viewBounds; + + // check whether the current orientation is supported: if it is, keep it, rather than forcing a rotation + BOOL forceStartupRotation = YES; + UIDeviceOrientation curDevOrientation = [[UIDevice currentDevice] orientation]; + + if (UIDeviceOrientationUnknown == curDevOrientation) { + // UIDevice isn't firing orientation notifications yet… go look at the status bar + curDevOrientation = (UIDeviceOrientation)[[UIApplication sharedApplication] statusBarOrientation]; + } + + if (UIDeviceOrientationIsValidInterfaceOrientation(curDevOrientation)) { + for (NSNumber *orient in self.viewController.supportedOrientations) { + if ([orient intValue] == curDevOrientation) { + forceStartupRotation = NO; + break; + } + } + } + + if (forceStartupRotation) { + NSLog(@"supportedOrientations: %@", self.viewController.supportedOrientations); + // The first item in the supportedOrientations array is the start orientation (guaranteed to be at least Portrait) + UIInterfaceOrientation newOrient = [[self.viewController.supportedOrientations objectAtIndex:0] intValue]; + NSLog(@"AppDelegate forcing status bar to: %d from: %d", newOrient, curDevOrientation); + [[UIApplication sharedApplication] setStatusBarOrientation:newOrient]; + } + + [self.window addSubview:self.viewController.view]; + [self.window makeKeyAndVisible]; + + return YES; +} + +// this happens while we are running ( in the background, or from within our own app ) +// only valid if HelloImageRecognition-Info.plist specifies a protocol to handle +- (BOOL) application:(UIApplication*)application handleOpenURL:(NSURL*)url +{ + if (!url) { + return NO; + } + + // calls into javascript global function 'handleOpenURL' + NSString* jsString = [NSString stringWithFormat:@"handleOpenURL(\"%@\");", url]; + [self.viewController.webView stringByEvaluatingJavaScriptFromString:jsString]; + + // all plugins will get the notification, and their handlers will be called + [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:CDVPluginHandleOpenURLNotification object:url]]; + + return YES; +} + +- (void) dealloc +{ + [super dealloc]; +} + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.h new file mode 100644 index 00000000..d7bebc1e --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.h @@ -0,0 +1,32 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// MainViewController.h +// HelloImageRecognition +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +@interface MainViewController : CDVViewController + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.m new file mode 100644 index 00000000..64c9bcb9 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.m @@ -0,0 +1,141 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// +// MainViewController.h +// HelloImageRecognition +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import "MainViewController.h" + +@implementation MainViewController + +- (id) initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil +{ + self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; + if (self) { + // Custom initialization + } + return self; +} + +- (void) didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. + [super didReceiveMemoryWarning]; + + // Release any cached data, images, etc that aren't in use. +} + +#pragma mark - View lifecycle + +- (void) viewDidLoad +{ + [super viewDidLoad]; + // Do any additional setup after loading the view from its nib. +} + +- (void) viewDidUnload +{ + [super viewDidUnload]; + // Release any retained subviews of the main view. + // e.g. self.myOutlet = nil; +} + +- (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + // Return YES for supported orientations + return [super shouldAutorotateToInterfaceOrientation:interfaceOrientation]; +} + +/* Comment out the block below to over-ride */ +/* +- (CDVCordovaView*) newCordovaViewWithFrame:(CGRect)bounds +{ + return[super newCordovaViewWithFrame:bounds]; +} +*/ + +/* Comment out the block below to over-ride */ +/* +#pragma CDVCommandDelegate implementation + +- (id) getCommandInstance:(NSString*)className +{ + return [super getCommandInstance:className]; +} + +- (BOOL) execute:(CDVInvokedUrlCommand*)command +{ + return [super execute:command]; +} + +- (NSString*) pathForResource:(NSString*)resourcepath; +{ + return [super pathForResource:resourcepath]; +} + +- (void) registerPlugin:(CDVPlugin*)plugin withClassName:(NSString*)className +{ + return [super registerPlugin:plugin withClassName:className]; +} +*/ + +#pragma UIWebDelegate implementation + +- (void) webViewDidFinishLoad:(UIWebView*) theWebView +{ + // only valid if ___PROJECTNAME__-Info.plist specifies a protocol to handle + if (self.invokeString) + { + // this is passed before the deviceready event is fired, so you can access it in js when you receive deviceready + NSLog(@"DEPRECATED: window.invokeString - use the window.handleOpenURL(url) function instead, which is always called when the app is launched through a custom scheme url."); + NSString* jsString = [NSString stringWithFormat:@"var invokeString = \"%@\";", self.invokeString]; + [theWebView stringByEvaluatingJavaScriptFromString:jsString]; + } + + // Black base color for background matches the native apps + theWebView.backgroundColor = [UIColor blackColor]; + + return [super webViewDidFinishLoad:theWebView]; +} + +/* Comment out the block below to over-ride */ +/* + +- (void) webViewDidStartLoad:(UIWebView*)theWebView +{ + return [super webViewDidStartLoad:theWebView]; +} + +- (void) webView:(UIWebView*)theWebView didFailLoadWithError:(NSError*)error +{ + return [super webView:theWebView didFailLoadWithError:error]; +} + +- (BOOL) webView:(UIWebView*)theWebView shouldStartLoadWithRequest:(NSURLRequest*)request navigationType:(UIWebViewNavigationType)navigationType +{ + return [super webView:theWebView shouldStartLoadWithRequest:request navigationType:navigationType]; +} +*/ + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.xib b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.xib new file mode 100644 index 00000000..e45d65c6 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Classes/MainViewController.xib @@ -0,0 +1,138 @@ + + + + + 1280 + 11C25 + 1919 + 1138.11 + 566.00 + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + 916 + + + IBProxyObject + IBUIView + + + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + PluginDependencyRecalculationVersion + + + + + IBFilesOwner + IBCocoaTouchFramework + + + IBFirstResponder + IBCocoaTouchFramework + + + + 274 + {{0, 20}, {320, 460}} + + + + 3 + MQA + + 2 + + + + IBCocoaTouchFramework + + + + + + + view + + + + 3 + + + + + + 0 + + + + + + 1 + + + + + -1 + + + File's Owner + + + -2 + + + + + + + MainViewController + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + UIResponder + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + com.apple.InterfaceBuilder.IBCocoaTouchPlugin + + + + + + 3 + + + + + MainViewController + UIViewController + + IBProjectSource + ./Classes/MainViewController.h + + + + + 0 + IBCocoaTouchFramework + YES + 3 + 916 + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Cordova.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Cordova.plist new file mode 100644 index 00000000..01a59d6d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Cordova.plist @@ -0,0 +1,67 @@ + + + + + UIWebViewBounce + + TopActivityIndicator + gray + EnableLocation + + EnableViewportScale + + AutoHideSplashScreen + + ShowSplashScreenSpinner + + MediaPlaybackRequiresUserAction + + AllowInlineMediaPlayback + + OpenAllWhitelistURLsInWebView + + BackupWebStorage + + ExternalHosts + + * + + Plugins + + WikitudePlugin + WTWikitudePlugin + Device + CDVDevice + Logger + CDVLogger + Compass + CDVLocation + Accelerometer + CDVAccelerometer + Camera + CDVCamera + NetworkStatus + CDVConnection + Contacts + CDVContacts + Debug Console + CDVDebugConsole + File + CDVFile + FileTransfer + CDVFileTransfer + Geolocation + CDVLocation + Notification + CDVNotification + Media + CDVSound + Capture + CDVCapture + SplashScreen + CDVSplashScreen + Battery + CDVBattery + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/CordovaBuildSettings.xcconfig b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/CordovaBuildSettings.xcconfig new file mode 100644 index 00000000..c70086c7 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/CordovaBuildSettings.xcconfig @@ -0,0 +1,26 @@ +// +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. +// + +// Cordova.xcconfig +// __TESTING__ +// + +// Override this to use your project specific CORDOVALIB. +// You can base it off the current project path, $(PROJECT_DIR) +CORDOVALIB = $(CORDOVALIB) diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Info.plist b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Info.plist new file mode 100644 index 00000000..1f629513 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Info.plist @@ -0,0 +1,58 @@ + + + + + CFBundleIcons + + CFBundlePrimaryIcon + + CFBundleIconFiles + + icon.png + icon@2x.png + icon-72.png + icon-72@2x.png + + UIPrerenderedIcon + + + + UISupportedInterfaceOrientations~ipad + + UIInterfaceOrientationPortrait + UIInterfaceOrientationLandscapeLeft + UIInterfaceOrientationPortraitUpsideDown + UIInterfaceOrientationLandscapeRight + + UISupportedInterfaceOrientations + + UIInterfaceOrientationPortrait + + CFBundleDevelopmentRegion + English + CFBundleDisplayName + ${PRODUCT_NAME} + CFBundleExecutable + ${EXECUTABLE_NAME} + CFBundleIconFile + icon.png + CFBundleIdentifier + com.wikitude.phonegapsamplehelloimagerecognition + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + ${PRODUCT_NAME} + CFBundlePackageType + APPL + CFBundleSignature + ???? + CFBundleVersion + 1.0 + LSRequiresIPhoneOS + + NSMainNibFile + + NSMainNibFile~ipad + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Prefix.pch b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Prefix.pch new file mode 100644 index 00000000..b4aef824 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/HelloImageRecognition-Prefix.pch @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ +// +// Prefix header for all source files of the 'HelloImageRecognition' target in the 'HelloImageRecognition' project +// + +#ifdef __OBJC__ + #import + #import +#endif diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/README b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/README new file mode 100644 index 00000000..f6e19d70 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/README @@ -0,0 +1,20 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +Put the .h and .m files of your plugin here. The .js files of your plugin belong in the www folder. \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.h b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.h new file mode 100644 index 00000000..0a71316d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.h @@ -0,0 +1,14 @@ +// +// WTWikitudeSDK.h +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + + +#import + +@interface WTWikitudePlugin : CDVPlugin + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.m new file mode 100644 index 00000000..3e54f354 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Plugins/Wikitude/WTWikitudePlugin.m @@ -0,0 +1,402 @@ +// +// WTWikitudeSDK.m +// HelloWorld +// +// Created by Andreas Schacherbauer on 8/24/12. +// +// + +#import "WTWikitudePlugin.h" + +// Wikitude SDK +#import "WTArchitectView.h" + + + + +@interface WTWikitudePlugin () + +@property (nonatomic, strong) WTArchitectView *architectView; + +@property (nonatomic, strong) NSString *currentARchitectViewCallbackID; +@property (nonatomic, strong) NSString *currentPlugInErrorCallback; + +@property (nonatomic, assign) BOOL isUsingInjectedLocation; + +@end + + +@implementation WTWikitudePlugin +@synthesize architectView=_architectView; + + +#pragma mark - View Lifecycle +/* View Lifecycle */ +- (void)isDeviceSupported:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + BOOL isDeviceSupported = [WTArchitectView isDeviceSupported]; + + if (isDeviceSupported) { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + } else { + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsInt:isDeviceSupported]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)open:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + + BOOL success = [WTArchitectView isDeviceSupported]; + if ( success ) { + + NSString *sdkKey = [options objectForKey:@"apiKey"]; + NSString *architectWorldFilePath = [options objectForKey:@"filePath"]; + + // First, lets check if we need to init a new sdk view + if ( !_architectView ) { + self.architectView = [[WTArchitectView alloc] initWithFrame:self.viewController.view.bounds]; + self.architectView.delegate = self; + [self.architectView initializeWithKey:sdkKey motionManager:nil]; + } + + // then add the view in its own navController to the ui. we need a own navController to have a backButton which can be used to dismiss the view + UIViewController *viewController = [[UIViewController alloc] init]; + viewController.view = self.architectView; + + UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:viewController]; + navController.navigationBar.tintColor = [UIColor blackColor]; + navController.navigationBar.topItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemDone target:self action:@selector(dismissARchitectView)]; + [self.viewController presentViewController:navController animated:NO completion:^{ + // completion code + }]; + + + + // and finaly load the architect world, specified in the open function in js + if (architectWorldFilePath) { + + NSString *worldName = [architectWorldFilePath lastPathComponent]; + worldName = [worldName stringByDeletingPathExtension]; + NSString *worldNameExtension = [architectWorldFilePath pathExtension]; + + NSString *architectWorldDirectoryPath = [architectWorldFilePath stringByDeletingLastPathComponent]; + + NSString *loadablePath = [[NSBundle mainBundle] pathForResource:worldName ofType:worldNameExtension inDirectory:architectWorldDirectoryPath]; + [self.architectView loadArchitectWorldFromUrl:loadablePath]; + } + } + + // start the sdk view updates + [self.architectView start]; + + + if ( success ) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } else { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)close:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + [self.architectView stop]; +// [self.architectView removeFromSuperview]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)show:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { +// NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = NO; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)hide:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + self.architectView.hidden = YES; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onResume:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView start]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +- (void)onPause:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + [self.architectView stop]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - Location Handling + +- (void)setLocation:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + // NSString* echo = [arguments objectAtIndex:1]; + + if (self.architectView) { + + float latitude = [[options objectForKey:@"lat"] floatValue]; + float longitude = [[options objectForKey:@"lon"] floatValue]; + float altitude = [[options objectForKey:@"alt"] floatValue]; + float accuracy = [[options objectForKey:@"acc"] floatValue]; + + if (!self.isUsingInjectedLocation) { + [self.architectView setUseInjectedLocation:YES]; + self.isUsingInjectedLocation = YES; + } + + [self.architectView injectLocationWithLatitude:latitude longitude:longitude altitude:altitude accuracy:accuracy]; + } + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +#pragma mark - Javascript + +- (void)callJavascript:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + + @try { + + if (arguments.count >= 1) { + + NSMutableString *javascriptToCall = [[arguments objectAtIndex:1] mutableCopy]; + for (NSUInteger i = 2; i < arguments.count; i++) { + [javascriptToCall appendString:[arguments objectAtIndex:i]]; + } + + if (self.architectView) { + [self.architectView callJavaScript:javascriptToCall]; + } + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:nil]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + }else + { + // return error no javascript to call found + } + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + + +- (void)onUrlInvoke:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options +{ + NSString* callbackId = [arguments objectAtIndex:0]; + + CDVPluginResult* pluginResult = nil; + NSString* javaScript = nil; + + @try { + + + self.currentARchitectViewCallbackID = callbackId; + self.currentPlugInErrorCallback = callbackId; + + + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_NO_RESULT]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScript = [pluginResult toSuccessCallbackString:callbackId]; + + + } @catch (NSException* exception) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_JSON_EXCEPTION messageAsString:[exception reason]]; + javaScript = [pluginResult toErrorCallbackString:callbackId]; + } + + [self writeJavascript:javaScript]; +} + +#pragma mark - WTArchitectView Delegate +- (void)urlWasInvoked:(NSString *)url +{ + + CDVPluginResult *pluginResult = nil; + NSString *javaScriptResult = nil; + + + if (url && self.currentARchitectViewCallbackID) { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:url]; + [pluginResult setKeepCallbackAsBool:YES]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentARchitectViewCallbackID]; + + + }else + { + pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR]; + javaScriptResult = [pluginResult toSuccessCallbackString:self.currentPlugInErrorCallback]; + } + + [self writeJavascript:javaScriptResult]; +} + +- (void)dismissARchitectView +{ + [self.viewController dismissModalViewControllerAnimated:NO]; + [self.architectView stop]; +} + +@end diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg.png new file mode 100644 index 00000000..784e9c7d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x.png new file mode 100644 index 00000000..1e28c6db Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x~ipad.png new file mode 100644 index 00000000..d4e34836 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg~ipad.png new file mode 100644 index 00000000..efbef8aa Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/controls_bg~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone.png new file mode 100644 index 00000000..155b88ca Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x.png new file mode 100644 index 00000000..79ef16ba Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x~ipad.png new file mode 100644 index 00000000..af1bbb21 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone~ipad.png new file mode 100644 index 00000000..ef1c472b Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/microphone~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button.png new file mode 100644 index 00000000..ceb95898 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x.png new file mode 100644 index 00000000..d6ce3028 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x~ipad.png new file mode 100644 index 00000000..0ac2e679 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button~ipad.png new file mode 100644 index 00000000..d8e24a4d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/record_button~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg.png new file mode 100644 index 00000000..bafc087e Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x.png new file mode 100644 index 00000000..798490b0 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x~ipad.png new file mode 100644 index 00000000..a1b7208f Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg~ipad.png new file mode 100644 index 00000000..3b467f63 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/recording_bg~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button.png new file mode 100644 index 00000000..9c31838a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x.png new file mode 100644 index 00000000..8cf657ea Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x~ipad.png new file mode 100644 index 00000000..88b606c8 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button~ipad.png new file mode 100644 index 00000000..59bb7a57 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/Capture.bundle/stop_button~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/de.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/de.lproj/Localizable.strings new file mode 100644 index 00000000..f1cdb42d --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/de.lproj/Localizable.strings @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + + +// accessibility label for recording button +"toggle audio recording" = "starten/beenden der Tonaufnahme"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "programmierte Aufnahme beendet"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "aufgenommene Zeit in Minuten und Sekunden"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/en.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/en.lproj/Localizable.strings new file mode 100644 index 00000000..89726844 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/en.lproj/Localizable.strings @@ -0,0 +1,25 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// accessibility label for recording button +"toggle audio recording" = "toggle audio recording"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "timed recording complete"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "recorded time in minutes and seconds"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/es.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/es.lproj/Localizable.strings new file mode 100644 index 00000000..23831e66 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/es.lproj/Localizable.strings @@ -0,0 +1,25 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + +// accessibility label for recording button +"toggle audio recording" = "grabación de audio cambiar"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "tiempo de grabación completo"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "tiempo registrado en minutos y segundos"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72.png new file mode 100644 index 00000000..8c6e5df3 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72@2x.png new file mode 100644 index 00000000..dd819da6 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon-72@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon.png new file mode 100644 index 00000000..b2571a71 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon@2x.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon@2x.png new file mode 100644 index 00000000..d75098f5 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/icons/icon@2x.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/se.lproj/Localizable.strings b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/se.lproj/Localizable.strings new file mode 100644 index 00000000..0af96468 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/se.lproj/Localizable.strings @@ -0,0 +1,26 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ + + +// accessibility label for recording button +"toggle audio recording" = "börja/avsluta inspelning"; +// notification spoken by VoiceOver when timed recording finishes +"timed recording complete" = "inspelning har avslutad"; +// accessibility hint for display of recorded elapsed time +"recorded time in minutes and seconds" = "inspelad tid in minuter och sekund"; \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape@2x~ipad.png new file mode 100644 index 00000000..95c542dc Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape~ipad.png new file mode 100644 index 00000000..f8e2b52d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Landscape~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait@2x~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait@2x~ipad.png new file mode 100644 index 00000000..aae1862c Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait@2x~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait~ipad.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait~ipad.png new file mode 100644 index 00000000..af9158ac Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default-Portrait~ipad.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default@2x~iphone.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default@2x~iphone.png new file mode 100644 index 00000000..bd24886a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default@2x~iphone.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default~iphone.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default~iphone.png new file mode 100644 index 00000000..6fcba565 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/Resources/splash/Default~iphone.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/main.m b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/main.m new file mode 100644 index 00000000..aee71a58 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/HelloImageRecognition/main.m @@ -0,0 +1,35 @@ +/* + Licensed to the Apache Software Foundation (ASF) under one + or more contributor license agreements. See the NOTICE file + distributed with this work for additional information + regarding copyright ownership. The ASF licenses this file + to you under the Apache License, Version 2.0 (the + "License"); you may not use this file except in compliance + with the License. You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, + software distributed under the License is distributed on an + "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + KIND, either express or implied. See the License for the + specific language governing permissions and limitations + under the License. + */ +// +// main.m +// HelloImageRecognition +// +// Created by ___FULLUSERNAME___ on ___DATE___. +// Copyright ___ORGANIZATIONNAME___ ___YEAR___. All rights reserved. +// + +#import + +int main(int argc, char *argv[]) { + + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; + int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate"); + [pool release]; + return retVal; +} diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/DirectionArrow.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/DirectionArrow.png new file mode 100644 index 00000000..8a0ccb64 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/DirectionArrow.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/SimpleIRWorld.html b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/SimpleIRWorld.html new file mode 100644 index 00000000..57f4423f --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/SimpleIRWorld.html @@ -0,0 +1,116 @@ + + + + + + +Simple IR World + + + + + + + + + + + + + +
Loading ...
+ + + + + \ No newline at end of file diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.png new file mode 100644 index 00000000..f820ca06 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.zip b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.zip new file mode 100644 index 00000000..34db5dcf Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/WikitudeLogo.zip differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/overlay.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/overlay.png new file mode 100644 index 00000000..5d2dfcd4 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/assets/world/SimpleImageRecognition/overlay.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/debug b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/debug new file mode 100755 index 00000000..37b0d637 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/debug @@ -0,0 +1,47 @@ +#!/bin/bash + +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# compile and launch a Cordova/iOS project to the simulator +# + +set -e + +CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) +PROJECT_PATH=$CORDOVA_PATH/.. + +for file in $PROJECT_PATH/*.xcodeproj; do + PROJECT_NAME=$(basename "$file" .xcodeproj) +done; + +cd $PROJECT_PATH + +APP=build/$PROJECT_NAME.app +SDK=`xcodebuild -showsdks | grep Sim | tail -1 | awk '{print $6}'` + +xcodebuild -project $PROJECT_NAME.xcodeproj -arch i386 -target $PROJECT_NAME -configuration Debug -sdk $SDK clean build VALID_ARCHS="i386" CONFIGURATION_BUILD_DIR=$PROJECT_PATH/build + +# launch using emulate + +$CORDOVA_PATH/emulate $PROJECT_PATH/$APP + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/emulate b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/emulate new file mode 100755 index 00000000..3822121c --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/emulate @@ -0,0 +1,58 @@ +#! /bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +set -e + +CORDOVA_PATH=$( cd "$( dirname "$0" )" && pwd ) +PROJECT_PATH=$CORDOVA_PATH/.. + +function getAppPath() { + for file in $PROJECT_PATH/*.xcodeproj; do + PROJECT_NAME=$(basename "$file" .xcodeproj) + done; + APP=build/$PROJECT_NAME.app + APP_PATH=$PROJECT_PATH/$APP +} + +APP_PATH=$1 + +if [ $# -lt 1 ]; then + getAppPath +fi + +if [ ! -d "$APP_PATH" ]; then + read -p "Project '$APP_PATH' is not built. Build? [y/n]: " REPLY + if [ "$REPLY" == "y" ]; then + $CORDOVA_PATH/debug + exit 0 + else + echo "$APP_PATH not found to emulate." + exit 1 + fi +fi + +# launch using ios-sim + +if which ios-sim >/dev/null; then + ios-sim launch $APP_PATH --stderr console.log --stdout console.log & +else + echo -e '\033[31mError: ios-sim was not found. Please download, build and install version 1.4 or greater from https://github.com/phonegap/ios-sim into your path. Or "brew install ios-sim" using homebrew: http://mxcl.github.com/homebrew/\033[m'; exit 1; +fi + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/log b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/log new file mode 100755 index 00000000..fd1261c5 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/cordova/log @@ -0,0 +1,26 @@ +#! /bin/sh +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# + +# +# USAGE +# +# ./log [path] +# +tail -f ${1:-".."}/console.log diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/config.xml b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/config.xml new file mode 100644 index 00000000..a7e35db9 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/config.xml @@ -0,0 +1,47 @@ + + + Hello Cordova + + + A sample Apache Cordova application that responds to the deviceready event. + + + + Apache Cordova Team + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/iOS/AdPlugin/www/cordova-2.0.0.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/cordova-2.0.0.js similarity index 61% rename from iOS/AdPlugin/www/cordova-2.0.0.js rename to iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/cordova-2.0.0.js index 54bc9fe2..c2caa2ff 100644 --- a/iOS/AdPlugin/www/cordova-2.0.0.js +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/cordova-2.0.0.js @@ -10,9 +10,9 @@ to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - + http://www.apache.org/licenses/LICENSE-2.0 - + Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -31,33 +31,33 @@ var require, var modules = {}; function build(module) { - var factory = module.factory; - module.exports = {}; - delete module.factory; - factory(require, module.exports, module); - return module.exports; + var factory = module.factory; + module.exports = {}; + delete module.factory; + factory(require, module.exports, module); + return module.exports; } require = function (id) { - if (!modules[id]) { - throw "module " + id + " not found"; - } - return modules[id].factory ? build(modules[id]) : modules[id].exports; + if (!modules[id]) { + throw "module " + id + " not found"; + } + return modules[id].factory ? build(modules[id]) : modules[id].exports; }; define = function (id, factory) { - if (modules[id]) { - throw "module " + id + " already defined"; - } - - modules[id] = { - id: id, - factory: factory - }; + if (modules[id]) { + throw "module " + id + " already defined"; + } + + modules[id] = { + id: id, + factory: factory + }; }; define.remove = function (id) { - delete modules[id]; + delete modules[id]; }; })(); @@ -99,22 +99,22 @@ var documentEventHandlers = {}, document.addEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); if (typeof documentEventHandlers[e] != 'undefined') { - if (evt === 'deviceready') { - documentEventHandlers[e].subscribeOnce(handler); - } else { - documentEventHandlers[e].subscribe(handler); - } + if (evt === 'deviceready') { + documentEventHandlers[e].subscribeOnce(handler); + } else { + documentEventHandlers[e].subscribe(handler); + } } else { - m_document_addEventListener.call(document, evt, handler, capture); + m_document_addEventListener.call(document, evt, handler, capture); } }; window.addEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); if (typeof windowEventHandlers[e] != 'undefined') { - windowEventHandlers[e].subscribe(handler); + windowEventHandlers[e].subscribe(handler); } else { - m_window_addEventListener.call(window, evt, handler, capture); + m_window_addEventListener.call(window, evt, handler, capture); } }; @@ -122,9 +122,9 @@ document.removeEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); // If unsubcribing from an event that is handled by a plugin if (typeof documentEventHandlers[e] != "undefined") { - documentEventHandlers[e].unsubscribe(handler); + documentEventHandlers[e].unsubscribe(handler); } else { - m_document_removeEventListener.call(document, evt, handler, capture); + m_document_removeEventListener.call(document, evt, handler, capture); } }; @@ -132,9 +132,9 @@ window.removeEventListener = function(evt, handler, capture) { var e = evt.toLowerCase(); // If unsubcribing from an event that is handled by a plugin if (typeof windowEventHandlers[e] != "undefined") { - windowEventHandlers[e].unsubscribe(handler); + windowEventHandlers[e].unsubscribe(handler); } else { - m_window_removeEventListener.call(window, evt, handler, capture); + m_window_removeEventListener.call(window, evt, handler, capture); } }; @@ -142,18 +142,18 @@ function createEvent(type, data) { var event = document.createEvent('Events'); event.initEvent(type, false, false); if (data) { - for (var i in data) { - if (data.hasOwnProperty(i)) { - event[i] = data[i]; - } - } + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } } return event; } if(typeof window.console === "undefined") { window.console = { - log:function(){} + log:function(){} }; } @@ -164,16 +164,16 @@ var cordova = { * Methods to add/remove your own addEventListener hijacking on document + window. */ addWindowEventHandler:function(event, opts) { - return (windowEventHandlers[event] = channel.create(event, opts)); + return (windowEventHandlers[event] = channel.create(event, opts)); }, addDocumentEventHandler:function(event, opts) { - return (documentEventHandlers[event] = channel.create(event, opts)); + return (documentEventHandlers[event] = channel.create(event, opts)); }, removeWindowEventHandler:function(event) { - delete windowEventHandlers[event]; + delete windowEventHandlers[event]; }, removeDocumentEventHandler:function(event) { - delete documentEventHandlers[event]; + delete documentEventHandlers[event]; }, /** * Retreive original event handlers that were replaced by Cordova @@ -181,31 +181,31 @@ var cordova = { * @return object */ getOriginalHandlers: function() { - return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, - 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; + return {'document': {'addEventListener': m_document_addEventListener, 'removeEventListener': m_document_removeEventListener}, + 'window': {'addEventListener': m_window_addEventListener, 'removeEventListener': m_window_removeEventListener}}; }, /** * Method to fire event from native code */ fireDocumentEvent: function(type, data) { - var evt = createEvent(type, data); - if (typeof documentEventHandlers[type] != 'undefined') { - setTimeout(function() { - documentEventHandlers[type].fire(evt); - }, 0); - } else { - document.dispatchEvent(evt); - } + var evt = createEvent(type, data); + if (typeof documentEventHandlers[type] != 'undefined') { + setTimeout(function() { + documentEventHandlers[type].fire(evt); + }, 0); + } else { + document.dispatchEvent(evt); + } }, fireWindowEvent: function(type, data) { - var evt = createEvent(type,data); - if (typeof windowEventHandlers[type] != 'undefined') { - setTimeout(function() { - windowEventHandlers[type].fire(evt); - }, 0); - } else { - window.dispatchEvent(evt); - } + var evt = createEvent(type,data); + if (typeof windowEventHandlers[type] != 'undefined') { + setTimeout(function() { + windowEventHandlers[type].fire(evt); + }, 0); + } else { + window.dispatchEvent(evt); + } }, // TODO: this is Android only; think about how to do this better shuttingDown:false, @@ -226,16 +226,16 @@ var cordova = { callbackId: 0, callbacks: {}, callbackStatus: { - NO_RESULT: 0, - OK: 1, - CLASS_NOT_FOUND_EXCEPTION: 2, - ILLEGAL_ACCESS_EXCEPTION: 3, - INSTANTIATION_EXCEPTION: 4, - MALFORMED_URL_EXCEPTION: 5, - IO_EXCEPTION: 6, - INVALID_ACTION: 7, - JSON_EXCEPTION: 8, - ERROR: 9 + NO_RESULT: 0, + OK: 1, + CLASS_NOT_FOUND_EXCEPTION: 2, + ILLEGAL_ACCESS_EXCEPTION: 3, + INSTANTIATION_EXCEPTION: 4, + MALFORMED_URL_EXCEPTION: 5, + IO_EXCEPTION: 6, + INVALID_ACTION: 7, + JSON_EXCEPTION: 8, + ERROR: 9 }, /** @@ -245,25 +245,25 @@ var cordova = { * @param args */ callbackSuccess: function(callbackId, args) { - if (cordova.callbacks[callbackId]) { - - // If result is to be sent to callback - if (args.status == cordova.callbackStatus.OK) { - try { - if (cordova.callbacks[callbackId].success) { - cordova.callbacks[callbackId].success(args.message); - } - } - catch (e) { - console.log("Error in success callback: "+callbackId+" = "+e); - } - } - - // Clear callback if not expecting any more results - if (!args.keepCallback) { - delete cordova.callbacks[callbackId]; - } - } + if (cordova.callbacks[callbackId]) { + + // If result is to be sent to callback + if (args.status == cordova.callbackStatus.OK) { + try { + if (cordova.callbacks[callbackId].success) { + cordova.callbacks[callbackId].success(args.message); + } + } + catch (e) { + console.log("Error in success callback: "+callbackId+" = "+e); + } + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } }, /** @@ -273,30 +273,30 @@ var cordova = { * @param args */ callbackError: function(callbackId, args) { - if (cordova.callbacks[callbackId]) { - try { - if (cordova.callbacks[callbackId].fail) { - cordova.callbacks[callbackId].fail(args.message); - } - } - catch (e) { - console.log("Error in error callback: "+callbackId+" = "+e); - } - - // Clear callback if not expecting any more results - if (!args.keepCallback) { - delete cordova.callbacks[callbackId]; - } - } + if (cordova.callbacks[callbackId]) { + try { + if (cordova.callbacks[callbackId].fail) { + cordova.callbacks[callbackId].fail(args.message); + } + } + catch (e) { + console.log("Error in error callback: "+callbackId+" = "+e); + } + + // Clear callback if not expecting any more results + if (!args.keepCallback) { + delete cordova.callbacks[callbackId]; + } + } }, addConstructor: function(func) { - channel.onCordovaReady.subscribeOnce(function() { - try { - func(); - } catch(e) { - console.log("Failed to run constructor: " + e); - } - }); + channel.onCordovaReady.subscribeOnce(function() { + try { + func(); + } catch(e) { + console.log("Failed to run constructor: " + e); + } + }); } }; @@ -315,50 +315,50 @@ var utils = require('cordova/utils'); function each(objects, func, context) { for (var prop in objects) { - if (objects.hasOwnProperty(prop)) { - func.apply(context, [objects[prop], prop]); - } + if (objects.hasOwnProperty(prop)) { + func.apply(context, [objects[prop], prop]); + } } } function include(parent, objects, clobber, merge) { each(objects, function (obj, key) { - try { - var result = obj.path ? require(obj.path) : {}; - - if (clobber) { - // Clobber if it doesn't exist. - if (typeof parent[key] === 'undefined') { - parent[key] = result; - } else if (typeof obj.path !== 'undefined') { - // If merging, merge properties onto parent, otherwise, clobber. - if (merge) { - recursiveMerge(parent[key], result); - } else { - parent[key] = result; - } - } - result = parent[key]; - } else { - // Overwrite if not currently defined. - if (typeof parent[key] == 'undefined') { - parent[key] = result; - } else if (merge && typeof obj.path !== 'undefined') { - // If merging, merge parent onto result - recursiveMerge(result, parent[key]); - parent[key] = result; - } else { - // Set result to what already exists, so we can build children into it if they exist. - result = parent[key]; - } - } - - if (obj.children) { - include(result, obj.children, clobber, merge); - } - } catch(e) { - utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); - } + try { + var result = obj.path ? require(obj.path) : {}; + + if (clobber) { + // Clobber if it doesn't exist. + if (typeof parent[key] === 'undefined') { + parent[key] = result; + } else if (typeof obj.path !== 'undefined') { + // If merging, merge properties onto parent, otherwise, clobber. + if (merge) { + recursiveMerge(parent[key], result); + } else { + parent[key] = result; + } + } + result = parent[key]; + } else { + // Overwrite if not currently defined. + if (typeof parent[key] == 'undefined') { + parent[key] = result; + } else if (merge && typeof obj.path !== 'undefined') { + // If merging, merge parent onto result + recursiveMerge(result, parent[key]); + parent[key] = result; + } else { + // Set result to what already exists, so we can build children into it if they exist. + result = parent[key]; + } + } + + if (obj.children) { + include(result, obj.children, clobber, merge); + } + } catch(e) { + utils.alert('Exception building cordova JS globals: ' + e + ' for key "' + key + '"'); + } }); } @@ -371,32 +371,32 @@ function include(parent, objects, clobber, merge) { */ function recursiveMerge(target, src) { for (var prop in src) { - if (src.hasOwnProperty(prop)) { - if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) { - // If the target object is a constructor override off prototype. - target.prototype[prop] = src[prop]; - } else { - target[prop] = typeof src[prop] === 'object' ? recursiveMerge( - target[prop], src[prop]) : src[prop]; - } - } + if (src.hasOwnProperty(prop)) { + if (typeof target.prototype !== 'undefined' && target.prototype.constructor === target) { + // If the target object is a constructor override off prototype. + target.prototype[prop] = src[prop]; + } else { + target[prop] = typeof src[prop] === 'object' ? recursiveMerge( + target[prop], src[prop]) : src[prop]; + } + } } return target; } module.exports = { build: function (objects) { - return { - intoButDontClobber: function (target) { - include(target, objects, false, false); - }, - intoAndClobber: function(target) { - include(target, objects, true, false); - }, - intoAndMerge: function(target) { - include(target, objects, true, true); - } - }; + return { + intoButDontClobber: function (target) { + include(target, objects, false, false); + }, + intoAndClobber: function(target) { + include(target, objects, true, false); + }, + intoAndMerge: function(target) { + include(target, objects, true, true); + } + }; } }; @@ -460,73 +460,73 @@ var Channel = function(type, opts) { this.fired = false; this.enabled = true; this.events = { - onSubscribe:null, - onUnsubscribe:null + onSubscribe:null, + onUnsubscribe:null }; if (opts) { - if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; - if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; + if (opts.onSubscribe) this.events.onSubscribe = opts.onSubscribe; + if (opts.onUnsubscribe) this.events.onUnsubscribe = opts.onUnsubscribe; } }, channel = { - /** - * Calls the provided function only after all of the channels specified - * have been fired. - */ - join: function (h, c) { - var i = c.length; - var len = i; - var f = function() { - if (!(--i)) h(); - }; - for (var j=0; j this.length) { - this.position = this.length; + this.position = this.length; } // Offset is between 0 and file size so set the position // to start writing. else { - this.position = offset; + this.position = offset; } }; @@ -2808,7 +2808,7 @@ FileWriter.prototype.seek = function(offset) { FileWriter.prototype.truncate = function(size) { // Throw an exception if we are already writing a file if (this.readyState === FileWriter.WRITING) { - throw new FileError(FileError.INVALID_STATE_ERR); + throw new FileError(FileError.INVALID_STATE_ERR); } // WRITING state @@ -2818,58 +2818,58 @@ FileWriter.prototype.truncate = function(size) { // If onwritestart callback if (typeof me.onwritestart === "function") { - me.onwritestart(new ProgressEvent("writestart", {"target":this})); + me.onwritestart(new ProgressEvent("writestart", {"target":this})); } // Write file exec( - // Success callback - function(r) { - // If DONE (cancelled), then don't do anything - if (me.readyState === FileWriter.DONE) { - return; - } - - // DONE state - me.readyState = FileWriter.DONE; - - // Update the length of the file - me.length = r; - me.position = Math.min(me.position, r); - - // If onwrite callback - if (typeof me.onwrite === "function") { - me.onwrite(new ProgressEvent("write", {"target":me})); - } - - // If onwriteend callback - if (typeof me.onwriteend === "function") { - me.onwriteend(new ProgressEvent("writeend", {"target":me})); - } - }, - // Error callback - function(e) { - // If DONE (cancelled), then don't do anything - if (me.readyState === FileWriter.DONE) { - return; - } - - // DONE state - me.readyState = FileWriter.DONE; - - // Save error - me.error = new FileError(e); - - // If onerror callback - if (typeof me.onerror === "function") { - me.onerror(new ProgressEvent("error", {"target":me})); - } - - // If onwriteend callback - if (typeof me.onwriteend === "function") { - me.onwriteend(new ProgressEvent("writeend", {"target":me})); - } - }, "File", "truncate", [this.fileName, size]); + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Update the length of the file + me.length = r; + me.position = Math.min(me.position, r); + + // If onwrite callback + if (typeof me.onwrite === "function") { + me.onwrite(new ProgressEvent("write", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileWriter.DONE) { + return; + } + + // DONE state + me.readyState = FileWriter.DONE; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {"target":me})); + } + + // If onwriteend callback + if (typeof me.onwriteend === "function") { + me.onwriteend(new ProgressEvent("writeend", {"target":me})); + } + }, "File", "truncate", [this.fileName, size]); }; module.exports = FileWriter; @@ -2935,20 +2935,20 @@ var Media = function(src, successCallback, errorCallback, statusCallback) { // successCallback optional if (successCallback && (typeof successCallback !== "function")) { - console.log("Media Error: successCallback is not a function"); - return; + console.log("Media Error: successCallback is not a function"); + return; } // errorCallback optional if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Media Error: errorCallback is not a function"); - return; + console.log("Media Error: errorCallback is not a function"); + return; } // statusCallback optional if (statusCallback && (typeof statusCallback !== "function")) { - console.log("Media Error: statusCallback is not a function"); - return; + console.log("Media Error: statusCallback is not a function"); + return; } this.id = utils.createUUID(); @@ -2994,8 +2994,8 @@ Media.prototype.play = function(options) { Media.prototype.stop = function() { var me = this; exec(function() { - me._position = 0; - me.successCallback(); + me._position = 0; + me.successCallback(); }, this.errorCallback, "Media", "stopPlayingAudio", [this.id]); }; @@ -3005,7 +3005,7 @@ Media.prototype.stop = function() { Media.prototype.seekTo = function(milliseconds) { var me = this; exec(function(p) { - me._position = p; + me._position = p; }, this.errorCallback, "Media", "seekToAudio", [this.id, milliseconds]); }; @@ -3032,8 +3032,8 @@ Media.prototype.getDuration = function() { Media.prototype.getCurrentPosition = function(success, fail) { var me = this; exec(function(p) { - me._position = p; - success(p); + me._position = p; + success(p); }, fail, "Media", "getCurrentPositionAudio", [this.id]); }; @@ -3077,26 +3077,26 @@ Media.onStatus = function(id, msg, value) { var media = mediaObjects[id]; // If state update if (msg === Media.MEDIA_STATE) { - if (value === Media.MEDIA_STOPPED) { - if (media.successCallback) { - media.successCallback(); - } - } - if (media.statusCallback) { - media.statusCallback(value); - } + if (value === Media.MEDIA_STOPPED) { + if (media.successCallback) { + media.successCallback(); + } + } + if (media.statusCallback) { + media.statusCallback(value); + } } else if (msg === Media.MEDIA_DURATION) { - media._duration = value; + media._duration = value; } else if (msg === Media.MEDIA_ERROR) { - if (media.errorCallback) { - // value should be a MediaError object when msg == MEDIA_ERROR - media.errorCallback(value); - } + if (media.errorCallback) { + // value should be a MediaError object when msg == MEDIA_ERROR + media.errorCallback(value); + } } else if (msg === Media.MEDIA_POSITION) { - media._position = value; + media._position = value; } }; @@ -3152,9 +3152,9 @@ utils.extend(MediaFile, File); */ MediaFile.prototype.getFormatData = function(successCallback, errorCallback) { if (typeof this.fullPath === "undefined" || this.fullPath === null) { - errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)); + errorCallback(new CaptureError(CaptureError.CAPTURE_INVALID_ARGUMENT)); } else { - exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); + exec(successCallback, errorCallback, "Capture", "getFormatData", [this.fullPath, this.type]); } }; @@ -3168,13 +3168,13 @@ MediaFile.prototype.getFormatData = function(successCallback, errorCallback) { MediaFile.cast = function(pluginResult) { var mediaFiles = []; for (var i=0; i.dispatchEvent - // need to first figure out how to implement EventTarget - } - } - return event; + var event = document.createEvent('Events'); + event.initEvent('ProgressEvent', false, false); + if (data) { + for (var i in data) { + if (data.hasOwnProperty(i)) { + event[i] = data[i]; + } + } + if (data.target) { + // TODO: cannot call .dispatchEvent + // need to first figure out how to implement EventTarget + } + } + return event; }; try { - var ev = createEvent({type:"abort",target:document}); - return function ProgressEvent(type, data) { - data.type = type; - return createEvent(data); - }; + var ev = createEvent({type:"abort",target:document}); + return function ProgressEvent(type, data) { + data.type = type; + return createEvent(data); + }; } catch(e){ */ - return function ProgressEvent(type, dict) { - this.type = type; - this.bubbles = false; - this.cancelBubble = false; - this.cancelable = false; - this.lengthComputable = false; - this.loaded = dict && dict.loaded ? dict.loaded : 0; - this.total = dict && dict.total ? dict.total : 0; - this.target = dict && dict.target ? dict.target : null; - }; + return function ProgressEvent(type, dict) { + this.type = type; + this.bubbles = false; + this.cancelBubble = false; + this.cancelable = false; + this.lengthComputable = false; + this.loaded = dict && dict.loaded ? dict.loaded : 0; + this.total = dict && dict.total ? dict.total : 0; + this.target = dict && dict.target ? dict.target : null; + }; //} })(); @@ -3333,16 +3333,16 @@ var accel = null; // Tells native to start. function start() { exec(function(a) { - var tempListeners = listeners.slice(0); - accel = new Acceleration(a.x, a.y, a.z, a.timestamp); - for (var i = 0, l = tempListeners.length; i < l; i++) { - tempListeners[i].win(accel); - } + var tempListeners = listeners.slice(0); + accel = new Acceleration(a.x, a.y, a.z, a.timestamp); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].win(accel); + } }, function(e) { - var tempListeners = listeners.slice(0); - for (var i = 0, l = tempListeners.length; i < l; i++) { - tempListeners[i].fail(e); - } + var tempListeners = listeners.slice(0); + for (var i = 0, l = tempListeners.length; i < l; i++) { + tempListeners[i].fail(e); + } }, "Accelerometer", "start", []); running = true; } @@ -3362,10 +3362,10 @@ function createCallbackPair(win, fail) { function removeListeners(l) { var idx = listeners.indexOf(l); if (idx > -1) { - listeners.splice(idx, 1); - if (listeners.length === 0) { - stop(); - } + listeners.splice(idx, 1); + if (listeners.length === 0) { + stop(); + } } } @@ -3378,27 +3378,27 @@ var accelerometer = { * @param {AccelerationOptions} options The options for getting the accelerometer data such as timeout. (OPTIONAL) */ getCurrentAcceleration: function(successCallback, errorCallback, options) { - // successCallback required - if (typeof successCallback !== "function") { - throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; - } - - var p; - var win = function(a) { - removeListeners(p); - successCallback(a); - }; - var fail = function(e) { - removeListeners(p); - errorCallback(e); - }; - - p = createCallbackPair(win, fail); - listeners.push(p); - - if (!running) { - start(); - } + // successCallback required + if (typeof successCallback !== "function") { + throw "getCurrentAcceleration must be called with at least a success callback function as first parameter."; + } + + var p; + var win = function(a) { + removeListeners(p); + successCallback(a); + }; + var fail = function(e) { + removeListeners(p); + errorCallback(e); + }; + + p = createCallbackPair(win, fail); + listeners.push(p); + + if (!running) { + start(); + } }, /** @@ -3410,43 +3410,43 @@ var accelerometer = { * @return String The watch id that must be passed to #clearWatch to stop watching. */ watchAcceleration: function(successCallback, errorCallback, options) { - // Default interval (10 sec) - var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; - - // successCallback required - if (typeof successCallback !== "function") { - throw "watchAcceleration must be called with at least a success callback function as first parameter."; - } - - // Keep reference to watch id, and report accel readings as often as defined in frequency - var id = utils.createUUID(); - - var p = createCallbackPair(function(){}, function(e) { - removeListeners(p); - errorCallback(e); - }); - listeners.push(p); - - timers[id] = { - timer:window.setInterval(function() { - if (accel) { - successCallback(accel); - } - }, frequency), - listeners:p - }; - - if (running) { - // If we're already running then immediately invoke the success callback - // but only if we have retreived a value, sample code does not check for null ... - if(accel) { - successCallback(accel); - } - } else { - start(); - } - - return id; + // Default interval (10 sec) + var frequency = (options && options.frequency && typeof options.frequency == 'number') ? options.frequency : 10000; + + // successCallback required + if (typeof successCallback !== "function") { + throw "watchAcceleration must be called with at least a success callback function as first parameter."; + } + + // Keep reference to watch id, and report accel readings as often as defined in frequency + var id = utils.createUUID(); + + var p = createCallbackPair(function(){}, function(e) { + removeListeners(p); + errorCallback(e); + }); + listeners.push(p); + + timers[id] = { + timer:window.setInterval(function() { + if (accel) { + successCallback(accel); + } + }, frequency), + listeners:p + }; + + if (running) { + // If we're already running then immediately invoke the success callback + // but only if we have retreived a value, sample code does not check for null ... + if(accel) { + successCallback(accel); + } + } else { + start(); + } + + return id; }, /** @@ -3455,12 +3455,12 @@ var accelerometer = { * @param {String} id The id of the watch returned from #watchAcceleration. */ clearWatch: function(id) { - // Stop javascript timer & remove from timer list - if (id && timers[id]) { - window.clearInterval(timers[id].timer); - removeListeners(timers[id].listeners); - delete timers[id]; - } + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + window.clearInterval(timers[id].timer); + removeListeners(timers[id].listeners); + delete timers[id]; + } } }; @@ -3479,8 +3479,8 @@ var cordova = require('cordova'), function handlers() { return battery.channels.batterystatus.numHandlers + - battery.channels.batterylow.numHandlers + - battery.channels.batterycritical.numHandlers; + battery.channels.batterylow.numHandlers + + battery.channels.batterycritical.numHandlers; } var Battery = function() { @@ -3526,24 +3526,24 @@ Battery.prototype.onUnsubscribe = function() { */ Battery.prototype._status = function(info) { if (info) { - var me = battery; + var me = battery; var level = info.level; - if (me._level !== level || me._isPlugged !== info.isPlugged) { - // Fire batterystatus event - cordova.fireWindowEvent("batterystatus", info); + if (me._level !== level || me._isPlugged !== info.isPlugged) { + // Fire batterystatus event + cordova.fireWindowEvent("batterystatus", info); - // Fire low battery event - if (level === 20 || level === 5) { - if (level === 20) { - cordova.fireWindowEvent("batterylow", info); - } - else { - cordova.fireWindowEvent("batterycritical", info); - } - } - } - me._level = level; - me._isPlugged = info.isPlugged; + // Fire low battery event + if (level === 20 || level === 5) { + if (level === 20) { + cordova.fireWindowEvent("batterylow", info); + } + else { + cordova.fireWindowEvent("batterycritical", info); + } + } + } + me._level = level; + me._isPlugged = info.isPlugged; } }; @@ -3574,18 +3574,18 @@ var exec = require('cordova/exec'), */ function _capture(type, successCallback, errorCallback, options) { var win = function(pluginResult) { - var mediaFiles = []; - var i; - for (i = 0; i < pluginResult.length; i++) { - var mediaFile = new MediaFile(); - mediaFile.name = pluginResult[i].name; - mediaFile.fullPath = pluginResult[i].fullPath; - mediaFile.type = pluginResult[i].type; - mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate; - mediaFile.size = pluginResult[i].size; - mediaFiles.push(mediaFile); - } - successCallback(mediaFiles); + var mediaFiles = []; + var i; + for (i = 0; i < pluginResult.length; i++) { + var mediaFile = new MediaFile(); + mediaFile.name = pluginResult[i].name; + mediaFile.fullPath = pluginResult[i].fullPath; + mediaFile.type = pluginResult[i].type; + mediaFile.lastModifiedDate = pluginResult[i].lastModifiedDate; + mediaFile.size = pluginResult[i].size; + mediaFiles.push(mediaFile); + } + successCallback(mediaFiles); }; exec(win, errorCallback, "Capture", type, [options]); } @@ -3644,98 +3644,98 @@ var exec = require('cordova/exec'), CompassError = require('cordova/plugin/CompassError'), timers = {}, compass = { - /** - * Asynchronously acquires the current heading. - * @param {Function} successCallback The function to call when the heading - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the heading data. - * @param {CompassOptions} options The options for getting the heading data (not used). - */ - getCurrentHeading:function(successCallback, errorCallback, options) { - // successCallback required - if (typeof successCallback !== "function") { - console.log("Compass Error: successCallback is not a function"); - return; - } - - // errorCallback optional - if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Compass Error: errorCallback is not a function"); - return; - } - - var win = function(result) { - var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); - successCallback(ch); - }; - var fail = function(code) { - var ce = new CompassError(code); - errorCallback(ce); - }; - - // Get heading - exec(win, fail, "Compass", "getHeading", [options]); - }, - - /** - * Asynchronously acquires the heading repeatedly at a given interval. - * @param {Function} successCallback The function to call each time the heading - * data is available - * @param {Function} errorCallback The function to call when there is an error - * getting the heading data. - * @param {HeadingOptions} options The options for getting the heading data - * such as timeout and the frequency of the watch. For iOS, filter parameter - * specifies to watch via a distance filter rather than time. - */ - watchHeading:function(successCallback, errorCallback, options) { - // Default interval (100 msec) - var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; - var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; - - // successCallback required - if (typeof successCallback !== "function") { - console.log("Compass Error: successCallback is not a function"); - return; - } - - // errorCallback optional - if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Compass Error: errorCallback is not a function"); - return; - } - - var id = utils.createUUID(); - if (filter > 0) { - // is an iOS request for watch by filter, no timer needed - timers[id] = "iOS"; - compass.getCurrentHeading(successCallback, errorCallback, options); - } else { - // Start watch timer to get headings - timers[id] = window.setInterval(function() { - compass.getCurrentHeading(successCallback, errorCallback); - }, frequency); - } - - return id; - }, - - /** - * Clears the specified heading watch. - * @param {String} watchId The ID of the watch returned from #watchHeading. - */ - clearWatch:function(id) { - // Stop javascript timer & remove from timer list - if (id && timers[id]) { - if (timers[id] != "iOS") { - clearInterval(timers[id]); - } else { - // is iOS watch by filter so call into device to stop - exec(null, null, "Compass", "stopHeading", []); - } - delete timers[id]; - } - } + /** + * Asynchronously acquires the current heading. + * @param {Function} successCallback The function to call when the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {CompassOptions} options The options for getting the heading data (not used). + */ + getCurrentHeading:function(successCallback, errorCallback, options) { + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var win = function(result) { + var ch = new CompassHeading(result.magneticHeading, result.trueHeading, result.headingAccuracy, result.timestamp); + successCallback(ch); + }; + var fail = function(code) { + var ce = new CompassError(code); + errorCallback(ce); + }; + + // Get heading + exec(win, fail, "Compass", "getHeading", [options]); + }, + + /** + * Asynchronously acquires the heading repeatedly at a given interval. + * @param {Function} successCallback The function to call each time the heading + * data is available + * @param {Function} errorCallback The function to call when there is an error + * getting the heading data. + * @param {HeadingOptions} options The options for getting the heading data + * such as timeout and the frequency of the watch. For iOS, filter parameter + * specifies to watch via a distance filter rather than time. + */ + watchHeading:function(successCallback, errorCallback, options) { + // Default interval (100 msec) + var frequency = (options !== undefined && options.frequency !== undefined) ? options.frequency : 100; + var filter = (options !== undefined && options.filter !== undefined) ? options.filter : 0; + + // successCallback required + if (typeof successCallback !== "function") { + console.log("Compass Error: successCallback is not a function"); + return; + } + + // errorCallback optional + if (errorCallback && (typeof errorCallback !== "function")) { + console.log("Compass Error: errorCallback is not a function"); + return; + } + + var id = utils.createUUID(); + if (filter > 0) { + // is an iOS request for watch by filter, no timer needed + timers[id] = "iOS"; + compass.getCurrentHeading(successCallback, errorCallback, options); + } else { + // Start watch timer to get headings + timers[id] = window.setInterval(function() { + compass.getCurrentHeading(successCallback, errorCallback); + }, frequency); + } + + return id; + }, + + /** + * Clears the specified heading watch. + * @param {String} watchId The ID of the watch returned from #watchHeading. + */ + clearWatch:function(id) { + // Stop javascript timer & remove from timer list + if (id && timers[id]) { + if (timers[id] != "iOS") { + clearInterval(timers[id]); + } else { + // is iOS watch by filter so call into device to stop + exec(null, null, "Compass", "stopHeading", []); + } + delete timers[id]; + } + } }; module.exports = compass; @@ -3780,9 +3780,9 @@ console.useLogger = function (value) { if (arguments.length) UseLogger = !!value; if (UseLogger) { - if (logger.useConsole()) { - throw new Error("console and logger are too intertwingly"); - } + if (logger.useConsole()) { + throw new Error("console and logger are too intertwingly"); + } } return UseLogger; @@ -3860,8 +3860,8 @@ console.time = function(name) { console.timeEnd = function(name) { var timeStart = Timers[name]; if (!timeStart) { - console.warn("unknown timer: " + name); - return; + console.warn("unknown timer: " + name); + return; } var timeElapsed = new Date().valueOf() - timeStart; @@ -3893,9 +3893,9 @@ console.table = function(data, columns) { //------------------------------------------------------------------------------ function wrapperedOrigCall(orgFunc, newFunc) { return function() { - var args = [].slice.call(arguments); - try { orgFunc.apply(WinConsole, args); } catch (e) {} - try { newFunc.apply(console, args); } catch (e) {} + var args = [].slice.call(arguments); + try { orgFunc.apply(WinConsole, args); } catch (e) {} + try { newFunc.apply(console, args); } catch (e) {} }; } @@ -3906,7 +3906,7 @@ function wrapperedOrigCall(orgFunc, newFunc) { //------------------------------------------------------------------------------ for (var key in console) { if (typeof WinConsole[key] == "function") { - console[key] = wrapperedOrigCall(WinConsole[key], console[key]); + console[key] = wrapperedOrigCall(WinConsole[key], console[key]); } } @@ -3933,23 +3933,23 @@ var contacts = { * @return array of Contacts matching search criteria */ find:function(fields, successCB, errorCB, options) { - if (!successCB) { - throw new TypeError("You must specify a success callback for the find command."); - } - if (!fields || (utils.isArray(fields) && fields.length === 0)) { - if (typeof errorCB === "function") { - errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); - } - } else { - var win = function(result) { - var cs = []; - for (var i = 0, l = result.length; i < l; i++) { - cs.push(contacts.create(result[i])); - } - successCB(cs); - }; - exec(win, errorCB, "Contacts", "search", [fields, options]); - } + if (!successCB) { + throw new TypeError("You must specify a success callback for the find command."); + } + if (!fields || (utils.isArray(fields) && fields.length === 0)) { + if (typeof errorCB === "function") { + errorCB(new ContactError(ContactError.INVALID_ARGUMENT_ERROR)); + } + } else { + var win = function(result) { + var cs = []; + for (var i = 0, l = result.length; i < l; i++) { + cs.push(contacts.create(result[i])); + } + successCB(cs); + }; + exec(win, errorCB, "Contacts", "search", [fields, options]); + } }, /** @@ -3960,14 +3960,14 @@ var contacts = { * @returns new Contact object */ create:function(properties) { - var i; - var contact = new Contact(); - for (i in properties) { - if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { - contact[i] = properties[i]; - } - } - return contact; + var i; + var contact = new Contact(); + for (i in properties) { + if (typeof contact[i] !== 'undefined' && properties.hasOwnProperty(i)) { + contact[i] = properties[i]; + } + } + return contact; } }; @@ -4000,18 +4000,18 @@ function Device() { var me = this; channel.onCordovaReady.subscribeOnce(function() { - me.getInfo(function(info) { - me.available = true; - me.platform = info.platform; - me.version = info.version; - me.name = info.name; - me.uuid = info.uuid; - me.cordova = info.cordova; - channel.onCordovaInfoReady.fire(); - },function(e) { - me.available = false; - utils.alert("[ERROR] Error initializing Cordova: " + e); - }); + me.getInfo(function(info) { + me.available = true; + me.platform = info.platform; + me.version = info.version; + me.name = info.name; + me.uuid = info.uuid; + me.cordova = info.cordova; + channel.onCordovaInfoReady.fire(); + },function(e) { + me.available = false; + utils.alert("[ERROR] Error initializing Cordova: " + e); + }); }); } @@ -4025,14 +4025,14 @@ Device.prototype.getInfo = function(successCallback, errorCallback) { // successCallback required if (typeof successCallback !== "function") { - console.log("Device Error: successCallback is not a function"); - return; + console.log("Device Error: successCallback is not a function"); + return; } // errorCallback optional if (errorCallback && (typeof errorCallback !== "function")) { - console.log("Device Error: errorCallback is not a function"); - return; + console.log("Device Error: errorCallback is not a function"); + return; } // Get info @@ -4055,25 +4055,25 @@ var timers = {}; // list of timers in use // Returns default params, overrides if provided with values function parseParameters(options) { var opt = { - maximumAge: 0, - enableHighAccuracy: false, - timeout: Infinity + maximumAge: 0, + enableHighAccuracy: false, + timeout: Infinity }; if (options) { - if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { - opt.maximumAge = options.maximumAge; - } - if (options.enableHighAccuracy !== undefined) { - opt.enableHighAccuracy = options.enableHighAccuracy; - } - if (options.timeout !== undefined && !isNaN(options.timeout)) { - if (options.timeout < 0) { - opt.timeout = 0; - } else { - opt.timeout = options.timeout; - } - } + if (options.maximumAge !== undefined && !isNaN(options.maximumAge) && options.maximumAge > 0) { + opt.maximumAge = options.maximumAge; + } + if (options.enableHighAccuracy !== undefined) { + opt.enableHighAccuracy = options.enableHighAccuracy; + } + if (options.timeout !== undefined && !isNaN(options.timeout)) { + if (options.timeout < 0) { + opt.timeout = 0; + } else { + opt.timeout = options.timeout; + } + } } return opt; @@ -4082,12 +4082,12 @@ function parseParameters(options) { // Returns a timeout failure, closed over a specified timeout value and error callback. function createTimeout(errorCallback, timeout) { var t = setTimeout(function() { - clearTimeout(t); - t = null; - errorCallback({ - code:PositionError.TIMEOUT, - message:"Position retrieval timed out." - }); + clearTimeout(t); + t = null; + errorCallback({ + code:PositionError.TIMEOUT, + message:"Position retrieval timed out." + }); }, timeout); return t; } @@ -4102,73 +4102,73 @@ var geolocation = { * @param {PositionOptions} options The options for getting the position data. (OPTIONAL) */ getCurrentPosition:function(successCallback, errorCallback, options) { - if (arguments.length === 0) { - throw new Error("getCurrentPosition must be called with at least one argument."); - } - options = parseParameters(options); - - // Timer var that will fire an error callback if no position is retrieved from native - // before the "timeout" param provided expires - var timeoutTimer = null; - - var win = function(p) { - clearTimeout(timeoutTimer); - if (!timeoutTimer) { - // Timeout already happened, or native fired error callback for - // this geo request. - // Don't continue with success callback. - return; - } - var pos = new Position( - { - latitude:p.latitude, - longitude:p.longitude, - altitude:p.altitude, - accuracy:p.accuracy, - heading:p.heading, - velocity:p.velocity, - altitudeAccuracy:p.altitudeAccuracy - }, - (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) - ); - geolocation.lastPosition = pos; - successCallback(pos); - }; - var fail = function(e) { - clearTimeout(timeoutTimer); - timeoutTimer = null; - var err = new PositionError(e.code, e.message); - if (errorCallback) { - errorCallback(err); - } - }; - - // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just - // fire the success callback with the cached position. - if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { - successCallback(geolocation.lastPosition); - // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. - } else if (options.timeout === 0) { - fail({ - code:PositionError.TIMEOUT, - message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceed's provided PositionOptions' maximumAge parameter." - }); - // Otherwise we have to call into native to retrieve a position. - } else { - if (options.timeout !== Infinity) { - // If the timeout value was not set to Infinity (default), then - // set up a timeout function that will fire the error callback - // if no successful position was retrieved before timeout expired. - timeoutTimer = createTimeout(fail, options.timeout); - } else { - // This is here so the check in the win function doesn't mess stuff up - // may seem weird but this guarantees timeoutTimer is - // always truthy before we call into native - timeoutTimer = true; - } - exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); - } - return timeoutTimer; + if (arguments.length === 0) { + throw new Error("getCurrentPosition must be called with at least one argument."); + } + options = parseParameters(options); + + // Timer var that will fire an error callback if no position is retrieved from native + // before the "timeout" param provided expires + var timeoutTimer = null; + + var win = function(p) { + clearTimeout(timeoutTimer); + if (!timeoutTimer) { + // Timeout already happened, or native fired error callback for + // this geo request. + // Don't continue with success callback. + return; + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + var fail = function(e) { + clearTimeout(timeoutTimer); + timeoutTimer = null; + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + // Check our cached position, if its timestamp difference with current time is less than the maximumAge, then just + // fire the success callback with the cached position. + if (geolocation.lastPosition && options.maximumAge && (((new Date()).getTime() - geolocation.lastPosition.timestamp.getTime()) <= options.maximumAge)) { + successCallback(geolocation.lastPosition); + // If the cached position check failed and the timeout was set to 0, error out with a TIMEOUT error object. + } else if (options.timeout === 0) { + fail({ + code:PositionError.TIMEOUT, + message:"timeout value in PositionOptions set to 0 and no cached Position object available, or cached Position object's age exceed's provided PositionOptions' maximumAge parameter." + }); + // Otherwise we have to call into native to retrieve a position. + } else { + if (options.timeout !== Infinity) { + // If the timeout value was not set to Infinity (default), then + // set up a timeout function that will fire the error callback + // if no successful position was retrieved before timeout expired. + timeoutTimer = createTimeout(fail, options.timeout); + } else { + // This is here so the check in the win function doesn't mess stuff up + // may seem weird but this guarantees timeoutTimer is + // always truthy before we call into native + timeoutTimer = true; + } + exec(win, fail, "Geolocation", "getLocation", [options.enableHighAccuracy, options.maximumAge]); + } + return timeoutTimer; }, /** * Asynchronously watches the geolocation for changes to geolocation. When a change occurs, @@ -4180,48 +4180,48 @@ var geolocation = { * @return String The watch id that must be passed to #clearWatch to stop watching. */ watchPosition:function(successCallback, errorCallback, options) { - if (arguments.length === 0) { - throw new Error("watchPosition must be called with at least one argument."); - } - options = parseParameters(options); - - var id = utils.createUUID(); - - // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition - timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); - - var fail = function(e) { - clearTimeout(timers[id]); - var err = new PositionError(e.code, e.message); - if (errorCallback) { - errorCallback(err); - } - }; - - var win = function(p) { - clearTimeout(timers[id]); - if (options.timeout !== Infinity) { - timers[id] = createTimeout(fail, options.timeout); - } - var pos = new Position( - { - latitude:p.latitude, - longitude:p.longitude, - altitude:p.altitude, - accuracy:p.accuracy, - heading:p.heading, - velocity:p.velocity, - altitudeAccuracy:p.altitudeAccuracy - }, - (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) - ); - geolocation.lastPosition = pos; - successCallback(pos); - }; - - exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); - - return id; + if (arguments.length === 0) { + throw new Error("watchPosition must be called with at least one argument."); + } + options = parseParameters(options); + + var id = utils.createUUID(); + + // Tell device to get a position ASAP, and also retrieve a reference to the timeout timer generated in getCurrentPosition + timers[id] = geolocation.getCurrentPosition(successCallback, errorCallback, options); + + var fail = function(e) { + clearTimeout(timers[id]); + var err = new PositionError(e.code, e.message); + if (errorCallback) { + errorCallback(err); + } + }; + + var win = function(p) { + clearTimeout(timers[id]); + if (options.timeout !== Infinity) { + timers[id] = createTimeout(fail, options.timeout); + } + var pos = new Position( + { + latitude:p.latitude, + longitude:p.longitude, + altitude:p.altitude, + accuracy:p.accuracy, + heading:p.heading, + velocity:p.velocity, + altitudeAccuracy:p.altitudeAccuracy + }, + (p.timestamp === undefined ? new Date() : ((p.timestamp instanceof Date) ? p.timestamp : new Date(p.timestamp))) + ); + geolocation.lastPosition = pos; + successCallback(pos); + }; + + exec(win, fail, "Geolocation", "addWatch", [id, options.enableHighAccuracy]); + + return id; }, /** * Clears the specified heading watch. @@ -4229,11 +4229,11 @@ var geolocation = { * @param {String} id The ID of the watch returned from #watchPosition */ clearWatch:function(id) { - if (id && timers[id] !== undefined) { - clearTimeout(timers[id]); - delete timers[id]; - exec(null, null, "Geolocation", "clearWatch", [id]); - } + if (id && timers[id] !== undefined) { + clearTimeout(timers[id]); + delete timers[id]; + exec(null, null, "Geolocation", "clearWatch", [id]); + } } }; @@ -4251,26 +4251,26 @@ var exec = require('cordova/exec'), */ module.exports = { display : function(errorCB, options) { - /* - * Display a contact using the iOS Contact Picker UI - * NOT part of W3C spec so no official documentation - * - * @param errorCB error callback - * @param options object - * allowsEditing: boolean AS STRING - * "true" to allow editing the contact - * "false" (default) display contact - */ - - if (this.id === null) { - if (typeof errorCB === "function") { - var errorObj = new ContactError(ContactError.UNKNOWN_ERROR); - errorCB(errorObj); - } - } - else { - exec(null, errorCB, "Contacts","displayContact", [this.id, options]); - } + /* + * Display a contact using the iOS Contact Picker UI + * NOT part of W3C spec so no official documentation + * + * @param errorCB error callback + * @param options object + * allowsEditing: boolean AS STRING + * "true" to allow editing the contact + * "false" (default) display contact + */ + + if (this.id === null) { + if (typeof errorCB === "function") { + var errorObj = new ContactError(ContactError.UNKNOWN_ERROR); + errorCB(errorObj); + } + } + else { + exec(null, errorCB, "Contacts","displayContact", [this.id, options]); + } } }; }); @@ -4279,13 +4279,13 @@ module.exports = { define("cordova/plugin/ios/Entry", function(require, exports, module) { module.exports = { toURL:function() { - // TODO: refactor path in a cross-platform way so we can eliminate - // these kinds of platform-specific hacks. - return "file://localhost" + this.fullPath; + // TODO: refactor path in a cross-platform way so we can eliminate + // these kinds of platform-specific hacks. + return "file://localhost" + this.fullPath; }, toURI: function() { - console.log("DEPRECATED: Update your code to use 'toURL'"); - return "file://localhost" + this.fullPath; + console.log("DEPRECATED: Update your code to use 'toURL'"); + return "file://localhost" + this.fullPath; } }; }); @@ -4299,84 +4299,84 @@ var exec = require('cordova/exec'), module.exports = { readAsText:function(file, encoding) { - // Figure out pathing - this.fileName = ''; - if (typeof file.fullPath === 'undefined') { - this.fileName = file; - } else { - this.fileName = file.fullPath; - } - - // Already loading something - if (this.readyState == FileReader.LOADING) { - throw new FileError(FileError.INVALID_STATE_ERR); - } - - // LOADING state - this.readyState = FileReader.LOADING; - - // If loadstart callback - if (typeof this.onloadstart === "function") { - this.onloadstart(new ProgressEvent("loadstart", {target:this})); - } - - // Default encoding is UTF-8 - var enc = encoding ? encoding : "UTF-8"; - - var me = this; - - // Read file - exec( - // Success callback - function(r) { - // If DONE (cancelled), then don't do anything - if (me.readyState === FileReader.DONE) { - return; - } - - // Save result - me.result = decodeURIComponent(r); - - // If onload callback - if (typeof me.onload === "function") { - me.onload(new ProgressEvent("load", {target:me})); - } - - // DONE state - me.readyState = FileReader.DONE; - - // If onloadend callback - if (typeof me.onloadend === "function") { - me.onloadend(new ProgressEvent("loadend", {target:me})); - } - }, - // Error callback - function(e) { - // If DONE (cancelled), then don't do anything - if (me.readyState === FileReader.DONE) { - return; - } - - // DONE state - me.readyState = FileReader.DONE; - - // null result - me.result = null; - - // Save error - me.error = new FileError(e); - - // If onerror callback - if (typeof me.onerror === "function") { - me.onerror(new ProgressEvent("error", {target:me})); - } - - // If onloadend callback - if (typeof me.onloadend === "function") { - me.onloadend(new ProgressEvent("loadend", {target:me})); - } - }, - "File", "readAsText", [this.fileName, enc]); + // Figure out pathing + this.fileName = ''; + if (typeof file.fullPath === 'undefined') { + this.fileName = file; + } else { + this.fileName = file.fullPath; + } + + // Already loading something + if (this.readyState == FileReader.LOADING) { + throw new FileError(FileError.INVALID_STATE_ERR); + } + + // LOADING state + this.readyState = FileReader.LOADING; + + // If loadstart callback + if (typeof this.onloadstart === "function") { + this.onloadstart(new ProgressEvent("loadstart", {target:this})); + } + + // Default encoding is UTF-8 + var enc = encoding ? encoding : "UTF-8"; + + var me = this; + + // Read file + exec( + // Success callback + function(r) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // Save result + me.result = decodeURIComponent(r); + + // If onload callback + if (typeof me.onload === "function") { + me.onload(new ProgressEvent("load", {target:me})); + } + + // DONE state + me.readyState = FileReader.DONE; + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, + // Error callback + function(e) { + // If DONE (cancelled), then don't do anything + if (me.readyState === FileReader.DONE) { + return; + } + + // DONE state + me.readyState = FileReader.DONE; + + // null result + me.result = null; + + // Save error + me.error = new FileError(e); + + // If onerror callback + if (typeof me.onerror === "function") { + me.onerror(new ProgressEvent("error", {target:me})); + } + + // If onloadend callback + if (typeof me.onloadend === "function") { + me.onloadend(new ProgressEvent("loadend", {target:me})); + } + }, + "File", "readAsText", [this.fileName, enc]); } }; }); @@ -4407,18 +4407,18 @@ DebugConsole.prototype.setLevel = function(level) { var stringify = function(message) { try { - if (typeof message === "object" && JSON && JSON.stringify) { - try { - return JSON.stringify(message); - } - catch (e) { - return "error JSON.stringify()ing argument: " + e; - } - } else { - return message.toString(); - } + if (typeof message === "object" && JSON && JSON.stringify) { + try { + return JSON.stringify(message); + } + catch (e) { + return "error JSON.stringify()ing argument: " + e; + } + } else { + return message.toString(); + } } catch (e) { - return e.toString(); + return e.toString(); } }; @@ -4428,10 +4428,10 @@ var stringify = function(message) { */ DebugConsole.prototype.log = function(message) { if (this.logLevel <= DebugConsole.INFO_LEVEL) { - exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'INFO' } ]); + exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'INFO' } ]); } else if (this.winConsole && this.winConsole.log) { - this.winConsole.log(message); + this.winConsole.log(message); } }; @@ -4441,10 +4441,10 @@ DebugConsole.prototype.log = function(message) { */ DebugConsole.prototype.warn = function(message) { if (this.logLevel <= DebugConsole.WARN_LEVEL) { - exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'WARN' } ]); + exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'WARN' } ]); } else if (this.winConsole && this.winConsole.warn) { - this.winConsole.warn(message); + this.winConsole.warn(message); } }; @@ -4454,10 +4454,10 @@ DebugConsole.prototype.warn = function(message) { */ DebugConsole.prototype.error = function(message) { if (this.logLevel <= DebugConsole.ERROR_LEVEL) { - exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'ERROR' } ]); + exec(null, null, 'Debug Console', 'log', [ stringify(message), { logLevel: 'ERROR' } ]); } else if (this.winConsole && this.winConsole.error){ - this.winConsole.error(message); + this.winConsole.error(message); } }; @@ -4473,28 +4473,28 @@ var exec = require('cordova/exec'); */ module.exports = { newContactUI : function(successCallback) { - /* - * Create a contact using the iOS Contact Picker UI - * NOT part of W3C spec so no official documentation - * - * returns: the id of the created contact as param to successCallback - */ - exec(successCallback, null, "Contacts","newContact", []); + /* + * Create a contact using the iOS Contact Picker UI + * NOT part of W3C spec so no official documentation + * + * returns: the id of the created contact as param to successCallback + */ + exec(successCallback, null, "Contacts","newContact", []); }, chooseContact : function(successCallback, options) { - /* - * Select a contact using the iOS Contact Picker UI - * NOT part of W3C spec so no official documentation - * - * @param errorCB error callback - * @param options object - * allowsEditing: boolean AS STRING - * "true" to allow editing the contact - * "false" (default) display contact - * - * returns: the id of the selected contact as param to successCallback - */ - exec(successCallback, null, "Contacts","chooseContact", [options]); + /* + * Select a contact using the iOS Contact Picker UI + * NOT part of W3C spec so no official documentation + * + * @param errorCB error callback + * @param options object + * allowsEditing: boolean AS STRING + * "true" to allow editing the contact + * "false" (default) display contact + * + * returns: the id of the selected contact as param to successCallback + */ + exec(successCallback, null, "Contacts","chooseContact", [options]); } }; }); @@ -4519,7 +4519,7 @@ var Media = require('cordova/plugin/Media'); module.exports = { beep:function(count) { - (new Media('beep.wav')).play(); + (new Media('beep.wav')).play(); } }; }); @@ -4604,10 +4604,10 @@ CurrentLevel = LevelsMap.WARN; */ logger.level = function (value) { if (arguments.length) { - if (LevelsMap[value] === null) { - throw new Error("invalid logging level: " + value); - } - CurrentLevel = LevelsMap[value]; + if (LevelsMap[value] === null) { + throw new Error("invalid logging level: " + value); + } + CurrentLevel = LevelsMap[value]; } return Levels[CurrentLevel]; @@ -4624,19 +4624,19 @@ logger.useConsole = function (value) { if (arguments.length) UseConsole = !!value; if (UseConsole) { - if (typeof console == "undefined") { - throw new Error("global console object is not defined"); - } + if (typeof console == "undefined") { + throw new Error("global console object is not defined"); + } - if (typeof console.log != "function") { - throw new Error("global console object does not have a log function"); - } + if (typeof console.log != "function") { + throw new Error("global console object does not have a log function"); + } - if (typeof console.useLogger == "function") { - if (console.useLogger()) { - throw new Error("console and logger are too intertwingly"); - } - } + if (typeof console.useLogger == "function") { + if (console.useLogger()) { + throw new Error("console and logger are too intertwingly"); + } + } } return UseConsole; @@ -4700,35 +4700,35 @@ logger.logLevel = function(level, message /* , ... */) { message = utils.vformat(message, formatArgs); if (LevelsMap[level] === null) { - throw new Error("invalid logging level: " + level); + throw new Error("invalid logging level: " + level); } if (LevelsMap[level] > CurrentLevel) return; // queue the message if not yet at deviceready if (!DeviceReady && !UseConsole) { - Queued.push([level, message]); - return; + Queued.push([level, message]); + return; } // if not using the console, use the native logger if (!UseConsole) { - exec(null, null, "Logger", "logLevel", [level, message]); - return; + exec(null, null, "Logger", "logLevel", [level, message]); + return; } // make sure console is not using logger if (console.__usingCordovaLogger) { - throw new Error("console and logger are too intertwingly"); + throw new Error("console and logger are too intertwingly"); } // log to the console switch (level) { - case logger.LOG: console.log(message); break; - case logger.ERROR: console.log("ERROR: " + message); break; - case logger.WARN: console.log("WARN: " + message); break; - case logger.INFO: console.log("INFO: " + message); break; - case logger.DEBUG: console.log("DEBUG: " + message); break; + case logger.LOG: console.log(message); break; + case logger.ERROR: console.log("ERROR: " + message); break; + case logger.WARN: console.log("WARN: " + message); break; + case logger.INFO: console.log("INFO: " + message); break; + case logger.DEBUG: console.log("DEBUG: " + message); break; } }; @@ -4739,8 +4739,8 @@ logger.__onDeviceReady = function() { DeviceReady = true; for (var i=0; i 3) { - fail(FileError.SYNTAX_ERR); + fail(FileError.SYNTAX_ERR); } else { - // if successful, return a FileSystem object - var success = function(file_system) { - if (file_system) { - if (typeof successCallback === 'function') { - // grab the name and root from the file system object - var result = new FileSystem(file_system.name, file_system.root); - successCallback(result); - } - } - else { - // no FileSystem object returned - fail(FileError.NOT_FOUND_ERR); - } - }; - exec(success, fail, "File", "requestFileSystem", [type, size]); + // if successful, return a FileSystem object + var success = function(file_system) { + if (file_system) { + if (typeof successCallback === 'function') { + // grab the name and root from the file system object + var result = new FileSystem(file_system.name, file_system.root); + successCallback(result); + } + } + else { + // no FileSystem object returned + fail(FileError.NOT_FOUND_ERR); + } + }; + exec(success, fail, "File", "requestFileSystem", [type, size]); } }; @@ -4935,36 +4935,36 @@ var DirectoryEntry = require('cordova/plugin/DirectoryEntry'), module.exports = function(uri, successCallback, errorCallback) { // error callback var fail = function(error) { - if (typeof errorCallback === 'function') { - errorCallback(new FileError(error)); - } + if (typeof errorCallback === 'function') { + errorCallback(new FileError(error)); + } }; // sanity check for 'not:valid:filename' if(!uri || uri.split(":").length > 2) { - setTimeout( function() { - fail(FileError.ENCODING_ERR); - },0); - return; + setTimeout( function() { + fail(FileError.ENCODING_ERR); + },0); + return; } // if successful, return either a file or directory entry var success = function(entry) { - var result; - if (entry) { - if (typeof successCallback === 'function') { - // create appropriate Entry object - result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath); - try { - successCallback(result); - } - catch (e) { - console.log('Error invoking callback: ' + e); - } - } - } - else { - // no Entry object returned - fail(FileError.NOT_FOUND_ERR); - } + var result; + if (entry) { + if (typeof successCallback === 'function') { + // create appropriate Entry object + result = (entry.isDirectory) ? new DirectoryEntry(entry.name, entry.fullPath) : new FileEntry(entry.name, entry.fullPath); + try { + successCallback(result); + } + catch (e) { + console.log('Error invoking callback: ' + e); + } + } + } + else { + // no Entry object returned + fail(FileError.NOT_FOUND_ERR); + } }; exec(success, fail, "File", "resolveLocalFileSystemURI", [uri]); @@ -4978,10 +4978,10 @@ var exec = require('cordova/exec'); var splashscreen = { show:function() { - exec(null, null, "SplashScreen", "show", []); + exec(null, null, "SplashScreen", "show", []); }, hide:function() { - exec(null, null, "SplashScreen", "hide", []); + exec(null, null, "SplashScreen", "hide", []); } }; @@ -5011,24 +5011,24 @@ utils.isDate = function(d) { */ utils.clone = function(obj) { if(!obj || typeof obj == 'function' || utils.isDate(obj) || typeof obj != 'object') { - return obj; + return obj; } var retVal, i; if(utils.isArray(obj)){ - retVal = []; - for(i = 0; i < obj.length; ++i){ - retVal.push(utils.clone(obj[i])); - } - return retVal; + retVal = []; + for(i = 0; i < obj.length; ++i){ + retVal.push(utils.clone(obj[i])); + } + return retVal; } retVal = {}; for(i in obj){ - if(!(i in retVal) || retVal[i] != obj[i]) { - retVal[i] = utils.clone(obj[i]); - } + if(!(i in retVal) || retVal[i] != obj[i]) { + retVal[i] = utils.clone(obj[i]); + } } return retVal; }; @@ -5038,13 +5038,13 @@ utils.clone = function(obj) { */ utils.close = function(context, func, params) { if (typeof params == 'undefined') { - return function() { - return func.apply(context, arguments); - }; + return function() { + return func.apply(context, arguments); + }; } else { - return function() { - return func.apply(context, params); - }; + return function() { + return func.apply(context, params); + }; } }; @@ -5053,10 +5053,10 @@ utils.close = function(context, func, params) { */ utils.createUUID = function() { return UUIDcreatePart(4) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(2) + '-' + - UUIDcreatePart(6); + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(2) + '-' + + UUIDcreatePart(6); }; /** @@ -5068,10 +5068,10 @@ utils.extend = (function() { var F = function() {}; // extend Child from Parent return function(Child, Parent) { - F.prototype = Parent.prototype; - Child.prototype = new F(); - Child.__super__ = Parent.prototype; - Child.prototype.constructor = Child; + F.prototype = Parent.prototype; + Child.prototype = new F(); + Child.__super__ = Parent.prototype; + Child.prototype.constructor = Child; }; }()); @@ -5080,9 +5080,9 @@ utils.extend = (function() { */ utils.alert = function(msg) { if (alert) { - alert(msg); + alert(msg); } else if (console && console.log) { - console.log(msg); + console.log(msg); } }; @@ -5120,22 +5120,22 @@ utils.vformat = function(formatString, args) { var result = []; while (args.length) { - var arg = args.shift(); - var match = pattern.exec(rest); + var arg = args.shift(); + var match = pattern.exec(rest); - if (!match) break; + if (!match) break; - rest = match[3]; + rest = match[3]; - result.push(match[1]); + result.push(match[1]); - if (match[2] == '%') { - result.push('%'); - args.unshift(arg); - continue; - } + if (match[2] == '%') { + result.push('%'); + args.unshift(arg); + continue; + } - result.push(formatted(arg, match[2])); + result.push(formatted(arg, match[2])); } result.push(rest); @@ -5147,11 +5147,11 @@ utils.vformat = function(formatString, args) { function UUIDcreatePart(length) { var uuidpart = ""; for (var i=0; i + + + + + + + + Hello Cordova + + +
+

Apache Cordovaâ„¢

+
+ + +
+
+ + + + + + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/WikitudePlugin.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/WikitudePlugin.js new file mode 100644 index 00000000..997558e3 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/WikitudePlugin.js @@ -0,0 +1,353 @@ +var WikitudePlugin = { + + /** + * + * This is the SDK Key, provided to you after you purchased the Wikitude SDK from http://www.wikitude.com/developer/sdk + * If you're having a trial version, leave this string empty + * + */ + mySDKKey : "ENTER-YOUR-KEY-HERE", + + /** + * + * Change the value of this variable to modify the location update rate + * + */ + locationUpdateRate : 3000, + + /** + * + * This variable represents if the current device is capable of running the Wikitude SDK + * + */ + isDeviceSupported : false, + + /** + * + * This watchID is used to shedule location updates + * + */ + watchID : null, + + /** + * + * Callbacks to get device information if ARchitect Worlds can be launched + * + */ + onDeviceSupportedCallback : null, + onDeviceNotSupportedCallback : null, + + /** + * + * Callbacks to get notified if the ARchitect World finished launching or if something went wrong during the World launch + * + */ + onARchitectWorldLaunchedCallback : null, + onARchitectWorldFailedLaunchingCallback : null, + + /** + * + * This function gets called if PhoneGap reports that it has finished loading successfully. + * + */ + isDeviceSupported: function(successCallback, errorCallback) + { + + WikitudePlugin.onDeviceSupportedCallback = successCallback; + WikitudePlugin.onDeviceNotSupportedCallback = errorCallback; + + + // PhoneGap is running, so the first thing we do is to check if the current device is capable of running the Wikitude Plugin + cordova.exec(WikitudePlugin.deviceIsARchitectReady, WikitudePlugin.deviceIsNotARchitectReady, "WikitudePlugin", "isDeviceSupported", [""]); + + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is able to start the Wikitude SDK + * + */ + deviceIsARchitectReady : function() + { + // We keep track of the device status + WikitudePlugin.isDeviceSupported = true; + + + if(WikitudePlugin.onDeviceSupportedCallback) + { + WikitudePlugin.onDeviceSupportedCallback(); + } + }, + + /** + * + * This function gets called if the Wikitude Plugin reports that the device is not able of starting the Wikitude SDK. + * + */ + deviceIsNotARchitectReady : function() + { + WikitudePlugin.isDeviceSupported = false; + + // In this case we notify the user that his device is not supported by the Wikitude SDK + if(WikitudePlugin.onDeviceNotSupportedCallback) + { + WikitudePlugin.onDeviceNotSupportedCallback(); + } + }, + + + /* + * ============================================================================================================================= + * + * PUBLIC API + * + * ============================================================================================================================= + */ + + /* Managing ARchitect world loading */ + + /** + * + * Call this function if you want to load an ARchitect World + * + * @param {String} worldPath The path to an ARchitect world ether on the device or on e.g. your dropbox + * + */ + loadARchitectWorld : function(worldPath) + { + + // before we actually call load, we check again if the device is able to open the world + if(WikitudePlugin.isDeviceSupported) + { + + // the 'open' function of the Wikitude Plugin requires a option dictionary with two keys: + // @param {Object} options (required) + // @param {String} options.sdkKey License key for the Wikitude SDK + // @param {String} options.filePath The path to a local ARchitect world or to a ARchitect world on a server or your dropbox + + cordova.exec(WikitudePlugin.worldLaunched, WikitudePlugin.worldFailedLaunching, "WikitudePlugin", "open", [{ sdkKey: WikitudePlugin.mySDKKey, filePath: worldPath}]); + + + // We add an event listener on the resume and pause event of the application lifecycle + document.addEventListener("resume", WikitudePlugin.onResume, false); + document.addEventListener("pause", WikitudePlugin.onPause, false); + + // After we started loading the world, we start location updates + WikitudePlugin.startLocationUpdates(); + + }else + { + // if the device is not able to start the Wikitude SDK, we notify the user again + WikitudePlugin.deviceNotARchitectReady(); + } + }, + + /* Managing the Wikitude SDK Lifecycle */ + + /** + * + * Use this function to stop the Wikitude SDK and to remove the ARchitectView from the screen + * + */ + close : function() + { + document.removeEventListener("pause", WikitudePlugin.onPause, false); + document.removeEventListener("resume", WikitudePlugin.onResume, false); + + WikitudePlugin.stopLocationUpdates(); + + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "close", [""]); + }, + + /** + * + * Use this function to only hide the Wikitude SDK. All location and rendering updates are still active + * + */ + hide : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "hide", [""]); + }, + + /** + * + * Use this function to show the Wikitude SDK if it was hidden before + * + */ + show : function() + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "show", [""]); + }, + + /* Interacting with the Wikitude SDK */ + + /** + * + * Use this function to call javascript which will be executed in the context of your ARchitect World + * + * + * @param js The JavaScript that gets evaluated in context of the ARchitect World + * + */ + callJavaScript : function(js) + { + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "callJavascript", [js]); + }, + + /** + * + * Use this function to set a callback which will be invoked when the ARchitect World calls for example + * document.location = "architectsdk://opendetailpage?id=9"; + * + * + * @param onUrlInvokeCallback A function which gets called when the ARchitect World invokes a call to "document.location = architectsdk://" + */ + setOnUrlInvokeCallback : function(onUrlInvokeCallback) + { + cordova.exec(onUrlInvokeCallback, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onUrlInvoke", [""]); + }, + + + /* + * ============================================================================================================================= + * + * Callbacks of public functions + * + * ============================================================================================================================= + */ + + /** + * + * Use this callback to get notified if the world loaded successfully + * + */ + worldLaunched : function() + { + if(WikitudePlugin.onARchitectWorldLaunchedCallback) + { + WikitudePlugin.onARchitectWorldLaunchedCallback(); + } + }, + + /** + * + * Use this callback to get notified if the Wikitude SDK wasn't able to load the ARchitect World + * + */ + worldFailedLaunching : function(err) + { + if(WikitudePlugin.onARchitectWorldFailedLaunchingCallback) + { + WikitudePlugin.onARchitectWorldFailedLaunchingCallback(err); + } + }, + + /* Lifecycle updates */ + + /** + * + * This function actually starts the PhoneGap location updates + * + */ + startLocationUpdates : function() + { + + WikitudePlugin.watchID = navigator.geolocation.watchPosition(WikitudePlugin.onReceivedLocation, WikitudePlugin.onWikitudeError, { frequency: WikitudePlugin.locationUpdateRate }); + }, + + /** + * + * This callback gets called everytime the location did update + * + */ + onReceivedLocation : function(position) + { + + // Every time that PhoneGap did received a location update, we pass the location into the Wikitude SDK + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "setLocation", [{ lat: position.coords.latitude, lon: position.coords.longitude, alt: position.coords.altitude, acc: position.coords.accuracy}]); + }, + + /** + * + * Use this function to stop location updates + * + */ + stopLocationUpdates : function() + { + + // We clear the location update watch which was responsible for updating the location in a specific time interval + navigator.geolocation.clearWatch(WikitudePlugin.watchID); + WikitudePlugin.watchID = null; + }, + + /** + * + * This function gets called every time the application did become active. + * + */ + onResume : function() + { + + // Call the Wikitude SDK that the application did become active again + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onResume", [""]); + + // And start continuing updating the user location + WikitudePlugin.startLocationUpdates(); + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onPause : function() + { + + // Call the Wikitude SDK that the application did resign active + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "onPause", [""]); + + // And stop all ongoing location updates + WikitudePlugin.stopLocationUpdates(); + }, + + /** + * + * Android specific! + * This function gets called if the user presses the back button + * + */ + onBackButton : function() + { + + cordova.exec(WikitudePlugin.onWikitudeOK, WikitudePlugin.onWikitudeError, "WikitudePlugin", "close", [""]); + WikitudePlugin.stopLocationUpdates(); + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeOK : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + onWikitudeError : function() + { + }, + + /** + * + * This function gets called every time the application is about to become inactive + * + */ + report: function(id) + { + console.log("app report: " + id); + } +}; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/index.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/index.js new file mode 100644 index 00000000..b82a058e --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/js/index.js @@ -0,0 +1,37 @@ +var app = { + initialize: function() { + this.bind(); + }, + bind: function() { + document.addEventListener('deviceready', this.deviceready, false); + }, + + // A callback which gets called if the device is able to launch ARchitect Worlds + onDeviceSupportedCallback : function() + { + // The device is able to launch ARchitect World, so lets do so :) + WikitudePlugin.loadARchitectWorld("assets/world/SimpleImageRecognition/SimpleIRWorld.html"); + }, + + // A callback which gets called if the device is not able to start ARchitect Worlds + onDeviceNotSupportedCallback : function() + { + app.report("Unable to launch ARchitect Worlds on this device"); + }, + + deviceready: function() { + // note that this is an event handler so the scope is that of the event + // so we need to call app.report(), and not this.report() + app.report('deviceready'); + + // check if the current device is able to launch ARchitect Worlds + WikitudePlugin.isDeviceSupported(app.onDeviceSupportedCallback, app.onDeviceNotSupportedCallback); + }, + report: function(id) { + console.log("report:" + id); + // hide the .pending

and show the .complete

+ document.querySelector('#' + id + ' .pending').className += ' hide'; + var completeElem = document.querySelector('#' + id + ' .complete'); + completeElem.className = completeElem.className.split('hide').join(''); + } +}; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_128.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_128.png new file mode 100644 index 00000000..3516df32 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_128.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_16.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_16.png new file mode 100644 index 00000000..54e19c55 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_16.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_24.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_24.png new file mode 100644 index 00000000..c7d43ad5 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_24.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_256.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_256.png new file mode 100644 index 00000000..e1cd0e61 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_256.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_32.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_32.png new file mode 100644 index 00000000..734fffca Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_32.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_48.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_48.png new file mode 100644 index 00000000..8ad8bac0 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_48.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_512.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_512.png new file mode 100644 index 00000000..c9465f3f Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_512.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_64.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_64.png new file mode 100644 index 00000000..03b38495 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_64.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_36.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_36.png new file mode 100644 index 00000000..cd5032a4 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_36.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_48.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_48.png new file mode 100644 index 00000000..e79c6062 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_48.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_72.png new file mode 100644 index 00000000..4d276344 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_72.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_96.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_96.png new file mode 100644 index 00000000..ec7ffbfb Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_android_96.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_bb_80.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_bb_80.png new file mode 100644 index 00000000..f86a27a9 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_bb_80.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_114.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_114.png new file mode 100644 index 00000000..efd9c374 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_114.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_144.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_144.png new file mode 100644 index 00000000..dd819da6 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_144.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_57.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_57.png new file mode 100644 index 00000000..c795fc4e Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_57.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_72.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_72.png new file mode 100644 index 00000000..b1cfde7d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/icon/cordova_ios_72.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_landscape.png new file mode 100644 index 00000000..a61e2b1a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_portrait.png new file mode 100644 index 00000000..5d6a28a8 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_hdpi_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_landscape.png new file mode 100644 index 00000000..f3934cdc Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_portrait.png new file mode 100644 index 00000000..65ad163a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_ldpi_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_landscape.png new file mode 100644 index 00000000..a1b697c5 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_portrait.png new file mode 100644 index 00000000..ea156935 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_mdpi_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_landscape.png new file mode 100644 index 00000000..79f2f094 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_portrait.png new file mode 100644 index 00000000..c2e80421 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/android_xhdpi_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_300.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_300.png new file mode 100644 index 00000000..b548bdc4 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_300.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_400.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_400.png new file mode 100644 index 00000000..3facdf9e Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/blackberry_transparent_400.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_landscape.png new file mode 100644 index 00000000..04be5acf Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_portrait.png new file mode 100644 index 00000000..41e839d9 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_landscape.png new file mode 100644 index 00000000..95c542dc Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_portrait.png new file mode 100644 index 00000000..aae1862c Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/ipad_retina_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_landscape.png new file mode 100644 index 00000000..d1548837 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_portrait.png new file mode 100644 index 00000000..6fcba565 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_landscape.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_landscape.png new file mode 100644 index 00000000..0165669d Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_landscape.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_portrait.png b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_portrait.png new file mode 100644 index 00000000..bd24886a Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/iphone_retina_portrait.png differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/windows_phone_portrait.jpg b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/windows_phone_portrait.jpg new file mode 100644 index 00000000..9f953870 Binary files /dev/null and b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/res/screen/windows_phone_portrait.jpg differ diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec.html b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec.html new file mode 100644 index 00000000..83d7d2e3 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec.html @@ -0,0 +1,50 @@ + + + + Jasmine Spec Runner + + + + + + + + + + + + + + + + + +

+ + diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/helper.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/helper.js new file mode 100644 index 00000000..9f994450 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/helper.js @@ -0,0 +1,11 @@ +afterEach(function() { + document.getElementById('stage').innerHTML = ''; +}); + +var helper = { + trigger: function(obj, name) { + var e = document.createEvent('Event'); + e.initEvent(name, true, true); + obj.dispatchEvent(e); + } +}; diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/index.js b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/index.js new file mode 100644 index 00000000..121cf631 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/HelloImageRecognition/www/spec/index.js @@ -0,0 +1,49 @@ +describe('app', function() { + describe('initialize', function() { + it('should bind deviceready', function() { + runs(function() { + spyOn(app, 'deviceready'); + app.initialize(); + helper.trigger(window.document, 'deviceready'); + }); + + waitsFor(function() { + return (app.deviceready.calls.length > 0); + }, 'deviceready should be called once', 500); + + runs(function() { + expect(app.deviceready).toHaveBeenCalled(); + }); + }); + }); + + describe('deviceready', function() { + it('should report that it fired', function() { + spyOn(app, 'report'); + app.deviceready(); + expect(app.report).toHaveBeenCalledWith('deviceready'); + }); + }); + + describe('report', function() { + beforeEach(function() { + var el = document.getElementById('stage'); + el.innerHTML = ['
', + '

Pending

', + '

Complete

', + '
'].join('\n'); + }); + + it('should show the completion state', function() { + app.report('deviceready'); + var el = document.querySelector('#deviceready .complete:not(.hide)'); + expect(el).toBeTruthy(); + }); + + it('should hide the pending state', function() { + app.report('deviceready'); + var el = document.querySelector('#deviceready .pending.hide'); + expect(el).toBeTruthy(); + }); + }); +}); diff --git a/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/README.md b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/README.md new file mode 100644 index 00000000..378bd651 --- /dev/null +++ b/iOS/AugmentedReality-Wikitude/SampleProjects/Extended/README.md @@ -0,0 +1,16 @@ +# Hello Image Recognition iOS + +This document describes all necessary steps to get the sample running. + + +###Setup +*** + +* Download the Vuforia Framework from [Qualcomm](https://ar.qualcomm.at/sdk/ios) (You need to register yourself as a Qualcomm developer) + +* After that, copy the lib and and header files from your downloaded Vuforia SDK into the ``` [ProjectFolder/"AppName"/Vuforia/include/QCAR] ``` and ``` [ProjectFolder/"AppName"/Vuforia/lib/arm/] ``` folder of this project + +* Download the Wikitude SDK from [our website](http://www.wikitude.com/developer/sdk) (You need to register yourself as a Wikitude developer) + +* Copy the SDK folder from ``` [DownloadedSDKRoot/iOS/SDK] ``` into ``` [ProjectFolder/"AppName"/WikitudeSDK] ``` + diff --git a/iOS/BarcodeScanner/CDVBarcodeScanner.mm b/iOS/BarcodeScanner/CDVBarcodeScanner.mm index 338ba495..20d473cc 100644 --- a/iOS/BarcodeScanner/CDVBarcodeScanner.mm +++ b/iOS/BarcodeScanner/CDVBarcodeScanner.mm @@ -16,11 +16,20 @@ //------------------------------------------------------------------------------ #import "zxing-all-in-one.h" -#ifdef CORDOVA_FRAMEWORK -#import -#else -#import "CDVPlugin.h" -#endif +#import + + +//------------------------------------------------------------------------------ +// Delegate to handle orientation functions +// +//------------------------------------------------------------------------------ +@protocol CDVBarcodeScannerOrientationDelegate + +- (NSUInteger)supportedInterfaceOrientations; +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; +- (BOOL)shouldAutorotate; + +@end //------------------------------------------------------------------------------ // Adds a shutter button to the UI, and changes the scan from continuous to @@ -76,11 +85,13 @@ - (void)dumpImage:(UIImage*)image; //------------------------------------------------------------------------------ // view controller for the ui //------------------------------------------------------------------------------ -@interface CDVbcsViewController : UIViewController {} +@interface CDVbcsViewController : UIViewController {} @property (nonatomic, retain) CDVbcsProcessor* processor; @property (nonatomic, retain) NSString* alternateXib; @property (nonatomic) BOOL shutterPressed; @property (nonatomic, retain) IBOutlet UIView* overlayView; +// unsafe_unretained is equivalent to assign - used to prevent retain cycles in the property below +@property (nonatomic, unsafe_unretained) id orientationDelegate; - (id)initWithProcessor:(CDVbcsProcessor*)processor alternateOverlay:(NSString *)alternateXib; - (void)startCapturing; @@ -238,6 +249,8 @@ - (void)scanBarcode { } self.viewController = [[[CDVbcsViewController alloc] initWithProcessor: self alternateOverlay:self.alternateXib] autorelease]; + // here we set the orientation delegate to the MainViewController of the app (orientation controlled in the Project Settings) + self.viewController.orientationDelegate = self.plugin.viewController; // delayed [self openDialog]; [self performSelector:@selector(openDialog) withObject:nil afterDelay:1]; @@ -287,7 +300,7 @@ - (void)barcodeScanCancelled { - (NSString*)setUpCaptureSession { NSError* error = nil; - AVCaptureSession* captureSession = [[AVCaptureSession alloc] init]; + AVCaptureSession* captureSession = [[[AVCaptureSession alloc] init] autorelease]; self.captureSession = captureSession; AVCaptureDevice* device = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; @@ -633,6 +646,17 @@ - (void)loadView { [self.view addSubview:[self buildOverlayView]]; } +//-------------------------------------------------------------------------- +- (void)viewWillAppear:(BOOL)animated { + + // set video orientation to what the camera sees + self.processor.previewLayer.orientation = [[UIApplication sharedApplication] statusBarOrientation]; + + // this fixes the bug when the statusbar is landscape, and the preview layer + // starts up in portrait (not filling the whole view) + self.processor.previewLayer.frame = self.view.bounds; +} + //-------------------------------------------------------------------------- - (void)viewDidAppear:(BOOL)animated { [self startCapturing]; @@ -645,13 +669,6 @@ - (void)startCapturing { self.processor.capturing = YES; } -//-------------------------------------------------------------------------- -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { - // rotation currently not supported - if (interfaceOrientation == UIInterfaceOrientationPortrait) return YES; - return NO; -} - //-------------------------------------------------------------------------- - (void)shutterButtonPressed { self.shutterPressed = YES; @@ -800,4 +817,45 @@ - (UIImage*)buildReticleImage { return result; } +#pragma mark CDVBarcodeScannerOrientationDelegate + +- (BOOL)shouldAutorotate +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) { + return [self.orientationDelegate shouldAutorotate]; + } + + return YES; +} + +- (NSUInteger)supportedInterfaceOrientations +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) { + return [self.orientationDelegate supportedInterfaceOrientations]; + } + + return UIInterfaceOrientationMaskPortrait; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) { + return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } + + return YES; +} + +- (void) willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)orientation duration:(NSTimeInterval)duration +{ + [CATransaction begin]; + + self.processor.previewLayer.orientation = orientation; + [self.processor.previewLayer layoutSublayers]; + self.processor.previewLayer.frame = self.view.bounds; + + [CATransaction commit]; + [super willAnimateRotationToInterfaceOrientation:orientation duration:duration]; +} + @end diff --git a/iOS/PayPalPlugin/wwwCDV20.zip b/iOS/BarcodeScanner/Example/cdv230.zip similarity index 55% rename from iOS/PayPalPlugin/wwwCDV20.zip rename to iOS/BarcodeScanner/Example/cdv230.zip index d1cf560e..852b3244 100644 Binary files a/iOS/PayPalPlugin/wwwCDV20.zip and b/iOS/BarcodeScanner/Example/cdv230.zip differ diff --git a/iOS/Biblesearch/README.md b/iOS/Biblesearch/README.md new file mode 100644 index 00000000..e3d44e58 --- /dev/null +++ b/iOS/Biblesearch/README.md @@ -0,0 +1,11 @@ +# biblesearch-api-js + +The American Bible Society has produced this javascript library to ease the use of the Bible Search api (http://bibles.org/pages/api) in phonegap mobile applications. The api (and this library) allow you to easily: + +* search the Bible +* locate specific passages +* get information about specific books, chapters, and verses +* do all that in one or more versions +* store nothing locally + +You can find this plugin at https://github.com/americanbible/biblesearch-api-js. diff --git a/iOS/Canvas2ImagePlugin/README.md b/iOS/Canvas2ImagePlugin/README.md new file mode 100644 index 00000000..68829386 --- /dev/null +++ b/iOS/Canvas2ImagePlugin/README.md @@ -0,0 +1,6 @@ +Canvas2ImagePlugin +============ + +This plugin allows you to save the contents of an HTML canvas tag to the iOS Photo Library from your app. + +This plugin resides at [http://github.com/devgeeks/Canvas2ImagePlugin](http://github.com/devgeeks/Canvas2ImagePlugin) \ No newline at end of file diff --git a/iOS/ChildBrowser/ChildBrowserCommand.h b/iOS/ChildBrowser/ChildBrowserCommand.h index 1cabc2b1..7f8e6ad4 100644 --- a/iOS/ChildBrowser/ChildBrowserCommand.h +++ b/iOS/ChildBrowser/ChildBrowserCommand.h @@ -2,21 +2,14 @@ // Copyright 2010 Nitobi. All rights reserved. // Copyright 2012, Randy McMillan - #import #import "ChildBrowserViewController.h" +@interface ChildBrowserCommand : CDVPlugin {} +@property (nonatomic, strong) ChildBrowserViewController* childBrowser; -@interface ChildBrowserCommand : CDVPlugin { - - ChildBrowserViewController* childBrowser; -} - -@property (nonatomic, retain) ChildBrowserViewController *childBrowser; - - -- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; --(void) onChildLocationChange:(NSString*)newLoc; +- (void)showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; +- (void)onChildLocationChange:(NSString*)newLoc; @end diff --git a/iOS/ChildBrowser/ChildBrowserCommand.m b/iOS/ChildBrowser/ChildBrowserCommand.m index c3acbf2e..43ec3b4a 100644 --- a/iOS/ChildBrowser/ChildBrowserCommand.m +++ b/iOS/ChildBrowser/ChildBrowserCommand.m @@ -4,19 +4,30 @@ #import "ChildBrowserCommand.h" #import - - +#import @implementation ChildBrowserCommand @synthesize childBrowser; -- (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url +- (void)showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url { - if(childBrowser == NULL) - { - childBrowser = [[ ChildBrowserViewController alloc ] initWithScale:FALSE ]; - childBrowser.delegate = self; + /* setting audio session category to "Playback" (since iOS 6) */ + AVAudioSession *audioSession = [AVAudioSession sharedInstance]; + NSError *setCategoryError = nil; + BOOL ok = [audioSession setCategory:AVAudioSessionCategoryPlayback error:&setCategoryError]; + if (!ok) { + NSLog(@"Error setting AVAudioSessionCategoryPlayback: %@", setCategoryError); + }; + + if (self.childBrowser == nil) { +#if __has_feature(objc_arc) + self.childBrowser = [[ChildBrowserViewController alloc] initWithScale:NO]; +#else + self.childBrowser = [[[ChildBrowserViewController alloc] initWithScale:NO] autorelease]; +#endif + self.childBrowser.delegate = self; + self.childBrowser.orientationDelegate = self.viewController; } /* // TODO: Work in progress @@ -24,47 +35,53 @@ - (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)o NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","]; */ - CDVViewController* cont = (CDVViewController*)[ super viewController ]; - childBrowser.supportedOrientations = cont.supportedOrientations; - [ cont presentModalViewController:childBrowser animated:YES ]; + [self.viewController presentModalViewController:childBrowser animated:YES]; - NSString *url = (NSString*) [arguments objectAtIndex:0]; + NSString* url = (NSString*)[arguments objectAtIndex:0]; - [childBrowser loadURL:url ]; - -} -- (void) getPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { - NSString *url = (NSString*) [arguments objectAtIndex:0]; - [childBrowser loadURL:url ]; + [self.childBrowser loadURL:url]; } --(void) close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url +- (void)getPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { - [ childBrowser closeBrowser]; + NSString* url = (NSString*)[arguments objectAtIndex:0]; + [self.childBrowser loadURL:url]; } --(void) onClose +- (void)close:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options // args: url { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onClose();",@""]; - [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; + [self.childBrowser closeBrowser]; } --(void) onOpenInSafari +- (void)onClose { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onOpenExternal();",@""]; - [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; + [self.webView stringByEvaluatingJavaScriptFromString:@"window.plugins.childBrowser.onClose();"]; } - --(void) onChildLocationChange:(NSString*)newLoc +- (void)onOpenInSafari { + [self.webView stringByEvaluatingJavaScriptFromString:@"window.plugins.childBrowser.onOpenExternal();"]; +} - NSString* tempLoc = [NSString stringWithFormat:@"%@",newLoc]; +- (void)onChildLocationChange:(NSString*)newLoc +{ + NSString* tempLoc = [NSString stringWithFormat:@"%@", newLoc]; NSString* encUrl = [tempLoc stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]; - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onLocationChange('%@');",encUrl]; + NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.childBrowser.onLocationChange('%@');", encUrl]; + [self.webView stringByEvaluatingJavaScriptFromString:jsCallback]; +} + +#if !__has_feature(objc_arc) +- (void)dealloc +{ + self.childBrowser = nil; + + [super dealloc]; } +#endif + @end diff --git a/iOS/ChildBrowser/ChildBrowserViewController.h b/iOS/ChildBrowser/ChildBrowserViewController.h index a870d699..07f0183a 100644 --- a/iOS/ChildBrowser/ChildBrowserViewController.h +++ b/iOS/ChildBrowser/ChildBrowserViewController.h @@ -4,8 +4,7 @@ #import -@protocol ChildBrowserDelegate - +@protocol ChildBrowserDelegate /* * onChildLocationChanging:newLoc @@ -13,38 +12,43 @@ * Discussion: * Invoked when a new page has loaded */ --(void) onChildLocationChange:(NSString*)newLoc; --(void) onOpenInSafari; --(void) onClose; +- (void)onChildLocationChange:(NSString*)newLoc; +- (void)onOpenInSafari; +- (void)onClose; + @end +@protocol CDVOrientationDelegate + +- (NSUInteger)supportedInterfaceOrientations; +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation; +- (BOOL)shouldAutorotate; + +@end + +@interface ChildBrowserViewController : UIViewController {} + +@property (nonatomic, strong) IBOutlet UIWebView* webView; +@property (nonatomic, strong) IBOutlet UIBarButtonItem* closeBtn; +@property (nonatomic, strong) IBOutlet UIBarButtonItem* refreshBtn; +@property (nonatomic, strong) IBOutlet UILabel* addressLabel; +@property (nonatomic, strong) IBOutlet UIBarButtonItem* backBtn; +@property (nonatomic, strong) IBOutlet UIBarButtonItem* fwdBtn; +@property (nonatomic, strong) IBOutlet UIBarButtonItem* safariBtn; +@property (nonatomic, strong) IBOutlet UIActivityIndicatorView* spinner; + +// unsafe_unretained is equivalent to assign - used to prevent retain cycles in the two properties below +@property (nonatomic, unsafe_unretained) id delegate; +@property (nonatomic, unsafe_unretained) id orientationDelegate; + +@property (copy) NSString* imageURL; +@property (assign) BOOL isImage; +@property (assign) BOOL scaleEnabled; -@interface ChildBrowserViewController : UIViewController < UIWebViewDelegate > { - IBOutlet UIWebView* webView; - IBOutlet UIBarButtonItem* closeBtn; - IBOutlet UIBarButtonItem* refreshBtn; - IBOutlet UILabel* addressLabel; - IBOutlet UIBarButtonItem* backBtn; - IBOutlet UIBarButtonItem* fwdBtn; - IBOutlet UIBarButtonItem* safariBtn; - IBOutlet UIActivityIndicatorView* spinner; - BOOL scaleEnabled; - BOOL isImage; - NSString* imageURL; - NSArray* supportedOrientations; - id delegate; -} - -@property (nonatomic, retain)id delegate; -@property (nonatomic, retain) NSArray* supportedOrientations; -@property(retain) NSString* imageURL; -@property(assign) BOOL isImage; - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation; - (ChildBrowserViewController*)initWithScale:(BOOL)enabled; - (IBAction)onDoneButtonPress:(id)sender; - (IBAction)onSafariButtonPress:(id)sender; - (void)loadURL:(NSString*)url; --(void)closeBrowser; +- (void)closeBrowser; @end diff --git a/iOS/ChildBrowser/ChildBrowserViewController.m b/iOS/ChildBrowser/ChildBrowserViewController.m index 3ec61702..8160bd53 100644 --- a/iOS/ChildBrowser/ChildBrowserViewController.m +++ b/iOS/ChildBrowser/ChildBrowserViewController.m @@ -1,4 +1,4 @@ -/// Created by Jesse MacFadyen on 10-05-29. +// / Created by Jesse MacFadyen on 10-05-29. // Copyright 2010 Nitobi. All rights reserved. // Copyright 2012, Randy McMillan @@ -6,10 +6,10 @@ @implementation ChildBrowserViewController -@synthesize imageURL; -@synthesize supportedOrientations; -@synthesize isImage; -@synthesize delegate; +@synthesize imageURL, isImage; +@synthesize delegate, orientationDelegate; +@synthesize spinner, webView, addressLabel; +@synthesize closeBtn, refreshBtn, backBtn, fwdBtn, safariBtn; /* // The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad. @@ -21,196 +21,162 @@ - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil } */ -+ (NSString*) resolveImageResource:(NSString*)resource ++ (NSString*)resolveImageResource:(NSString*)resource { NSString* systemVersion = [[UIDevice currentDevice] systemVersion]; BOOL isLessThaniOS4 = ([systemVersion compare:@"4.0" options:NSNumericSearch] == NSOrderedAscending); if (isLessThaniOS4) { - return [NSString stringWithFormat:@"%@.png", resource]; - } else { - - if ([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES && [[UIScreen mainScreen] scale] == 2.00) { - - return [NSString stringWithFormat:@"%@@2x.png", resource]; - - } - + if (([[UIScreen mainScreen] respondsToSelector:@selector(scale)] == YES) && ([[UIScreen mainScreen] scale] == 2.00)) { + return [NSString stringWithFormat:@"%@@2x.png", resource]; + } } - return resource;//if all else fails + return resource; // if all else fails } - - (ChildBrowserViewController*)initWithScale:(BOOL)enabled { self = [super init]; - scaleEnabled = enabled; + self.scaleEnabled = enabled; return self; } // Implement viewDidLoad to do additional setup after loading the view, typically from a nib. -- (void)viewDidLoad { +- (void)viewDidLoad +{ [super viewDidLoad]; - refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]]; - backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]]; - fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]]; - safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]]; + self.refreshBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/but_refresh"]]; + self.backBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_left"]]; + self.fwdBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/arrow_right"]]; + self.safariBtn.image = [UIImage imageNamed:[[self class] resolveImageResource:@"ChildBrowser.bundle/compass"]]; - webView.delegate = self; - webView.scalesPageToFit = TRUE; - webView.backgroundColor = [UIColor whiteColor]; + self.webView.delegate = self; + self.webView.scalesPageToFit = TRUE; + self.webView.backgroundColor = [UIColor whiteColor]; NSLog(@"View did load"); } -- (void)didReceiveMemoryWarning { -// Releases the view if it doesn't have a superview. +- (void)didReceiveMemoryWarning +{ + // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning]; -// Release any cached data, images, etc that aren't in use. + // Release any cached data, images, etc that aren't in use. } -- (void)viewDidUnload { +- (void)viewDidUnload +{ // Release any retained subviews of the main view. // e.g. self.myOutlet = nil; NSLog(@"View did UN-load"); } +- (void)dealloc +{ + self.webView.delegate = nil; + self.delegate = nil; + self.orientationDelegate = nil; + +#if !__has_feature(objc_arc) + self.webView = nil; + self.closeBtn = nil; + self.refreshBtn = nil; + self.addressLabel = nil; + self.backBtn = nil; + self.fwdBtn = nil; + self.safariBtn = nil; + self.spinner = nil; -- (void)dealloc { - - webView.delegate = nil; - - [webView release]; - [closeBtn release]; - [refreshBtn release]; - [addressLabel release]; - [backBtn release]; - [fwdBtn release]; - [safariBtn release]; - [spinner release]; - [ supportedOrientations release]; [super dealloc]; +#endif } --(void)closeBrowser +- (void)closeBrowser { - - if(delegate != NULL) { - [delegate onClose]; + if (self.delegate != nil) { + [self.delegate onClose]; } - if ([self respondsToSelector:@selector(presentingViewController)]) { - //Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan + if ([self respondsToSelector:@selector(presentingViewController)]) { + // Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; } else { [[self parentViewController] dismissModalViewControllerAnimated:YES]; } } --(IBAction) onDoneButtonPress:(id)sender +- (IBAction)onDoneButtonPress:(id)sender { - [ self closeBrowser]; - NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]; -// NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:@""]]; - [webView loadRequest:request]; + [self closeBrowser]; + NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:@"about:blank"]]; + [self.webView loadRequest:request]; } - --(IBAction) onSafariButtonPress:(id)sender +- (IBAction)onSafariButtonPress:(id)sender { - - if(delegate != NULL) - { - [delegate onOpenInSafari]; + if (self.delegate != nil) { + [self.delegate onOpenInSafari]; } - if(isImage) - { - NSURL* pURL = [ [NSURL alloc] initWithString:imageURL ]; - [ [ UIApplication sharedApplication ] openURL:pURL ]; - } - else - { - NSURLRequest *request = webView.request; - [[UIApplication sharedApplication] openURL:request.URL]; - } - - -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation -{ - BOOL autoRotate = [self.supportedOrientations count] > 1; // autorotate if only more than 1 orientation supported - if (autoRotate) - { - if ([self.supportedOrientations containsObject: - [NSNumber numberWithInt:interfaceOrientation]]) { - return YES; - } + if (self.isImage) { + NSURL* pURL = [NSURL URLWithString:self.imageURL]; + [[UIApplication sharedApplication] openURL:pURL]; + } else { + NSURLRequest* request = self.webView.request; + [[UIApplication sharedApplication] openURL:request.URL]; } - - return NO; } - - - - (void)loadURL:(NSString*)url { - NSLog(@"Opening Url : %@",url); - - if( [url hasSuffix:@".png" ] || - [url hasSuffix:@".jpg" ] || - [url hasSuffix:@".jpeg" ] || - [url hasSuffix:@".bmp" ] || - [url hasSuffix:@".gif" ] ) - { - [ imageURL release ]; - imageURL = [url copy]; - isImage = YES; + NSLog(@"Opening Url : %@", url); + + if ([url hasSuffix:@".png"] || + [url hasSuffix:@".jpg"] || + [url hasSuffix:@".jpeg"] || + [url hasSuffix:@".bmp"] || + [url hasSuffix:@".gif"]) { + self.imageURL = nil; + self.imageURL = url; + self.isImage = YES; NSString* htmlText = @""; - htmlText = [ htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url ]; + htmlText = [htmlText stringByReplacingOccurrencesOfString:@"IMGSRC" withString:url]; - [webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]]; - - } - else - { - imageURL = @""; - isImage = NO; - NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; - [webView loadRequest:request]; + [self.webView loadHTMLString:htmlText baseURL:[NSURL URLWithString:@""]]; + } else { + self.imageURL = @""; + self.isImage = NO; + NSURLRequest* request = [NSURLRequest requestWithURL:[NSURL URLWithString:url]]; + [self.webView loadRequest:request]; } - webView.hidden = NO; + self.webView.hidden = NO; } +- (void)webViewDidStartLoad:(UIWebView*)sender +{ + self.addressLabel.text = @"Loading..."; + self.backBtn.enabled = self.webView.canGoBack; + self.fwdBtn.enabled = self.webView.canGoForward; -- (void)webViewDidStartLoad:(UIWebView *)sender { - addressLabel.text = @"Loading..."; - backBtn.enabled = webView.canGoBack; - fwdBtn.enabled = webView.canGoForward; - - [ spinner startAnimating ]; - + [self.spinner startAnimating]; } -- (void)webViewDidFinishLoad:(UIWebView *)sender +- (void)webViewDidFinishLoad:(UIWebView*)sender { - NSURLRequest *request = webView.request; - NSLog(@"New Address is : %@",request.URL.absoluteString); - addressLabel.text = request.URL.absoluteString; - backBtn.enabled = webView.canGoBack; - fwdBtn.enabled = webView.canGoForward; - [ spinner stopAnimating ]; - - if(delegate != NULL) - { - [delegate onChildLocationChange:request.URL.absoluteString]; - } + NSURLRequest* request = self.webView.request; + NSLog(@"New Address is : %@", request.URL.absoluteString); + self.addressLabel.text = request.URL.absoluteString; + self.backBtn.enabled = self.webView.canGoBack; + self.fwdBtn.enabled = self.webView.canGoForward; + [self.spinner stopAnimating]; + + if (self.delegate != NULL) { + [self.delegate onChildLocationChange:request.URL.absoluteString]; + } } /*- (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error { @@ -229,4 +195,34 @@ - (void)webViewDidFinishLoad:(UIWebView *)sender } } */ + +#pragma mark CDVOrientationDelegate + +- (BOOL)shouldAutorotate +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotate)]) { + return [self.orientationDelegate shouldAutorotate]; + } + + return YES; +} + +- (NSUInteger)supportedInterfaceOrientations +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(supportedInterfaceOrientations)]) { + return [self.orientationDelegate supportedInterfaceOrientations]; + } + + return UIInterfaceOrientationMaskPortrait; +} + +- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation +{ + if ((self.orientationDelegate != nil) && [self.orientationDelegate respondsToSelector:@selector(shouldAutorotateToInterfaceOrientation:)]) { + return [self.orientationDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation]; + } + + return YES; +} + @end diff --git a/iOS/DatePicker/DatePicker.js b/iOS/DatePicker/DatePicker.js index 541f72fa..22ab676a 100644 --- a/iOS/DatePicker/DatePicker.js +++ b/iOS/DatePicker/DatePicker.js @@ -1,16 +1,11 @@ /** - Cordova DatePicker Plugin - Copyright (c) Greg Allen 2011 - MIT Licensed -**/ - -if (!window.plugins.datePicker) { - - /* shim to work in 1.5 and 1.6 */ - if (!window.Cordova) { - window.Cordova = cordova; - }; - + * Cordova DatePicker Plugin + * Copyright (c) Greg Allen 2011 + * MIT Licensed + * + * Updated for Cordova 2.1 by Robert (Jamie) Munro + */ +if (typeof cordova !== "undefined") { /** * Constructor */ @@ -37,29 +32,29 @@ if (!window.plugins.datePicker) { padDate(options.date.getMinutes()) + ":00Z"; } var defaults = { - mode: 'datetime', - date: '', - allowOldDates: true, + mode : 'datetime', + date : '', + allowOldDates : true, allowFutureDates : true - } + }; + for (var key in defaults) { if (typeof options[key] !== "undefined") defaults[key] = options[key]; } this._callback = cb; - Cordova.exec("DatePicker.show", defaults); - } + + cordova.exec("DatePicker.show", defaults); + }; DatePicker.prototype._dateSelected = function(date) { - var d = new Date(parseFloat(date)*1000); + var d = new Date(parseFloat(date) * 1000); if (this._callback) this._callback(d); } - - Cordova.addConstructor(function() { - if(!window.plugins) - { + cordova.addConstructor(function() { + if (!window.plugins) { window.plugins = {}; } window.plugins.datePicker = new DatePicker(); diff --git a/iOS/DeviceDetails/DeviceDetails.h b/iOS/DeviceDetails/DeviceDetails.h new file mode 100644 index 00000000..ebe6ad32 --- /dev/null +++ b/iOS/DeviceDetails/DeviceDetails.h @@ -0,0 +1,13 @@ +#import +#import + +@interface DeviceDetails : CDVPlugin { + NSMutableDictionary* callbackIds; +} + +@property (nonatomic, retain) NSMutableDictionary* callbackIds; + +- (void)getDeviceDetails:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; +- (void)getDeviceUUID:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; + +@end \ No newline at end of file diff --git a/iOS/DeviceDetails/DeviceDetails.js b/iOS/DeviceDetails/DeviceDetails.js new file mode 100644 index 00000000..262ca79b --- /dev/null +++ b/iOS/DeviceDetails/DeviceDetails.js @@ -0,0 +1,16 @@ +;(function(cordova) { + + function DeviceDetails() {} + + DeviceDetails.prototype.getDetails = function(callback) { + cordova.exec(callback, callback, "DeviceDetails", "getDeviceDetails", []) + } + + DeviceDetails.prototype.getUUID = function(callback) { + cordova.exec(callback, callback, "DeviceDetails", "getDeviceUUID", []) + } + + if (!window.plugins) window.plugins = {} + window.plugins.deviceDetails = new DeviceDetails() + +})(window.cordova || window.Cordova || window.PhoneGap); diff --git a/iOS/DeviceDetails/DeviceDetails.m b/iOS/DeviceDetails/DeviceDetails.m new file mode 100644 index 00000000..efff79bc --- /dev/null +++ b/iOS/DeviceDetails/DeviceDetails.m @@ -0,0 +1,49 @@ +#import "DeviceDetails.h" +#import + +@implementation DeviceDetails + +@synthesize callbackIds = _callbackIds; + +- (NSMutableDictionary*)callbackIds { + if(_callbackIds == nil) { + _callbackIds = [[NSMutableDictionary alloc] init]; + } + return _callbackIds; +} + +- (void)getDeviceDetails:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { + [self.callbackIds setValue:[arguments pop] forKey:@"getDeviceDetails"]; + + NSMutableDictionary *results = [NSMutableDictionary dictionary]; + + // Get the users Device Model, Display Name Token & Version Number + UIDevice *dev = [UIDevice currentDevice]; + [results setValue:dev.uniqueIdentifier forKey:@"deviceUuid"]; + [results setValue:dev.name forKey:@"deviceName"]; + [results setValue:dev.model forKey:@"deviceModel"]; + [results setValue:dev.systemVersion forKey:@"deviceSystemVersion"]; + + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; + [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"getDeviceDetails"]]]; +} + +- (void)getDeviceUUID:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { + [self.callbackIds setValue:[arguments pop] forKey:@"getDeviceUUID"]; + + NSMutableDictionary *results = [NSMutableDictionary dictionary]; + + // Get the users Device UUID + UIDevice *dev = [UIDevice currentDevice]; + [results setValue:dev.uniqueIdentifier forKey:@"deviceUuid"]; + + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; + [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"getDeviceUUID"]]]; +} + +- (void) dealloc { + [_callbackIds dealloc]; + [super dealloc]; +} + +@end diff --git a/iOS/DeviceDetails/README.md b/iOS/DeviceDetails/README.md new file mode 100644 index 00000000..d5c53cc9 --- /dev/null +++ b/iOS/DeviceDetails/README.md @@ -0,0 +1,14 @@ +# Cordova DeviceDetails plugin # + + window.plugins.deviceDetails.getDetails(function(details) { + // {"deviceModel":"iPhone Simulator","deviceName":"iPhone Simulator","deviceSystemVersion":"5.1"} + localStorage.setItem('deviceModel', details.deviceModel) + localStorage.setItem('deviceName', details.deviceName) + localStorage.setItem('deviceSystemVersion', details.deviceSystemVersion) + }) + + // UUID is in a separate call because it got deprecated and requires explicit user permission now + window.plugins.deviceDetails.getUUID(function(response) { + // {"deviceUuid":"AADCC45F-C305-5A7F-96F7-6CF122CD0388"} + localStorage.setItem('deviceUuid', response.deviceUuid) + }) diff --git a/iOS/EmailComposerWithAttachments/EmailComposer.h b/iOS/EmailComposerWithAttachments/EmailComposer.h new file mode 100755 index 00000000..db253196 --- /dev/null +++ b/iOS/EmailComposerWithAttachments/EmailComposer.h @@ -0,0 +1,25 @@ +// +// EmailComposer.h +// +// Version 1.1 +// +// Created by Guido Sabatini in 2012. +// + +#import +#import +#import + + +@interface EmailComposer : CDVPlugin { + + +} + +// UNCOMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +//- (void) showEmailComposer:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +// COMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +- (void) showEmailComposer:(CDVInvokedUrlCommand*)command; + +@end \ No newline at end of file diff --git a/iOS/EmailComposerWithAttachments/EmailComposer.js b/iOS/EmailComposerWithAttachments/EmailComposer.js new file mode 100755 index 00000000..647946cd --- /dev/null +++ b/iOS/EmailComposerWithAttachments/EmailComposer.js @@ -0,0 +1,60 @@ +// window.plugins.emailComposer + +function EmailComposer() { + this.resultCallback = null; // Function +} + +EmailComposer.ComposeResultType = { +Cancelled:0, +Saved:1, +Sent:2, +Failed:3, +NotSent:4 +} + + + +// showEmailComposer : all args optional + +EmailComposer.prototype.showEmailComposer = function(subject,body,toRecipients,ccRecipients,bccRecipients,bIsHTML,attachments) { + var args = {}; + if(toRecipients) + args.toRecipients = toRecipients; + if(ccRecipients) + args.ccRecipients = ccRecipients; + if(bccRecipients) + args.bccRecipients = bccRecipients; + if(subject) + args.subject = subject; + if(body) + args.body = body; + if(bIsHTML) + args.bIsHTML = bIsHTML; + if(attachments) + args.attachments = attachments; + + cordova.exec(null, null, "EmailComposer", "showEmailComposer", [args]); +} + +EmailComposer.prototype.showEmailComposerWithCallback = function(callback, subject, body, toRecipients, ccRecipients, bccRecipients, isHTML, attachments) { + this.resultCallback = callback; + this.showEmailComposer.apply(this,[subject,body,toRecipients,ccRecipients,bccRecipients,isHTML,attachments]); +} + +EmailComposer.prototype._didFinishWithResult = function(res) { + this.resultCallback(res); +} + +cordova.addConstructor(function() { + if(!window.plugins) + { + window.plugins = {}; + } + + // shim to work in 1.5 and 1.6 + if (!window.Cordova) { + window.Cordova = cordova; + }; + + window.plugins.emailComposer = new EmailComposer(); + }); \ No newline at end of file diff --git a/iOS/EmailComposerWithAttachments/EmailComposer.m b/iOS/EmailComposerWithAttachments/EmailComposer.m new file mode 100755 index 00000000..70433932 --- /dev/null +++ b/iOS/EmailComposerWithAttachments/EmailComposer.m @@ -0,0 +1,182 @@ +// +// EmailComposer.m +// +// Version 1.1 +// +// Created by Guido Sabatini in 2012. +// + +#define RETURN_CODE_EMAIL_CANCELLED 0 +#define RETURN_CODE_EMAIL_SAVED 1 +#define RETURN_CODE_EMAIL_SENT 2 +#define RETURN_CODE_EMAIL_FAILED 3 +#define RETURN_CODE_EMAIL_NOTSENT 4 + +#import "EmailComposer.h" +#import + +@interface EmailComposer () + +-(void) showEmailComposerWithParameters:(NSDictionary*)parameters; +-(void) returnWithCode:(int)code; +-(NSString *) getMimeTypeFromFileExtension:(NSString *)extension; + +@end + +@implementation EmailComposer + +// UNCOMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +//- (void) showEmailComposer:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { +// NSDictionary *parameters = [NSDictionary dictionaryWithObjectsAndKeys: +// [options valueForKey:@"toRecipients"], @"toRecipients", +// [options valueForKey:@"ccRecipients"], @"ccRecipients", +// [options valueForKey:@"bccRecipients"], @"bccRecipients", +// [options valueForKey:@"subject"], @"subject", +// [options valueForKey:@"body"], @"body", +// [options valueForKey:@"bIsHTML"], @"bIsHTML", +// [options valueForKey:@"attachments"], @"attachments", +// nil]; +// [self showEmailComposerWithParameters:parameters]; +//} + +// COMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +- (void) showEmailComposer:(CDVInvokedUrlCommand*)command { + NSDictionary *parameters = [command.arguments objectAtIndex:0]; + [self showEmailComposerWithParameters:parameters]; +} + +-(void) showEmailComposerWithParameters:(NSDictionary*)parameters { + + MFMailComposeViewController *mailComposer = [[MFMailComposeViewController alloc] init]; + mailComposer.mailComposeDelegate = self; + + // set subject + @try { + NSString* subject = [parameters objectForKey:@"subject"]; + if (subject) { + [mailComposer setSubject:subject]; + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set subject; error: %@", exception); + } + + // set body + @try { + NSString* body = [parameters objectForKey:@"body"]; + BOOL isHTML = [[parameters objectForKey:@"bIsHTML"] boolValue]; + if(body) { + [mailComposer setMessageBody:body isHTML:isHTML]; + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set body; error: %@", exception); + } + + // Set recipients + @try { + NSArray* toRecipientsArray = [parameters objectForKey:@"toRecipients"]; + if(toRecipientsArray) { + [mailComposer setToRecipients:toRecipientsArray]; + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set TO recipients; error: %@", exception); + } + + @try { + NSArray* ccRecipientsArray = [parameters objectForKey:@"ccRecipients"]; + if(ccRecipientsArray) { + [mailComposer setCcRecipients:ccRecipientsArray]; + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set CC recipients; error: %@", exception); + } + + @try { + NSArray* bccRecipientsArray = [parameters objectForKey:@"bccRecipients"]; + if(bccRecipientsArray) { + [mailComposer setBccRecipients:bccRecipientsArray]; + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set BCC recipients; error: %@", exception); + } + + @try { + int counter = 1; + NSArray *attachmentPaths = [parameters objectForKey:@"attachments"]; + if (attachmentPaths) { + for (NSString* path in attachmentPaths) { + @try { + NSData *data = [[NSFileManager defaultManager] contentsAtPath:path]; + [mailComposer addAttachmentData:data mimeType:[self getMimeTypeFromFileExtension:[path pathExtension]] fileName:[NSString stringWithFormat:@"attachment%d.%@", counter, [path pathExtension]]]; + counter++; + } + @catch (NSException *exception) { + DLog(@"Cannot attach file at path %@; error: %@", path, exception); + } + } + } + } + @catch (NSException *exception) { + NSLog(@"EmailComposer - Cannot set attachments; error: %@", exception); + } + + if (mailComposer != nil) { + [self.viewController presentModalViewController:mailComposer animated:YES]; + } else { + [self returnWithCode:RETURN_CODE_EMAIL_NOTSENT]; + } + [mailComposer release]; +} + + +// Dismisses the email composition interface when users tap Cancel or Send. +// Proceeds to update the message field with the result of the operation. +- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error { + // Notifies users about errors associated with the interface + int webviewResult = 0; + + switch (result) { + case MFMailComposeResultCancelled: + webviewResult = RETURN_CODE_EMAIL_CANCELLED; + break; + case MFMailComposeResultSaved: + webviewResult = RETURN_CODE_EMAIL_SAVED; + break; + case MFMailComposeResultSent: + webviewResult =RETURN_CODE_EMAIL_SENT; + break; + case MFMailComposeResultFailed: + webviewResult = RETURN_CODE_EMAIL_FAILED; + break; + default: + webviewResult = RETURN_CODE_EMAIL_NOTSENT; + break; + } + + [controller dismissModalViewControllerAnimated:YES]; + [self returnWithCode:webviewResult]; +} + +// Call the callback with the specified code +-(void) returnWithCode:(int)code { + [self writeJavascript:[NSString stringWithFormat:@"window.plugins.emailComposer._didFinishWithResult(%d);", code]]; +} + +// Retrieve the mime type from the file extension +-(NSString *) getMimeTypeFromFileExtension:(NSString *)extension { + if (!extension) + return nil; + CFStringRef pathExtension, type; + // Get the UTI from the file's extension + pathExtension = (CFStringRef)extension; + type = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension, NULL); + + // Converting UTI to a mime type + return (NSString *)UTTypeCopyPreferredTagWithClass(type, kUTTagClassMIMEType); +} + +@end \ No newline at end of file diff --git a/iOS/EmailComposerWithAttachments/readme.md b/iOS/EmailComposerWithAttachments/readme.md new file mode 100755 index 00000000..fd6d474d --- /dev/null +++ b/iOS/EmailComposerWithAttachments/readme.md @@ -0,0 +1,56 @@ +# EmailComposer with attachments handling + +**Update: VERSION 1.1** +Now the plugin can handle any type of attachments, not only images or PDFs + +**Description** +This is a modification of the EmailComposer iOS plugin made by **Randy McMillan** +In this version of the plugin, you can attach images and PDF files to emails. A little refactoring was made. +It is compliant with Cordova 2.2.0 standard (new CDVInvokedUrlCommand parameter sent to native methods). If you want to use the plugin with an older version of Cordova you must comment the method + + showEmailComposer:(CDVInvokedUrlCommand*)command; + +and uncomment the method + + showEmailComposer:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +both in EmailComposer.h and EmailComposer.m files + +**IMPORTANT:** You will need to add MessageUI.framework to your project if it is not already included. + +**IMPORTANT:** by now, you can attach only PDF and IMAGES (the latter will be convertend in PNG format) + +- Add the EmailComposer.h EmailComposer.m files to your Plugins Folder. + +- Place the EmailComposer.js file somewhere in your www folder, and include it from your html. + +- Add to Cordova.plist Plugins: key **EmailComposer** value **EmailComposer** + +Callable interface: + + window.plugins.emailComposer.showEmailComposerWithCallback(callback,subject,body,toRecipients,ccRecipients,bccRecipients,isHtml,attachments); + +or + + window.plugins.emailComposer.showEmailComposer(subject,body,toRecipients,ccRecipients,bccRecipients,isHtml,attachments); + +**Parameters:** +- callback: a js function that will receive return parameter from the plugin +- subject: a string representing the subject of the email; can be null +- body: a string representing the email body (could be HTML code, in this case set **isHtml** to **true**); can be null +- toRecipients: a js array containing all the email addresses for TO field; can be null/empty +- ccRecipients: a js array containing all the email addresses for CC field; can be null/empty +- bccRecipients: a js array containing all the email addresses for BCC field; can be null/empty +- isHtml: a bool value indicating if the body is HTML or plain text +- attachments: a js array containing all full paths to the files you want to attach; can be null/empty + +**Example** + + window.plugins.emailComposer.showEmailComposerWithCallback(function(result){console.log(result);},"Look at this photo","Take a look at this:",["example@email.com", "johndoe@email.org"],[],[],true,["_complete_path/image.jpg"]); + +**Return values** +- 0: email composition cancelled (cancel button pressed and draft not saved) +- 1: email saved (cancel button pressed but draft saved) +- 2: email sent +- 3: send failed +- 4: email not sent (something wrong happened) diff --git a/iOS/FacebookConnect/README.md b/iOS/FacebookConnect/README.md new file mode 100644 index 00000000..628d06ea --- /dev/null +++ b/iOS/FacebookConnect/README.md @@ -0,0 +1,49 @@ +# Cordova FacebookConnect Plugin # +by [Olivier Louvignes](http://olouv.com) + +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-facebook-connect/tree/master) +--- + +## DESCRIPTION ## + +* This plugin provides a simple way to use Facebook Graph API in Cordova. + +* This plugin is built for Cordova >= v2.1.0 with ARC. Both iOS & Android are supported with the same javascript interface. + +* For iOS, this plugin relies on the [Facebook iOS SDK](https://github.com/facebook/facebook-ios-sdk) that is bundled in the `FacebookSDK` folder (licensed under the Apache License, Version 2.0). + +* For Android, this plugin relies on the [Facebook Android SDK](https://github.com/facebook/facebook-android-sdk) that is packaged as a .jar in the `libs` folder (licensed under the Apache License, Version 2.0). + +* Regarding the existing implementation : [phonegap-plugin-facebook-connect](https://github.com/davejohnson/phonegap-plugin-facebook-connect) built by Dave Johnson, this version does not require the Facebook JS sdk (redundant to native sdk). It is also quite easier to use (unified login & initial /me request) and it does support multiple graph requests (strong callback handling). + +## LICENSE ## + + The MIT License + + Copyright (c) 2012 Olivier Louvignes + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +## CREDITS ## + +Contributors : + +* [Olivier Louvignes](http://olouv.com), author. + diff --git a/iOS/Filepicker/README.md b/iOS/Filepicker/README.md new file mode 100644 index 00000000..e9d641de --- /dev/null +++ b/iOS/Filepicker/README.md @@ -0,0 +1,48 @@ +# Cordova Filepicker Plugin # +by [Albert Swantner](http://albertut.com) +and [Jon Uy](http://github.com/jonuy) + +--- +### [This plugin is hosted by the author](https://github.com/albertut/cordova-filepicker) +--- + +## DESCRIPTION ## + +* This plugin provides a simple way to use the `Filepicker.io` native SDK from iOS. + +* This plugin is built for Cordova >= v2.1.0 with ARC. + +[![Screenshot](http://albertut.com/filepicker_ios.png)](https://github.com/albertut/cordova-filepicker) + +## LICENSE ## + + The MIT License + + Copyright (c) 2012 Albert Swantner and Jon Uy + + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. + +## CREDITS ## + +Contributors : + +* [Albert Swantner](http://www.albertut.com), author. +* [Jon Uy](https://github.com/jonuy), author. + + diff --git a/iOS/GameCenter/README.md b/iOS/GameCenter/README.md new file mode 100644 index 00000000..d7310841 --- /dev/null +++ b/iOS/GameCenter/README.md @@ -0,0 +1,20 @@ +# Game Center Plugin: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-gameCenter](https://github.com/Wizcorp/phonegap-plugin-gameCenter) + +-------------- + +# Description : + +PhoneGap plugin for; + +integrating Game Center in a Phonegap iOS app/game. + + +-------------- + +# License : MIT + +# Original Author : [https://github.com/phyx3r](https://github.com/phyx3r) + +# Updates and Modifications : [https://github.com/Wizcorp](https://github.com/Wizcorp) \ No newline at end of file diff --git a/iOS/Geofencing/DGGeofencing.js b/iOS/Geofencing/DGGeofencing.js new file mode 100644 index 00000000..7590e06b --- /dev/null +++ b/iOS/Geofencing/DGGeofencing.js @@ -0,0 +1,59 @@ +/** + * Geofencing.js + * + * Phonegap Geofencing Plugin + * Copyright (c) Dov Goldberg 2012 + * http://www.ogonium.com + * dov.goldberg@ogonium.com + * + */ +var DGGeofencing = { + /* + Params: + #define KEY_REGION_ID @"fid" + #define KEY_REGION_LAT @"latitude" + #define KEY_REGION_LNG @"longitude" + #define KEY_REGION_RADIUS @"radius" + #define KEY_REGION_ACCURACY @"accuracy" + */ + addRegion: function(params, success, fail) { + return PhoneGap.exec(success, fail, "DGGeofencing", "addRegion", [params]); + }, + + /* + Params: + #define KEY_REGION_ID @"fid" + #define KEY_REGION_LAT @"latitude" + #define KEY_REGION_LNG @"longitude" + */ + removeRegion: function(params, success, fail) { + return PhoneGap.exec(success, fail, "DGGeofencing", "removeRegion", [params]); + }, + + /* + Params: + NONE + */ + getWatchedRegionIds: function(success, fail) { + return PhoneGap.exec(success, fail, "DGGeofencing", "getWatchedRegionIds", []); + }, + + /* + Params: + NONE + */ + getPendingRegionUpdates: function(success, fail) { + return PhoneGap.exec(success, fail, "DGGeofencing", "getPendingRegionUpdates", []); + }, + + /* + This is used so the JavaScript can be updated when a region is entered or exited + */ + regionMonitorUpdate: function(regionupdate) { + console.log("regionMonitorUpdate: " + regionupdate); + var ev = document.createEvent('HTMLEvents'); + ev.regionupdate = regionupdate; + ev.initEvent('region-update', true, true, arguments); + document.dispatchEvent(ev); + } +}; \ No newline at end of file diff --git a/iOS/Geofencing/Geofencing/DGGeofencing.h b/iOS/Geofencing/Geofencing/DGGeofencing.h new file mode 100644 index 00000000..5d6ab23e --- /dev/null +++ b/iOS/Geofencing/Geofencing/DGGeofencing.h @@ -0,0 +1,75 @@ +// +// Geofencing.h +// TikalTimeTracker +// Sections of this code adapted from Apache Cordova +// +// Created by Dov Goldberg on 5/3/12. +// Copyright (c) 2012 Ogonium. All rights reserved. +// + +#import +#import + +#import + +#import "DGGeofencingHelper.h" + +#define KEY_REGION_ID @"fid" +#define KEY_REGION_LAT @"latitude" +#define KEY_REGION_LNG @"longitude" +#define KEY_REGION_RADIUS @"radius" +#define KEY_REGION_ACCURACY @"accuracy" + +enum DGLocationStatus { + PERMISSIONDENIED = 1, + POSITIONUNAVAILABLE, + TIMEOUT, + REGIONMONITORINGPERMISSIONDENIED, + REGIONMONITORINGUNAVAILABLE +}; +typedef NSInteger DGLocationStatus; + +enum DGLocationAccuracy { + DGLocationAccuracyBestForNavigation, + DGLocationAccuracyBest, + DGLocationAccuracyNearestTenMeters, + DGLocationAccuracyHundredMeters, + DGLocationAccuracyThreeKilometers +}; +typedef NSInteger DGLocationAccuracy; + +// simple ojbect to keep track of location information +@interface DGLocationData : NSObject + +@property (nonatomic, assign) DGLocationStatus locationStatus; +@property (nonatomic, retain) CLLocation* locationInfo; +@property (nonatomic, retain) NSMutableArray* locationCallbacks; + +@end + +@interface DGGeofencing : CDVPlugin + +//@property (nonatomic, retain) CLLocationManager *locationManager; +@property (nonatomic, retain) DGLocationData* locationData; + +- (BOOL) isLocationServicesEnabled; +- (BOOL) isAuthorized; +- (BOOL) isRegionMonitoringAvailable; +- (BOOL) isRegionMonitoringEnabled; +- (void) saveGeofenceCallbackId:(NSString *) callbackId; +- (void) addRegionToMonitor:(NSMutableDictionary *)params; +- (void) removeRegionToMonitor:(NSMutableDictionary *)params; + +- (void) returnLocationError: (NSUInteger) errorCode withMessage: (NSString*) message; +- (void) returnRegionSuccess; + +#pragma mark Plugin Functions +- (void) addRegion:(CDVInvokedUrlCommand*)command; +- (void) removeRegion:(CDVInvokedUrlCommand*)command; +- (void) getWatchedRegionIds:(CDVInvokedUrlCommand*)command; +- (void) getPendingRegionUpdates:(CDVInvokedUrlCommand*)command; +//- (void)addRegion:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; +//- (void)removeRegion:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; +//- (void)getWatchedRegionIds:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +@end diff --git a/iOS/Geofencing/Geofencing/DGGeofencing.m b/iOS/Geofencing/Geofencing/DGGeofencing.m new file mode 100644 index 00000000..161b5901 --- /dev/null +++ b/iOS/Geofencing/Geofencing/DGGeofencing.m @@ -0,0 +1,334 @@ +// +// Geofencing.m +// TikalTimeTracker +// +// Created by Dov Goldberg on 5/3/12. +// Copyright (c) 2012 __MyCompanyName__. All rights reserved. +// + +#import "DGGeofencing.h" +#import + +@implementation DGLocationData + +@synthesize locationStatus, locationInfo, locationCallbacks; + +-(DGLocationData*) init +{ + self = (DGLocationData*)[super init]; + if (self) + { + self.locationInfo = nil; + self.locationCallbacks = nil; + [CDVPluginResult setVerbose:YES]; + } + return self; +} +-(void) dealloc +{ + self.locationInfo = nil; + self.locationCallbacks = nil; + [super dealloc]; +} + +@end + +@implementation DGGeofencing + +@synthesize locationData; + +- (CDVPlugin*) initWithWebView:(UIWebView*)theWebView +{ + self = (DGGeofencing*)[super initWithWebView:(UIWebView*)theWebView]; + if (self) + { + //self.locationManager = [[[CLLocationManager alloc] init] autorelease]; + //self.locationManager.delegate = self; // Tells the location manager to send updates to this object + self.locationData = nil; + } + return self; +} + +- (void) dealloc +{ + //self.locationManager.delegate = nil; + //self.locationManager = nil; + [super dealloc]; +} + +- (BOOL) isRegionMonitoringAvailable +{ + BOOL regionMonitoringAvailableClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(regionMonitoringAvailable)]; + if (regionMonitoringAvailableClassPropertyAvailable) + { + BOOL regionMonitoringAvailable = [CLLocationManager regionMonitoringAvailable]; + return (regionMonitoringAvailable); + } + + // by default, assume NO + return NO; +} + +- (BOOL) isRegionMonitoringEnabled +{ + BOOL regionMonitoringEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(regionMonitoringEnabled)]; + if (regionMonitoringEnabledClassPropertyAvailable) + { + BOOL regionMonitoringEnabled = [CLLocationManager regionMonitoringEnabled]; + return (regionMonitoringEnabled); + } + + // by default, assume NO + return NO; +} + +- (BOOL) isAuthorized +{ + BOOL authorizationStatusClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ + if (authorizationStatusClassPropertyAvailable) + { + NSUInteger authStatus = [CLLocationManager authorizationStatus]; + return (authStatus == kCLAuthorizationStatusAuthorized) || (authStatus == kCLAuthorizationStatusNotDetermined); + } + + // by default, assume YES (for iOS < 4.2) + return YES; +} + +- (BOOL) isLocationServicesEnabled +{ + BOOL locationServicesEnabledInstancePropertyAvailable = [[[DGGeofencingHelper sharedGeofencingHelper] locationManager] respondsToSelector:@selector(locationServicesEnabled)]; // iOS 3.x + BOOL locationServicesEnabledClassPropertyAvailable = [CLLocationManager respondsToSelector:@selector(locationServicesEnabled)]; // iOS 4.x + + if (locationServicesEnabledClassPropertyAvailable) + { // iOS 4.x + return [CLLocationManager locationServicesEnabled]; + } + else if (locationServicesEnabledInstancePropertyAvailable) + { // iOS 2.x, iOS 3.x + return [(id)[[DGGeofencingHelper sharedGeofencingHelper] locationManager] locationServicesEnabled]; + } + else + { + return NO; + } +} + +- (void) saveGeofenceCallbackId:(NSString *) callbackId { + NSLog(@"callbackId: %@", callbackId); + if (!self.locationData) { + self.locationData = [[[DGLocationData alloc] init] autorelease]; + } + + DGLocationData* lData = self.locationData; + if (!lData.locationCallbacks) { + lData.locationCallbacks = [NSMutableArray array];//]WithCapacity:1]; + } + + // add the callbackId into the array so we can call back when get data + [lData.locationCallbacks enqueue:callbackId]; +} + +- (void) returnRegionSuccess; { + NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2]; + [posError setObject: [NSNumber numberWithInt: CDVCommandStatus_OK] forKey:@"code"]; + [posError setObject: @"Region Success" forKey: @"message"]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:posError]; + NSString *callbackId = [self.locationData.locationCallbacks dequeue]; + if (callbackId) { + [self writeJavascript:[result toSuccessCallbackString:callbackId]]; + } +} + +- (void)returnLocationError: (NSUInteger) errorCode withMessage: (NSString*) message +{ + NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2]; + [posError setObject: [NSNumber numberWithInt: errorCode] forKey:@"code"]; + [posError setObject: message ? message : @"" forKey: @"message"]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError]; + NSString *callbackId = [self.locationData.locationCallbacks dequeue]; + if (callbackId) { + [self writeJavascript:[result toErrorCallbackString:callbackId]]; + } +} + +#pragma mark Plugin Functions + +- (void)addRegion:(CDVInvokedUrlCommand*)command { + + NSString* callbackId = command.callbackId; + + [self saveGeofenceCallbackId:callbackId]; + + if (![self isLocationServicesEnabled]) + { + BOOL forcePrompt = NO; + if (!forcePrompt) + { + [self returnLocationError:PERMISSIONDENIED withMessage: nil]; + return; + } + } + + if (![self isAuthorized]) + { + NSString* message = nil; + BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ + if (authStatusAvailable) { + NSUInteger code = [CLLocationManager authorizationStatus]; + if (code == kCLAuthorizationStatusNotDetermined) { + // could return POSITION_UNAVAILABLE but need to coordinate with other platforms + message = @"User undecided on application's use of location services"; + } else if (code == kCLAuthorizationStatusRestricted) { + message = @"application use of location services is restricted"; + } + } + //PERMISSIONDENIED is only PositionError that makes sense when authorization denied + [self returnLocationError:PERMISSIONDENIED withMessage: message]; + + return; + } + + if (![self isRegionMonitoringAvailable]) + { + [self returnLocationError:REGIONMONITORINGUNAVAILABLE withMessage: @"Region monitoring is unavailable"]; + return; + } + + if (![self isRegionMonitoringEnabled]) + { + [self returnLocationError:REGIONMONITORINGPERMISSIONDENIED withMessage: @"User has restricted the use of region monitoring"]; + return; + } + NSMutableDictionary *options; + [command legacyArguments:nil andDict:&options]; + [self addRegionToMonitor:options]; + + [self returnRegionSuccess]; +} + +- (void) getPendingRegionUpdates:(CDVInvokedUrlCommand*)command { + NSString* callbackId = command.callbackId; + + NSString *path = [DGGeofencingHelper applicationDocumentsDirectory]; + NSString *finalPath = [path stringByAppendingPathComponent:@"notifications.dg"]; + NSMutableArray *updates = [NSMutableArray arrayWithContentsOfFile:finalPath]; + + if (updates) { + NSError *error; + [[NSFileManager defaultManager] removeItemAtPath:finalPath error:&error]; + } else { + updates = [NSMutableArray array]; + } + + NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:3]; + [posError setObject: [NSNumber numberWithInt: CDVCommandStatus_OK] forKey:@"code"]; + [posError setObject: @"Region Success" forKey: @"message"]; + [posError setObject: updates forKey: @"pendingupdates"]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:posError]; + if (callbackId) { + [self writeJavascript:[result toSuccessCallbackString:callbackId]]; + } + NSLog(@"pendingupdates: %@", updates); +} + +- (void) addRegionToMonitor:(NSMutableDictionary *)params { + // Parse Incoming Params + NSString *regionId = [params objectForKey:KEY_REGION_ID]; + NSString *latitude = [params objectForKey:KEY_REGION_LAT]; + NSString *longitude = [params objectForKey:KEY_REGION_LNG]; + double radius = [[params objectForKey:KEY_REGION_RADIUS] doubleValue]; + + CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([latitude doubleValue], [longitude doubleValue]); + CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:coord radius:radius identifier:regionId]; + [[[DGGeofencingHelper sharedGeofencingHelper] locationManager] startMonitoringForRegion:region desiredAccuracy:kCLLocationAccuracyBestForNavigation]; + [region release]; +} + +- (void) removeRegionToMonitor:(NSMutableDictionary *)params { + // Parse Incoming Params + NSString *regionId = [params objectForKey:KEY_REGION_ID]; + NSString *latitude = [params objectForKey:KEY_REGION_LAT]; + NSString *longitude = [params objectForKey:KEY_REGION_LNG]; + + CLLocationCoordinate2D coord = CLLocationCoordinate2DMake([latitude doubleValue], [longitude doubleValue]); + CLRegion *region = [[CLRegion alloc] initCircularRegionWithCenter:coord radius:10.0 identifier:regionId]; + [[[DGGeofencingHelper sharedGeofencingHelper] locationManager] stopMonitoringForRegion:region]; + [region release]; +} + +- (void)removeRegion:(CDVInvokedUrlCommand*)command { + + NSString* callbackId = command.callbackId; + + [self saveGeofenceCallbackId:callbackId]; + + if (![self isLocationServicesEnabled]) + { + BOOL forcePrompt = NO; + if (!forcePrompt) + { + [self returnLocationError:PERMISSIONDENIED withMessage: nil]; + return; + } + } + + if (![self isAuthorized]) + { + NSString* message = nil; + BOOL authStatusAvailable = [CLLocationManager respondsToSelector:@selector(authorizationStatus)]; // iOS 4.2+ + if (authStatusAvailable) { + NSUInteger code = [CLLocationManager authorizationStatus]; + if (code == kCLAuthorizationStatusNotDetermined) { + // could return POSITION_UNAVAILABLE but need to coordinate with other platforms + message = @"User undecided on application's use of location services"; + } else if (code == kCLAuthorizationStatusRestricted) { + message = @"application use of location services is restricted"; + } + } + //PERMISSIONDENIED is only PositionError that makes sense when authorization denied + [self returnLocationError:PERMISSIONDENIED withMessage: message]; + + return; + } + + if (![self isRegionMonitoringAvailable]) + { + [self returnLocationError:REGIONMONITORINGUNAVAILABLE withMessage: @"Region monitoring is unavailable"]; + return; + } + + if (![self isRegionMonitoringEnabled]) + { + [self returnLocationError:REGIONMONITORINGPERMISSIONDENIED withMessage: @"User has restricted the use of region monitoring"]; + return; + } + NSMutableDictionary *options; + [command legacyArguments:nil andDict:&options]; + [self removeRegionToMonitor:options]; + + [self returnRegionSuccess]; +} + +- (void)getWatchedRegionIds:(CDVInvokedUrlCommand*)command { + NSString* callbackId = command.callbackId; + + NSSet *regions = [[DGGeofencingHelper sharedGeofencingHelper] locationManager].monitoredRegions; + NSMutableArray *watchedRegions = [NSMutableArray array]; + for (CLRegion *region in regions) { + [watchedRegions addObject:region.identifier]; + } + NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:3]; + [posError setObject: [NSNumber numberWithInt: CDVCommandStatus_OK] forKey:@"code"]; + [posError setObject: @"Region Success" forKey: @"message"]; + [posError setObject: watchedRegions forKey: @"regionids"]; + CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:posError]; + if (callbackId) { + [self writeJavascript:[result toSuccessCallbackString:callbackId]]; + } + NSLog(@"watchedRegions: %@", watchedRegions); +} + +#pragma mark Core Location Delegates + +@end diff --git a/iOS/Geofencing/Geofencing/DGGeofencingHelper.h b/iOS/Geofencing/Geofencing/DGGeofencingHelper.h new file mode 100644 index 00000000..eb11efe4 --- /dev/null +++ b/iOS/Geofencing/Geofencing/DGGeofencingHelper.h @@ -0,0 +1,25 @@ +// +// DGGeofencingHelper.h +// Geofencing +// +// Created by Dov Goldberg on 10/18/12. +// +// + +#import +#import +#import + +@class CDVCordovaView; +@interface DGGeofencingHelper : NSObject + +@property (nonatomic, retain) CLLocationManager *locationManager; +@property (nonatomic, assign) CDVCordovaView *webView; +@property (nonatomic, assign) BOOL didLaunchForRegionUpdate; + ++(DGGeofencingHelper*)sharedGeofencingHelper; + +- (void) dispose; ++ (NSString*) applicationDocumentsDirectory; + +@end diff --git a/iOS/Geofencing/Geofencing/DGGeofencingHelper.m b/iOS/Geofencing/Geofencing/DGGeofencingHelper.m new file mode 100644 index 00000000..4fda24e5 --- /dev/null +++ b/iOS/Geofencing/Geofencing/DGGeofencingHelper.m @@ -0,0 +1,125 @@ +// +// DGGeofencingHelper.m +// Geofencing +// +// Created by Dov Goldberg on 10/18/12. +// +// + +#import "DGGeofencingHelper.h" +#import + +static DGGeofencingHelper *sharedGeofencingHelper = nil; + +@implementation DGGeofencingHelper + +@synthesize webView; +@synthesize locationManager; +@synthesize didLaunchForRegionUpdate; + +- (void) locationManager:(CLLocationManager *)manager didEnterRegion:(CLRegion *)region +{ + if (self.didLaunchForRegionUpdate) { + NSString *path = [DGGeofencingHelper applicationDocumentsDirectory]; + NSString *finalPath = [path stringByAppendingPathComponent:@"notifications.dg"]; + NSMutableArray *updates = [NSMutableArray arrayWithContentsOfFile:finalPath]; + + if (!updates) { + updates = [NSMutableArray array]; + } + + NSMutableDictionary *update = [NSMutableDictionary dictionary]; + + [update setObject:region.identifier forKey:@"fid"]; + [update setObject:[NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]] forKey:@"timestamp"]; + [update setObject:@"enter" forKey:@"status"]; + + [updates addObject:update]; + + [updates writeToFile:finalPath atomically:YES]; + } else { + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + [dict setObject:@"enter" forKey:@"status"]; + [dict setObject:region.identifier forKey:@"fid"]; + NSString *jsStatement = [NSString stringWithFormat:@"DGGeofencing.regionMonitorUpdate(%@);", [dict cdvjk_JSONString]]; + [self.webView stringByEvaluatingJavaScriptFromString:jsStatement]; + } +} + +- (void) locationManager:(CLLocationManager *)manager didExitRegion:(CLRegion *)region +{ + if (self.didLaunchForRegionUpdate) { + NSString *path = [DGGeofencingHelper applicationDocumentsDirectory]; + NSString *finalPath = [path stringByAppendingPathComponent:@"notifications.dg"]; + NSMutableArray *updates = [NSMutableArray arrayWithContentsOfFile:finalPath]; + + if (!updates) { + updates = [NSMutableArray array]; + } + + NSMutableDictionary *update = [NSMutableDictionary dictionary]; + + [update setObject:region.identifier forKey:@"fid"]; + [update setObject:[NSNumber numberWithDouble:[[NSDate date] timeIntervalSince1970]] forKey:@"timestamp"]; + [update setObject:@"left" forKey:@"status"]; + + [updates addObject:update]; + + [updates writeToFile:finalPath atomically:YES]; + } else { + NSMutableDictionary *dict = [NSMutableDictionary dictionary]; + [dict setObject:@"left" forKey:@"status"]; + [dict setObject:region.identifier forKey:@"fid"]; + NSString *jsStatement = [NSString stringWithFormat:@"DGGeofencing.regionMonitorUpdate(%@);", [dict cdvjk_JSONString]]; + [self.webView stringByEvaluatingJavaScriptFromString:jsStatement]; + } +} + +- (void)locationManager:(CLLocationManager *)manager monitoringDidFailForRegion:(CLRegion *)region withError:(NSError *)error { +#pragma mark TODO - Monitoring Failure Callback +// NSMutableDictionary* posError = [NSMutableDictionary dictionaryWithCapacity:2]; +// [posError setObject: [NSNumber numberWithInt: error.code] forKey:@"code"]; +// [posError setObject: region.identifier forKey: @"regionid"]; +// CDVPluginResult* result = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:posError]; +// NSString *callbackId = [self.locationData.locationCallbacks dequeue]; +// if (callbackId) { +// [self writeJavascript:[result toErrorCallbackString:callbackId]]; +// } +} + +- (id) init { + self = [super init]; + if (self) { + self.locationManager = [[CLLocationManager alloc] init]; + self.locationManager.delegate = self; // Tells the location manager to send updates to this object + } + return self; +} + ++(DGGeofencingHelper *)sharedGeofencingHelper +{ + //objects using shard instance are responsible for retain/release count + //retain count must remain 1 to stay in mem + + if (!sharedGeofencingHelper) + { + sharedGeofencingHelper = [[DGGeofencingHelper alloc] init]; + } + + return sharedGeofencingHelper; +} + +- (void) dispose { + locationManager.delegate = nil; + [locationManager release]; + [sharedGeofencingHelper release]; +} + ++ (NSString*) applicationDocumentsDirectory +{ + NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); + NSString *basePath = ([paths count] > 0) ? [paths objectAtIndex:0] : nil; + return basePath; +} + +@end diff --git a/iOS/Geofencing/README.md b/iOS/Geofencing/README.md new file mode 100644 index 00000000..3c3c4c1d --- /dev/null +++ b/iOS/Geofencing/README.md @@ -0,0 +1,166 @@ +PhoneGap-Geofencing +=================== + +Geofencing Plugin For PhoneGap. + +## DESCRIPTION ## + +* This plugin provides a simple way to use iOS Region Monitoring in PhoneGap applications. +* Simple JS interface is exposed to allow the adding and removing of regions to monitor. +* Included ability to receive realtime region notifications when regions are entered and exited. + +## WHAT IS GEOFENCING ## + +Geofencing is a way to monitor geographic regions. In iOS it allows an app to be informed when a specified geographic region is entered or exited. + +## SETUP ## + +Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). + +1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) +2. Drag and drop the DGGeofencing.h and DGGeofencing.m files from the DGGeofencing folder in Finder to your Plugins folder in XCode. +3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files using + +4. Add new entry with key `DGGeofencing` and value `DGGeofencing` to `Plugins` in `Cordova.plist/Cordova.plist` + +## INCLUDED FUNTIONS ## + +DGGeofencing.js contains the following functions: + +1. addRegion - Adds a new region to be monitored. +2. removeRegion - Clears an existing region from being monitored. +3. getWatchedRegionIds - Returns a list of currently monitored region identifiers. + +## PLUGIN CODE EXAMPLE ## + +To add a new region to be monitored use the DGGeofencing addRegion function. +The parameters are: + +1. fid - String - This is a unique identifier. +2. radius - Integer - Specifies the radius in meters of the region. +3. latitude - String - latitude of the region. +4. longitude - String - latitude of the region. + +Example: + + var params = {"fid": location.id, "radius": 15, "latitude": location.lat, "longitude": location.lng}; + console.log(params); + DGGeofencing.addRegion( + params, + function(result) { + console.log("add success"); + }, + function(error) { + alert("failed to add region"); + } + ); + +To remove an existing region use the DGGeofencing removeRegion function. +The parameters are: +1. fid - String - This is a unique identifier. +2. latitude - String - latitude of the region. +3. longitude - String - latitude of the region. + +Example: + + var params = {"fid": item.fid, "latitude": item.latitude, "longitude": item.longitude}; + DGGeofencing.removeRegion( + params, + function(result) { + alert("delete success") + }, + function(error) { + alert("delete error"); + } + ); + +To retrieve the list of identifiers of currently monitored regions use the DGGeofencing getWatchedRegionIds function. +No parameters. + +The result object contains an array of strings in regionids + +Example: + + DGGeofencing.getWatchedRegionIds( + function(result) { + alert("success: " + result.regionids) + }, + function(error) { + alert("error"); + } + ); + +## HOW TO SETUP REGION NOTIFICATIONS ## + +Of course adding and removing monitored regions would be useless without the ability to receive real time notifications when region boundries are crossed. +This setup will allow the JavaScript to receive updates both when the app is running and not running. + +Follow these steps to setup region notifications when the app is running: + +1. Drag and drop the DGGeofencingHelper.h and DGGeofencingHelper.m files from the DGGeofencing folder in Finder to your Plugins folder in XCode. +2. Add the following code to the viewDidLoad function in the MainViewController.m file after [super viewDidLoad]; + +
[[DGGeofencingHelper sharedGeofencingHelper] setWebView:self.webView];
+ +3. Make sure to import DGGeofencingHelper.h in the MainViewController.m file. +4. In your JavaScript add the following code in the same place where you process the documentReady event. + +
document.addEventListener("region-update", function(event) {
+		var fid = event.regionupdate.fid;
+		var status = event.regionupdate.status;
+	});
+ +When the app is not running, even in the background, region notifications are saved as they come in. +In order to retrieve these pending region notifications follow these instructions. + +1. Add the following code in the app delegate - (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions + +
    if ([[launchOptions allKeys] containsObject:UIApplicationLaunchOptionsLocationKey]) {
+    [[DGGeofencingHelper sharedGeofencingHelper] setDidLaunchForRegionUpdate:YES];
+} else {
+    [[DGGeofencingHelper sharedGeofencingHelper] setDidLaunchForRegionUpdate:NO];
+}
+ +2. In the JavaScript you will need to use the following code to retrieve these notifications. + +
    DGGeofencing.getPendingRegionUpdates(
+			function(result) { 
+				var updates = result.pendingupdates;
+				$(updates).each(function(index, update){
+					var fid = update.fid;
+					var status = update.status;
+					var timestamp = update.timestamp;
+					console.log("fid: " + fid + " status: " + status + " timestamp: " + timestamp);
+				});   
+	      	},
+	      	function(error) {   
+		  		alert("failed");
+	      	}
+		);
+ +## USAGE SAMPLE CODE ## + +Feel free to take a look at a project I have made that uses the above plugin. +You can find this project in my github repository [Phonegap-Geofencing](https://github.com/radshag/PhoneGap-Geofencing/tree/master/iOS/Sample). + +## QUESTIONS AND COMMENTS ## + +All questions and comments are welcome. Please do so on my [GitHub Page](https://github.com/radshag/PhoneGap-Geofencing/issues). + +The latest version of the DGGeofencing plugin can always be found [here](https://github.com/radshag/PhoneGap-Geofencing/tree/master/iOS/DGGeofencing). + +## LICENSE ## + +The MIT License + +Copyright (c) 2012 Dov Goldberg +EMAIL: dov.goldberg@ogonium.com +WEBSITE: http://www.ogonium.com + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.h b/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.h index 67238595..c0c499d7 100644 --- a/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.h +++ b/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.h @@ -9,11 +9,7 @@ // #import -#ifdef CORDOVA_FRAMEWORK #import -#else -#import "CDVPlugin.h" -#endif #import "GANTracker.h" @interface GoogleAnalyticsPlugin : CDVPlugin { diff --git a/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.js b/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.js index 9d274920..3628fe94 100755 --- a/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.js +++ b/iOS/GoogleAnalytics/GoogleAnalyticsPlugin.js @@ -12,7 +12,7 @@ GoogleAnalyticsPlugin.prototype.trackEvent = function(category,action,label,valu var options = {category:category, action:action, label:label, - value:value}; + value:isNaN(parseInt(value)) ? -1 : value}; cordova.exec("GoogleAnalyticsPlugin.trackEvent",options); }; diff --git a/iOS/ImageRecognition-Moodstocks/README.md b/iOS/ImageRecognition-Moodstocks/README.md new file mode 100644 index 00000000..7bc3b76a --- /dev/null +++ b/iOS/ImageRecognition-Moodstocks/README.md @@ -0,0 +1,21 @@ +# Moodstocks SDK PhoneGap plugin + +This is a PhoneGap plugin that uses Moodstocks real-time on-device image recognition SDK. We provide a demo application to help you get started. + +So far we only support the iOS platform (tested with PhoneGap v2.3). The Android version is under development. + +This plugin is hosted at: [https://github.com/Moodstocks/moodstocks-phonegap-demo-app](https://github.com/Moodstocks/moodstocks-phonegap-demo-app) + +## Real-time on-device image recognition SDK + +The Moodstocks SDK provides a scanner for mobile devices. It recognizes both barcodes and images. Scanning operates on the client-side which lets you create nice augmented reality overlays. Also it even works off-line thanks to a built-in, easy-to-use on-device image signatures synchronization. + +To get started (for free!) create an account on [Moodstocks Developer Center](https://developers.moodstocks.com/) and follow the instructions. + +## Help + +Need help? Check out our [Help Center](http://help.moodstocks.com/). + +## Copyright + +Copyright (c) 2013 [Moodstocks SAS](http://www.moodstocks.com) diff --git a/iOS/InAppPurchaseManager/InAppPurchaseManager.m b/iOS/InAppPurchaseManager/InAppPurchaseManager.m index 79efd126..ee806137 100644 --- a/iOS/InAppPurchaseManager/InAppPurchaseManager.m +++ b/iOS/InAppPurchaseManager/InAppPurchaseManager.m @@ -14,18 +14,18 @@ // To avoid compilation warning, declare JSONKit and SBJson's // category methods without including their header files. @interface NSArray (StubsForSerializers) -- (NSString *)JSONString; -- (NSString *)JSONRepresentation; +- (NSString *)cdvjk_JSONString; +- (NSString *)cdvjk_JSONRepresentation; @end // Helper category method to choose which JSON serializer to use. -@interface NSArray (JSONSerialize) -- (NSString *)JSONSerialize; +@interface NSArray (cdvjk_JSONSerialize) +- (NSString *)cdvjk_JSONSerialize; @end -@implementation NSArray (JSONSerialize) -- (NSString *)JSONSerialize { - return [self respondsToSelector:@selector(JSONString)] ? [self JSONString] : [self JSONRepresentation]; +@implementation NSArray (cdvjk_JSONSerialize) +- (NSString *)cdvjk_JSONSerialize { + return [self respondsToSelector:@selector(cdvjk_JSONString)] ? [self cdvjk_JSONString] : [self cdvjk_JSONRepresentation]; } @end @@ -153,7 +153,7 @@ - (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)tran NILABLE(productId), NILABLE(transactionReceipt), nil]; - NSString *js = [NSString stringWithFormat:@"plugins.inAppPurchaseManager.updatedTransactionCallback.apply(plugins.inAppPurchaseManager, %@)", [callbackArgs JSONSerialize]]; + NSString *js = [NSString stringWithFormat:@"plugins.inAppPurchaseManager.updatedTransactionCallback.apply(plugins.inAppPurchaseManager, %@)", [callbackArgs cdvjk_JSONSerialize]]; NSLog(@"js: %@", js); [self writeJavascript: js]; [[SKPaymentQueue defaultQueue] finishTransaction:transaction]; @@ -191,7 +191,7 @@ - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProdu NILABLE(product.localizedDescription), NILABLE(product.localizedPrice), nil]; - NSString *js = [NSString stringWithFormat:@"%@.apply(plugins.inAppPurchaseManager, %@)", successCallback, [callbackArgs JSONSerialize]]; + NSString *js = [NSString stringWithFormat:@"%@.apply(plugins.inAppPurchaseManager, %@)", successCallback, [callbackArgs cdvjk_JSONSerialize]]; NSLog(@"js: %@", js); [command writeJavascript: js]; } @@ -245,7 +245,7 @@ - (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProdu NILABLE(validProducts), NILABLE(response.invalidProductIdentifiers), nil]; - NSString *js = [NSString stringWithFormat:@"%@.apply(plugins.inAppPurchaseManager, %@);", callback, [callbackArgs JSONSerialize]]; + NSString *js = [NSString stringWithFormat:@"%@.apply(plugins.inAppPurchaseManager, %@);", callback, [callbackArgs cdvjk_JSONSerialize]]; [command writeJavascript: js]; [request release]; diff --git a/iOS/Instagram/README.md b/iOS/Instagram/README.md new file mode 100644 index 00000000..2bf2a08a --- /dev/null +++ b/iOS/Instagram/README.md @@ -0,0 +1,14 @@ +# Instagram Plugin # +by [Vlad Stirbu](https://github.com/vstirbu). + +## Description ## + +Plugin for sharing the content of a canvas to Instagram. The plugin works with Cordova >= 1.8.1. + +## Source and documentation ## + +This plugin lives at [https://github.com/vstirbu/InstagramPlugin](https://github.com/vstirbu/InstagramPlugin) + +## License ## + +The MIT License \ No newline at end of file diff --git a/iOS/KeyboardToolbarRemover/README.md b/iOS/KeyboardToolbarRemover/README.md new file mode 100644 index 00000000..eb8e76f6 --- /dev/null +++ b/iOS/KeyboardToolbarRemover/README.md @@ -0,0 +1,12 @@ +# Keyboard Toolbar Remover Cordova Plugin + +The keyboard in an iOS web view has an InputAccessoryView with Previous, Next and Done buttons. + +![with_toolbar](https://github.com/don/KeyboardToolbarRemover/raw/master/with_toolbar.png) + +This plugin allows the toolbar to be hidden. + +![toolbar_removed](https://github.com/don/KeyboardToolbarRemover/raw/master/toolbar_removed.png) + +# Source Code +[https://github.com/don/KeyboardToolbarRemover](https://github.com/don/KeyboardToolbarRemover) diff --git a/iOS/Keychain/README.md b/iOS/Keychain/README.md index 9e55301f..b6b3f36e 100644 --- a/iOS/Keychain/README.md +++ b/iOS/Keychain/README.md @@ -1,54 +1,3 @@ # Cordova Keychain Plugin # -by Shazron Abdullah - -## Adding the Plugin to your project ## - -Using this plugin requires [iOS Cordova](http://github.com/apache/incubator-cordova-ios) and Xcode 4. - -1. Make sure your Cordova Xcode project has been [updated for Cordova 1.6.0](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md) -2. Add the .h and .m files to your Plugins folder in your project (as a Group "yellow folder" not a Reference "blue folder") -3. Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as <script> tags in your html file(s) -4. In **Cordova.plist** (1.5.0 or greater) or **PhoneGap.plist** (1.4.1 or lesser), under the **Plugins** section, add an idential key and value of **"SAiOSKeychainPlugin"** -5. Add the **"Security.framework"** to your project's Target, in the **Build Phase** tab - **Link Binary with Libraries** - - -## RELEASE NOTES ## - -### 20120709 ### - -* Updated for Cordova - -### 20101105 ### -* Initial release -* See the .js file for API docs, and the KeychainPlugin-Host/www/index.html for sample code - -## BUGS AND CONTRIBUTIONS ## - -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires an Apache iCLA), this should be easier. - -Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "KeychainPlugin" or on [Github](http://github.com/phonegap/phonegap-plugins/issues) -(preferred) - -## LICENSE ## - -SFHFKeychainUtils code by: - Created by Buzz Andersen on 10/20/08. - Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. - Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. - -The rest: - -Copyright 2012 Shazron Abdullah - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. +This plugin has been moved to [http://github.com/shazron/KeychainPlugin](http://github.com/shazron/KeychainPlugin) diff --git a/iOS/Keychain/SAiOSKeychainPlugin.h b/iOS/Keychain/SAiOSKeychainPlugin.h deleted file mode 100644 index 63e4fbff..00000000 --- a/iOS/Keychain/SAiOSKeychainPlugin.h +++ /dev/null @@ -1,62 +0,0 @@ -// -// SAiOSPaypalPlugin.h -// Keychain Plugin for Cordova -// -// Created by shazron on 10-11-05. -// Copyright 2012 Shazron Abdullah. All rights reserved. - -#import -#import -#ifdef CORDOVA_FRAMEWORK -#import -#else -#import "CDVlugin.h" -#endif - -@interface SAiOSKeychainPlugin : CDVPlugin { -} - -- (void) getForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) setForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) removeForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end - -// -// SFHFKeychainUtils.h -// -// Created by Buzz Andersen on 10/20/08. -// Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. -// Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -@interface SFHFKeychainUtils : NSObject { - -} - -+ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; -+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error; -+ (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; - -@end \ No newline at end of file diff --git a/iOS/Keychain/SAiOSKeychainPlugin.js b/iOS/Keychain/SAiOSKeychainPlugin.js deleted file mode 100644 index 1050118d..00000000 --- a/iOS/Keychain/SAiOSKeychainPlugin.js +++ /dev/null @@ -1,126 +0,0 @@ -// ////////////////////////////////////// -// Keychain PhoneGap Plugin -// by Shazron Abdullah -// Nov 5th 2010 -// - - -// /////////////////// -(function(){ -// /////////////////// - -// get local ref to global PhoneGap/Cordova/cordova object for exec function -var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks - -/** - * Constructor - */ -function SAiOSKeychainPlugin() -{ - this._getCallbacks = {}; - this._setCallbacks = {}; - this._removeCallbacks = {}; -} - -//MARK: Get - -SAiOSKeychainPlugin.prototype._onGetCallbackSuccess = function(key, value) -{ - if (this._getCallbacks[key] && this._getCallbacks[key].onSuccess) { - this._getCallbacks[key].onSuccess(key, value); - } - delete this._getCallbacks[key]; -} - -SAiOSKeychainPlugin.prototype._onGetCallbackFail = function(key, error) -{ - if (this._getCallbacks[key] && this._getCallbacks[key].onFail) { - this._getCallbacks[key].onFail(key, error); - } - delete this._getCallbacks[key]; -} - - -SAiOSKeychainPlugin.prototype.getForKey = function(key, servicename, onSuccess, onFail) -{ - this._getCallbacks[key] = { onSuccess:onSuccess, onFail:onFail }; - - cordovaRef.exec("SAiOSKeychainPlugin.getForKey", key, servicename); -} - -//MARK: Set - -SAiOSKeychainPlugin.prototype._onSetCallbackSuccess = function(key) -{ - if (this._setCallbacks[key] && this._setCallbacks[key].onSuccess) { - this._setCallbacks[key].onSuccess(key); - } - delete this._setCallbacks[key]; -} - -SAiOSKeychainPlugin.prototype._onSetCallbackFail = function(key, error) -{ - if (this._setCallbacks[key] && this._setCallbacks[key].onFail) { - this._setCallbacks[key].onFail(key, error); - } - delete this._setCallbacks[key]; -} - -SAiOSKeychainPlugin.prototype.setForKey = function(key, value, servicename, onSuccess, onFail) -{ - this._setCallbacks[key] = { onSuccess:onSuccess, onFail:onFail }; - - cordovaRef.exec("SAiOSKeychainPlugin.setForKey", key, value, servicename); -} - -//MARK: Remove - -SAiOSKeychainPlugin.prototype._onRemoveCallbackSuccess = function(key) -{ - if (this._removeCallbacks[key] && this._removeCallbacks[key].onSuccess) { - this._removeCallbacks[key].onSuccess(key); - } - delete this._removeCallbacks[key]; -} - -SAiOSKeychainPlugin.prototype._onRemoveCallbackFail = function(key, error) -{ - if (this._removeCallbacks[key] && this._removeCallbacks[key].onFail) { - this._removeCallbacks[key].onFail(key, error); - } - delete this._removeCallbacks[key]; -} - -SAiOSKeychainPlugin.prototype.removeForKey = function(key, servicename, onSuccess, onFail) -{ - this._removeCallbacks[key] = { onSuccess:onSuccess, onFail:onFail }; - - cordovaRef.exec("SAiOSKeychainPlugin.removeForKey", key, servicename); -} - -//MARK: Install - -SAiOSKeychainPlugin.install = function() -{ - if ( !window.plugins ) { - window.plugins = {}; - } - if ( !window.plugins.keychain ) { - window.plugins.keychain = new SAiOSKeychainPlugin(); - } -} - -/** - * Add to Cordova constructor - */ -if (cordovaRef && cordovaRef.addConstructor) { - cordovaRef.addConstructor(SAiOSKeychainPlugin.install); -} else { - console.log("Keychain Cordova Plugin could not be installed."); - return null; -} - -// /////////////////// -})(); -// /////////////////// - diff --git a/iOS/Keychain/SAiOSKeychainPlugin.m b/iOS/Keychain/SAiOSKeychainPlugin.m deleted file mode 100644 index fe251333..00000000 --- a/iOS/Keychain/SAiOSKeychainPlugin.m +++ /dev/null @@ -1,521 +0,0 @@ -// -// SAiOSPaypalPlugin.m -// Cordova Plugin for Cordova -// -// Created by shazron on 10-11-05. -// Copyright 2010 Shazron Abdullah. All rights reserved. - -#import "SAiOSKeychainPlugin.h" - -@implementation SAiOSKeychainPlugin - --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView -{ - self = (SAiOSKeychainPlugin*)[super initWithWebView:(UIWebView*)theWebView]; - if (self) { - // initialization here - } - return self; -} - -- (void) getForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - int argc = [arguments count]; - if (argc < 2) { - return; - } - - NSString* key = [arguments objectAtIndex:0]; - NSString* serviceName = [arguments objectAtIndex:1]; - NSError* error = nil; - - NSString* value = [SFHFKeychainUtils getPasswordForUsername:key andServiceName:serviceName error:&error]; - if (error == nil && value != nil) { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onGetCallbackSuccess(\"%@\", \"%@\");", key, value]; - [super writeJavascript:jsCallback]; - } else { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onGetCallbackFail(\"%@\", \"%@\");", key, [error localizedDescription]]; - [super writeJavascript:jsCallback]; - } -} - -- (void) setForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - int argc = [arguments count]; - if (argc < 3) { - return; - } - - NSString* key = [arguments objectAtIndex:0]; - NSString* value = [arguments objectAtIndex:1]; - NSString* serviceName = [arguments objectAtIndex:2]; - NSError* error = nil; - - BOOL stored = [SFHFKeychainUtils storeUsername:key andPassword:value forServiceName:serviceName updateExisting:YES error:&error]; - if (stored) { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onSetCallbackSuccess(\"%@\");", key]; - [super writeJavascript:jsCallback]; - } else { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onSetCallbackFail(\"%@\", \"%@\");", key, [error localizedDescription]]; - [super writeJavascript:jsCallback]; - } -} - -- (void) removeForKey:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - int argc = [arguments count]; - if (argc < 2) { - return; - } - - NSString* key = [arguments objectAtIndex:0]; - NSString* serviceName = [arguments objectAtIndex:1]; - NSError* error = nil; - - BOOL deleted = [SFHFKeychainUtils deleteItemForUsername:key andServiceName:serviceName error:&error]; - if (deleted) { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onRemoveCallbackSuccess(\"%@\");", key]; - [super writeJavascript:jsCallback]; - } else { - NSString* jsCallback = [NSString stringWithFormat:@"window.plugins.keychain._onRemoveCallbackFail(\"%@\", \"%@\");", key, [error localizedDescription]]; - [super writeJavascript:jsCallback]; - } -} - - -@end - - -// -// SFHFKeychainUtils.m -// -// Created by Buzz Andersen on 10/20/08. -// Based partly on code by Jonathan Wight, Jon Crosby, and Mike Malone. -// Copyright 2008 Sci-Fi Hi-Fi. All rights reserved. -// -// Permission is hereby granted, free of charge, to any person -// obtaining a copy of this software and associated documentation -// files (the "Software"), to deal in the Software without -// restriction, including without limitation the rights to use, -// copy, modify, merge, publish, distribute, sublicense, and/or sell -// copies of the Software, and to permit persons to whom the -// Software is furnished to do so, subject to the following -// conditions: -// -// The above copyright notice and this permission notice shall be -// included in all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES -// OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -// HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -// WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -// OTHER DEALINGS IN THE SOFTWARE. -// - -#import - -static NSString *SFHFKeychainUtilsErrorDomain = @"SFHFKeychainUtilsErrorDomain"; - -#if __IPHONE_OS_VERSION_MIN_REQUIRED < 30000 && TARGET_IPHONE_SIMULATOR -@interface SFHFKeychainUtils (PrivateMethods) -+ (SecKeychainItemRef) getKeychainItemReferenceForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error; -@end -#endif - -@implementation SFHFKeychainUtils - -#if __IPHONE_OS_VERSION_MIN_REQUIRED < 30000 && TARGET_IPHONE_SIMULATOR - -+ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { - if (!username || !serviceName) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - return nil; - } - - SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; - - if (*error || !item) { - return nil; - } - - // from Advanced Mac OS X Programming, ch. 16 - UInt32 length; - char *password; - SecKeychainAttribute attributes[8]; - SecKeychainAttributeList list; - - attributes[0].tag = kSecAccountItemAttr; - attributes[1].tag = kSecDescriptionItemAttr; - attributes[2].tag = kSecLabelItemAttr; - attributes[3].tag = kSecModDateItemAttr; - - list.count = 4; - list.attr = attributes; - - OSStatus status = SecKeychainItemCopyContent(item, NULL, &list, &length, (void **)&password); - - if (status != noErr) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - return nil; - } - - NSString *passwordString = nil; - - if (password != NULL) { - char passwordBuffer[1024]; - - if (length > 1023) { - length = 1023; - } - strncpy(passwordBuffer, password, length); - - passwordBuffer[length] = '\0'; - passwordString = [NSString stringWithCString:passwordBuffer]; - } - - SecKeychainItemFreeContent(&list, password); - - CFRelease(item); - - return passwordString; -} - -+ (void) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error { - if (!username || !password || !serviceName) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - return; - } - - OSStatus status = noErr; - - SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; - - if (*error && [*error code] != noErr) { - return; - } - - *error = nil; - - if (item) { - status = SecKeychainItemModifyAttributesAndData(item, - NULL, - strlen([password UTF8String]), - [password UTF8String]); - - CFRelease(item); - } - else { - status = SecKeychainAddGenericPassword(NULL, - strlen([serviceName UTF8String]), - [serviceName UTF8String], - strlen([username UTF8String]), - [username UTF8String], - strlen([password UTF8String]), - [password UTF8String], - NULL); - } - - if (status != noErr) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - } -} - -+ (void) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { - if (!username || !serviceName) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: 2000 userInfo: nil]; - return; - } - - *error = nil; - - SecKeychainItemRef item = [SFHFKeychainUtils getKeychainItemReferenceForUsername: username andServiceName: serviceName error: error]; - - if (*error && [*error code] != noErr) { - return; - } - - OSStatus status; - - if (item) { - status = SecKeychainItemDelete(item); - - CFRelease(item); - } - - if (status != noErr) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - } -} - -+ (SecKeychainItemRef) getKeychainItemReferenceForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { - if (!username || !serviceName) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - return nil; - } - - *error = nil; - - SecKeychainItemRef item; - - OSStatus status = SecKeychainFindGenericPassword(NULL, - strlen([serviceName UTF8String]), - [serviceName UTF8String], - strlen([username UTF8String]), - [username UTF8String], - NULL, - NULL, - &item); - - if (status != noErr) { - if (status != errSecItemNotFound) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - } - - return nil; - } - - return item; -} - -#else - -+ (NSString *) getPasswordForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error { - if (!username || !serviceName) { - if (error != nil) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - } - return nil; - } - - if (error != nil) { - *error = nil; - } - - // Set up a query dictionary with the base query attributes: item type (generic), username, and service - - NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, kSecAttrAccount, kSecAttrService, nil] autorelease]; - NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, username, serviceName, nil] autorelease]; - - NSMutableDictionary *query = [[[NSMutableDictionary alloc] initWithObjects: objects forKeys: keys] autorelease]; - - // First do a query for attributes, in case we already have a Keychain item with no password data set. - // One likely way such an incorrect item could have come about is due to the previous (incorrect) - // version of this code (which set the password as a generic attribute instead of password data). - - NSDictionary *attributeResult = NULL; - NSMutableDictionary *attributeQuery = [query mutableCopy]; - [attributeQuery setObject: (id) kCFBooleanTrue forKey:(id) kSecReturnAttributes]; - OSStatus status = SecItemCopyMatching((CFDictionaryRef) attributeQuery, (CFTypeRef *) &attributeResult); - - [attributeResult release]; - [attributeQuery release]; - - if (status != noErr) { - // No existing item found--simply return nil for the password - if (error != nil && status != errSecItemNotFound) { - //Only return an error if a real exception happened--not simply for "not found." - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - } - - return nil; - } - - // We have an existing item, now query for the password data associated with it. - - NSData *resultData = nil; - NSMutableDictionary *passwordQuery = [query mutableCopy]; - [passwordQuery setObject: (id) kCFBooleanTrue forKey: (id) kSecReturnData]; - - status = SecItemCopyMatching((CFDictionaryRef) passwordQuery, (CFTypeRef *) &resultData); - - [resultData autorelease]; - [passwordQuery release]; - - if (status != noErr) { - if (status == errSecItemNotFound) { - // We found attributes for the item previously, but no password now, so return a special error. - // Users of this API will probably want to detect this error and prompt the user to - // re-enter their credentials. When you attempt to store the re-entered credentials - // using storeUsername:andPassword:forServiceName:updateExisting:error - // the old, incorrect entry will be deleted and a new one with a properly encrypted - // password will be added. - if (error != nil) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -1999 userInfo: nil]; - } - } - else { - // Something else went wrong. Simply return the normal Keychain API error code. - if (error != nil) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - } - } - - return nil; - } - - NSString *password = nil; - - if (resultData) { - password = [[NSString alloc] initWithData: resultData encoding: NSUTF8StringEncoding]; - } - else { - // There is an existing item, but we weren't able to get password data for it for some reason, - // Possibly as a result of an item being incorrectly entered by the previous code. - // Set the -1999 error so the code above us can prompt the user again. - if (error != nil) { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -1999 userInfo: nil]; - } - } - - return [password autorelease]; -} - -+ (BOOL) storeUsername: (NSString *) username andPassword: (NSString *) password forServiceName: (NSString *) serviceName updateExisting: (BOOL) updateExisting error: (NSError **) error -{ - if (!username || !password || !serviceName) - { - if (error != nil) - { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - } - return NO; - } - - // See if we already have a password entered for these credentials. - NSError *getError = nil; - NSString *existingPassword = [SFHFKeychainUtils getPasswordForUsername: username andServiceName: serviceName error:&getError]; - - if ([getError code] == -1999) - { - // There is an existing entry without a password properly stored (possibly as a result of the previous incorrect version of this code. - // Delete the existing item before moving on entering a correct one. - - getError = nil; - - [self deleteItemForUsername: username andServiceName: serviceName error: &getError]; - - if ([getError code] != noErr) - { - if (error != nil) - { - *error = getError; - } - return NO; - } - } - else if ([getError code] != noErr) - { - if (error != nil) - { - *error = getError; - } - return NO; - } - - if (error != nil) - { - *error = nil; - } - - OSStatus status = noErr; - - if (existingPassword) - { - // We have an existing, properly entered item with a password. - // Update the existing item. - - if (![existingPassword isEqualToString:password] && updateExisting) - { - //Only update if we're allowed to update existing. If not, simply do nothing. - - NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, - kSecAttrService, - kSecAttrLabel, - kSecAttrAccount, - nil] autorelease]; - - NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, - serviceName, - serviceName, - username, - nil] autorelease]; - - NSDictionary *query = [[[NSDictionary alloc] initWithObjects: objects forKeys: keys] autorelease]; - - status = SecItemUpdate((CFDictionaryRef) query, (CFDictionaryRef) [NSDictionary dictionaryWithObject: [password dataUsingEncoding: NSUTF8StringEncoding] forKey: (NSString *) kSecValueData]); - } - } - else - { - // No existing entry (or an existing, improperly entered, and therefore now - // deleted, entry). Create a new entry. - - NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, - kSecAttrService, - kSecAttrLabel, - kSecAttrAccount, - kSecValueData, - nil] autorelease]; - - NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, - serviceName, - serviceName, - username, - [password dataUsingEncoding: NSUTF8StringEncoding], - nil] autorelease]; - - NSDictionary *query = [[[NSDictionary alloc] initWithObjects: objects forKeys: keys] autorelease]; - - status = SecItemAdd((CFDictionaryRef) query, NULL); - } - - if (error != nil && status != noErr) - { - // Something went wrong with adding the new item. Return the Keychain error code. - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - - return NO; - } - - return YES; -} - -+ (BOOL) deleteItemForUsername: (NSString *) username andServiceName: (NSString *) serviceName error: (NSError **) error -{ - if (!username || !serviceName) - { - if (error != nil) - { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: -2000 userInfo: nil]; - } - return NO; - } - - if (error != nil) - { - *error = nil; - } - - NSArray *keys = [[[NSArray alloc] initWithObjects: (NSString *) kSecClass, kSecAttrAccount, kSecAttrService, kSecReturnAttributes, nil] autorelease]; - NSArray *objects = [[[NSArray alloc] initWithObjects: (NSString *) kSecClassGenericPassword, username, serviceName, kCFBooleanTrue, nil] autorelease]; - - NSDictionary *query = [[[NSDictionary alloc] initWithObjects: objects forKeys: keys] autorelease]; - - OSStatus status = SecItemDelete((CFDictionaryRef) query); - - if (error != nil && status != noErr) - { - *error = [NSError errorWithDomain: SFHFKeychainUtilsErrorDomain code: status userInfo: nil]; - - return NO; - } - - return YES; -} - -#endif - -@end \ No newline at end of file diff --git a/iOS/Keychain/index.html b/iOS/Keychain/index.html deleted file mode 100755 index 7c9ba115..00000000 --- a/iOS/Keychain/index.html +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - - - paypal-plugin-host - - - - - - - - -
(using servicename )
- -
-
- -
GET FROM KEYCHAIN
-
- - - -
-
-
- -
SET TO KEYCHAIN

- -
- - - -
-
-
-
REMOVE FROM KEYCHAIN

- - - - - - diff --git a/iOS/Keychain/master.css b/iOS/Keychain/master.css deleted file mode 100755 index 2c49b0b1..00000000 --- a/iOS/Keychain/master.css +++ /dev/null @@ -1,97 +0,0 @@ - -body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; -} - -#info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - width:295px; - padding:4px 0px 2px 10px; -} - -#info h4{ - font-size:.95em; - margin:0; - padding:0; -} - -#stage.theme{ - padding-top:3px; -} - -/* Definition List */ -#Page1 > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; -} - -#Page1 > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; -} - -#Page1 > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; -} - -/* Content Styling */ -h1, h2, p{ - margin:1em 0 .5em 13px; -} - -h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; -} - -h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; -} - -/* Stage Buttons */ -#stage.theme a.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; -} -#stage.theme a.btn.large{ - width:308px; - padding:1.2em 0; -} diff --git a/iOS/Macaddress/README.md b/iOS/Macaddress/README.md new file mode 100644 index 00000000..a728875f --- /dev/null +++ b/iOS/Macaddress/README.md @@ -0,0 +1,40 @@ +

MacAddress plugin for Phonegap (Cordova)

+

By Joey Wong (Huang Jun Yan) Updated for Cordova 2.4.0

+ + +This is the plugins to help you get the iOS WIFI MAC address + +The UDID API is deprecated in iOS 5. To get a unique identifier, maybe you need to turn to iPhones/iPad/iPod touch' MAC address instead. + + +

INSTALL

+========================= + +1. Drag the Macaddress.h, Macaddress.m into the "Plugins" folder in Xcode. + +2. Attach the "macaddress.js" to your www folder + +3. Don't forget to enable the plugins in Cordova config.xml (for Cordova 2.3 or higher) + +Add this: + + +<plugin name="Macaddress" value="Macaddress" /> + + +For older version, please modify the PhoneGap.plist file of your application. Under the key "Plugins" add another one with key name +Macaddress and value Macaddress. + +

How to use

+========================================== +Get the WIFI MAC address by following script : + +
+plugins.macaddress.getMacAddress(function(response){
+                                    alert('MAC Address:'+response);
+                                  },function(errorMsg){
+                                    alert('Error:'+errorMsg);
+                                  });
+
+ +Voila !~ diff --git a/iOS/MapKit/MapKit.js b/iOS/MapKit/MapKit.js index 45852ef2..f3dd15bb 100644 --- a/iOS/MapKit/MapKit.js +++ b/iOS/MapKit/MapKit.js @@ -1,4 +1,7 @@ -(function(window) { + +(function() { + +var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks /* * PhoneGap is available under *either* the terms of the modified BSD license *or* the @@ -70,4 +73,4 @@ window.plugins.mapKit = new MapKit(); }); -}(window)); \ No newline at end of file +})(); \ No newline at end of file diff --git a/iOS/MessageBox/MessageBox.h b/iOS/MessageBox/MessageBox.h deleted file mode 100644 index 7a9472a0..00000000 --- a/iOS/MessageBox/MessageBox.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// MessageBox.h -// -// Created by Olivier Louvignes on 11/26/11. -// Updated on 04/08/2012 for Cordova -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import -#ifdef CORDOVA_FRAMEWORK -#import -#else -#import "CORDOVA/CDVPlugin.h" -#endif - -@interface MessageBox : CDVPlugin { - NSString* callbackID; -} - -@property (nonatomic, copy) NSString* callbackID; - -// Instance Method -- (void) prompt:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iOS/MessageBox/MessageBox.js b/iOS/MessageBox/MessageBox.js deleted file mode 100644 index bc63523b..00000000 --- a/iOS/MessageBox/MessageBox.js +++ /dev/null @@ -1,68 +0,0 @@ -// -// MessageBox.js -// -// Created by Olivier Louvignes on 11/26/2011. -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -function MessageBox() {} - -MessageBox.prototype.alert = function(title, message, callback, options) { - if(!options) options = {}; - var config = { - scope: options.scope || null, - okButtonTitle: options.okButtonTitle || 'OK' - }; - - var _callback = function(buttonIndex) { - var button = 'ok'; - if(typeof callback == 'function') callback.call(config.scope, button); - }; - - return navigator.notification.alert(message, _callback, title, config.okButtonTitle + ''); -}; - -MessageBox.prototype.confirm = function(title, message, callback, options) { - if(!options) options = {}; - var config = { - scope: options.scope || null, - yesButtonTitle: options.yesButtonTitle || 'Yes', - noButtonTitle: options.noButtonTitle || 'No' - }; - - var _callback = function(buttonIndex) { - var button = (buttonIndex === 2) ? 'yes' : 'no'; - if(typeof callback == 'function') callback.call(config.scope, button); - }; - - return navigator.notification.confirm(message, _callback, title, config.noButtonTitle + ', ' + config.yesButtonTitle); -}; - -MessageBox.prototype.prompt = function(title, message, callback, options) { - if(!options) options = {}; - var scope = options.scope || null; - delete options.scope; - - var config = { - okButtonTitle: options.okButtonTitle || 'OK', - cancelButtonTitle: options.cancelButtonTitle || 'Cancel', - title : title || 'Prompt', - message : message || '', - type : options.type || 'text', - placeholder : options.placeholder || '' - }; - - var _callback = function(result) { - var value = (result.buttonIndex == 1) ? result.value : false; - button = (result.buttonIndex == 1) ? 'ok' : 'cancel'; - if(typeof callback == 'function') callback.call(scope, button, value); - }; - - return cordova.exec(_callback, _callback, 'MessageBox', 'prompt', [config]); -}; - -cordova.addConstructor(function() { - if(!window.plugins) window.plugins = {}; - window.plugins.messageBox = new MessageBox(); -}); diff --git a/iOS/MessageBox/MessageBox.m b/iOS/MessageBox/MessageBox.m deleted file mode 100644 index 228d4975..00000000 --- a/iOS/MessageBox/MessageBox.m +++ /dev/null @@ -1,126 +0,0 @@ -// -// MessageBox.m -// -// Created by Olivier Louvignes on 11/26/2011. -// Updated on 04/08/2012 for Cordova -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import "MessageBox.h" - -@implementation MessageBox - -@synthesize callbackID; - --(void)prompt:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { - - //NSLog(@"options: %@", options); - //NSLog(@"arguments: %@", arguments); - - // The first argument in the arguments parameter is the callbackID. - // We use this to send data back to the successCallback or failureCallback - // through PluginResult. - self.callbackID = [arguments pop]; - - // Compiling options with defaults - NSString *title = [options objectForKey:@"title"] ?: @"Prompt"; - NSMutableString *message = [NSMutableString stringWithString: ([options objectForKey:@"message"] ?: @"")]; - NSString *type = [options objectForKey:@"type"] ?: @"text"; - NSString *placeholder = [options objectForKey:@"placeholder"] ?: @""; - NSString *okButtonTitle = [options objectForKey:@"okButtonTitle"] ?: @"OK"; - NSString *cancelButtonTitle = [options objectForKey:@"cancelButtonTitle"] ?: @"Cancel"; - NSInteger textFieldPositionRow = (int)[options objectForKey:@"textFieldPositionRow"] ?: 1; - - // Increment textFieldPositionRow if there is a message - if ([message length] != 0 && textFieldPositionRow == 1) { - [message appendString: @"\n"]; - textFieldPositionRow = 2; - } - // Append line-break to the message - [message appendString: @"\n"]; - - // Create UIAlertView popup - UIAlertView *prompt = [[UIAlertView alloc] initWithTitle:title - message:message - delegate:self - cancelButtonTitle:cancelButtonTitle - otherButtonTitles:okButtonTitle, nil]; - - // Create prompt textField - UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 20.0 + textFieldPositionRow*25.0, 260.0, 25.0)]; // left, top, width, height - [textField setBackgroundColor:[UIColor whiteColor]]; - if ([placeholder length] != 0) { - NSLog(@"Placeholder!"); - [textField setPlaceholder:placeholder]; - } - if ([[type lowercaseString] isEqualToString:@"password"]) [textField setSecureTextEntry:YES]; - if ([[type lowercaseString] isEqualToString:@"decimalpad"]) [textField setKeyboardType:UIKeyboardTypeDecimalPad]; - if ([[type lowercaseString] isEqualToString:@"email"]) [textField setKeyboardType:UIKeyboardTypeEmailAddress]; - - [prompt addSubview:textField]; - - // Position fix for iOS < 4 - NSString *iOsVersion = [[UIDevice currentDevice] systemVersion]; - if ([iOsVersion intValue] < 4) { - [prompt setTransform:CGAffineTransformMakeTranslation(0.0, 110.0)]; - } - - // Display prompt - [prompt show]; - [prompt release]; - - // Set cursor and show keyboard - [textField becomeFirstResponder]; - -} - -- (void)alertView:(UIAlertView *)view clickedButtonAtIndex:(NSInteger)buttonIndex { - - //NSLog(@"Clicked %d", buttonIndex); - - // Retreive textField object from view - UITextField *textField = [view.subviews objectAtIndex:5]; - - // Build returned result - NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; - [result setObject:textField.text forKey:@"value"]; - [result setObject:[NSNumber numberWithInteger:buttonIndex] forKey:@"buttonIndex"]; - - // Create Plugin Result - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]; - - // Checking if cancel was clicked - if (buttonIndex != [view cancelButtonIndex]) { - //Call the Success Javascript function - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - } else { - //Call the Failure Javascript function - [self writeJavascript: [pluginResult toErrorCallbackString:self.callbackID]]; - } - -} - -@end - -/* - * Implementation - * @link https://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVPluginResult.h - * @linkhttps://github.com/apache/incubator-cordova-ios/blob/master/CordovaLib/Classes/CDVPluginResult.m - --(CDVPluginResult*) init; -+(void) releaseStatus; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsInt: (int) theMessage; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDouble: (double) theMessage; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsString: (NSString*) theMessage cast: (NSString*) theCast; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsArray: (NSArray*) theMessage cast: (NSString*) theCast; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsInt: (int) theMessage cast: (NSString*) theCast; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDouble: (double) theMessage cast: (NSString*) theCast; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageAsDictionary: (NSDictionary*) theMessage cast: (NSString*) theCast; -+(CDVPluginResult*) resultWithStatus: (CDVCommandStatus) statusOrdinal messageToErrorObject: (int) errorCode; - -*/ diff --git a/iOS/MessageBox/README.md b/iOS/MessageBox/README.md index 3bb70365..079ac491 100644 --- a/iOS/MessageBox/README.md +++ b/iOS/MessageBox/README.md @@ -1,75 +1,52 @@ # Cordova MessageBox Plugin # -by `Olivier Louvignes` +by [Olivier Louvignes](http://olouv.com) + +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-messagebox/tree/master) +--- ## DESCRIPTION ## -* This plugin provides an unified API to use the `UIAlertView` native component from IOS. It does comply with the latest (future-2.x) cordova standards. +* This plugin provides an unified API to use the `UIAlertView` native component from iOS. + +* This plugin is built for Cordova >= v2.1.0 with ARC. * Compared to the `iPhone/Prompt` plugin, it is more documented & simpler to understand. It does also provide new options for prompt (message, multiline, input type password). * There is a `Sencha Touch 2.0` plugin to easily leverage this plugin [here](https://github.com/mgcrea/sencha-touch-plugins/blob/master/CordovaMessageBox.js) -## SETUP ## - -Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). - -1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) -2. Drag and drop the `MessageBox` folder from Finder to your Plugins folder in XCode, using "Create groups for any added folders" -3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files using - -4. Add new entry with key `MessageBox` and value `MessageBox` to `Plugins` in `Cordova.plist` - -## JAVASCRIPT INTERFACE ## - - // After device ready, create a local alias - var messageBox = window.plugins.messageBox; - - // Alert - messageBox.alert('Title', 'Message', function(button) { - console.warn('alert(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }); - - // Confirm - messageBox.confirm('Title', 'Message', function(button) { - console.warn('confirm(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }); - - // Default prompt - messageBox.prompt('Title', 'Message', function(button, value) { - console.warn('prompt(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }); - - // Prompt a password - messageBox.prompt('Please enter your password', '', function(button, value) { - console.warn('prompt(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }, {placeholder: 'password', type: 'password'}); - -* Check [source](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/MessageBox/MessageBox.js) for additional configuration. - -## BUGS AND CONTRIBUTIONS ## - -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires a CLA), this should be easier. - -Post issues on [Github](https://github.com/apache/incubator-cordova-ios/issues) - -The latest code (my fork) will always be [here](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/MessageBox) +[![Screenshot](https://raw.github.com/mgcrea/cordova-messagebox/master/samples/ios/sample.png)](https://github.com/mgcrea/cordova-messagebox/tree/master) ## LICENSE ## -Copyright 2011 Olivier Louvignes. All rights reserved. + The MIT License -The MIT License + Copyright (c) 2012 Olivier Louvignes -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. ## CREDITS ## +Contributors : + +* [Olivier Louvignes](http://olouv.com) + Inspired by : * [Prompt Phonegap plugin](https://github.com/phonegap/phonegap-plugins/tree/master/iPhone/Prompt) diff --git a/iOS/NavigationBar/CDVNavigationBar.xib b/iOS/NavigationBar/CDVNavigationBar.xib deleted file mode 100644 index 0fc23f56..00000000 --- a/iOS/NavigationBar/CDVNavigationBar.xib +++ /dev/null @@ -1,223 +0,0 @@ - - - - 1280 - 10K549 - 1938 - 1038.36 - 461.00 - - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - 933 - - - YES - IBUINavigationItem - IBUIBarButtonItem - IBUINavigationBar - IBProxyObject - - - YES - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - PluginDependencyRecalculationVersion - - - - YES - - IBFilesOwner - IBCocoaTouchFramework - - - IBFirstResponder - IBCocoaTouchFramework - - - - 290 - {320, 44} - - - - IBCocoaTouchFramework - - YES - - - Title - - Item - IBCocoaTouchFramework - 1 - - - - Item - IBCocoaTouchFramework - 1 - - - IBCocoaTouchFramework - - - - - - - YES - - - leftButton - - - - 38 - - - - rightButton - - - - 39 - - - - view - - - - 40 - - - - navItem - - - - 42 - - - - leftButtonTapped: - - - - 43 - - - - rightButtonTapped: - - - - 44 - - - - - YES - - 0 - - YES - - - - - - -1 - - - File's Owner - - - -2 - - - - - 34 - - - YES - - - - - - 35 - - - YES - - - - - - - 36 - - - - - 37 - - - - - - - YES - - YES - -1.CustomClassName - -1.IBPluginDependency - -2.CustomClassName - -2.IBPluginDependency - 34.IBPluginDependency - 35.IBPluginDependency - 36.IBPluginDependency - 37.IBPluginDependency - - - YES - PGNavigationBarController - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - UIResponder - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - com.apple.InterfaceBuilder.IBCocoaTouchPlugin - - - - YES - - - - - - YES - - - - - 44 - - - 0 - IBCocoaTouchFramework - - com.apple.InterfaceBuilder.CocoaTouchPlugin.InterfaceBuilder3 - - - YES - 3 - 933 - - diff --git a/iOS/NavigationBar/CDVNavigationBarController.h b/iOS/NavigationBar/CDVNavigationBarController.h deleted file mode 100644 index b259623c..00000000 --- a/iOS/NavigationBar/CDVNavigationBarController.h +++ /dev/null @@ -1,33 +0,0 @@ -// -// CDVNavigationBarController.h -// HelloPhoneGap1 -// -// Created by Hiedi Utley on 8/18/11. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// - -#import - -@protocol CDVNavigationBarDelegate --(void)leftButtonTapped; --(void)rightButtonTapped; -@end - -@interface CDVNavigationBarController : UIViewController{ - - IBOutlet UIBarButtonItem * leftButton; - IBOutlet UIBarButtonItem * rightButton; - IBOutlet UINavigationItem * navItem; - id delegate; - -} - -@property (nonatomic, retain) UINavigationItem * navItem; -@property (nonatomic, retain) UIBarButtonItem * leftButton; -@property (nonatomic, retain) UIBarButtonItem * rightButton; -@property (nonatomic, retain) id delegate; - --(IBAction)leftButtonTapped:(id)sender; --(IBAction)rightButtonTapped:(id)sender; - -@end diff --git a/iOS/NavigationBar/CDVNavigationBarController.m b/iOS/NavigationBar/CDVNavigationBarController.m deleted file mode 100644 index af0b464c..00000000 --- a/iOS/NavigationBar/CDVNavigationBarController.m +++ /dev/null @@ -1,88 +0,0 @@ -// -// CDVNavigationBarController.m -// HelloPhoneGap1 -// -// Created by Hiedi Utley on 8/18/11. -// Copyright (c) 2011 __MyCompanyName__. All rights reserved. -// - -#import "CDVNavigationBarController.h" - -@implementation CDVNavigationBarController -@synthesize navItem; -@synthesize leftButton; -@synthesize rightButton; -@synthesize delegate; - --(id) init -{ - self = [super initWithNibName:@"CDVNavigationBar" bundle:nil]; - if (self) { - // Custom initialization - } - return self; -} - -- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil -{ - return [self init]; -} - -- (void)didReceiveMemoryWarning -{ - // Releases the view if it doesn't have a superview. - [super didReceiveMemoryWarning]; - - // Release any cached data, images, etc that aren't in use. -} - --(void) dealloc -{ - [navItem release]; - [leftButton release]; - [rightButton release]; - [delegate release]; - [super dealloc]; - -} -#pragma mark - View lifecycle - -/* -// Implement loadView to create a view hierarchy programmatically, without using a nib. -- (void)loadView -{ -} -*/ - -/* -// Implement viewDidLoad to do additional setup after loading the view, typically from a nib. -- (void)viewDidLoad -{ - [super viewDidLoad]; -} -*/ - -- (void)viewDidUnload -{ - [super viewDidUnload]; - // Release any retained subviews of the main view. - // e.g. self.myOutlet = nil; -} - -- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation -{ - // Return YES for supported orientations - return (interfaceOrientation == UIInterfaceOrientationPortrait); -} - --(IBAction)leftButtonTapped:(id)sender -{ - [delegate leftButtonTapped]; -} --(IBAction)rightButtonTapped:(id)sender -{ - [delegate rightButtonTapped]; -} - - -@end diff --git a/iOS/NavigationBar/NavigationBar.h b/iOS/NavigationBar/NavigationBar.h deleted file mode 100644 index fbb05ea6..00000000 --- a/iOS/NavigationBar/NavigationBar.h +++ /dev/null @@ -1,42 +0,0 @@ -#import -#import -#import - -// For older versions of Cordova, you may have to use: #import "CDVPlugin.h" -#import - -#import "CDVNavigationBarController.h" - -@interface NavigationBar : CDVPlugin { - UINavigationBar * navBar; - - CGRect originalWebViewBounds; - CGFloat navBarHeight; - CGFloat tabBarHeight; - - CDVNavigationBarController * navBarController; -} - -@property (nonatomic, retain) CDVNavigationBarController *navBarController; - -- (void)create:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)setTitle:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options; -- (void)setLogo:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options; -- (void)show:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)hide:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)init:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)setupLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)setupRightButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)leftButtonTapped; -- (void)rightButtonTapped; - -- (void)hideLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)showRightButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)hideLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)showRightButton:(NSArray*)arguments withDict:(NSDictionary*)options; - -@end - -@interface UITabBar (NavBarCompat) -@property (nonatomic) bool tabBarAtBottom; -@end \ No newline at end of file diff --git a/iOS/NavigationBar/NavigationBar.js b/iOS/NavigationBar/NavigationBar.js deleted file mode 100644 index 1ecc2ff6..00000000 --- a/iOS/NavigationBar/NavigationBar.js +++ /dev/null @@ -1,117 +0,0 @@ -function NavigationBar() { - this.leftButtonCallback = null; - this.rightButtonCallback = null; -} - -/** - * Create a navigation bar. - * - * @param style: One of "BlackTransparent", "BlackOpaque", "Black" or "Default". The latter will be used if no style is given. - */ -NavigationBar.prototype.create = function(style) -{ - cordova.exec("NavigationBar.create", style || "Default"); -}; - -/** - * Must be called before any other method in order to initialize the plugin. - */ -NavigationBar.prototype.init = function() -{ - cordova.exec("NavigationBar.init"); -}; - -NavigationBar.prototype.resize = function() { - cordova.exec("NavigationBar.resize"); -}; - -/** - * Assign either title or image to the left navigation bar button, and assign the tap callback -*/ -NavigationBar.prototype.setupLeftButton = function(title, image, onselect, options) -{ - this.leftButtonCallback = onselect; - cordova.exec("NavigationBar.setupLeftButton", title || "", image || "", options || {}); -}; - -NavigationBar.prototype.hideLeftButton = function() -{ - cordova.exec("NavigationBar.hideLeftButton"); -}; - -NavigationBar.prototype.showLeftButton = function() -{ - cordova.exec("NavigationBar.showLeftButton"); -}; - -/** - * Internal function called by the plugin - */ -NavigationBar.prototype.leftButtonTapped = function() -{ - if(typeof(this.leftButtonCallback) === "function") - this.leftButtonCallback() -}; - -/** - * Assign either title or image to the right navigation bar button, and assign the tap callback -*/ -NavigationBar.prototype.setupRightButton = function(title, image, onselect, options) -{ - this.rightButtonCallback = onselect; - cordova.exec("NavigationBar.setupRightButton", title || "", image || "", onselect, options || {}); -}; - - -NavigationBar.prototype.hideRightButton = function() -{ - cordova.exec("NavigationBar.hideRightButton"); -}; - -NavigationBar.prototype.showRightButton = function() -{ - cordova.exec("NavigationBar.showRightButton"); -}; - -/** - * Internal function called by the plugin - */ -NavigationBar.prototype.rightButtonTapped = function() -{ - if(typeof(this.rightButtonCallback) === "function") - this.rightButtonCallback() -}; - -NavigationBar.prototype.setTitle = function(title) -{ - cordova.exec("NavigationBar.setTitle", title); -}; - -NavigationBar.prototype.setLogo = function(imageURL) -{ - cordova.exec("NavigationBar.setLogo", imageURL); -}; - -/** - * Shows the navigation bar. Make sure you called create() first. - */ -NavigationBar.prototype.show = function() { - cordova.exec("NavigationBar.show"); -}; - -/** - * Hides the navigation bar. Make sure you called create() first. - */ -NavigationBar.prototype.hide = function() { - - cordova.exec("NavigationBar.hide"); -}; - -cordova.addConstructor(function() -{ - if(!window.plugins) - { - window.plugins = {}; - } - window.plugins.navigationBar = new NavigationBar(); -}); diff --git a/iOS/NavigationBar/NavigationBar.m b/iOS/NavigationBar/NavigationBar.m deleted file mode 100644 index 3d6f83e7..00000000 --- a/iOS/NavigationBar/NavigationBar.m +++ /dev/null @@ -1,400 +0,0 @@ -/* - NavigationBar.m - - Work based on the NativeControls plugin (Jesse MacFadyen, MIT licensed) and additions made by Hiedi Utley - (https://github.com/hutley/HelloPhoneGap1.0/) and zSprawl (https://github.com/zSprawl/NativeControls/). - - Navigation bar API cleaned, improved and moved in a separate plugin by Andreas Sommer - (AndiDog, https://github.com/AndiDog/phonegap-plugins). - */ - -#import "NavigationBar.h" -#import -#import - -// For older versions of Cordova, you may have to use: #import "CDVDebug.h" -#import - -@implementation NavigationBar -#ifndef __IPHONE_3_0 -@synthesize webView; -#endif -@synthesize navBarController; - --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView -{ - self = (NavigationBar*)[super initWithWebView:theWebView]; - if(self) - { - // The original web view bounds must be retrieved here. On iPhone, it would be 0,0,320,460 for example. Since - // Cordova seems to initialize plugins on the first call, there is a plugin method init() that has to be called - // in order to make Cordova call *this* method. If someone forgets the init() call and uses the navigation bar - // and tab bar plugins together, these values won't be the original web view bounds and layout will be wrong. - originalWebViewBounds = theWebView.bounds; - navBarHeight = 44.0f; - tabBarHeight = 49.0f; - } - return self; -} - -- (void)dealloc -{ - if (navBar) - [navBar release]; - - if (navBarController) - [navBarController release]; - - [super dealloc]; -} - -// NOTE: Returned object is owned --(UIBarButtonItem*)backgroundButtonFromImage:(NSString*)imageName title:(NSString*)title fixedMarginLeft:(float)fixedMarginLeft fixedMarginRight:(float)fixedMarginRight target:(id)target action:(SEL)action -{ - UIButton *backButton = [[UIButton alloc] init]; - UIImage *imgNormal = [UIImage imageNamed:imageName]; - - // UIImage's resizableImageWithCapInsets method is only available from iOS 5.0. With earlier versions, the - // stretchableImageWithLeftCapWidth is used which behaves a bit differently. - if([imgNormal respondsToSelector:@selector(resizableImageWithCapInsets)]) - imgNormal = [imgNormal resizableImageWithCapInsets:UIEdgeInsetsMake(0, fixedMarginLeft, 0, fixedMarginRight)]; - else - imgNormal = [imgNormal stretchableImageWithLeftCapWidth:MAX(fixedMarginLeft, fixedMarginRight) topCapHeight:0]; - - [backButton setBackgroundImage:imgNormal forState:UIControlStateNormal]; - - backButton.titleLabel.textColor = [UIColor whiteColor]; - backButton.titleLabel.font = [UIFont boldSystemFontOfSize:12.0f]; - backButton.titleLabel.textAlignment = UITextAlignmentCenter; - - CGSize textSize = [title sizeWithFont:backButton.titleLabel.font]; - - float buttonWidth = MAX(imgNormal.size.width, textSize.width + fixedMarginLeft + fixedMarginRight);//imgNormal.size.width > (textSize.width + fixedMarginLeft + fixedMarginRight) - //? imgNormal.size.width : (textSize.width + fixedMarginLeft + fixedMarginRight); - backButton.frame = CGRectMake(0, 0, buttonWidth, imgNormal.size.height); - - CGFloat marginTopBottom = (backButton.frame.size.height - textSize.height) / 2; - [backButton setTitleEdgeInsets:UIEdgeInsetsMake(marginTopBottom, fixedMarginLeft, marginTopBottom, fixedMarginRight)]; - - [backButton setTitle:title forState:UIControlStateNormal]; - [backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; - [backButton.titleLabel setFont:[UIFont boldSystemFontOfSize:12.0f]]; - - UIBarButtonItem *backButtonItem = [[UIBarButtonItem alloc] initWithCustomView:backButton]; - [backButton addTarget:target action:action forControlEvents:UIControlEventTouchUpInside]; - - [backButton release]; - // imgNormal is autoreleased - - return backButtonItem; -} - --(void)correctWebViewBounds -{ - if(!navBar) - return; - - const bool navBarShown = !navBar.hidden; - bool tabBarShown = false; - bool tabBarAtBottom = true; - - UIView *parent = [navBar superview]; - for(UIView *view in parent.subviews) - if([view isMemberOfClass:[UITabBar class]]) - { - tabBarShown = !view.hidden; - - // Tab bar height is customizable - if(tabBarShown) - { - tabBarHeight = view.bounds.size.height; - - // Since the navigation bar plugin plays together with the tab bar plugin, and the tab bar can as well - // be positioned at the top, here's some magic to find out where it's positioned: - tabBarAtBottom = true; - if([view respondsToSelector:@selector(tabBarAtBottom)]) - tabBarAtBottom = [view performSelector:@selector(tabBarAtBottom)]; - } - - break; - } - - // IMPORTANT: Below code is the same in both the navigation and tab bar plugins! - - CGFloat left = originalWebViewBounds.origin.x; - CGFloat right = left + originalWebViewBounds.size.width; - CGFloat top = originalWebViewBounds.origin.y; - CGFloat bottom = top + originalWebViewBounds.size.height; - - UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; - switch (orientation) - { - case UIInterfaceOrientationPortrait: - case UIInterfaceOrientationPortraitUpsideDown: - // No need to change width/height from original bounds - break; - case UIInterfaceOrientationLandscapeLeft: - case UIInterfaceOrientationLandscapeRight: - right = left + originalWebViewBounds.size.height + 20.0f; - bottom = top + originalWebViewBounds.size.width - 20.0f; - break; - default: - NSLog(@"Unknown orientation: %d", orientation); - break; - } - - if(navBarShown) - top += navBarHeight; - - if(tabBarShown) - { - if(tabBarAtBottom) - bottom -= tabBarHeight; - else - top += tabBarHeight; - } - - CGRect webViewBounds = CGRectMake(left, top, right - left, bottom - top); - - [self.webView setFrame:webViewBounds]; - - // NOTE: Following part again for navigation bar plugin only - - if(navBarShown) - { - if(tabBarAtBottom) - [navBar setFrame:CGRectMake(left, originalWebViewBounds.origin.y, right - left, navBarHeight)]; - else - [navBar setFrame:CGRectMake(left, originalWebViewBounds.origin.y + tabBarHeight, right - left, navBarHeight)]; - } -} - -/*********************************************************************************/ - --(void) create:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - if (!navBar) - { - navBarController = [[CDVNavigationBarController alloc] init]; - navBar = (UINavigationBar*)[navBarController view]; - - NSString * style = [arguments objectAtIndex:0]; - - if(style && [style isEqualToString:@"BlackTranslucent"]) - navBar.barStyle = UIBarStyleBlackTranslucent; - else if(style && [style isEqualToString:@"BlackOpaque"]) - navBar.barStyle = UIBarStyleBlackOpaque; - else if(style && [style isEqualToString:@"Black"]) - navBar.barStyle = UIBarStyleBlack; - // else the default will be used - - [navBarController setDelegate:self]; - - [[navBarController view] setFrame:CGRectMake(0, 0, originalWebViewBounds.size.width, navBarHeight)]; - [[[self webView] superview] addSubview:[navBarController view]]; - [navBar setHidden:YES]; - } -} - -+ (UIBarButtonSystemItem)getUIBarButtonSystemItemForString:(NSString*)imageName -{ - UIBarButtonSystemItem systemItem = -1; - - if([imageName isEqualToString:@"barButton:Action"]) systemItem = UIBarButtonSystemItemAction; - else if([imageName isEqualToString:@"barButton:Add"]) systemItem = UIBarButtonSystemItemAdd; - else if([imageName isEqualToString:@"barButton:Bookmarks"]) systemItem = UIBarButtonSystemItemBookmarks; - else if([imageName isEqualToString:@"barButton:Camera"]) systemItem = UIBarButtonSystemItemCamera; - else if([imageName isEqualToString:@"barButton:Cancel"]) systemItem = UIBarButtonSystemItemCancel; - else if([imageName isEqualToString:@"barButton:Compose"]) systemItem = UIBarButtonSystemItemCompose; - else if([imageName isEqualToString:@"barButton:Done"]) systemItem = UIBarButtonSystemItemDone; - else if([imageName isEqualToString:@"barButton:Edit"]) systemItem = UIBarButtonSystemItemEdit; - else if([imageName isEqualToString:@"barButton:FastForward"]) systemItem = UIBarButtonSystemItemFastForward; - else if([imageName isEqualToString:@"barButton:FixedSpace"]) systemItem = UIBarButtonSystemItemFixedSpace; - else if([imageName isEqualToString:@"barButton:FlexibleSpace"]) systemItem = UIBarButtonSystemItemFlexibleSpace; - else if([imageName isEqualToString:@"barButton:Organize"]) systemItem = UIBarButtonSystemItemOrganize; - else if([imageName isEqualToString:@"barButton:PageCurl"]) systemItem = UIBarButtonSystemItemPageCurl; - else if([imageName isEqualToString:@"barButton:Pause"]) systemItem = UIBarButtonSystemItemPause; - else if([imageName isEqualToString:@"barButton:Play"]) systemItem = UIBarButtonSystemItemPlay; - else if([imageName isEqualToString:@"barButton:Redo"]) systemItem = UIBarButtonSystemItemRedo; - else if([imageName isEqualToString:@"barButton:Refresh"]) systemItem = UIBarButtonSystemItemRefresh; - else if([imageName isEqualToString:@"barButton:Reply"]) systemItem = UIBarButtonSystemItemReply; - else if([imageName isEqualToString:@"barButton:Rewind"]) systemItem = UIBarButtonSystemItemRewind; - else if([imageName isEqualToString:@"barButton:Save"]) systemItem = UIBarButtonSystemItemSave; - else if([imageName isEqualToString:@"barButton:Search"]) systemItem = UIBarButtonSystemItemSearch; - else if([imageName isEqualToString:@"barButton:Stop"]) systemItem = UIBarButtonSystemItemStop; - else if([imageName isEqualToString:@"barButton:Trash"]) systemItem = UIBarButtonSystemItemTrash; - else if([imageName isEqualToString:@"barButton:Undo"]) systemItem = UIBarButtonSystemItemUndo; - - return systemItem; -} - --(void) init:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - // Dummy function, see initWithWebView -} - -// NOTE: Returned object is owned -- (UIBarButtonItem*)makeButtonWithOptions:(NSDictionary*)options title:(NSString*)title imageName:(NSString*)imageName actionOnSelf:(SEL)actionOnSelf -{ - NSNumber *useImageAsBackgroundOpt = [options objectForKey:@"useImageAsBackground"]; - float fixedMarginLeft = [[options objectForKey:@"fixedMarginLeft"] floatValue] ?: 13; - float fixedMarginRight = [[options objectForKey:@"fixedMarginRight"] floatValue] ?: 13; - bool useImageAsBackground = useImageAsBackgroundOpt ? [useImageAsBackgroundOpt boolValue] : false; - - if((title && [title length] > 0) || useImageAsBackground) - { - if(useImageAsBackground && imageName && [imageName length] > 0) - { - return [self backgroundButtonFromImage:imageName title:title - fixedMarginLeft:fixedMarginLeft fixedMarginRight:fixedMarginRight - target:self action:actionOnSelf]; - } - else - { - return [[UIBarButtonItem alloc] initWithTitle:title style:UIBarButtonItemStylePlain target:self action:actionOnSelf]; - } - } - else if (imageName && [imageName length] > 0) - { - UIBarButtonSystemItem systemItem = [NavigationBar getUIBarButtonSystemItemForString:imageName]; - - if(systemItem != -1) - return [[UIBarButtonItem alloc] initWithBarButtonSystemItem:systemItem target:self action:actionOnSelf]; - else - return [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:imageName] style:UIBarButtonItemStylePlain target:self action:actionOnSelf]; - } - else - { - // Fail silently - NSLog(@"Invalid setup{Left/Right}Button parameters\n"); - return nil; - } -} - -- (void)setupLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - NSString * title = [arguments objectAtIndex:0]; - NSString * imageName = [arguments objectAtIndex:1]; - - UIBarButtonItem *newButton = [self makeButtonWithOptions:options title:title imageName:imageName actionOnSelf:@selector(leftButtonTapped)]; - navBarController.navItem.leftBarButtonItem = newButton; - navBarController.leftButton = newButton; - [newButton release]; -} - -- (void)setupRightButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - NSString * title = [arguments objectAtIndex:0]; - NSString * imageName = [arguments objectAtIndex:1]; - - UIBarButtonItem *newButton = [self makeButtonWithOptions:options title:title imageName:imageName actionOnSelf:@selector(rightButtonTapped)]; - navBarController.navItem.rightBarButtonItem = newButton; - navBarController.rightButton = newButton; - [newButton release]; -} - -- (void)hideLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [[navBarController navItem] setLeftBarButtonItem:nil]; -} - -- (void)showLeftButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [[navBarController navItem] setLeftBarButtonItem:[navBarController leftButton]]; -} - -- (void)hideRightButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [[navBarController navItem] setRightBarButtonItem:nil]; -} - -- (void)showRightButton:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [[navBarController navItem] setRightBarButtonItem:[navBarController rightButton]]; -} - --(void) leftButtonTapped -{ - NSString * jsCallBack = @"window.plugins.navigationBar.leftButtonTapped();"; - [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - --(void) rightButtonTapped -{ - NSString * jsCallBack = @"window.plugins.navigationBar.rightButtonTapped();"; - [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - --(void) show:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - if (!navBar) - [self create:nil withDict:nil]; - - if ([navBar isHidden]) - { - [navBar setHidden:NO]; - [self correctWebViewBounds]; - } -} - - --(void) hide:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - if (navBar && ![navBar isHidden]) - { - [navBar setHidden:YES]; - [self correctWebViewBounds]; - } -} - -/** - * Resize the navigation bar (this should be called on orientation change) - * This is important in playing together with the tab bar plugin, especially because the tab bar can be placed on top - * or at the bottom, so the navigation bar bounds also need to be changed. - * - * @param arguments unused - * @param options unused - */ -- (void)resize:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [self correctWebViewBounds]; -} - --(void) setTitle:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - if (navBar) - { - NSString *name = [arguments objectAtIndex:0]; - [navBarController navItem].title = name; - - // Reset otherwise overriding logo reference - [navBarController navItem].titleView = NULL; - } -} - --(void) setLogo:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - NSString * logoURL = [arguments objectAtIndex:0]; - UIImage * image = nil; - - if (logoURL && logoURL != @"") - { - if ([logoURL hasPrefix:@"http://"] || [logoURL hasPrefix:@"https://"]) - { - NSData * data = [NSData dataWithContentsOfURL:[NSURL URLWithString:logoURL]]; - image = [UIImage imageWithData:data]; - } - else - image = [UIImage imageNamed:logoURL]; - - if (image) - { - UIImageView * view = [[[UIImageView alloc] initWithImage:image] autorelease]; - [view setContentMode:UIViewContentModeScaleAspectFit]; - [view setBounds: CGRectMake(0, 0, 100, 30)]; - [[navBarController navItem] setTitleView:view]; - } - } -} - -@end diff --git a/iOS/NavigationBar/README.md b/iOS/NavigationBar/README.md deleted file mode 100644 index b4372b23..00000000 --- a/iOS/NavigationBar/README.md +++ /dev/null @@ -1,129 +0,0 @@ -Navigation bar for Cordova on iOS -================================= - -This plugin lets you create and control a native navigation bar and its buttons. - -License -------- - -[MIT license](http://www.opensource.org/licenses/mit-license.html) - -Contributors ------------- - -This plugin was put together from the incomplete NativeControls plugin and other sources. See NavigationBar.m for the history. - -Installing the plugin ---------------------- - -- Copy *.xib, *.m and *.h files to your project's "Plugins" folder (should already exist and contain a README file if you used the Cordova project template) -- They have to be added to the project as well, so drag them from the "Plugins" folder (in Finder) to the same folder (in Xcode) and select to create references -- Open "Supporting Files/Cordova.plist" and under "Plugins", add a key with the plugin name "NavigationBar" and a string value of "NavigationBar" (I guess it's the plugin's main class name) - -Note regarding orientation changes and the tab bar plugin ---------------------------------------------------------- - -If the tab bar plugin is used together with this plugin and the tab bar is positioned on top (defaults to bottom), it's necessary to resize the navigation bar automatically: - - window.addEventListener("resize", function() { - plugins.navigationBar.resize(); - ), false); - -Using the tab bar and navigation bar plugin together ----------------------------------------------------- - -In order to use the [tab bar plugin](https://github.com/AndiDog/phonegap-plugins/tree/master/iOS/TabBar) and [navigation bar plugin](https://github.com/AndiDog/phonegap-plugins/tree/master/iOS/NavigationBar) together, you must initialize both plugins before calling any of their methods, i.e. before creating a navigation/tab bar. For example right when your application starts: - - document.addEventListener("deviceready", function() { - console.log("Cordova ready") - - plugins.navigationBar.init() - plugins.tabBar.init() - - plugins.navigationBar.create() - plugins.tabBar.create() - - // ... - -This is because both plugins are aware of each other and resize Cordova's web view accordingly, but therefore they have to know the web view's initial dimensions. If for example you only initialize the tab bar plugin, create the tab bar and later decide to also create a navigation bar, the navigation bar plugin would think the original web view size is 320x411 instead of 320x460 (on iPhone). Layouting *could* be done using the screen size as well but it's currently implemented like this. - -Example -------- - -This example shows how to use the navigation bar: - - document.addEventListener("deviceready", function() { - console.log("Cordova ready") - - plugins.navigationBar.init() - - plugins.navigationBar.create() // or .create("BlackOpaque") to apply a certain style - plugins.navigationBar.hideLeftButton() - plugins.navigationBar.hideRightButton() - - plugins.navigationBar.setTitle("My heading") - - plugins.navigationBar.showLeftButton() - plugins.navigationBar.showRightButton() - - // Create left navigation button with a title (you can either have a title or an image, not both!) - plugins.navigationBar.setupLeftButton("Text", null, function() { - alert("left nav button tapped") - }) - - // Create right navigation button from a system-predefined button (see the full list in NativeControls.m) - // or from an image - plugins.navigationBar.setupRightButton( - null, - "barButton:Bookmarks", // or your own file like "/www/stylesheets/images/ajax-loader.png", - function() { - alert("right nav button tapped") - } - ) - - plugins.navigationBar.show() - }, false) - -How to create a custom button (such as an arrow-shaped back button) -------------------------------------------------------------------- - -There are [several ways](http://stackoverflow.com/questions/227078/creating-a-left-arrow-button-like-uinavigationbars-back-style-on-a-uitoolba) to create a back button at runtime without having to use `UINavigationController`, but only one of them seems to be okay if you want your app to be approved: A custom button background image. - -![Screenshot](http://i.imgur.com/naC96.png) - -The above screenshot has a navigation bar with two such custom buttons. The left one actually has a background image very similar to the black iOS navigation bar. A stretchable picture (such as [this](http://imgur.com/yibWD) or [that one](http://imgur.com/K2LUS) which were used above) should be used because the plugin automatically sets the button size according to the text size (but not smaller than the original picture). You can define left/right margins which shall not be stretched if the button width changes. Important: iOS 5.0 supports defining two different values for the left/right margins. In earlier iOS versions, the plugins takes the larger value (13 pixels in the example below), so please test if your background image looks fine with older versions (install and use the iPhone 4.3 simulator, for example). - -Note: Vertical margins are supported by iOS but not implemented in the plugin – tell me if you would like that feature. I think you should keep navigation bar buttons at a fixed height (30px on normal 320x480 iPhone display). - -Put the button image in the "Resources" folder of your project. Here's some example code on how to use it: - - plugins.navigationBar.setupLeftButton( - "Baaack", - "blackbutton.png", - function() { - alert('leftnavbutton tapped') - }, - { - useImageAsBackground: true - fixedMarginLeft: 13 // 13 pixels on the left side are not stretched (the left-arrow shape) - fixedMarginRight: 5 // and 5 pixels on the right side (all room between these margins is used for the text label) - } - ) - - plugins.navigationBar.setupRightButton( - null, // with a custom background image, it's possible to set no title at all - "greenbutton.png", - function() { - alert('rightnavbutton tapped') - }, - { - useImageAsBackground: true - fixedMarginLeft: 5 - fixedMarginRight: 13 - } - ) - -Reporting issues or requests for improvement --------------------------------------------- - -Please report problems on [my GitHub fork of phonegap-plugins](https://github.com/AndiDog/phonegap-plugins). \ No newline at end of file diff --git a/iOS/NavigationBar/REPO MOVED.txt b/iOS/NavigationBar/REPO MOVED.txt new file mode 100644 index 00000000..85661c52 --- /dev/null +++ b/iOS/NavigationBar/REPO MOVED.txt @@ -0,0 +1 @@ +This plugin is now located at https://github.com/AndiDog/phonegap-ios-navigationbar-plugin \ No newline at end of file diff --git a/iOS/NavigationBar/example.png b/iOS/NavigationBar/example.png deleted file mode 100644 index aa25acf5..00000000 Binary files a/iOS/NavigationBar/example.png and /dev/null differ diff --git a/iOS/OCRPlugin/OCRPlugin.h b/iOS/OCRPlugin/OCRPlugin.h deleted file mode 100644 index 7740ff42..00000000 --- a/iOS/OCRPlugin/OCRPlugin.h +++ /dev/null @@ -1,17 +0,0 @@ -// -// OCRPlugin.h -// pruebaTesseract -// -// Created by Admin on 09/06/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// -#import -@class claseAuxiliar; - -@interface OCRPlugin : CDVPlugin - -@property (nonatomic, copy) NSString* callbackID; - -- (void) recogniseOCR:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iOS/OCRPlugin/OCRPlugin.m b/iOS/OCRPlugin/OCRPlugin.m deleted file mode 100644 index b0e59967..00000000 --- a/iOS/OCRPlugin/OCRPlugin.m +++ /dev/null @@ -1,82 +0,0 @@ -// -// OCRPlugin.m -// pruebaTesseract -// -// Created by Admin on 09/06/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "OCRPlugin.h" -#import "claseAuxiliar.h" - -@implementation OCRPlugin -@synthesize callbackID; - - - - - -- (void) recogniseOCR:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { //get the callback id - - NSString *url_string = [options objectForKey:@"url_imagen"]; - self.callbackID = [arguments pop]; - - claseAuxiliar *cA = [[claseAuxiliar alloc]init]; - - NSURL *url = [NSURL URLWithString:url_string]; - NSData *data = [NSData dataWithContentsOfURL:url]; - UIImage *Realimage = [[UIImage alloc] initWithData:data]; - - UIImage *newImage = [cA resizeImage:Realimage]; - - NSString *text = [cA ocrImage:newImage]; - [self performSelectorOnMainThread:@selector(ocrProcessingFinished:) - withObject:text - waitUntilDone:NO]; - - - [cA release]; - -} - - - -- (void)ocrProcessingFinished:(NSString *)result -{ - - - - - // Create Plugin Result - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK - messageAsString: result ]; - - - // Checking if the string received is HelloWorld or not - - if (result == nil - || ([result respondsToSelector:@selector(length)] - && [(NSData *)result length] == 0) - || ([result respondsToSelector:@selector(count)] - && [(NSArray *)result count] == 0)) - - { - // Call the Failure Javascript function - - [self writeJavascript: [pluginResult toErrorCallbackString:self.callbackID]]; - - - } else - - { - - // Call the Success Javascript function - - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - - - } -} - -@end diff --git a/iOS/OCRPlugin/README.md b/iOS/OCRPlugin/README.md index 669cf22a..55d7fd4c 100644 --- a/iOS/OCRPlugin/README.md +++ b/iOS/OCRPlugin/README.md @@ -1,57 +1,5 @@ PhonegapOCRPlugin ================= +This plugin has been moved to: -ocr plugin for phonegap using tesseract - -drag the tessdata folder to your phonegap project -mark the checkbox "copy items into destination group" -Choose the radio-button "Create folder references for any added folders" - -drag the dependencies folder to your phonegap project -mark the checkbox "copy items into destination group" -Choose the radio-button "Created groups for any added folders" - -drag OCRPlugin.h, OCRPlugin.m, claseAuxiliar.h and claseAuxiliar.mm - -drag OCRPlugin.js to your www folder - -Add the plugin to cordova.xml - -com.jcesarmobile.OCRPlugin OCRPlugin - - -Thanks to suzuki for compiling tesseract in this post -http://tinsuke.wordpress.com/2011/11/01/how-to-compile-and-use-tesseract-3-01-on-ios-sdk-5 - -I have included an index.html with an example. - -It uses the camera function with destinationType.FILE_URI (IMPORTANT!!!) - - - // A button will call this function - // - function capturePhoto() { - // Take picture using device camera and retrieve image as base64-encoded string - navigator.camera.getPicture(onPhotoURISuccess, onFail, { quality: 100, - destinationType: destinationType.FILE_URI }); - } - - // Call the plugin when a photo is successfully retrieved - // - function onPhotoURISuccess(imageURI) { - callNativePlugin({url_imagen: imageURI}); - } - - - function callNativePlugin( returnSuccess ) { - OCRPlugin.callNativeFunction( nativePluginResultHandler, nativePluginErrorHandler, returnSuccess ); - } - - function nativePluginResultHandler (result) { - alert("ok: "+result); - } - - function nativePluginErrorHandler (error) { - alert("error: "+error); - } - +https://github.com/jcesarmobile/PhonegapOCRPlugin \ No newline at end of file diff --git a/iOS/OCRPlugin/claseAuxiliar.h b/iOS/OCRPlugin/claseAuxiliar.h deleted file mode 100644 index 39c0462a..00000000 --- a/iOS/OCRPlugin/claseAuxiliar.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// claseAuxiliar.h -// pruebaTesseract -// -// Created by Admin on 03/06/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// -#import -#import - - - -#ifdef __cplusplus -#include "baseapi.h" -using namespace tesseract; -#else -@class TessBaseAPI; -#endif - - -@interface claseAuxiliar : NSObject { - - - TessBaseAPI *tesseract; - - -} - - --(NSString *) ocrImage: (UIImage *) uiImage; --(UIImage *)resizeImage:(UIImage *)image; - - - - -@end - - - - - - diff --git a/iOS/OCRPlugin/claseAuxiliar.mm b/iOS/OCRPlugin/claseAuxiliar.mm deleted file mode 100644 index 19f6f340..00000000 --- a/iOS/OCRPlugin/claseAuxiliar.mm +++ /dev/null @@ -1,131 +0,0 @@ -// -// claseAuxiliar.m -// pruebaTesseract -// -// Created by Admin on 03/06/12. -// Copyright (c) 2012 __MyCompanyName__. All rights reserved. -// - -#import "claseAuxiliar.h" - - -#include "baseapi.h" - -//#include "environ.h" -//#import "pix.h" - -static inline double radians (double degrees) {return degrees * M_PI/180;} - -@implementation claseAuxiliar - --(id)init { - self = [super init]; - if (self) { - // Set up the tessdata path. This is included in the application bundle - // but is copied to the Documents directory on the first run. - NSArray *documentPaths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); - NSString *documentPath = ([documentPaths count] > 0) ? [documentPaths objectAtIndex:0] : nil; - - NSString *dataPath = [documentPath stringByAppendingPathComponent:@"tessdata"]; - NSFileManager *fileManager = [NSFileManager defaultManager]; - // If the expected store doesn't exist, copy the default store. - if (![fileManager fileExistsAtPath:dataPath]) { - // get the path to the app bundle (with the tessdata dir) - NSString *bundlePath = [[NSBundle mainBundle] bundlePath]; - NSString *tessdataPath = [bundlePath stringByAppendingPathComponent:@"tessdata"]; - if (tessdataPath) { - [fileManager copyItemAtPath:tessdataPath toPath:dataPath error:NULL]; - } - } - - setenv("TESSDATA_PREFIX", [[documentPath stringByAppendingString:@"/"] UTF8String], 1); - - // init the tesseract engine. - tesseract = new tesseract::TessBaseAPI(); - tesseract->Init([dataPath cStringUsingEncoding:NSUTF8StringEncoding], "eng"); - - } - return self; -} - - -- (NSString *) ocrImage: (UIImage *) uiImage -{ - - //code from http://robertcarlsen.net/2009/12/06/ocr-on-iphone-demo-1043 - - CGSize imageSize = [uiImage size]; - double bytes_per_line = CGImageGetBytesPerRow([uiImage CGImage]); - double bytes_per_pixel = CGImageGetBitsPerPixel([uiImage CGImage]) / 8.0; - - CFDataRef data = CGDataProviderCopyData(CGImageGetDataProvider([uiImage CGImage])); - const UInt8 *imageData = CFDataGetBytePtr(data); - - // this could take a while. maybe needs to happen asynchronously. - char* text = tesseract->TesseractRect(imageData,(int)bytes_per_pixel,(int)bytes_per_line, 0, 0,(int) imageSize.height,(int) imageSize.width); - - // Do something useful with the text! - // NSLog(@"Converted text: %@",[NSString stringWithCString:text encoding:NSUTF8StringEncoding]); - - return [NSString stringWithCString:text encoding:NSUTF8StringEncoding]; -} - - -//http://www.iphonedevsdk.com/forum/iphone-sdk-development/7307-resizing-photo-new-uiimage.html#post33912 --(UIImage *)resizeImage:(UIImage *)image { - - CGImageRef imageRef = [image CGImage]; - CGImageAlphaInfo alphaInfo = CGImageGetAlphaInfo(imageRef); - CGColorSpaceRef colorSpaceInfo = CGColorSpaceCreateDeviceRGB(); - - if (alphaInfo == kCGImageAlphaNone) - alphaInfo = kCGImageAlphaNoneSkipLast; - - int width, height; - - width = 640;//[image size].width; - height = 640;//[image size].height; - - CGContextRef bitmap; - - if (image.imageOrientation == UIImageOrientationUp | image.imageOrientation == UIImageOrientationDown) { - bitmap = CGBitmapContextCreate(NULL, width, height, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, alphaInfo); - - } else { - bitmap = CGBitmapContextCreate(NULL, height, width, CGImageGetBitsPerComponent(imageRef), CGImageGetBytesPerRow(imageRef), colorSpaceInfo, alphaInfo); - - } - - if (image.imageOrientation == UIImageOrientationLeft) { - NSLog(@"image orientation left"); - CGContextRotateCTM (bitmap, radians(90)); - CGContextTranslateCTM (bitmap, 0, -height); - - } else if (image.imageOrientation == UIImageOrientationRight) { - NSLog(@"image orientation right"); - CGContextRotateCTM (bitmap, radians(-90)); - CGContextTranslateCTM (bitmap, -width, 0); - - } else if (image.imageOrientation == UIImageOrientationUp) { - NSLog(@"image orientation up"); - - } else if (image.imageOrientation == UIImageOrientationDown) { - NSLog(@"image orientation down"); - CGContextTranslateCTM (bitmap, width,height); - CGContextRotateCTM (bitmap, radians(-180.)); - - } - - CGContextDrawImage(bitmap, CGRectMake(0, 0, width, height), imageRef); - CGImageRef ref = CGBitmapContextCreateImage(bitmap); - UIImage *result = [UIImage imageWithCGImage:ref]; - - CGContextRelease(bitmap); - CGImageRelease(ref); - - return result; -} - - - -@end diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/allheaders.h b/iOS/OCRPlugin/dependencies/include/leptonica/allheaders.h deleted file mode 100644 index d44536d7..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/allheaders.h +++ /dev/null @@ -1,32 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_ALLHEADERS_H -#define LEPTONICA_ALLHEADERS_H - - -#define LIBLEPT_MAJOR_VERSION 1 -#define LIBLEPT_MINOR_VERSION 68 - -#include "alltypes.h" - -#ifndef NO_PROTOS -#include "leptprotos.h" -#endif /* NO_PROTOS */ - - -#endif /* LEPTONICA_ALLHEADERS_H */ - - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/alltypes.h b/iOS/OCRPlugin/dependencies/include/leptonica/alltypes.h deleted file mode 100644 index 7baf8454..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/alltypes.h +++ /dev/null @@ -1,49 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_ALLTYPES_H -#define LEPTONICA_ALLTYPES_H - - /* Standard */ -#include -#include - - /* General and configuration defs */ -#include "environ.h" - - /* Imaging */ -#include "array.h" -#include "arrayaccess.h" -#include "bbuffer.h" -#include "bmf.h" -#include "ccbord.h" -#include "dewarp.h" -#include "gplot.h" -#include "heap.h" -#include "imageio.h" -#include "jbclass.h" -#include "list.h" -#include "morph.h" -#include "pix.h" -#include "ptra.h" -#include "queue.h" -#include "regutils.h" -#include "sudoku.h" -#include "stack.h" -#include "watershed.h" - - -#endif /* LEPTONICA_ALLTYPES_H */ - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/array.h b/iOS/OCRPlugin/dependencies/include/leptonica/array.h deleted file mode 100644 index 094b49c4..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/array.h +++ /dev/null @@ -1,125 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_ARRAY_H -#define LEPTONICA_ARRAY_H - -/* - * Contains the following structs: - * struct Numa - * struct Numaa - * struct Numa2d - * struct NumaHash - * struct Sarray - * struct L_Bytea - * - * Contains definitions for: - * Numa interpolation flags - */ - - -/*------------------------------------------------------------------------* - * Array Structs * - *------------------------------------------------------------------------*/ - -#define NUMA_VERSION_NUMBER 1 - - /* Number array: an array of floats */ -struct Numa -{ - l_int32 nalloc; /* size of allocated number array */ - l_int32 n; /* number of numbers saved */ - l_int32 refcount; /* reference count (1 if no clones) */ - l_float32 startx; /* x value assigned to array[0] */ - l_float32 delx; /* change in x value as i --> i + 1 */ - l_float32 *array; /* number array */ -}; -typedef struct Numa NUMA; - - - /* Array of number arrays */ -struct Numaa -{ - l_int32 nalloc; /* size of allocated ptr array */ - l_int32 n; /* number of Numa saved */ - struct Numa **numa; /* array of Numa */ -}; -typedef struct Numaa NUMAA; - - - - /* Sparse 2-dimensional array of number arrays */ -struct Numa2d -{ - l_int32 nrows; /* number of rows allocated for ptr array */ - l_int32 ncols; /* number of cols allocated for ptr array */ - l_int32 initsize; /* initial size of each numa that is made */ - struct Numa ***numa; /* 2D array of Numa */ -}; -typedef struct Numa2d NUMA2D; - - - /* A hash table of Numas */ -struct NumaHash -{ - l_int32 nbuckets; - l_int32 initsize; /* initial size of each numa that is made */ - struct Numa **numa; -}; -typedef struct NumaHash NUMAHASH; - - -#define SARRAY_VERSION_NUMBER 1 - - /* String array: an array of C strings */ -struct Sarray -{ - l_int32 nalloc; /* size of allocated ptr array */ - l_int32 n; /* number of strings allocated */ - l_int32 refcount; /* reference count (1 if no clones) */ - char **array; /* string array */ -}; -typedef struct Sarray SARRAY; - - - /* Byte array (analogous to C++ "string") */ -struct L_Bytea -{ - size_t nalloc; /* number of bytes allocated in data array */ - size_t size; /* number of bytes presently used */ - l_int32 refcount; /* reference count (1 if no clones) */ - l_uint8 *data; /* data array */ -}; -typedef struct L_Bytea L_BYTEA; - - -/*------------------------------------------------------------------------* - * Array flags * - *------------------------------------------------------------------------*/ - - /* Flags for interpolation in Numa */ -enum { - L_LINEAR_INTERP = 1, /* linear */ - L_QUADRATIC_INTERP = 2 /* quadratic */ -}; - - /* Flags for added borders in Numa */ -enum { - L_EXTENDED_BORDER = 1, /* extended with same value */ - L_MIRRORED_BORDER = 2 /* mirrored */ -}; - - -#endif /* LEPTONICA_ARRAY_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/arrayaccess.h b/iOS/OCRPlugin/dependencies/include/leptonica/arrayaccess.h deleted file mode 100644 index d1b22b38..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/arrayaccess.h +++ /dev/null @@ -1,194 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_ARRAY_ACCESS_H -#define LEPTONICA_ARRAY_ACCESS_H - -/* - * arrayaccess.h - * - * 1, 2, 4, 8, 16 and 32 bit data access within an array of 32-bit words - * - * This is used primarily to access 1, 2, 4, 8, 16 and 32 bit pixels - * in a line of image data, represented as an array of 32-bit words. - * - * pdata: pointer to first 32-bit word in the array - * n: index of the pixel in the array - * - * Function calls for these accessors are defined in arrayaccess.c. - * - * However, for efficiency we use the inline macros for all accesses. - * Even though the 2 and 4 bit set* accessors are more complicated, - * they are about 10% faster than the function calls. - * - * The 32 bit access is just a cast and ptr arithmetic. We include - * it so that the input ptr can be void*. - * - * At the end of this file is code for invoking the function calls - * instead of inlining. - * - * The macro SET_DATA_BIT_VAL(pdata, n, val) is a bit slower than - * if (val == 0) - * CLEAR_DATA_BIT(pdata, n); - * else - * SET_DATA_BIT(pdata, n); - */ - - - /* Use the inline accessors (except with _MSC_VER), because they - * are faster. */ -#define USE_INLINE_ACCESSORS 1 - -#if USE_INLINE_ACCESSORS -#ifndef _MSC_VER - - /*--------------------------------------------------* - * 1 bit access * - *--------------------------------------------------*/ -#define GET_DATA_BIT(pdata, n) \ - ((*((l_uint32 *)(pdata) + ((n) >> 5)) >> (31 - ((n) & 31))) & 1) - -#define SET_DATA_BIT(pdata, n) \ - (*((l_uint32 *)(pdata) + ((n) >> 5)) |= (0x80000000 >> ((n) & 31))) - -#define CLEAR_DATA_BIT(pdata, n) \ - (*((l_uint32 *)(pdata) + ((n) >> 5)) &= ~(0x80000000 >> ((n) & 31))) - -#define SET_DATA_BIT_VAL(pdata, n, val) \ - ({l_uint32 *_TEMP_WORD_PTR_; \ - _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 5); \ - *_TEMP_WORD_PTR_ &= ~(0x80000000 >> ((n) & 31)); \ - *_TEMP_WORD_PTR_ |= ((val) << (31 - ((n) & 31))); \ - }) - - - /*--------------------------------------------------* - * 2 bit access * - *--------------------------------------------------*/ -#define GET_DATA_DIBIT(pdata, n) \ - ((*((l_uint32 *)(pdata) + ((n) >> 4)) >> (2 * (15 - ((n) & 15)))) & 3) - -#define SET_DATA_DIBIT(pdata, n, val) \ - ({l_uint32 *_TEMP_WORD_PTR_; \ - _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 4); \ - *_TEMP_WORD_PTR_ &= ~(0xc0000000 >> (2 * ((n) & 15))); \ - *_TEMP_WORD_PTR_ |= (((val) & 3) << (30 - 2 * ((n) & 15))); \ - }) - -#define CLEAR_DATA_DIBIT(pdata, n) \ - (*((l_uint32 *)(pdata) + ((n) >> 4)) &= ~(0xc0000000 >> (2 * ((n) & 15)))) - - - /*--------------------------------------------------* - * 4 bit access * - *--------------------------------------------------*/ -#define GET_DATA_QBIT(pdata, n) \ - ((*((l_uint32 *)(pdata) + ((n) >> 3)) >> (4 * (7 - ((n) & 7)))) & 0xf) - -#define SET_DATA_QBIT(pdata, n, val) \ - ({l_uint32 *_TEMP_WORD_PTR_; \ - _TEMP_WORD_PTR_ = (l_uint32 *)(pdata) + ((n) >> 3); \ - *_TEMP_WORD_PTR_ &= ~(0xf0000000 >> (4 * ((n) & 7))); \ - *_TEMP_WORD_PTR_ |= (((val) & 15) << (28 - 4 * ((n) & 7))); \ - }) - -#define CLEAR_DATA_QBIT(pdata, n) \ - (*((l_uint32 *)(pdata) + ((n) >> 3)) &= ~(0xf0000000 >> (4 * ((n) & 7)))) - - - /*--------------------------------------------------* - * 8 bit access * - *--------------------------------------------------*/ -#ifdef L_BIG_ENDIAN -#define GET_DATA_BYTE(pdata, n) \ - (*((l_uint8 *)(pdata) + (n))) -#else /* L_LITTLE_ENDIAN */ -#define GET_DATA_BYTE(pdata, n) \ - (*(l_uint8 *)((l_uintptr_t)((l_uint8 *)(pdata) + (n)) ^ 3)) -#endif /* L_BIG_ENDIAN */ - -#ifdef L_BIG_ENDIAN -#define SET_DATA_BYTE(pdata, n, val) \ - (*((l_uint8 *)(pdata) + (n)) = (val)) -#else /* L_LITTLE_ENDIAN */ -#define SET_DATA_BYTE(pdata, n, val) \ - (*(l_uint8 *)((l_uintptr_t)((l_uint8 *)(pdata) + (n)) ^ 3) = (val)) -#endif /* L_BIG_ENDIAN */ - - - /*--------------------------------------------------* - * 16 bit access * - *--------------------------------------------------*/ -#ifdef L_BIG_ENDIAN -#define GET_DATA_TWO_BYTES(pdata, n) \ - (*((l_uint16 *)(pdata) + (n))) -#else /* L_LITTLE_ENDIAN */ -#define GET_DATA_TWO_BYTES(pdata, n) \ - (*(l_uint16 *)((l_uintptr_t)((l_uint16 *)(pdata) + (n)) ^ 2)) -#endif /* L_BIG_ENDIAN */ - -#ifdef L_BIG_ENDIAN -#define SET_DATA_TWO_BYTES(pdata, n, val) \ - (*((l_uint16 *)(pdata) + (n)) = (val)) -#else /* L_LITTLE_ENDIAN */ -#define SET_DATA_TWO_BYTES(pdata, n, val) \ - (*(l_uint16 *)((l_uintptr_t)((l_uint16 *)(pdata) + (n)) ^ 2) = (val)) -#endif /* L_BIG_ENDIAN */ - - - /*--------------------------------------------------* - * 32 bit access * - *--------------------------------------------------*/ -#define GET_DATA_FOUR_BYTES(pdata, n) \ - (*((l_uint32 *)(pdata) + (n))) - -#define SET_DATA_FOUR_BYTES(pdata, n, val) \ - (*((l_uint32 *)(pdata) + (n)) = (val)) - - -#endif /* ! _MSC_VER */ -#endif /* USE_INLINE_ACCESSORS */ - - - - /*--------------------------------------------------* - * Slower, using function calls for all accessors * - *--------------------------------------------------*/ -#if !USE_INLINE_ACCESSORS || defined(_MSC_VER) -#define GET_DATA_BIT(pdata, n) l_getDataBit(pdata, n) -#define SET_DATA_BIT(pdata, n) l_setDataBit(pdata, n) -#define CLEAR_DATA_BIT(pdata, n) l_clearDataBit(pdata, n) -#define SET_DATA_BIT_VAL(pdata, n, val) l_setDataBitVal(pdata, n, val) - -#define GET_DATA_DIBIT(pdata, n) l_getDataDibit(pdata, n) -#define SET_DATA_DIBIT(pdata, n, val) l_setDataDibit(pdata, n, val) -#define CLEAR_DATA_DIBIT(pdata, n) l_clearDataDibit(pdata, n) - -#define GET_DATA_QBIT(pdata, n) l_getDataQbit(pdata, n) -#define SET_DATA_QBIT(pdata, n, val) l_setDataQbit(pdata, n, val) -#define CLEAR_DATA_QBIT(pdata, n) l_clearDataQbit(pdata, n) - -#define GET_DATA_BYTE(pdata, n) l_getDataByte(pdata, n) -#define SET_DATA_BYTE(pdata, n, val) l_setDataByte(pdata, n, val) - -#define GET_DATA_TWO_BYTES(pdata, n) l_getDataTwoBytes(pdata, n) -#define SET_DATA_TWO_BYTES(pdata, n, val) l_setDataTwoBytes(pdata, n, val) - -#define GET_DATA_FOUR_BYTES(pdata, n) l_getDataFourBytes(pdata, n) -#define SET_DATA_FOUR_BYTES(pdata, n, val) l_setDataFourBytes(pdata, n, val) -#endif /* !USE_INLINE_ACCESSORS || _MSC_VER */ - - -#endif /* LEPTONICA_ARRAY_ACCESS_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/bbuffer.h b/iOS/OCRPlugin/dependencies/include/leptonica/bbuffer.h deleted file mode 100644 index 5aa85dd8..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/bbuffer.h +++ /dev/null @@ -1,46 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_BBUFFER_H -#define LEPTONICA_BBUFFER_H - -/* - * bbuffer.h - * - * Expandable byte buffer for reading data in from memory and - * writing data out to other memory. - * - * This implements a queue of bytes, so data read in is put - * on the "back" of the queue (i.e., the end of the byte array) - * and data written out is taken from the "front" of the queue - * (i.e., from an index marker "nwritten" that is initially set at - * the beginning of the array.) As usual with expandable - * arrays, we keep the size of the allocated array and the - * number of bytes that have been read into the array. - * - * For implementation details, see bbuffer.c. - */ - -struct ByteBuffer -{ - l_int32 nalloc; /* size of allocated byte array */ - l_int32 n; /* number of bytes read into to the array */ - l_int32 nwritten; /* number of bytes written from the array */ - l_uint8 *array; /* byte array */ -}; -typedef struct ByteBuffer BBUFFER; - - -#endif /* LEPTONICA_BBUFFER_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/bmf.h b/iOS/OCRPlugin/dependencies/include/leptonica/bmf.h deleted file mode 100644 index 2cb4b3fa..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/bmf.h +++ /dev/null @@ -1,51 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_BMF_H -#define LEPTONICA_BMF_H - -/* - * bmf.h - * - * Simple data structure to hold bitmap fonts and related data - */ - - /* Constants for deciding when text block is divided into paragraphs */ -enum { - SPLIT_ON_LEADING_WHITE = 1, /* tab or space at beginning of line */ - SPLIT_ON_BLANK_LINE = 2, /* newline with optional white space */ - SPLIT_ON_BOTH = 3 /* leading white space or newline */ -}; - - -struct L_Bmf -{ - struct Pixa *pixa; /* pixa of bitmaps for 93 characters */ - l_int32 size; /* font size (in points at 300 ppi) */ - char *directory; /* directory containing font bitmaps */ - l_int32 baseline1; /* baseline offset for ascii 33 - 57 */ - l_int32 baseline2; /* baseline offset for ascii 58 - 91 */ - l_int32 baseline3; /* baseline offset for ascii 93 - 126 */ - l_int32 lineheight; /* max height of line of chars */ - l_int32 kernwidth; /* pixel dist between char bitmaps */ - l_int32 spacewidth; /* pixel dist between word bitmaps */ - l_int32 vertlinesep; /* extra vertical space between text lines */ - l_int32 *fonttab; /* table mapping ascii --> font index */ - l_int32 *baselinetab; /* table mapping ascii --> baseline offset */ - l_int32 *widthtab; /* table mapping ascii --> char width */ -}; -typedef struct L_Bmf L_BMF; - -#endif /* LEPTONICA_BMF_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/bmp.h b/iOS/OCRPlugin/dependencies/include/leptonica/bmp.h deleted file mode 100644 index ccd378b8..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/bmp.h +++ /dev/null @@ -1,74 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_BMP_H -#define LEPTONICA_BMP_H - -/* - * This file is here to describe the fields in the header of - * the BMP file. These fields are not used directly in Leptonica. - * The only thing we use are the sizes of these two headers. - * Furthermore, because of potential namespace conflicts with - * the typedefs and defined sizes, we have changed the names - * to protect anyone who may also need to use the original definitions. - * Thanks to J. D. Bryan for pointing out the potential problems when - * developing on Win32 compatible systems. - */ - -/*-------------------------------------------------------------* - * BMP file header * - *-------------------------------------------------------------*/ -struct BMP_FileHeader -{ - l_int16 bfType; /* file type; must be "BM" */ - l_int16 bfSize; /* length of the file; - sizeof(BMP_FileHeader) + - sizeof(BMP_InfoHeader) + - size of color table + - size of DIB bits */ - l_int16 bfFill1; /* remainder of the bfSize field */ - l_int16 bfReserved1; /* don't care (set to 0)*/ - l_int16 bfReserved2; /* don't care (set to 0)*/ - l_int16 bfOffBits; /* offset from beginning of file */ - l_int16 bfFill2; /* remainder of the bfOffBits field */ -}; -typedef struct BMP_FileHeader BMP_FH; - -#define BMP_FHBYTES sizeof(BMP_FH) - - -/*-------------------------------------------------------------* - * BMP info header * - *-------------------------------------------------------------*/ -struct BMP_InfoHeader -{ - l_int32 biSize; /* size of the BMP_InfoHeader struct */ - l_int32 biWidth; /* bitmap width in pixels */ - l_int32 biHeight; /* bitmap height in pixels */ - l_int16 biPlanes; /* number of bitmap planes */ - l_int16 biBitCount; /* number of bits per pixel */ - l_int32 biCompression; /* compression format (0 == uncompressed) */ - l_int32 biSizeImage; /* size of image in bytes */ - l_int32 biXPelsPerMeter; /* pixels per meter in x direction */ - l_int32 biYPelsPerMeter; /* pixels per meter in y direction */ - l_int32 biClrUsed; /* number of colors used */ - l_int32 biClrImportant; /* number of important colors used */ -}; -typedef struct BMP_InfoHeader BMP_IH; - -#define BMP_IHBYTES sizeof(BMP_IH) - - -#endif /* LEPTONICA_BMP_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/ccbord.h b/iOS/OCRPlugin/dependencies/include/leptonica/ccbord.h deleted file mode 100644 index 48497ffc..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/ccbord.h +++ /dev/null @@ -1,103 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_CCBORD_H -#define LEPTONICA_CCBORD_H - -/* - * ccbord.h - * - * CCBord: represents a single connected component - * CCBorda: an array of CCBord - */ - - /* Use in ccbaStepChainsToPixCoords() */ -enum { - CCB_LOCAL_COORDS = 1, - CCB_GLOBAL_COORDS = 2 -}; - - /* Use in ccbaGenerateSPGlobalLocs() */ -enum { - CCB_SAVE_ALL_PTS = 1, - CCB_SAVE_TURNING_PTS = 2 -}; - - - /* CCBord contains: - * - * (1) a minimally-clipped bitmap of the component (pix), - * (2) a boxa consisting of: - * for the primary component: - * (xul, yul) pixel location in global coords - * (w, h) of the bitmap - * for the hole components: - * (x, y) in relative coordinates in primary component - * (w, h) of the hole border (which is 2 pixels - * larger in each direction than the hole itself) - * (3) a pta ('start') of the initial border pixel location for each - * closed curve, all in relative coordinates of the primary - * component. This is given for the primary component, - * followed by the hole components, if any. - * (4) a refcount of the ccbord; used internally when a ccbord - * is accessed from a ccborda (array of ccbord) - * (5) a ptaa for the chain code for the border in relative - * coordinates, where the first pta is the exterior border - * and all other pta are for interior borders (holes) - * (6) a ptaa for the global pixel loc rendition of the border, - * where the first pta is the exterior border and all other - * pta are for interior borders (holes). - * This is derived from the local or step chain code. - * (7) a numaa for the chain code for the border as orientation - * directions between successive border pixels, where - * the first numa is the exterior border and all other - * numa are for interior borders (holes). This is derived - * from the local chain code. The 8 directions are 0 - 7. - * (8) a pta for a single chain for each c.c., comprised of outer - * and hole borders, plus cut paths between them, all in - * local coords. - * (9) a pta for a single chain for each c.c., comprised of outer - * and hole borders, plus cut paths between them, all in - * global coords. - */ -struct CCBord -{ - struct Pix *pix; /* component bitmap (min size) */ - struct Boxa *boxa; /* regions of each closed curve */ - struct Pta *start; /* initial border pixel locations */ - l_int32 refcount; /* number of handles; start at 1 */ - struct Ptaa *local; /* ptaa of chain pixels (local) */ - struct Ptaa *global; /* ptaa of chain pixels (global) */ - struct Numaa *step; /* numaa of chain code (step dir) */ - struct Pta *splocal; /* pta of single chain (local) */ - struct Pta *spglobal; /* pta of single chain (global) */ -}; -typedef struct CCBord CCBORD; - - -struct CCBorda -{ - struct Pix *pix; /* input pix (may be null) */ - l_int32 w; /* width of pix */ - l_int32 h; /* height of pix */ - l_int32 n; /* number of ccbord in ptr array */ - l_int32 nalloc; /* number of ccbord ptrs allocated */ - struct CCBord **ccb; /* ccb ptr array */ -}; -typedef struct CCBorda CCBORDA; - - -#endif /* LEPTONICA_CCBORD_H */ - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/dewarp.h b/iOS/OCRPlugin/dependencies/include/leptonica/dewarp.h deleted file mode 100644 index 4dd3750d..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/dewarp.h +++ /dev/null @@ -1,57 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_DEWARP_H -#define LEPTONICA_DEWARP_H - -/* - * dewarp.h - * - * Data structure to hold arrays and results for generating - * a vertical disparity array based on textlines. The disparity - * array is two-dimensional, and it represents a vertical - * displacement, relative to the flat point in the textlines. - * After dewarping, all points on the altered curve will have - * a y-value equal to the flat point. - * - * The sampled vertical disparity array is expanded to full resolution, - * using linear interpolation, from which it is trivially applied - * to the input image. - */ - -#define DEWARP_VERSION_NUMBER 1 - -struct L_Dewarp -{ - struct Pix *pixs; /* source pix, 1 bpp */ - struct Pix *pixd; /* dewarped pix; 1, 8 or 32 bpp */ - struct FPix *sampvdispar; /* sampled vertical disparity array */ - struct FPix *samphdispar; /* sampled horizontal disparity array */ - struct FPix *fullvdispar; /* full vertical disparity array */ - struct FPix *fullhdispar; /* full horiztontal disparity array */ - struct Numa *naflats; /* sorted flat location of each line */ - struct Numa *nacurves; /* sorted curvature of each line */ - l_int32 pageno; /* page number; important for reuse */ - l_int32 sampling; /* sampling factor of disparity array */ - l_int32 minlines; /* min number of long lines required */ - l_int32 applyhoriz; /* flag for estimating horiz. disparity */ - l_int32 nx; /* number of sampling pts in x direction */ - l_int32 ny; /* number of sampling pts in y direction */ - l_int32 extraw; /* extra width required for hor. disparity */ - l_int32 success; /* sets to 1 if model build succeeds */ -}; -typedef struct L_Dewarp L_DEWARP; - -#endif /* LEPTONICA_DEWARP_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/endianness.h b/iOS/OCRPlugin/dependencies/include/leptonica/endianness.h deleted file mode 100644 index e9eaba90..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/endianness.h +++ /dev/null @@ -1,11 +0,0 @@ -#if !defined (L_BIG_ENDIAN) && !defined (L_LITTLE_ENDIAN) -# if 0 -# ifdef __BIG_ENDIAN__ -# define L_BIG_ENDIAN -# else -# define L_LITTLE_ENDIAN -# endif -# else -# define L_LITTLE_ENDIAN -# endif -#endif diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/environ.h b/iOS/OCRPlugin/dependencies/include/leptonica/environ.h deleted file mode 100644 index 792a7740..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/environ.h +++ /dev/null @@ -1,281 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_ENVIRON_H -#define LEPTONICA_ENVIRON_H - -/*------------------------------------------------------------------------* - * Defines and includes differ for Unix and Windows. Also for Windows, * - * differentiate between conditionals based on platform and compiler. * - * For platforms: * - * _WIN32 => Windows, 32- or 64-bit * - * _WIN64 => Windows, 64-bit only * - * __CYGWIN__ => Cygwin * - * For compilers: * - * __GNUC__ => gcc * - * _MSC_VER => msvc * - *------------------------------------------------------------------------*/ - -/* MS VC++ does not provide stdint.h, so define the missing types here */ - -#ifndef _MSC_VER -#include - -#else -/* Note that _WIN32 is defined for both 32 and 64 bit applications, - whereas _WIN64 is defined only for the latter */ - -#ifdef _WIN64 -typedef __int64 intptr_t; -typedef unsigned __int64 uintptr_t; -#else -typedef int intptr_t; -typedef unsigned int uintptr_t; -#endif - -/* VC++6 doesn't seem to have powf, expf. */ -#if (_MSC_VER < 1400) -#define powf(x, y) (float)pow((double)(x), (double)(y)) -#define expf(x) (float)exp((double)(x)) -#endif - -#endif /* _MSC_VER */ - -/* Windows specifics */ - -#ifdef _WIN32 - -/* DLL EXPORTS and IMPORTS: - * Important: LEPTONLIB_* is deprected. It is retained here only for - * compatibility with tesseract 3.00. In your project files, use - * LIBLEPT_EXPORTS and LIBLEPT_IMPORTS */ -#if defined(LIBLEPT_EXPORTS) || defined(LEPTONLIB_EXPORTS) -#define LEPT_DLL __declspec(dllexport) -#elif defined(LIBLEPT_IMPORTS) || defined(LEPTONLIB_IMPORTS) -#define LEPT_DLL __declspec(dllimport) -#else -#define LEPT_DLL -#endif - -#else /* non-WINDOWS-SPECIFICS */ -#include -#define LEPT_DLL -#endif /* _WIN32 */ - -typedef intptr_t l_intptr_t; -typedef uintptr_t l_uintptr_t; -typedef void *L_TIMER; - - -/*--------------------------------------------------------------------* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* - * USER CONFIGURABLE * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* - * Environ variables with I/O libraries * - * Manual Configuration Only: NOT AUTO_CONF * - *--------------------------------------------------------------------*/ -/* - * Leptonica provides interfaces to link to five external image I/O - * libraries, plus zlib. Setting any of these to 0 here causes - * non-functioning stubs to be linked. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_LIBJPEG 1 -#define HAVE_LIBTIFF 1 -#define HAVE_LIBPNG 1 -#define HAVE_LIBZ 1 -#define HAVE_LIBGIF 0 -#define HAVE_LIBUNGIF 0 -#define HAVE_LIBWEBP 0 -#endif /* ~HAVE_CONFIG_H */ - -/* - * On linux systems, you can do I/O between Pix and memory. Specifically, - * you can compress (write compressed data to memory from a Pix) and - * uncompress (read from compressed data in memory to a Pix). - * For jpeg, png, pnm and bmp, these use the non-posix GNU functions - * fmemopen() and open_memstream(). These functions are not - * available on other systems. To use these functions in linux, - * you must define HAVE_FMEMOPEN to be 1 here. - */ -#ifndef HAVE_CONFIG_H -#define HAVE_FMEMOPEN 0 -#endif /* ~HAVE_CONFIG_H */ - - -/*--------------------------------------------------------------------* - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* - * USER CONFIGURABLE * - * !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!* - * Environ variables for uncompressed formatted image I/O * - *--------------------------------------------------------------------*/ -/* - * Leptonica supplies image I/O for pnm, bmp, ps, and pdf. - * Setting any of these to 0 causes non-functioning stubs to be linked. - */ -#define USE_BMPIO 1 -#define USE_PNMIO 1 -#define USE_PSIO 1 -#define USE_PDFIO 1 - - -/*--------------------------------------------------------------------* - * Built-in types * - *--------------------------------------------------------------------*/ -typedef signed char l_int8; -typedef unsigned char l_uint8; -typedef short l_int16; -typedef unsigned short l_uint16; -typedef int l_int32; -typedef unsigned int l_uint32; -typedef float l_float32; -typedef double l_float64; - - -/*------------------------------------------------------------------------* - * Standard macros * - *------------------------------------------------------------------------*/ -#ifndef L_MIN -#define L_MIN(x,y) (((x) < (y)) ? (x) : (y)) -#endif - -#ifndef L_MAX -#define L_MAX(x,y) (((x) > (y)) ? (x) : (y)) -#endif - -#ifndef L_ABS -#define L_ABS(x) (((x) < 0) ? (-1 * (x)) : (x)) -#endif - -#ifndef L_SIGN -#define L_SIGN(x) (((x) < 0) ? -1 : 1) -#endif - -#ifndef UNDEF -#define UNDEF -1 -#endif - -#ifndef NULL -#define NULL 0 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - - -/*--------------------------------------------------------------------* - * Environ variables used within compiler invocation * - *--------------------------------------------------------------------*/ -/* - * To control conditional compilation, one of two variables - * - * L_LITTLE_ENDIAN (e.g., for Intel X86) - * L_BIG_ENDIAN (e.g., for Sun SPARC, Mac Power PC) - * - * is defined when the GCC compiler is invoked. - * All code should compile properly for both hardware architectures. - */ - - -/*------------------------------------------------------------------------* - * Simple search state variables * - *------------------------------------------------------------------------*/ -enum { - L_NOT_FOUND = 0, - L_FOUND = 1 -}; - - -/*------------------------------------------------------------------------* - * Standard memory allocation * - * - * These specify the memory management functions that are used - * on all heap data except for Pix. Memory management for Pix - * also defaults to malloc and free. See pix1.c for details. - *------------------------------------------------------------------------*/ -#define MALLOC(blocksize) malloc(blocksize) -#define CALLOC(numelem, elemsize) calloc(numelem, elemsize) -#define REALLOC(ptr, blocksize) realloc(ptr, blocksize) -#define FREE(ptr) free(ptr) - - -/*------------------------------------------------------------------------* - * Control printing of error, warning, and info messages * - * * - * (Use -DNO_CONSOLE_IO on compiler line to prevent text output) * - *------------------------------------------------------------------------*/ -#ifdef NO_CONSOLE_IO - -#define PROCNAME(name) -#define ERROR_PTR(a,b,c) ((void *)(c)) -#define ERROR_INT(a,b,c) ((l_int32)(c)) -#define ERROR_FLOAT(a,b,c) ((l_float32)(c)) -#define L_ERROR(a,b) -#define L_ERROR_STRING(a,b,c) -#define L_ERROR_INT(a,b,c) -#define L_ERROR_FLOAT(a,b,c) -#define L_WARNING(a,b) -#define L_WARNING_STRING(a,b,c) -#define L_WARNING_INT(a,b,c) -#define L_WARNING_INT2(a,b,c,d) -#define L_WARNING_FLOAT(a,b,c) -#define L_WARNING_FLOAT2(a,b,c,d) -#define L_INFO(a,b) -#define L_INFO_STRING(a,b,c) -#define L_INFO_INT(a,b,c) -#define L_INFO_INT2(a,b,c,d) -#define L_INFO_FLOAT(a,b,c) -#define L_INFO_FLOAT2(a,b,c,d) - -#else - -#define PROCNAME(name) static const char procName[] = name -#define ERROR_PTR(a,b,c) returnErrorPtr((a),(b),(c)) -#define ERROR_INT(a,b,c) returnErrorInt((a),(b),(c)) -#define ERROR_FLOAT(a,b,c) returnErrorFloat((a),(b),(c)) -#define L_ERROR(a,b) l_error((a),(b)) -#define L_ERROR_STRING(a,b,c) l_errorString((a),(b),(c)) -#define L_ERROR_INT(a,b,c) l_errorInt((a),(b),(c)) -#define L_ERROR_FLOAT(a,b,c) l_errorFloat((a),(b),(c)) -#define L_WARNING(a,b) l_warning((a),(b)) -#define L_WARNING_STRING(a,b,c) l_warningString((a),(b),(c)) -#define L_WARNING_INT(a,b,c) l_warningInt((a),(b),(c)) -#define L_WARNING_INT2(a,b,c,d) l_warningInt2((a),(b),(c),(d)) -#define L_WARNING_FLOAT(a,b,c) l_warningFloat((a),(b),(c)) -#define L_WARNING_FLOAT2(a,b,c,d) l_warningFloat2((a),(b),(c),(d)) -#define L_INFO(a,b) l_info((a),(b)) -#define L_INFO_STRING(a,b,c) l_infoString((a),(b),(c)) -#define L_INFO_INT(a,b,c) l_infoInt((a),(b),(c)) -#define L_INFO_INT2(a,b,c,d) l_infoInt2((a),(b),(c),(d)) -#define L_INFO_FLOAT(a,b,c) l_infoFloat((a),(b),(c)) -#define L_INFO_FLOAT2(a,b,c,d) l_infoFloat2((a),(b),(c),(d)) - -#endif /* NO_CONSOLE_IO */ - - -/*------------------------------------------------------------------------* - * snprintf() renamed in MSVC * - *------------------------------------------------------------------------*/ -#ifdef _MSC_VER -#define snprintf(buf, size, ...) _snprintf_s(buf, size, _TRUNCATE, __VA_ARGS__) -#endif - - -#endif /* LEPTONICA_ENVIRON_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/freetype.h b/iOS/OCRPlugin/dependencies/include/leptonica/freetype.h deleted file mode 100644 index 17fa11a4..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/freetype.h +++ /dev/null @@ -1,23 +0,0 @@ -/*====================================================================* - - Copyright (C) 2008 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_FREETYPE_H -#define LEPTONICA_FREETYPE_H - -#define LEPTONICA_FT_RESOLUTION 96 - -typedef struct ft_library_st FT_LIBRARY; - -#endif /* LEPTONICA_FREETYPE_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/gplot.h b/iOS/OCRPlugin/dependencies/include/leptonica/gplot.h deleted file mode 100644 index 651a97f2..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/gplot.h +++ /dev/null @@ -1,77 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_GPLOT_H -#define LEPTONICA_GPLOT_H - -/* - * gplot.h - * - * Data structures and parameters for generating gnuplot files - */ - -#define GPLOT_VERSION_NUMBER 1 - -#define NUM_GPLOT_STYLES 5 -enum GPLOT_STYLE { - GPLOT_LINES = 0, - GPLOT_POINTS = 1, - GPLOT_IMPULSES = 2, - GPLOT_LINESPOINTS = 3, - GPLOT_DOTS = 4 -}; - -#define NUM_GPLOT_OUTPUTS 6 -enum GPLOT_OUTPUT { - GPLOT_NONE = 0, - GPLOT_PNG = 1, - GPLOT_PS = 2, - GPLOT_EPS = 3, - GPLOT_X11 = 4, - GPLOT_LATEX = 5 -}; - -enum GPLOT_SCALING { - GPLOT_LINEAR_SCALE = 0, /* default */ - GPLOT_LOG_SCALE_X = 1, - GPLOT_LOG_SCALE_Y = 2, - GPLOT_LOG_SCALE_X_Y = 3 -}; - -extern const char *gplotstylenames[]; /* used in gnuplot cmd file */ -extern const char *gplotfilestyles[]; /* used in simple file input */ -extern const char *gplotfileoutputs[]; /* used in simple file input */ - -struct GPlot -{ - char *rootname; /* for cmd, data, output */ - char *cmdname; /* command file name */ - struct Sarray *cmddata; /* command file contents */ - struct Sarray *datanames; /* data file names */ - struct Sarray *plotdata; /* plot data (1 string/file) */ - struct Sarray *plottitles; /* title for each individual plot */ - struct Numa *plotstyles; /* plot style for individual plots */ - l_int32 nplots; /* current number of plots */ - char *outname; /* output file name */ - l_int32 outformat; /* GPLOT_OUTPUT values */ - l_int32 scaling; /* GPLOT_SCALING values */ - char *title; /* optional */ - char *xlabel; /* optional x axis label */ - char *ylabel; /* optional y axis label */ -}; -typedef struct GPlot GPLOT; - - -#endif /* LEPTONICA_GPLOT_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/heap.h b/iOS/OCRPlugin/dependencies/include/leptonica/heap.h deleted file mode 100644 index bee78e24..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/heap.h +++ /dev/null @@ -1,73 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_HEAP_H -#define LEPTONICA_HEAP_H - -/* - * heap.h - * - * Expandable priority queue configured as a heap for arbitrary void* data - * - * The L_Heap is used to implement a priority queue. The elements - * in the heap are ordered in either increasing or decreasing key value. - * The key is a float field 'keyval' that is required to be - * contained in the elements of the queue. - * - * The heap is a simple binary tree with the following constraints: - * - the key of each node is >= the keys of the two children - * - the tree is complete, meaning that each level (1, 2, 4, ...) - * is filled and the last level is filled from left to right - * - * The tree structure is implicit in the queue array, with the - * array elements numbered as a breadth-first search of the tree - * from left to right. It is thus guaranteed that the largest - * (or smallest) key belongs to the first element in the array. - * - * Heap sort is used to sort the array. Once an array has been - * sorted as a heap, it is convenient to use it as a priority queue, - * because the min (or max) elements are always at the root of - * the tree (element 0), and once removed, the heap can be - * resorted in not more than log[n] steps, where n is the number - * of elements on the heap. Likewise, if an arbitrary element is - * added to the end of the array A, the sorted heap can be restored - * in not more than log[n] steps. - * - * A L_Heap differs from a L_Queue in that the elements in the former - * are sorted by a key. Internally, the array is maintained - * as a queue, with a pointer to the end of the array. The - * head of the array always remains at array[0]. The array is - * maintained (sorted) as a heap. When an item is removed from - * the head, the last item takes its place (thus reducing the - * array length by 1), and this is followed by array element - * swaps to restore the heap property. When an item is added, - * it goes at the end of the array, and is swapped up to restore - * the heap. If the ptr array is full, adding another item causes - * the ptr array size to double. - * - * For further implementation details, see heap.c. - */ - -struct L_Heap -{ - l_int32 nalloc; /* size of allocated ptr array */ - l_int32 n; /* number of elements stored in the heap */ - void **array; /* ptr array */ - l_int32 direction; /* L_SORT_INCREASING or L_SORT_DECREASING */ -}; -typedef struct L_Heap L_HEAP; - - -#endif /* LEPTONICA_HEAP_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/imageio.h b/iOS/OCRPlugin/dependencies/include/leptonica/imageio.h deleted file mode 100644 index f3fa5d1d..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/imageio.h +++ /dev/null @@ -1,153 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_IMAGEIO_H -#define LEPTONICA_IMAGEIO_H - -/* ------------------ Image file format types -------------- */ -/* - * The IFF_DEFAULT flag is used to write the file out in the - * same (input) file format that the pix was read from. If the pix - * was not read from file, the input format field will be - * IFF_UNKNOWN and the output file format will be chosen to - * be compressed and lossless; namely, IFF_TIFF_G4 for d = 1 - * and IFF_PNG for everything else. IFF_JP2 is for jpeg2000, which - * is not supported in leptonica. - * - * In the future, new format types that have defined extensions - * will be added before IFF_DEFAULT, and will be kept in sync with - * the file format extensions in writefile.c. The positions of - * file formats before IFF_DEFAULT will remain invariant. - */ -enum { - IFF_UNKNOWN = 0, - IFF_BMP = 1, - IFF_JFIF_JPEG = 2, - IFF_PNG = 3, - IFF_TIFF = 4, - IFF_TIFF_PACKBITS = 5, - IFF_TIFF_RLE = 6, - IFF_TIFF_G3 = 7, - IFF_TIFF_G4 = 8, - IFF_TIFF_LZW = 9, - IFF_TIFF_ZIP = 10, - IFF_PNM = 11, - IFF_PS = 12, - IFF_GIF = 13, - IFF_JP2 = 14, - IFF_WEBP = 15, - IFF_LPDF = 16, - IFF_DEFAULT = 17, - IFF_SPIX = 18 -}; - - -/* ---------------------- Format header ids --------------------- */ -enum { - BMP_ID = 0x4d42, - TIFF_BIGEND_ID = 0x4d4d, /* MM - for 'motorola' */ - TIFF_LITTLEEND_ID = 0x4949 /* II - for 'intel' */ -}; - - -/* ------------------ Gray hinting in jpeg reader --------------- */ -enum { - L_HINT_GRAY = 1, /* only want grayscale information */ -}; - - -/* ------------------ Pdf formated encoding types --------------- */ -enum { - L_JPEG_ENCODE = 1, /* use dct encoding: 8 and 32 bpp, no cmap */ - L_G4_ENCODE = 2, /* use ccitt g4 fax encoding: 1 bpp */ - L_FLATE_ENCODE = 3 /* use flate encoding: any depth, cmap ok */ -}; - - -/* ------------------ Compressed image data --------------------- */ -/* - * In use, either datacomp or data85 will be produced, depending - * on whether the data needs to be ascii85 encoded. PostScript - * requires ascii85 encoding; pdf does not. - * - * For the colormap (flate compression only), PostScript uses ascii85 - * encoding and pdf uses a bracketed array of space-separated - * hex-encoded rgb triples. Only tiff g4 (type == L_G4_ENCODE) uses - * the minisblack field. - */ -struct L_Compressed_Data -{ - l_int32 type; /* encoding type: L_JPEG_ENCODE, etc */ - l_uint8 *datacomp; /* gzipped raster data */ - size_t nbytescomp; /* number of compressed bytes */ - char *data85; /* ascii85-encoded gzipped raster data */ - size_t nbytes85; /* number of ascii85 encoded bytes */ - char *cmapdata85; /* ascii85-encoded uncompressed cmap */ - char *cmapdatahex; /* hex pdf array for the cmap */ - l_int32 ncolors; /* number of colors in cmap */ - l_int32 w; /* image width */ - l_int32 h; /* image height */ - l_int32 bps; /* bits/sample; typ. 1, 2, 4 or 8 */ - l_int32 spp; /* samples/pixel; typ. 1 or 3 */ - l_int32 minisblack; /* tiff g4 photometry */ - size_t nbytes; /* number of uncompressed raster bytes */ - l_int32 res; /* resolution (ppi) */ -}; -typedef struct L_Compressed_Data L_COMPRESSED_DATA; - - -/* ------------------------ Pdf multi-image flags ------------------------ */ -enum { - L_FIRST_IMAGE = 1, /* first image to be used */ - L_NEXT_IMAGE = 2, /* intermediate image; not first or last */ - L_LAST_IMAGE = 3 /* last image to be used */ -}; - - -/* ------------------ Intermediate pdf generation data -------------------- */ -/* - * This accumulates data for generating a pdf of a single page consisting - * of an arbitrary number of images. - * - * None of the strings have a trailing newline. - */ -struct L_Pdf_Data -{ - char *title; /* optional title for pdf */ - l_int32 n; /* number of images */ - l_int32 ncmap; /* number of colormaps */ - struct L_Ptra *cida; /* array of compressed image data */ - char *id; /* %PDF-1.2 id string */ - char *obj1; /* catalog string */ - char *obj2; /* metadata string */ - char *obj3; /* pages string */ - char *obj4; /* page string (variable data) */ - char *obj5; /* content string (variable data) */ - char *poststream; /* post-binary-stream string */ - char *trailer; /* trailer string (variable data) */ - struct Pta *xy; /* store (xpt, ypt) array */ - struct Pta *wh; /* store (wpt, hpt) array */ - struct Box *mediabox; /* bounding region for all images */ - struct Sarray *saprex; /* pre-binary-stream xobject strings */ - struct Sarray *sacmap; /* colormap pdf object strings */ - struct Numa *objsize; /* sizes of each pdf string object */ - struct Numa *objloc; /* location of each pdf string object */ - l_int32 xrefloc; /* location of xref */ -}; -typedef struct L_Pdf_Data L_PDF_DATA; - - -#endif /* LEPTONICA_IMAGEIO_H */ - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/jbclass.h b/iOS/OCRPlugin/dependencies/include/leptonica/jbclass.h deleted file mode 100644 index ab4fa372..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/jbclass.h +++ /dev/null @@ -1,122 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_JBCLASS_H -#define LEPTONICA_JBCLASS_H - -/* - * jbclass.h - * - * JbClasser - * JbData - */ - - - /* The JbClasser struct holds all the data accumulated during the - * classification process that can be used for a compressed - * jbig2-type representation of a set of images. This is created - * in an initialization process and added to as the selected components - * on each successive page are analyzed. */ -struct JbClasser -{ - struct Sarray *safiles; /* input page image file names */ - l_int32 method; /* JB_RANKHAUS, JB_CORRELATION */ - l_int32 components; /* JB_CONN_COMPS, JB_CHARACTERS or */ - /* JB_WORDS */ - l_int32 maxwidth; /* max component width allowed */ - l_int32 maxheight; /* max component height allowed */ - l_int32 npages; /* number of pages already processed */ - l_int32 baseindex; /* number of components already processed */ - /* on fully processed pages */ - struct Numa *nacomps; /* number of components on each page */ - l_int32 sizehaus; /* size of square struct element for haus */ - l_float32 rankhaus; /* rank val of haus match, each way */ - l_float32 thresh; /* thresh value for correlation score */ - l_float32 weightfactor; /* corrects thresh value for heaver */ - /* components; use 0 for no correction */ - struct Numa *naarea; /* w * h of each template, without extra */ - /* border pixels */ - l_int32 w; /* max width of original src images */ - l_int32 h; /* max height of original src images */ - l_int32 nclass; /* current number of classes */ - l_int32 keep_pixaa; /* If zero, pixaa isn't filled */ - struct Pixaa *pixaa; /* instances for each class; unbordered */ - struct Pixa *pixat; /* templates for each class; bordered */ - /* and not dilated */ - struct Pixa *pixatd; /* templates for each class; bordered */ - /* and dilated */ - struct NumaHash *nahash; /* Hash table to find templates by size */ - struct Numa *nafgt; /* fg areas of undilated templates; */ - /* only used for rank < 1.0 */ - struct Pta *ptac; /* centroids of all bordered cc */ - struct Pta *ptact; /* centroids of all bordered template cc */ - struct Numa *naclass; /* array of class ids for each component */ - struct Numa *napage; /* array of page nums for each component */ - struct Pta *ptaul; /* array of UL corners at which the */ - /* template is to be placed for each */ - /* component */ - struct Pta *ptall; /* similar to ptaul, but for LL corners */ -}; -typedef struct JbClasser JBCLASSER; - - - /* The JbData struct holds all the data required for - * the compressed jbig-type representation of a set of images. - * The data can be written to file, read back, and used - * to regenerate an approximate version of the original, - * which differs in two ways from the original: - * (1) It uses a template image for each c.c. instead of the - * original instance, for each occurrence on each page. - * (2) It discards components with either a height or width larger - * than the maximuma, given here by the lattice dimensions - * used for storing the templates. */ -struct JbData -{ - struct Pix *pix; /* template composite for all classes */ - l_int32 npages; /* number of pages */ - l_int32 w; /* max width of original page images */ - l_int32 h; /* max height of original page images */ - l_int32 nclass; /* number of classes */ - l_int32 latticew; /* lattice width for template composite */ - l_int32 latticeh; /* lattice height for template composite */ - struct Numa *naclass; /* array of class ids for each component */ - struct Numa *napage; /* array of page nums for each component */ - struct Pta *ptaul; /* array of UL corners at which the */ - /* template is to be placed for each */ - /* component */ -}; -typedef struct JbData JBDATA; - - - /* Classifier methods */ -enum { - JB_RANKHAUS = 0, - JB_CORRELATION = 1 -}; - - /* For jbGetComponents(): type of component to extract from images */ -enum { - JB_CONN_COMPS = 0, - JB_CHARACTERS = 1, - JB_WORDS = 2 -}; - - /* These parameters are used for naming the two files - * in which the jbig2-like compressed data is stored. */ -#define JB_TEMPLATE_EXT ".templates.png" -#define JB_DATA_EXT ".data" - - -#endif /* LEPTONICA_JBCLASS_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/leptprotos.h b/iOS/OCRPlugin/dependencies/include/leptonica/leptprotos.h deleted file mode 100644 index d130a9b2..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/leptprotos.h +++ /dev/null @@ -1,2058 +0,0 @@ -/* - * This file was autogen'd by xtractprotos, v. 1.4 - */ -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -LEPT_DLL extern PIX * pixBackgroundNormSimple ( PIX *pixs, PIX *pixim, PIX *pixg ); -LEPT_DLL extern PIX * pixBackgroundNorm ( PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy ); -LEPT_DLL extern PIX * pixBackgroundNormMorph ( PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval ); -LEPT_DLL extern l_int32 pixBackgroundNormGrayArray ( PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy, PIX **ppixd ); -LEPT_DLL extern l_int32 pixBackgroundNormRGBArrays ( PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy, PIX **ppixr, PIX **ppixg, PIX **ppixb ); -LEPT_DLL extern l_int32 pixBackgroundNormGrayArrayMorph ( PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixd ); -LEPT_DLL extern l_int32 pixBackgroundNormRGBArraysMorph ( PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, l_int32 bgval, PIX **ppixr, PIX **ppixg, PIX **ppixb ); -LEPT_DLL extern l_int32 pixGetBackgroundGrayMap ( PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, PIX **ppixd ); -LEPT_DLL extern l_int32 pixGetBackgroundRGBMap ( PIX *pixs, PIX *pixim, PIX *pixg, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, PIX **ppixmr, PIX **ppixmg, PIX **ppixmb ); -LEPT_DLL extern l_int32 pixGetBackgroundGrayMapMorph ( PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixm ); -LEPT_DLL extern l_int32 pixGetBackgroundRGBMapMorph ( PIX *pixs, PIX *pixim, l_int32 reduction, l_int32 size, PIX **ppixmr, PIX **ppixmg, PIX **ppixmb ); -LEPT_DLL extern l_int32 pixFillMapHoles ( PIX *pix, l_int32 nx, l_int32 ny, l_int32 filltype ); -LEPT_DLL extern PIX * pixExtendByReplication ( PIX *pixs, l_int32 addw, l_int32 addh ); -LEPT_DLL extern l_int32 pixSmoothConnectedRegions ( PIX *pixs, PIX *pixm, l_int32 factor ); -LEPT_DLL extern PIX * pixGetInvBackgroundMap ( PIX *pixs, l_int32 bgval, l_int32 smoothx, l_int32 smoothy ); -LEPT_DLL extern PIX * pixApplyInvBackgroundGrayMap ( PIX *pixs, PIX *pixm, l_int32 sx, l_int32 sy ); -LEPT_DLL extern PIX * pixApplyInvBackgroundRGBMap ( PIX *pixs, PIX *pixmr, PIX *pixmg, PIX *pixmb, l_int32 sx, l_int32 sy ); -LEPT_DLL extern PIX * pixApplyVariableGrayMap ( PIX *pixs, PIX *pixg, l_int32 target ); -LEPT_DLL extern PIX * pixGlobalNormRGB ( PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 mapval ); -LEPT_DLL extern PIX * pixGlobalNormNoSatRGB ( PIX *pixd, PIX *pixs, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 factor, l_float32 rank ); -LEPT_DLL extern l_int32 pixThresholdSpreadNorm ( PIX *pixs, l_int32 filtertype, l_int32 edgethresh, l_int32 smoothx, l_int32 smoothy, l_float32 gamma, l_int32 minval, l_int32 maxval, l_int32 targetthresh, PIX **ppixth, PIX **ppixb, PIX **ppixd ); -LEPT_DLL extern PIX * pixBackgroundNormFlex ( PIX *pixs, l_int32 sx, l_int32 sy, l_int32 smoothx, l_int32 smoothy, l_int32 delta ); -LEPT_DLL extern PIX * pixContrastNorm ( PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy ); -LEPT_DLL extern l_int32 pixMinMaxTiles ( PIX *pixs, l_int32 sx, l_int32 sy, l_int32 mindiff, l_int32 smoothx, l_int32 smoothy, PIX **ppixmin, PIX **ppixmax ); -LEPT_DLL extern l_int32 pixSetLowContrast ( PIX *pixs1, PIX *pixs2, l_int32 mindiff ); -LEPT_DLL extern PIX * pixLinearTRCTiled ( PIX *pixd, PIX *pixs, l_int32 sx, l_int32 sy, PIX *pixmin, PIX *pixmax ); -LEPT_DLL extern PIX * pixAffineSampledPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixAffineSampled ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixAffinePta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixAffine ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixAffinePtaColor ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval ); -LEPT_DLL extern PIX * pixAffineColor ( PIX *pixs, l_float32 *vc, l_uint32 colorval ); -LEPT_DLL extern PIX * pixAffinePtaGray ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval ); -LEPT_DLL extern PIX * pixAffineGray ( PIX *pixs, l_float32 *vc, l_uint8 grayval ); -LEPT_DLL extern PIX * pixAffinePtaWithAlpha ( PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border ); -LEPT_DLL extern PIX * pixAffinePtaGammaXform ( PIX *pixs, l_float32 gamma, PTA *ptad, PTA *ptas, l_float32 fract, l_int32 border ); -LEPT_DLL extern l_int32 getAffineXformCoeffs ( PTA *ptas, PTA *ptad, l_float32 **pvc ); -LEPT_DLL extern l_int32 affineInvertXform ( l_float32 *vc, l_float32 **pvci ); -LEPT_DLL extern l_int32 affineXformSampledPt ( l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp ); -LEPT_DLL extern l_int32 affineXformPt ( l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp ); -LEPT_DLL extern l_int32 linearInterpolatePixelColor ( l_uint32 *datas, l_int32 wpls, l_int32 w, l_int32 h, l_float32 x, l_float32 y, l_uint32 colorval, l_uint32 *pval ); -LEPT_DLL extern l_int32 linearInterpolatePixelGray ( l_uint32 *datas, l_int32 wpls, l_int32 w, l_int32 h, l_float32 x, l_float32 y, l_int32 grayval, l_int32 *pval ); -LEPT_DLL extern l_int32 gaussjordan ( l_float32 **a, l_float32 *b, l_int32 n ); -LEPT_DLL extern PIX * pixAffineSequential ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 bw, l_int32 bh ); -LEPT_DLL extern l_float32 * createMatrix2dTranslate ( l_float32 transx, l_float32 transy ); -LEPT_DLL extern l_float32 * createMatrix2dScale ( l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern l_float32 * createMatrix2dRotate ( l_float32 xc, l_float32 yc, l_float32 angle ); -LEPT_DLL extern PTA * ptaTranslate ( PTA *ptas, l_float32 transx, l_float32 transy ); -LEPT_DLL extern PTA * ptaScale ( PTA *ptas, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PTA * ptaRotate ( PTA *ptas, l_float32 xc, l_float32 yc, l_float32 angle ); -LEPT_DLL extern BOXA * boxaTranslate ( BOXA *boxas, l_float32 transx, l_float32 transy ); -LEPT_DLL extern BOXA * boxaScale ( BOXA *boxas, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern BOXA * boxaRotate ( BOXA *boxas, l_float32 xc, l_float32 yc, l_float32 angle ); -LEPT_DLL extern PTA * ptaAffineTransform ( PTA *ptas, l_float32 *mat ); -LEPT_DLL extern BOXA * boxaAffineTransform ( BOXA *boxas, l_float32 *mat ); -LEPT_DLL extern l_int32 l_productMatVec ( l_float32 *mat, l_float32 *vecs, l_float32 *vecd, l_int32 size ); -LEPT_DLL extern l_int32 l_productMat2 ( l_float32 *mat1, l_float32 *mat2, l_float32 *matd, l_int32 size ); -LEPT_DLL extern l_int32 l_productMat3 ( l_float32 *mat1, l_float32 *mat2, l_float32 *mat3, l_float32 *matd, l_int32 size ); -LEPT_DLL extern l_int32 l_productMat4 ( l_float32 *mat1, l_float32 *mat2, l_float32 *mat3, l_float32 *mat4, l_float32 *matd, l_int32 size ); -LEPT_DLL extern void addConstantGrayLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 d, l_int32 wpl, l_int32 val ); -LEPT_DLL extern void multConstantGrayLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 d, l_int32 wpl, l_float32 val ); -LEPT_DLL extern void addGrayLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls ); -LEPT_DLL extern void subtractGrayLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls ); -LEPT_DLL extern void thresholdToValueLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 d, l_int32 wpld, l_int32 threshval, l_int32 setval ); -LEPT_DLL extern void finalAccumulateLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 offset ); -LEPT_DLL extern void finalAccumulateThreshLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 offset, l_uint32 threshold ); -LEPT_DLL extern void accumulateLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 d, l_int32 wpls, l_int32 op ); -LEPT_DLL extern void multConstAccumulateLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 wpl, l_float32 factor, l_uint32 offset ); -LEPT_DLL extern void absDifferenceLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas1, l_uint32 *datas2, l_int32 d, l_int32 wpls ); -LEPT_DLL extern l_int32 l_getDataBit ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataBit ( void *line, l_int32 n ); -LEPT_DLL extern void l_clearDataBit ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataBitVal ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern l_int32 l_getDataDibit ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataDibit ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern void l_clearDataDibit ( void *line, l_int32 n ); -LEPT_DLL extern l_int32 l_getDataQbit ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataQbit ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern void l_clearDataQbit ( void *line, l_int32 n ); -LEPT_DLL extern l_int32 l_getDataByte ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataByte ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern l_int32 l_getDataTwoBytes ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataTwoBytes ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern l_int32 l_getDataFourBytes ( void *line, l_int32 n ); -LEPT_DLL extern void l_setDataFourBytes ( void *line, l_int32 n, l_int32 val ); -LEPT_DLL extern char * barcodeDispatchDecoder ( char *barstr, l_int32 format, l_int32 debugflag ); -LEPT_DLL extern l_int32 barcodeFormatIsSupported ( l_int32 format ); -LEPT_DLL extern NUMA * pixFindBaselines ( PIX *pixs, PTA **ppta, l_int32 debug ); -LEPT_DLL extern PIX * pixDeskewLocal ( PIX *pixs, l_int32 nslices, l_int32 redsweep, l_int32 redsearch, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta ); -LEPT_DLL extern l_int32 pixGetLocalSkewTransform ( PIX *pixs, l_int32 nslices, l_int32 redsweep, l_int32 redsearch, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta, PTA **pptas, PTA **pptad ); -LEPT_DLL extern NUMA * pixGetLocalSkewAngles ( PIX *pixs, l_int32 nslices, l_int32 redsweep, l_int32 redsearch, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta, l_float32 *pa, l_float32 *pb ); -LEPT_DLL extern BBUFFER * bbufferCreate ( l_uint8 *indata, l_int32 nalloc ); -LEPT_DLL extern void bbufferDestroy ( BBUFFER **pbb ); -LEPT_DLL extern l_uint8 * bbufferDestroyAndSaveData ( BBUFFER **pbb, size_t *pnbytes ); -LEPT_DLL extern l_int32 bbufferRead ( BBUFFER *bb, l_uint8 *src, l_int32 nbytes ); -LEPT_DLL extern l_int32 bbufferReadStream ( BBUFFER *bb, FILE *fp, l_int32 nbytes ); -LEPT_DLL extern l_int32 bbufferExtendArray ( BBUFFER *bb, l_int32 nbytes ); -LEPT_DLL extern l_int32 bbufferWrite ( BBUFFER *bb, l_uint8 *dest, size_t nbytes, size_t *pnout ); -LEPT_DLL extern l_int32 bbufferWriteStream ( BBUFFER *bb, FILE *fp, size_t nbytes, size_t *pnout ); -LEPT_DLL extern l_int32 bbufferBytesToWrite ( BBUFFER *bb, size_t *pnbytes ); -LEPT_DLL extern PIX * pixBilinearSampledPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixBilinearSampled ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixBilinearPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixBilinear ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixBilinearPtaColor ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval ); -LEPT_DLL extern PIX * pixBilinearColor ( PIX *pixs, l_float32 *vc, l_uint32 colorval ); -LEPT_DLL extern PIX * pixBilinearPtaGray ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval ); -LEPT_DLL extern PIX * pixBilinearGray ( PIX *pixs, l_float32 *vc, l_uint8 grayval ); -LEPT_DLL extern PIX * pixBilinearPtaWithAlpha ( PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border ); -LEPT_DLL extern PIX * pixBilinearPtaGammaXform ( PIX *pixs, l_float32 gamma, PTA *ptad, PTA *ptas, l_float32 fract, l_int32 border ); -LEPT_DLL extern l_int32 getBilinearXformCoeffs ( PTA *ptas, PTA *ptad, l_float32 **pvc ); -LEPT_DLL extern l_int32 bilinearXformSampledPt ( l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp ); -LEPT_DLL extern l_int32 bilinearXformPt ( l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp ); -LEPT_DLL extern l_int32 pixOtsuAdaptiveThreshold ( PIX *pixs, l_int32 sx, l_int32 sy, l_int32 smoothx, l_int32 smoothy, l_float32 scorefract, PIX **ppixth, PIX **ppixd ); -LEPT_DLL extern PIX * pixOtsuThreshOnBackgroundNorm ( PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 bgval, l_int32 smoothx, l_int32 smoothy, l_float32 scorefract, l_int32 *pthresh ); -LEPT_DLL extern PIX * pixMaskedThreshOnBackgroundNorm ( PIX *pixs, PIX *pixim, l_int32 sx, l_int32 sy, l_int32 thresh, l_int32 mincount, l_int32 smoothx, l_int32 smoothy, l_float32 scorefract, l_int32 *pthresh ); -LEPT_DLL extern l_int32 pixSauvolaBinarizeTiled ( PIX *pixs, l_int32 whsize, l_float32 factor, l_int32 nx, l_int32 ny, PIX **ppixth, PIX **ppixd ); -LEPT_DLL extern l_int32 pixSauvolaBinarize ( PIX *pixs, l_int32 whsize, l_float32 factor, l_int32 addborder, PIX **ppixm, PIX **ppixsd, PIX **ppixth, PIX **ppixd ); -LEPT_DLL extern PIX * pixSauvolaGetThreshold ( PIX *pixm, PIX *pixms, l_float32 factor, PIX **ppixsd ); -LEPT_DLL extern PIX * pixApplyLocalThreshold ( PIX *pixs, PIX *pixth, l_int32 redfactor ); -LEPT_DLL extern PIX * pixExpandBinaryReplicate ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern PIX * pixExpandBinaryPower2 ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern l_int32 expandBinaryPower2Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls, l_int32 factor ); -LEPT_DLL extern l_uint16 * makeExpandTab2x ( void ); -LEPT_DLL extern l_uint32 * makeExpandTab4x ( void ); -LEPT_DLL extern l_uint32 * makeExpandTab8x ( void ); -LEPT_DLL extern PIX * pixReduceBinary2 ( PIX *pixs, l_uint8 *intab ); -LEPT_DLL extern PIX * pixReduceRankBinaryCascade ( PIX *pixs, l_int32 level1, l_int32 level2, l_int32 level3, l_int32 level4 ); -LEPT_DLL extern PIX * pixReduceRankBinary2 ( PIX *pixs, l_int32 level, l_uint8 *intab ); -LEPT_DLL extern void reduceBinary2Low ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 hs, l_int32 wpls, l_uint8 *tab ); -LEPT_DLL extern void reduceRankBinary2Low ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 hs, l_int32 wpls, l_uint8 *tab, l_int32 level ); -LEPT_DLL extern l_uint8 * makeSubsampleTab2x ( void ); -LEPT_DLL extern PIX * pixBlend ( PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract ); -LEPT_DLL extern PIX * pixBlendMask ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 type ); -LEPT_DLL extern PIX * pixBlendGray ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 type, l_int32 transparent, l_uint32 transpix ); -LEPT_DLL extern PIX * pixBlendColor ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 transparent, l_uint32 transpix ); -LEPT_DLL extern PIX * pixBlendColorByChannel ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 rfract, l_float32 gfract, l_float32 bfract, l_int32 transparent, l_uint32 transpix ); -LEPT_DLL extern PIX * pixBlendGrayAdapt ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract, l_int32 shift ); -LEPT_DLL extern PIX * pixFadeWithGray ( PIX *pixs, PIX *pixb, l_float32 factor, l_int32 type ); -LEPT_DLL extern PIX * pixBlendHardLight ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 x, l_int32 y, l_float32 fract ); -LEPT_DLL extern l_int32 pixBlendCmap ( PIX *pixs, PIX *pixb, l_int32 x, l_int32 y, l_int32 sindex ); -LEPT_DLL extern PIX * pixBlendWithGrayMask ( PIX *pixs1, PIX *pixs2, PIX *pixg, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixColorGray ( PIX *pixs, BOX *box, l_int32 type, l_int32 thresh, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern PIX * pixSnapColor ( PIX *pixd, PIX *pixs, l_uint32 srcval, l_uint32 dstval, l_int32 diff ); -LEPT_DLL extern PIX * pixSnapColorCmap ( PIX *pixd, PIX *pixs, l_uint32 srcval, l_uint32 dstval, l_int32 diff ); -LEPT_DLL extern PIX * pixLinearMapToTargetColor ( PIX *pixd, PIX *pixs, l_uint32 srcval, l_uint32 dstval ); -LEPT_DLL extern l_int32 pixelLinearMapToTargetColor ( l_uint32 scolor, l_uint32 srcmap, l_uint32 dstmap, l_uint32 *pdcolor ); -LEPT_DLL extern l_int32 pixelFractionalShift ( l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fraction, l_uint32 *ppixel ); -LEPT_DLL extern L_BMF * bmfCreate ( const char *dir, l_int32 size ); -LEPT_DLL extern void bmfDestroy ( L_BMF **pbmf ); -LEPT_DLL extern PIX * bmfGetPix ( L_BMF *bmf, char chr ); -LEPT_DLL extern l_int32 bmfGetWidth ( L_BMF *bmf, char chr, l_int32 *pw ); -LEPT_DLL extern l_int32 bmfGetBaseline ( L_BMF *bmf, char chr, l_int32 *pbaseline ); -LEPT_DLL extern PIXA * pixaGetFont ( const char *dir, l_int32 size, l_int32 *pbl0, l_int32 *pbl1, l_int32 *pbl2 ); -LEPT_DLL extern l_int32 pixaSaveFont ( const char *indir, const char *outdir, l_int32 size ); -LEPT_DLL extern PIXA * pixaGenerateFont ( const char *dir, l_int32 size, l_int32 *pbl0, l_int32 *pbl1, l_int32 *pbl2 ); -LEPT_DLL extern PIX * pixReadStreamBmp ( FILE *fp ); -LEPT_DLL extern l_int32 pixWriteStreamBmp ( FILE *fp, PIX *pix ); -LEPT_DLL extern PIX * pixReadMemBmp ( const l_uint8 *cdata, size_t size ); -LEPT_DLL extern l_int32 pixWriteMemBmp ( l_uint8 **pdata, size_t *psize, PIX *pix ); -LEPT_DLL extern BOX * boxCreate ( l_int32 x, l_int32 y, l_int32 w, l_int32 h ); -LEPT_DLL extern BOX * boxCreateValid ( l_int32 x, l_int32 y, l_int32 w, l_int32 h ); -LEPT_DLL extern BOX * boxCopy ( BOX *box ); -LEPT_DLL extern BOX * boxClone ( BOX *box ); -LEPT_DLL extern void boxDestroy ( BOX **pbox ); -LEPT_DLL extern l_int32 boxGetGeometry ( BOX *box, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 boxSetGeometry ( BOX *box, l_int32 x, l_int32 y, l_int32 w, l_int32 h ); -LEPT_DLL extern l_int32 boxGetRefcount ( BOX *box ); -LEPT_DLL extern l_int32 boxChangeRefcount ( BOX *box, l_int32 delta ); -LEPT_DLL extern BOXA * boxaCreate ( l_int32 n ); -LEPT_DLL extern BOXA * boxaCopy ( BOXA *boxa, l_int32 copyflag ); -LEPT_DLL extern void boxaDestroy ( BOXA **pboxa ); -LEPT_DLL extern l_int32 boxaAddBox ( BOXA *boxa, BOX *box, l_int32 copyflag ); -LEPT_DLL extern l_int32 boxaExtendArray ( BOXA *boxa ); -LEPT_DLL extern l_int32 boxaExtendArrayToSize ( BOXA *boxa, l_int32 size ); -LEPT_DLL extern l_int32 boxaGetCount ( BOXA *boxa ); -LEPT_DLL extern l_int32 boxaGetValidCount ( BOXA *boxa ); -LEPT_DLL extern BOX * boxaGetBox ( BOXA *boxa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern BOX * boxaGetValidBox ( BOXA *boxa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern l_int32 boxaGetBoxGeometry ( BOXA *boxa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 boxaReplaceBox ( BOXA *boxa, l_int32 index, BOX *box ); -LEPT_DLL extern l_int32 boxaInsertBox ( BOXA *boxa, l_int32 index, BOX *box ); -LEPT_DLL extern l_int32 boxaRemoveBox ( BOXA *boxa, l_int32 index ); -LEPT_DLL extern l_int32 boxaInitFull ( BOXA *boxa, BOX *box ); -LEPT_DLL extern l_int32 boxaClear ( BOXA *boxa ); -LEPT_DLL extern BOXAA * boxaaCreate ( l_int32 n ); -LEPT_DLL extern BOXAA * boxaaCopy ( BOXAA *baas, l_int32 copyflag ); -LEPT_DLL extern void boxaaDestroy ( BOXAA **pbaa ); -LEPT_DLL extern l_int32 boxaaAddBoxa ( BOXAA *baa, BOXA *ba, l_int32 copyflag ); -LEPT_DLL extern l_int32 boxaaExtendArray ( BOXAA *baa ); -LEPT_DLL extern l_int32 boxaaGetCount ( BOXAA *baa ); -LEPT_DLL extern l_int32 boxaaGetBoxCount ( BOXAA *baa ); -LEPT_DLL extern BOXA * boxaaGetBoxa ( BOXAA *baa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern l_int32 boxaaReplaceBoxa ( BOXAA *baa, l_int32 index, BOXA *boxa ); -LEPT_DLL extern l_int32 boxaaInsertBoxa ( BOXAA *baa, l_int32 index, BOXA *boxa ); -LEPT_DLL extern l_int32 boxaaRemoveBoxa ( BOXAA *baa, l_int32 index ); -LEPT_DLL extern l_int32 boxaaAddBox ( BOXAA *baa, l_int32 index, BOX *box, l_int32 accessflag ); -LEPT_DLL extern BOXAA * boxaaRead ( const char *filename ); -LEPT_DLL extern BOXAA * boxaaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 boxaaWrite ( const char *filename, BOXAA *baa ); -LEPT_DLL extern l_int32 boxaaWriteStream ( FILE *fp, BOXAA *baa ); -LEPT_DLL extern BOXA * boxaRead ( const char *filename ); -LEPT_DLL extern BOXA * boxaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 boxaWrite ( const char *filename, BOXA *boxa ); -LEPT_DLL extern l_int32 boxaWriteStream ( FILE *fp, BOXA *boxa ); -LEPT_DLL extern l_int32 boxPrintStreamInfo ( FILE *fp, BOX *box ); -LEPT_DLL extern l_int32 boxContains ( BOX *box1, BOX *box2, l_int32 *presult ); -LEPT_DLL extern l_int32 boxIntersects ( BOX *box1, BOX *box2, l_int32 *presult ); -LEPT_DLL extern BOXA * boxaContainedInBox ( BOXA *boxas, BOX *box ); -LEPT_DLL extern BOXA * boxaIntersectsBox ( BOXA *boxas, BOX *box ); -LEPT_DLL extern BOXA * boxaClipToBox ( BOXA *boxas, BOX *box ); -LEPT_DLL extern BOXA * boxaCombineOverlaps ( BOXA *boxas ); -LEPT_DLL extern BOX * boxOverlapRegion ( BOX *box1, BOX *box2 ); -LEPT_DLL extern BOX * boxBoundingRegion ( BOX *box1, BOX *box2 ); -LEPT_DLL extern l_int32 boxOverlapFraction ( BOX *box1, BOX *box2, l_float32 *pfract ); -LEPT_DLL extern l_int32 boxContainsPt ( BOX *box, l_float32 x, l_float32 y, l_int32 *pcontains ); -LEPT_DLL extern BOX * boxaGetNearestToPt ( BOXA *boxa, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 boxGetCenter ( BOX *box, l_float32 *pcx, l_float32 *pcy ); -LEPT_DLL extern l_int32 boxIntersectByLine ( BOX *box, l_int32 x, l_int32 y, l_float32 slope, l_int32 *px1, l_int32 *py1, l_int32 *px2, l_int32 *py2, l_int32 *pn ); -LEPT_DLL extern BOX * boxClipToRectangle ( BOX *box, l_int32 wi, l_int32 hi ); -LEPT_DLL extern BOX * boxRelocateOneSide ( BOX *boxd, BOX *boxs, l_int32 loc, l_int32 sideflag ); -LEPT_DLL extern BOX * boxAdjustSides ( BOX *boxd, BOX *boxs, l_int32 delleft, l_int32 delright, l_int32 deltop, l_int32 delbot ); -LEPT_DLL extern l_int32 boxEqual ( BOX *box1, BOX *box2, l_int32 *psame ); -LEPT_DLL extern l_int32 boxaEqual ( BOXA *boxa1, BOXA *boxa2, l_int32 maxdist, NUMA **pnaindex, l_int32 *psame ); -LEPT_DLL extern l_int32 boxaJoin ( BOXA *boxad, BOXA *boxas, l_int32 istart, l_int32 iend ); -LEPT_DLL extern l_int32 boxaGetExtent ( BOXA *boxa, l_int32 *pw, l_int32 *ph, BOX **pbox ); -LEPT_DLL extern l_int32 boxaGetCoverage ( BOXA *boxa, l_int32 wc, l_int32 hc, l_int32 exactflag, l_float32 *pfract ); -LEPT_DLL extern l_int32 boxaSizeRange ( BOXA *boxa, l_int32 *pminw, l_int32 *pminh, l_int32 *pmaxw, l_int32 *pmaxh ); -LEPT_DLL extern l_int32 boxaLocationRange ( BOXA *boxa, l_int32 *pminx, l_int32 *pminy, l_int32 *pmaxx, l_int32 *pmaxy ); -LEPT_DLL extern BOXA * boxaSelectBySize ( BOXA *boxas, l_int32 width, l_int32 height, l_int32 type, l_int32 relation, l_int32 *pchanged ); -LEPT_DLL extern NUMA * boxaMakeSizeIndicator ( BOXA *boxa, l_int32 width, l_int32 height, l_int32 type, l_int32 relation ); -LEPT_DLL extern BOXA * boxaSelectWithIndicator ( BOXA *boxas, NUMA *na, l_int32 *pchanged ); -LEPT_DLL extern BOXA * boxaPermutePseudorandom ( BOXA *boxas ); -LEPT_DLL extern BOXA * boxaPermuteRandom ( BOXA *boxad, BOXA *boxas ); -LEPT_DLL extern l_int32 boxaSwapBoxes ( BOXA *boxa, l_int32 i, l_int32 j ); -LEPT_DLL extern PTA * boxaConvertToPta ( BOXA *boxa, l_int32 ncorners ); -LEPT_DLL extern BOXA * ptaConvertToBoxa ( PTA *pta, l_int32 ncorners ); -LEPT_DLL extern BOXA * boxaTransform ( BOXA *boxas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern BOX * boxTransform ( BOX *box, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern BOXA * boxaTransformOrdered ( BOXA *boxas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 order ); -LEPT_DLL extern BOX * boxTransformOrdered ( BOX *boxs, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 order ); -LEPT_DLL extern BOXA * boxaRotateOrth ( BOXA *boxas, l_int32 w, l_int32 h, l_int32 rotation ); -LEPT_DLL extern BOX * boxRotateOrth ( BOX *box, l_int32 w, l_int32 h, l_int32 rotation ); -LEPT_DLL extern BOXA * boxaSort ( BOXA *boxas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex ); -LEPT_DLL extern BOXA * boxaBinSort ( BOXA *boxas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex ); -LEPT_DLL extern BOXA * boxaSortByIndex ( BOXA *boxas, NUMA *naindex ); -LEPT_DLL extern BOXAA * boxaSort2d ( BOXA *boxas, NUMAA **pnaad, l_int32 delta1, l_int32 delta2, l_int32 minh1 ); -LEPT_DLL extern BOXAA * boxaSort2dByIndex ( BOXA *boxas, NUMAA *naa ); -LEPT_DLL extern BOX * boxaGetRankSize ( BOXA *boxa, l_float32 fract ); -LEPT_DLL extern BOX * boxaGetMedian ( BOXA *boxa ); -LEPT_DLL extern l_int32 boxaaGetExtent ( BOXAA *boxaa, l_int32 *pw, l_int32 *ph, BOX **pbox ); -LEPT_DLL extern BOXA * boxaaFlattenToBoxa ( BOXAA *baa, NUMA **pnaindex, l_int32 copyflag ); -LEPT_DLL extern l_int32 boxaaAlignBox ( BOXAA *baa, BOX *box, l_int32 delta, l_int32 *pindex ); -LEPT_DLL extern PIX * pixMaskConnComp ( PIX *pixs, l_int32 connectivity, BOXA **pboxa ); -LEPT_DLL extern PIX * pixMaskBoxa ( PIX *pixd, PIX *pixs, BOXA *boxa, l_int32 op ); -LEPT_DLL extern PIX * pixPaintBoxa ( PIX *pixs, BOXA *boxa, l_uint32 val ); -LEPT_DLL extern PIX * pixSetBlackOrWhiteBoxa ( PIX *pixs, BOXA *boxa, l_int32 op ); -LEPT_DLL extern PIX * pixPaintBoxaRandom ( PIX *pixs, BOXA *boxa ); -LEPT_DLL extern PIX * pixBlendBoxaRandom ( PIX *pixs, BOXA *boxa, l_float32 fract ); -LEPT_DLL extern PIX * pixDrawBoxa ( PIX *pixs, BOXA *boxa, l_int32 width, l_uint32 val ); -LEPT_DLL extern PIX * pixDrawBoxaRandom ( PIX *pixs, BOXA *boxa, l_int32 width ); -LEPT_DLL extern PIX * boxaaDisplay ( BOXAA *boxaa, l_int32 linewba, l_int32 linewb, l_uint32 colorba, l_uint32 colorb, l_int32 w, l_int32 h ); -LEPT_DLL extern BOXA * pixSplitIntoBoxa ( PIX *pixs, l_int32 minsum, l_int32 skipdist, l_int32 delta, l_int32 maxbg, l_int32 maxcomps, l_int32 remainder ); -LEPT_DLL extern BOXA * pixSplitComponentIntoBoxa ( PIX *pix, BOX *box, l_int32 minsum, l_int32 skipdist, l_int32 delta, l_int32 maxbg, l_int32 maxcomps, l_int32 remainder ); -LEPT_DLL extern L_BYTEA * l_byteaCreate ( size_t nbytes ); -LEPT_DLL extern L_BYTEA * l_byteaInitFromMem ( l_uint8 *data, size_t size ); -LEPT_DLL extern L_BYTEA * l_byteaInitFromFile ( const char *fname ); -LEPT_DLL extern L_BYTEA * l_byteaInitFromStream ( FILE *fp ); -LEPT_DLL extern L_BYTEA * l_byteaCopy ( L_BYTEA *bas, l_int32 copyflag ); -LEPT_DLL extern void l_byteaDestroy ( L_BYTEA **pba ); -LEPT_DLL extern size_t l_byteaGetSize ( L_BYTEA *ba ); -LEPT_DLL extern l_uint8 * l_byteaGetData ( L_BYTEA *ba, size_t *psize ); -LEPT_DLL extern l_uint8 * l_byteaCopyData ( L_BYTEA *ba, size_t *psize ); -LEPT_DLL extern l_int32 l_byteaAppendData ( L_BYTEA *ba, l_uint8 *newdata, size_t newbytes ); -LEPT_DLL extern l_int32 l_byteaAppendString ( L_BYTEA *ba, char *str ); -LEPT_DLL extern l_int32 l_byteaExtendArrayToSize ( L_BYTEA *ba, size_t size ); -LEPT_DLL extern l_int32 l_byteaJoin ( L_BYTEA *ba1, L_BYTEA **pba2 ); -LEPT_DLL extern l_int32 l_byteaSplit ( L_BYTEA *ba1, size_t splitloc, L_BYTEA **pba2 ); -LEPT_DLL extern l_int32 l_byteaFindEachSequence ( L_BYTEA *ba, l_uint8 *sequence, l_int32 seqlen, NUMA **pna ); -LEPT_DLL extern l_int32 l_byteaWrite ( const char *fname, L_BYTEA *ba, size_t startloc, size_t endloc ); -LEPT_DLL extern l_int32 l_byteaWriteStream ( FILE *fp, L_BYTEA *ba, size_t startloc, size_t endloc ); -LEPT_DLL extern CCBORDA * ccbaCreate ( PIX *pixs, l_int32 n ); -LEPT_DLL extern void ccbaDestroy ( CCBORDA **pccba ); -LEPT_DLL extern CCBORD * ccbCreate ( PIX *pixs ); -LEPT_DLL extern void ccbDestroy ( CCBORD **pccb ); -LEPT_DLL extern l_int32 ccbaAddCcb ( CCBORDA *ccba, CCBORD *ccb ); -LEPT_DLL extern l_int32 ccbaExtendArray ( CCBORDA *ccba ); -LEPT_DLL extern l_int32 ccbaGetCount ( CCBORDA *ccba ); -LEPT_DLL extern CCBORD * ccbaGetCcb ( CCBORDA *ccba, l_int32 index ); -LEPT_DLL extern CCBORDA * pixGetAllCCBorders ( PIX *pixs ); -LEPT_DLL extern CCBORD * pixGetCCBorders ( PIX *pixs, BOX *box ); -LEPT_DLL extern PTAA * pixGetOuterBordersPtaa ( PIX *pixs ); -LEPT_DLL extern PTA * pixGetOuterBorderPta ( PIX *pixs, BOX *box ); -LEPT_DLL extern l_int32 pixGetOuterBorder ( CCBORD *ccb, PIX *pixs, BOX *box ); -LEPT_DLL extern l_int32 pixGetHoleBorder ( CCBORD *ccb, PIX *pixs, BOX *box, l_int32 xs, l_int32 ys ); -LEPT_DLL extern l_int32 findNextBorderPixel ( l_int32 w, l_int32 h, l_uint32 *data, l_int32 wpl, l_int32 px, l_int32 py, l_int32 *pqpos, l_int32 *pnpx, l_int32 *pnpy ); -LEPT_DLL extern void locateOutsideSeedPixel ( l_int32 fpx, l_int32 fpy, l_int32 spx, l_int32 spy, l_int32 *pxs, l_int32 *pys ); -LEPT_DLL extern l_int32 ccbaGenerateGlobalLocs ( CCBORDA *ccba ); -LEPT_DLL extern l_int32 ccbaGenerateStepChains ( CCBORDA *ccba ); -LEPT_DLL extern l_int32 ccbaStepChainsToPixCoords ( CCBORDA *ccba, l_int32 coordtype ); -LEPT_DLL extern l_int32 ccbaGenerateSPGlobalLocs ( CCBORDA *ccba, l_int32 ptsflag ); -LEPT_DLL extern l_int32 ccbaGenerateSinglePath ( CCBORDA *ccba ); -LEPT_DLL extern PTA * getCutPathForHole ( PIX *pix, PTA *pta, BOX *boxinner, l_int32 *pdir, l_int32 *plen ); -LEPT_DLL extern PIX * ccbaDisplayBorder ( CCBORDA *ccba ); -LEPT_DLL extern PIX * ccbaDisplaySPBorder ( CCBORDA *ccba ); -LEPT_DLL extern PIX * ccbaDisplayImage1 ( CCBORDA *ccba ); -LEPT_DLL extern PIX * ccbaDisplayImage2 ( CCBORDA *ccba ); -LEPT_DLL extern l_int32 ccbaWrite ( const char *filename, CCBORDA *ccba ); -LEPT_DLL extern l_int32 ccbaWriteStream ( FILE *fp, CCBORDA *ccba ); -LEPT_DLL extern CCBORDA * ccbaRead ( const char *filename ); -LEPT_DLL extern CCBORDA * ccbaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 ccbaWriteSVG ( const char *filename, CCBORDA *ccba ); -LEPT_DLL extern char * ccbaWriteSVGString ( const char *filename, CCBORDA *ccba ); -LEPT_DLL extern PIX * pixThin ( PIX *pixs, l_int32 type, l_int32 connectivity, l_int32 maxiters ); -LEPT_DLL extern PIX * pixThinGeneral ( PIX *pixs, l_int32 type, SELA *sela, l_int32 maxiters ); -LEPT_DLL extern PIX * pixThinExamples ( PIX *pixs, l_int32 type, l_int32 index, l_int32 maxiters, const char *selfile ); -LEPT_DLL extern l_int32 jbCorrelation ( const char *dirin, l_float32 thresh, l_float32 weight, l_int32 components, const char *rootname, l_int32 firstpage, l_int32 npages, l_int32 renderflag ); -LEPT_DLL extern l_int32 jbRankHaus ( const char *dirin, l_int32 size, l_float32 rank, l_int32 components, const char *rootname, l_int32 firstpage, l_int32 npages, l_int32 renderflag ); -LEPT_DLL extern JBCLASSER * jbWordsInTextlines ( const char *dirin, l_int32 reduction, l_int32 maxwidth, l_int32 maxheight, l_float32 thresh, l_float32 weight, NUMA **pnatl, l_int32 firstpage, l_int32 npages ); -LEPT_DLL extern l_int32 pixGetWordsInTextlines ( PIX *pixs, l_int32 reduction, l_int32 minwidth, l_int32 minheight, l_int32 maxwidth, l_int32 maxheight, BOXA **pboxad, PIXA **ppixad, NUMA **pnai ); -LEPT_DLL extern l_int32 pixGetWordBoxesInTextlines ( PIX *pixs, l_int32 reduction, l_int32 minwidth, l_int32 minheight, l_int32 maxwidth, l_int32 maxheight, BOXA **pboxad, NUMA **pnai ); -LEPT_DLL extern NUMAA * boxaExtractSortedPattern ( BOXA *boxa, NUMA *na ); -LEPT_DLL extern l_int32 numaaCompareImagesByBoxes ( NUMAA *naa1, NUMAA *naa2, l_int32 nperline, l_int32 nreq, l_int32 maxshiftx, l_int32 maxshifty, l_int32 delx, l_int32 dely, l_int32 *psame, l_int32 debugflag ); -LEPT_DLL extern l_int32 pixColorContent ( PIX *pixs, l_int32 rwhite, l_int32 gwhite, l_int32 bwhite, l_int32 mingray, PIX **ppixr, PIX **ppixg, PIX **ppixb ); -LEPT_DLL extern PIX * pixColorMagnitude ( PIX *pixs, l_int32 rwhite, l_int32 gwhite, l_int32 bwhite, l_int32 type ); -LEPT_DLL extern PIX * pixMaskOverColorPixels ( PIX *pixs, l_int32 threshdiff, l_int32 mindist ); -LEPT_DLL extern l_int32 pixColorFraction ( PIX *pixs, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_int32 factor, l_float32 *ppixfract, l_float32 *pcolorfract ); -LEPT_DLL extern l_int32 pixNumSignificantGrayColors ( PIX *pixs, l_int32 darkthresh, l_int32 lightthresh, l_float32 minfract, l_int32 factor, l_int32 *pncolors ); -LEPT_DLL extern l_int32 pixColorsForQuantization ( PIX *pixs, l_int32 thresh, l_int32 *pncolors, l_int32 *piscolor, l_int32 debug ); -LEPT_DLL extern l_int32 pixNumColors ( PIX *pixs, l_int32 factor, l_int32 *pncolors ); -LEPT_DLL extern PIXCMAP * pixcmapCreate ( l_int32 depth ); -LEPT_DLL extern PIXCMAP * pixcmapCreateRandom ( l_int32 depth, l_int32 hasblack, l_int32 haswhite ); -LEPT_DLL extern PIXCMAP * pixcmapCreateLinear ( l_int32 d, l_int32 nlevels ); -LEPT_DLL extern PIXCMAP * pixcmapCopy ( PIXCMAP *cmaps ); -LEPT_DLL extern void pixcmapDestroy ( PIXCMAP **pcmap ); -LEPT_DLL extern l_int32 pixcmapAddColor ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixcmapAddNewColor ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapAddNearestColor ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapUsableColor ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pusable ); -LEPT_DLL extern l_int32 pixcmapAddBlackOrWhite ( PIXCMAP *cmap, l_int32 color, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapSetBlackAndWhite ( PIXCMAP *cmap, l_int32 setblack, l_int32 setwhite ); -LEPT_DLL extern l_int32 pixcmapGetCount ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapGetFreeCount ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapGetDepth ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapGetMinDepth ( PIXCMAP *cmap, l_int32 *pmindepth ); -LEPT_DLL extern l_int32 pixcmapClear ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapGetColor ( PIXCMAP *cmap, l_int32 index, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern l_int32 pixcmapGetColor32 ( PIXCMAP *cmap, l_int32 index, l_uint32 *pval32 ); -LEPT_DLL extern l_int32 pixcmapResetColor ( PIXCMAP *cmap, l_int32 index, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixcmapGetIndex ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapHasColor ( PIXCMAP *cmap, l_int32 *pcolor ); -LEPT_DLL extern l_int32 pixcmapCountGrayColors ( PIXCMAP *cmap, l_int32 *pngray ); -LEPT_DLL extern l_int32 pixcmapGetRankIntensity ( PIXCMAP *cmap, l_float32 rankval, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapGetNearestIndex ( PIXCMAP *cmap, l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapGetNearestGrayIndex ( PIXCMAP *cmap, l_int32 val, l_int32 *pindex ); -LEPT_DLL extern l_int32 pixcmapGetComponentRange ( PIXCMAP *cmap, l_int32 color, l_int32 *pminval, l_int32 *pmaxval ); -LEPT_DLL extern l_int32 pixcmapGetExtremeValue ( PIXCMAP *cmap, l_int32 type, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern PIXCMAP * pixcmapGrayToColor ( l_uint32 color ); -LEPT_DLL extern PIXCMAP * pixcmapColorToGray ( PIXCMAP *cmaps, l_float32 rwt, l_float32 gwt, l_float32 bwt ); -LEPT_DLL extern PIXCMAP * pixcmapReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 pixcmapWriteStream ( FILE *fp, PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapToArrays ( PIXCMAP *cmap, l_int32 **prmap, l_int32 **pgmap, l_int32 **pbmap ); -LEPT_DLL extern l_int32 pixcmapToRGBTable ( PIXCMAP *cmap, l_uint32 **ptab, l_int32 *pncolors ); -LEPT_DLL extern l_int32 pixcmapSerializeToMemory ( PIXCMAP *cmap, l_int32 cpc, l_int32 *pncolors, l_uint8 **pdata, l_int32 *pnbytes ); -LEPT_DLL extern PIXCMAP * pixcmapDeserializeFromMemory ( l_uint8 *data, l_int32 ncolors, l_int32 nbytes ); -LEPT_DLL extern char * pixcmapConvertToHex ( l_uint8 *data, l_int32 nbytes, l_int32 ncolors ); -LEPT_DLL extern l_int32 pixcmapGammaTRC ( PIXCMAP *cmap, l_float32 gamma, l_int32 minval, l_int32 maxval ); -LEPT_DLL extern l_int32 pixcmapContrastTRC ( PIXCMAP *cmap, l_float32 factor ); -LEPT_DLL extern l_int32 pixcmapShiftIntensity ( PIXCMAP *cmap, l_float32 fraction ); -LEPT_DLL extern PIX * pixColorMorph ( PIX *pixs, l_int32 type, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOctreeColorQuant ( PIX *pixs, l_int32 colors, l_int32 ditherflag ); -LEPT_DLL extern PIX * pixOctreeColorQuantGeneral ( PIX *pixs, l_int32 colors, l_int32 ditherflag, l_float32 validthresh, l_float32 colorthresh ); -LEPT_DLL extern l_int32 makeRGBToIndexTables ( l_uint32 **prtab, l_uint32 **pgtab, l_uint32 **pbtab, l_int32 cqlevels ); -LEPT_DLL extern void getOctcubeIndexFromRGB ( l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *rtab, l_uint32 *gtab, l_uint32 *btab, l_uint32 *pindex ); -LEPT_DLL extern PIX * pixOctreeQuantByPopulation ( PIX *pixs, l_int32 level, l_int32 ditherflag ); -LEPT_DLL extern PIX * pixOctreeQuantNumColors ( PIX *pixs, l_int32 maxcolors, l_int32 subsample ); -LEPT_DLL extern PIX * pixOctcubeQuantMixedWithGray ( PIX *pixs, l_int32 depth, l_int32 graylevels, l_int32 delta ); -LEPT_DLL extern PIX * pixFixedOctcubeQuant256 ( PIX *pixs, l_int32 ditherflag ); -LEPT_DLL extern PIX * pixFewColorsOctcubeQuant1 ( PIX *pixs, l_int32 level ); -LEPT_DLL extern PIX * pixFewColorsOctcubeQuant2 ( PIX *pixs, l_int32 level, NUMA *na, l_int32 ncolors, l_int32 *pnerrors ); -LEPT_DLL extern PIX * pixFewColorsOctcubeQuantMixed ( PIX *pixs, l_int32 level, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh, l_float32 minfract, l_int32 maxspan ); -LEPT_DLL extern PIX * pixFixedOctcubeQuantGenRGB ( PIX *pixs, l_int32 level ); -LEPT_DLL extern PIX * pixQuantFromCmap ( PIX *pixs, PIXCMAP *cmap, l_int32 mindepth, l_int32 level, l_int32 metric ); -LEPT_DLL extern PIX * pixOctcubeQuantFromCmap ( PIX *pixs, PIXCMAP *cmap, l_int32 mindepth, l_int32 level, l_int32 metric ); -LEPT_DLL extern PIX * pixOctcubeQuantFromCmapLUT ( PIX *pixs, PIXCMAP *cmap, l_int32 mindepth, l_int32 *cmaptab, l_uint32 *rtab, l_uint32 *gtab, l_uint32 *btab ); -LEPT_DLL extern NUMA * pixOctcubeHistogram ( PIX *pixs, l_int32 level, l_int32 *pncolors ); -LEPT_DLL extern l_int32 * pixcmapToOctcubeLUT ( PIXCMAP *cmap, l_int32 level, l_int32 metric ); -LEPT_DLL extern l_int32 pixRemoveUnusedColors ( PIX *pixs ); -LEPT_DLL extern l_int32 pixNumberOccupiedOctcubes ( PIX *pix, l_int32 level, l_int32 mincount, l_float32 minfract, l_int32 *pncolors ); -LEPT_DLL extern PIX * pixMedianCutQuant ( PIX *pixs, l_int32 ditherflag ); -LEPT_DLL extern PIX * pixMedianCutQuantGeneral ( PIX *pixs, l_int32 ditherflag, l_int32 outdepth, l_int32 maxcolors, l_int32 sigbits, l_int32 maxsub, l_int32 checkbw ); -LEPT_DLL extern PIX * pixMedianCutQuantMixed ( PIX *pixs, l_int32 ncolor, l_int32 ngray, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh ); -LEPT_DLL extern PIX * pixFewColorsMedianCutQuantMixed ( PIX *pixs, l_int32 ncolor, l_int32 ngray, l_int32 maxncolors, l_int32 darkthresh, l_int32 lightthresh, l_int32 diffthresh ); -LEPT_DLL extern l_int32 * pixMedianCutHisto ( PIX *pixs, l_int32 sigbits, l_int32 subsample ); -LEPT_DLL extern PIX * pixColorSegment ( PIX *pixs, l_int32 maxdist, l_int32 maxcolors, l_int32 selsize, l_int32 finalcolors ); -LEPT_DLL extern PIX * pixColorSegmentCluster ( PIX *pixs, l_int32 maxdist, l_int32 maxcolors ); -LEPT_DLL extern l_int32 pixAssignToNearestColor ( PIX *pixd, PIX *pixs, PIX *pixm, l_int32 level, l_int32 *countarray ); -LEPT_DLL extern l_int32 pixColorSegmentClean ( PIX *pixs, l_int32 selsize, l_int32 *countarray ); -LEPT_DLL extern l_int32 pixColorSegmentRemoveColors ( PIX *pixd, PIX *pixs, l_int32 finalcolors ); -LEPT_DLL extern PIX * pixConvertRGBToHSV ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIX * pixConvertHSVToRGB ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 convertRGBToHSV ( l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *phval, l_int32 *psval, l_int32 *pvval ); -LEPT_DLL extern l_int32 convertHSVToRGB ( l_int32 hval, l_int32 sval, l_int32 vval, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern l_int32 pixcmapConvertRGBToHSV ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapConvertHSVToRGB ( PIXCMAP *cmap ); -LEPT_DLL extern PIX * pixConvertRGBToHue ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertRGBToSaturation ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertRGBToValue ( PIX *pixs ); -LEPT_DLL extern PIX * pixMakeRangeMaskHS ( PIX *pixs, l_int32 huecenter, l_int32 huehw, l_int32 satcenter, l_int32 sathw, l_int32 regionflag ); -LEPT_DLL extern PIX * pixMakeRangeMaskHV ( PIX *pixs, l_int32 huecenter, l_int32 huehw, l_int32 valcenter, l_int32 valhw, l_int32 regionflag ); -LEPT_DLL extern PIX * pixMakeRangeMaskSV ( PIX *pixs, l_int32 satcenter, l_int32 sathw, l_int32 valcenter, l_int32 valhw, l_int32 regionflag ); -LEPT_DLL extern PIX * pixMakeHistoHS ( PIX *pixs, l_int32 factor, NUMA **pnahue, NUMA **pnasat ); -LEPT_DLL extern PIX * pixMakeHistoHV ( PIX *pixs, l_int32 factor, NUMA **pnahue, NUMA **pnaval ); -LEPT_DLL extern PIX * pixMakeHistoSV ( PIX *pixs, l_int32 factor, NUMA **pnasat, NUMA **pnaval ); -LEPT_DLL extern l_int32 pixFindHistoPeaksHSV ( PIX *pixs, l_int32 type, l_int32 width, l_int32 height, l_int32 npeaks, l_float32 erasefactor, PTA **ppta, NUMA **pnatot, PIXA **ppixa ); -LEPT_DLL extern PIX * displayHSVColorRange ( l_int32 hval, l_int32 sval, l_int32 vval, l_int32 huehw, l_int32 sathw, l_int32 nsamp, l_int32 factor ); -LEPT_DLL extern PIX * pixConvertRGBToYUV ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIX * pixConvertYUVToRGB ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 convertRGBToYUV ( l_int32 rval, l_int32 gval, l_int32 bval, l_int32 *pyval, l_int32 *puval, l_int32 *pvval ); -LEPT_DLL extern l_int32 convertYUVToRGB ( l_int32 yval, l_int32 uval, l_int32 vval, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern l_int32 pixcmapConvertRGBToYUV ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixcmapConvertYUVToRGB ( PIXCMAP *cmap ); -LEPT_DLL extern l_int32 pixEqual ( PIX *pix1, PIX *pix2, l_int32 *psame ); -LEPT_DLL extern l_int32 pixEqualWithCmap ( PIX *pix1, PIX *pix2, l_int32 *psame ); -LEPT_DLL extern l_int32 pixUsesCmapColor ( PIX *pixs, l_int32 *pcolor ); -LEPT_DLL extern l_int32 pixCorrelationBinary ( PIX *pix1, PIX *pix2, l_float32 *pval ); -LEPT_DLL extern PIX * pixDisplayDiffBinary ( PIX *pix1, PIX *pix2 ); -LEPT_DLL extern l_int32 pixCompareBinary ( PIX *pix1, PIX *pix2, l_int32 comptype, l_float32 *pfract, PIX **ppixdiff ); -LEPT_DLL extern l_int32 pixCompareGrayOrRGB ( PIX *pix1, PIX *pix2, l_int32 comptype, l_int32 plottype, l_int32 *psame, l_float32 *pdiff, l_float32 *prmsdiff, PIX **ppixdiff ); -LEPT_DLL extern l_int32 pixCompareGray ( PIX *pix1, PIX *pix2, l_int32 comptype, l_int32 plottype, l_int32 *psame, l_float32 *pdiff, l_float32 *prmsdiff, PIX **ppixdiff ); -LEPT_DLL extern l_int32 pixCompareRGB ( PIX *pix1, PIX *pix2, l_int32 comptype, l_int32 plottype, l_int32 *psame, l_float32 *pdiff, l_float32 *prmsdiff, PIX **ppixdiff ); -LEPT_DLL extern l_int32 pixCompareTiled ( PIX *pix1, PIX *pix2, l_int32 sx, l_int32 sy, l_int32 type, PIX **ppixdiff ); -LEPT_DLL extern NUMA * pixCompareRankDifference ( PIX *pix1, PIX *pix2, l_int32 factor ); -LEPT_DLL extern l_int32 pixTestForSimilarity ( PIX *pix1, PIX *pix2, l_int32 factor, l_int32 mindiff, l_float32 maxfract, l_float32 maxave, l_int32 *psimilar, l_int32 printstats ); -LEPT_DLL extern l_int32 pixGetDifferenceStats ( PIX *pix1, PIX *pix2, l_int32 factor, l_int32 mindiff, l_float32 *pfractdiff, l_float32 *pavediff, l_int32 printstats ); -LEPT_DLL extern NUMA * pixGetDifferenceHistogram ( PIX *pix1, PIX *pix2, l_int32 factor ); -LEPT_DLL extern l_int32 pixGetPSNR ( PIX *pix1, PIX *pix2, l_int32 factor, l_float32 *ppsnr ); -LEPT_DLL extern BOXA * pixConnComp ( PIX *pixs, PIXA **ppixa, l_int32 connectivity ); -LEPT_DLL extern BOXA * pixConnCompPixa ( PIX *pixs, PIXA **ppixa, l_int32 connectivity ); -LEPT_DLL extern BOXA * pixConnCompBB ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixCountConnComp ( PIX *pixs, l_int32 connectivity, l_int32 *pcount ); -LEPT_DLL extern l_int32 nextOnPixelInRaster ( PIX *pixs, l_int32 xstart, l_int32 ystart, l_int32 *px, l_int32 *py ); -LEPT_DLL extern l_int32 nextOnPixelInRasterLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 wpl, l_int32 xstart, l_int32 ystart, l_int32 *px, l_int32 *py ); -LEPT_DLL extern BOX * pixSeedfillBB ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y, l_int32 connectivity ); -LEPT_DLL extern BOX * pixSeedfill4BB ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y ); -LEPT_DLL extern BOX * pixSeedfill8BB ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixSeedfill ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixSeedfill4 ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixSeedfill8 ( PIX *pixs, L_STACK *lstack, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 convertFilesTo1bpp ( const char *dirin, const char *substr, l_int32 upscaling, l_int32 thresh, l_int32 firstpage, l_int32 npages, const char *dirout, l_int32 outformat ); -LEPT_DLL extern PIX * pixBlockconv ( PIX *pix, l_int32 wc, l_int32 hc ); -LEPT_DLL extern PIX * pixBlockconvGray ( PIX *pixs, PIX *pixacc, l_int32 wc, l_int32 hc ); -LEPT_DLL extern PIX * pixBlockconvAccum ( PIX *pixs ); -LEPT_DLL extern PIX * pixBlockconvGrayUnnormalized ( PIX *pixs, l_int32 wc, l_int32 hc ); -LEPT_DLL extern PIX * pixBlockconvTiled ( PIX *pix, l_int32 wc, l_int32 hc, l_int32 nx, l_int32 ny ); -LEPT_DLL extern PIX * pixBlockconvGrayTile ( PIX *pixs, PIX *pixacc, l_int32 wc, l_int32 hc ); -LEPT_DLL extern l_int32 pixWindowedStats ( PIX *pixs, l_int32 wc, l_int32 hc, l_int32 hasborder, PIX **ppixm, PIX **ppixms, FPIX **pfpixv, FPIX **pfpixrv ); -LEPT_DLL extern PIX * pixWindowedMean ( PIX *pixs, l_int32 wc, l_int32 hc, l_int32 hasborder, l_int32 normflag ); -LEPT_DLL extern PIX * pixWindowedMeanSquare ( PIX *pixs, l_int32 wc, l_int32 hc, l_int32 hasborder ); -LEPT_DLL extern l_int32 pixWindowedVariance ( PIX *pixm, PIX *pixms, FPIX **pfpixv, FPIX **pfpixrv ); -LEPT_DLL extern DPIX * pixMeanSquareAccum ( PIX *pixs ); -LEPT_DLL extern PIX * pixBlockrank ( PIX *pixs, PIX *pixacc, l_int32 wc, l_int32 hc, l_float32 rank ); -LEPT_DLL extern PIX * pixBlocksum ( PIX *pixs, PIX *pixacc, l_int32 wc, l_int32 hc ); -LEPT_DLL extern PIX * pixCensusTransform ( PIX *pixs, l_int32 halfsize, PIX *pixacc ); -LEPT_DLL extern PIX * pixConvolve ( PIX *pixs, L_KERNEL *kel, l_int32 outdepth, l_int32 normflag ); -LEPT_DLL extern PIX * pixConvolveSep ( PIX *pixs, L_KERNEL *kelx, L_KERNEL *kely, l_int32 outdepth, l_int32 normflag ); -LEPT_DLL extern PIX * pixConvolveRGB ( PIX *pixs, L_KERNEL *kel ); -LEPT_DLL extern PIX * pixConvolveRGBSep ( PIX *pixs, L_KERNEL *kelx, L_KERNEL *kely ); -LEPT_DLL extern FPIX * fpixConvolve ( FPIX *fpixs, L_KERNEL *kel, l_int32 normflag ); -LEPT_DLL extern FPIX * fpixConvolveSep ( FPIX *fpixs, L_KERNEL *kelx, L_KERNEL *kely, l_int32 normflag ); -LEPT_DLL extern void l_setConvolveSampling ( l_int32 xfact, l_int32 yfact ); -LEPT_DLL extern void blockconvLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 wpl, l_uint32 *dataa, l_int32 wpla, l_int32 wc, l_int32 hc ); -LEPT_DLL extern void blockconvAccumLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 d, l_int32 wpls ); -LEPT_DLL extern void blocksumLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpl, l_uint32 *dataa, l_int32 wpla, l_int32 wc, l_int32 hc ); -LEPT_DLL extern l_float32 pixCorrelationScore ( PIX *pix1, PIX *pix2, l_int32 area1, l_int32 area2, l_float32 delx, l_float32 dely, l_int32 maxdiffw, l_int32 maxdiffh, l_int32 *tab ); -LEPT_DLL extern l_int32 pixCorrelationScoreThresholded ( PIX *pix1, PIX *pix2, l_int32 area1, l_int32 area2, l_float32 delx, l_float32 dely, l_int32 maxdiffw, l_int32 maxdiffh, l_int32 *tab, l_int32 *downcount, l_float32 score_threshold ); -LEPT_DLL extern l_float32 pixCorrelationScoreSimple ( PIX *pix1, PIX *pix2, l_int32 area1, l_int32 area2, l_float32 delx, l_float32 dely, l_int32 maxdiffw, l_int32 maxdiffh, l_int32 *tab ); -LEPT_DLL extern L_DEWARP * dewarpCreate ( PIX *pixs, l_int32 pageno, l_int32 sampling, l_int32 minlines, l_int32 applyhoriz ); -LEPT_DLL extern void dewarpDestroy ( L_DEWARP **pdew ); -LEPT_DLL extern l_int32 dewarpBuildModel ( L_DEWARP *dew, l_int32 debugflag ); -LEPT_DLL extern PTAA * pixGetTextlineCenters ( PIX *pixs, l_int32 debugflag ); -LEPT_DLL extern PTA * pixGetMeanVerticals ( PIX *pixs, l_int32 x, l_int32 y ); -LEPT_DLL extern PTAA * ptaaRemoveShortLines ( PIX *pixs, PTAA *ptaas, l_float32 fract, l_int32 debugflag ); -LEPT_DLL extern FPIX * fpixBuildHorizontalDisparity ( FPIX *fpixv, l_float32 factor, l_int32 *pextraw ); -LEPT_DLL extern FPIX * fpixSampledDisparity ( FPIX *fpixs, l_int32 sampling ); -LEPT_DLL extern l_int32 dewarpApplyDisparity ( L_DEWARP *dew, PIX *pixs, l_int32 debugflag ); -LEPT_DLL extern PIX * pixApplyVerticalDisparity ( PIX *pixs, FPIX *fpix ); -LEPT_DLL extern PIX * pixApplyHorizontalDisparity ( PIX *pixs, FPIX *fpix, l_int32 extraw ); -LEPT_DLL extern l_int32 dewarpMinimize ( L_DEWARP *dew ); -LEPT_DLL extern l_int32 dewarpPopulateFullRes ( L_DEWARP *dew ); -LEPT_DLL extern L_DEWARP * dewarpRead ( const char *filename ); -LEPT_DLL extern L_DEWARP * dewarpReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 dewarpWrite ( const char *filename, L_DEWARP *dew ); -LEPT_DLL extern l_int32 dewarpWriteStream ( FILE *fp, L_DEWARP *dew ); -LEPT_DLL extern PIX * pixMorphDwa_2 ( PIX *pixd, PIX *pixs, l_int32 operation, char *selname ); -LEPT_DLL extern PIX * pixFMorphopGen_2 ( PIX *pixd, PIX *pixs, l_int32 operation, char *selname ); -LEPT_DLL extern l_int32 fmorphopgen_low_2 ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 index ); -LEPT_DLL extern PIX * pixSobelEdgeFilter ( PIX *pixs, l_int32 orientflag ); -LEPT_DLL extern PIX * pixTwoSidedEdgeFilter ( PIX *pixs, l_int32 orientflag ); -LEPT_DLL extern l_int32 pixMeasureEdgeSmoothness ( PIX *pixs, l_int32 side, l_int32 minjump, l_int32 minreversal, l_float32 *pjpl, l_float32 *pjspl, l_float32 *prpl, const char *debugfile ); -LEPT_DLL extern NUMA * pixGetEdgeProfile ( PIX *pixs, l_int32 side, const char *debugfile ); -LEPT_DLL extern l_int32 pixGetLastOffPixelInRun ( PIX *pixs, l_int32 x, l_int32 y, l_int32 direction, l_int32 *ploc ); -LEPT_DLL extern l_int32 pixGetLastOnPixelInRun ( PIX *pixs, l_int32 x, l_int32 y, l_int32 direction, l_int32 *ploc ); -LEPT_DLL extern PIX * pixGammaTRC ( PIX *pixd, PIX *pixs, l_float32 gamma, l_int32 minval, l_int32 maxval ); -LEPT_DLL extern PIX * pixGammaTRCMasked ( PIX *pixd, PIX *pixs, PIX *pixm, l_float32 gamma, l_int32 minval, l_int32 maxval ); -LEPT_DLL extern PIX * pixGammaTRCWithAlpha ( PIX *pixd, PIX *pixs, l_float32 gamma, l_int32 minval, l_int32 maxval ); -LEPT_DLL extern NUMA * numaGammaTRC ( l_float32 gamma, l_int32 minval, l_int32 maxval ); -LEPT_DLL extern PIX * pixContrastTRC ( PIX *pixd, PIX *pixs, l_float32 factor ); -LEPT_DLL extern PIX * pixContrastTRCMasked ( PIX *pixd, PIX *pixs, PIX *pixm, l_float32 factor ); -LEPT_DLL extern NUMA * numaContrastTRC ( l_float32 factor ); -LEPT_DLL extern PIX * pixEqualizeTRC ( PIX *pixd, PIX *pixs, l_float32 fract, l_int32 factor ); -LEPT_DLL extern NUMA * numaEqualizeTRC ( PIX *pix, l_float32 fract, l_int32 factor ); -LEPT_DLL extern l_int32 pixTRCMap ( PIX *pixs, PIX *pixm, NUMA *na ); -LEPT_DLL extern PIX * pixUnsharpMasking ( PIX *pixs, l_int32 halfwidth, l_float32 fract ); -LEPT_DLL extern PIX * pixUnsharpMaskingGray ( PIX *pixs, l_int32 halfwidth, l_float32 fract ); -LEPT_DLL extern PIX * pixUnsharpMaskingFast ( PIX *pixs, l_int32 halfwidth, l_float32 fract, l_int32 direction ); -LEPT_DLL extern PIX * pixUnsharpMaskingGrayFast ( PIX *pixs, l_int32 halfwidth, l_float32 fract, l_int32 direction ); -LEPT_DLL extern PIX * pixUnsharpMaskingGray1D ( PIX *pixs, l_int32 halfwidth, l_float32 fract, l_int32 direction ); -LEPT_DLL extern PIX * pixUnsharpMaskingGray2D ( PIX *pixs, l_int32 halfwidth, l_float32 fract ); -LEPT_DLL extern PIX * pixModifyHue ( PIX *pixd, PIX *pixs, l_float32 fract ); -LEPT_DLL extern PIX * pixModifySaturation ( PIX *pixd, PIX *pixs, l_float32 fract ); -LEPT_DLL extern l_int32 pixMeasureSaturation ( PIX *pixs, l_int32 factor, l_float32 *psat ); -LEPT_DLL extern PIX * pixMultConstantColor ( PIX *pixs, l_float32 rfact, l_float32 gfact, l_float32 bfact ); -LEPT_DLL extern PIX * pixMultMatrixColor ( PIX *pixs, L_KERNEL *kel ); -LEPT_DLL extern PIX * pixHalfEdgeByBandpass ( PIX *pixs, l_int32 sm1h, l_int32 sm1v, l_int32 sm2h, l_int32 sm2v ); -LEPT_DLL extern l_int32 fhmtautogen ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern l_int32 fhmtautogen1 ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern l_int32 fhmtautogen2 ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern PIX * pixHMTDwa_1 ( PIX *pixd, PIX *pixs, char *selname ); -LEPT_DLL extern PIX * pixFHMTGen_1 ( PIX *pixd, PIX *pixs, char *selname ); -LEPT_DLL extern l_int32 fhmtgen_low_1 ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 index ); -LEPT_DLL extern l_int32 pixItalicWords ( PIX *pixs, BOXA *boxaw, PIX *pixw, BOXA **pboxa, l_int32 debugflag ); -LEPT_DLL extern l_int32 pixOrientDetect ( PIX *pixs, l_float32 *pupconf, l_float32 *pleftconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern l_int32 makeOrientDecision ( l_float32 upconf, l_float32 leftconf, l_float32 minupconf, l_float32 minratio, l_int32 *porient, l_int32 debug ); -LEPT_DLL extern l_int32 pixUpDownDetect ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern l_int32 pixUpDownDetectGeneral ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 npixels, l_int32 debug ); -LEPT_DLL extern l_int32 pixOrientDetectDwa ( PIX *pixs, l_float32 *pupconf, l_float32 *pleftconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern l_int32 pixUpDownDetectDwa ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern l_int32 pixUpDownDetectGeneralDwa ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 npixels, l_int32 debug ); -LEPT_DLL extern l_int32 pixMirrorDetect ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern l_int32 pixMirrorDetectDwa ( PIX *pixs, l_float32 *pconf, l_int32 mincount, l_int32 debug ); -LEPT_DLL extern PIX * pixFlipFHMTGen ( PIX *pixd, PIX *pixs, char *selname ); -LEPT_DLL extern l_int32 fmorphautogen ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern l_int32 fmorphautogen1 ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern l_int32 fmorphautogen2 ( SELA *sela, l_int32 fileindex, const char *filename ); -LEPT_DLL extern PIX * pixMorphDwa_1 ( PIX *pixd, PIX *pixs, l_int32 operation, char *selname ); -LEPT_DLL extern PIX * pixFMorphopGen_1 ( PIX *pixd, PIX *pixs, l_int32 operation, char *selname ); -LEPT_DLL extern l_int32 fmorphopgen_low_1 ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 index ); -LEPT_DLL extern FPIX * fpixCreate ( l_int32 width, l_int32 height ); -LEPT_DLL extern FPIX * fpixCreateTemplate ( FPIX *fpixs ); -LEPT_DLL extern FPIX * fpixClone ( FPIX *fpix ); -LEPT_DLL extern FPIX * fpixCopy ( FPIX *fpixd, FPIX *fpixs ); -LEPT_DLL extern l_int32 fpixResizeImageData ( FPIX *fpixd, FPIX *fpixs ); -LEPT_DLL extern void fpixDestroy ( FPIX **pfpix ); -LEPT_DLL extern l_int32 fpixGetDimensions ( FPIX *fpix, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 fpixSetDimensions ( FPIX *fpix, l_int32 w, l_int32 h ); -LEPT_DLL extern l_int32 fpixGetWpl ( FPIX *fpix ); -LEPT_DLL extern l_int32 fpixSetWpl ( FPIX *fpix, l_int32 wpl ); -LEPT_DLL extern l_int32 fpixGetRefcount ( FPIX *fpix ); -LEPT_DLL extern l_int32 fpixChangeRefcount ( FPIX *fpix, l_int32 delta ); -LEPT_DLL extern l_int32 fpixGetResolution ( FPIX *fpix, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 fpixSetResolution ( FPIX *fpix, l_int32 xres, l_int32 yres ); -LEPT_DLL extern l_int32 fpixCopyResolution ( FPIX *fpixd, FPIX *fpixs ); -LEPT_DLL extern l_float32 * fpixGetData ( FPIX *fpix ); -LEPT_DLL extern l_int32 fpixSetData ( FPIX *fpix, l_float32 *data ); -LEPT_DLL extern l_int32 fpixGetPixel ( FPIX *fpix, l_int32 x, l_int32 y, l_float32 *pval ); -LEPT_DLL extern l_int32 fpixSetPixel ( FPIX *fpix, l_int32 x, l_int32 y, l_float32 val ); -LEPT_DLL extern FPIXA * fpixaCreate ( l_int32 n ); -LEPT_DLL extern FPIXA * fpixaCopy ( FPIXA *fpixa, l_int32 copyflag ); -LEPT_DLL extern void fpixaDestroy ( FPIXA **pfpixa ); -LEPT_DLL extern l_int32 fpixaAddFPix ( FPIXA *fpixa, FPIX *fpix, l_int32 copyflag ); -LEPT_DLL extern l_int32 fpixaExtendArray ( FPIXA *fpixa ); -LEPT_DLL extern l_int32 fpixaExtendArrayToSize ( FPIXA *fpixa, l_int32 size ); -LEPT_DLL extern l_int32 fpixaGetCount ( FPIXA *fpixa ); -LEPT_DLL extern l_int32 fpixaChangeRefcount ( FPIXA *fpixa, l_int32 delta ); -LEPT_DLL extern FPIX * fpixaGetFPix ( FPIXA *fpixa, l_int32 index, l_int32 accesstype ); -LEPT_DLL extern l_int32 fpixaGetFPixDimensions ( FPIXA *fpixa, l_int32 index, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 fpixaGetPixel ( FPIXA *fpixa, l_int32 index, l_int32 x, l_int32 y, l_float32 *pval ); -LEPT_DLL extern l_int32 fpixaSetPixel ( FPIXA *fpixa, l_int32 index, l_int32 x, l_int32 y, l_float32 val ); -LEPT_DLL extern DPIX * dpixCreate ( l_int32 width, l_int32 height ); -LEPT_DLL extern DPIX * dpixCreateTemplate ( DPIX *dpixs ); -LEPT_DLL extern DPIX * dpixClone ( DPIX *dpix ); -LEPT_DLL extern DPIX * dpixCopy ( DPIX *dpixd, DPIX *dpixs ); -LEPT_DLL extern l_int32 dpixResizeImageData ( DPIX *dpixd, DPIX *dpixs ); -LEPT_DLL extern void dpixDestroy ( DPIX **pdpix ); -LEPT_DLL extern l_int32 dpixGetDimensions ( DPIX *dpix, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 dpixSetDimensions ( DPIX *dpix, l_int32 w, l_int32 h ); -LEPT_DLL extern l_int32 dpixGetWpl ( DPIX *dpix ); -LEPT_DLL extern l_int32 dpixSetWpl ( DPIX *dpix, l_int32 wpl ); -LEPT_DLL extern l_int32 dpixGetRefcount ( DPIX *dpix ); -LEPT_DLL extern l_int32 dpixChangeRefcount ( DPIX *dpix, l_int32 delta ); -LEPT_DLL extern l_int32 dpixGetResolution ( DPIX *dpix, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 dpixSetResolution ( DPIX *dpix, l_int32 xres, l_int32 yres ); -LEPT_DLL extern l_int32 dpixCopyResolution ( DPIX *dpixd, DPIX *dpixs ); -LEPT_DLL extern l_float64 * dpixGetData ( DPIX *dpix ); -LEPT_DLL extern l_int32 dpixSetData ( DPIX *dpix, l_float64 *data ); -LEPT_DLL extern l_int32 dpixGetPixel ( DPIX *dpix, l_int32 x, l_int32 y, l_float64 *pval ); -LEPT_DLL extern l_int32 dpixSetPixel ( DPIX *dpix, l_int32 x, l_int32 y, l_float64 val ); -LEPT_DLL extern FPIX * fpixRead ( const char *filename ); -LEPT_DLL extern FPIX * fpixReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 fpixWrite ( const char *filename, FPIX *fpix ); -LEPT_DLL extern l_int32 fpixWriteStream ( FILE *fp, FPIX *fpix ); -LEPT_DLL extern FPIX * fpixEndianByteSwap ( FPIX *fpixd, FPIX *fpixs ); -LEPT_DLL extern DPIX * dpixRead ( const char *filename ); -LEPT_DLL extern DPIX * dpixReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 dpixWrite ( const char *filename, DPIX *dpix ); -LEPT_DLL extern l_int32 dpixWriteStream ( FILE *fp, DPIX *dpix ); -LEPT_DLL extern DPIX * dpixEndianByteSwap ( DPIX *dpixd, DPIX *dpixs ); -LEPT_DLL extern l_int32 fpixPrintStream ( FILE *fp, FPIX *fpix, l_int32 factor ); -LEPT_DLL extern FPIX * pixConvertToFPix ( PIX *pixs, l_int32 ncomps ); -LEPT_DLL extern PIX * fpixConvertToPix ( FPIX *fpixs, l_int32 outdepth, l_int32 negvals, l_int32 errorflag ); -LEPT_DLL extern PIX * fpixDisplayMaxDynamicRange ( FPIX *fpixs ); -LEPT_DLL extern DPIX * fpixConvertToDPix ( FPIX *fpix ); -LEPT_DLL extern FPIX * dpixConvertToFPix ( DPIX *dpix ); -LEPT_DLL extern l_int32 fpixGetMin ( FPIX *fpix, l_float32 *pminval, l_int32 *pxminloc, l_int32 *pyminloc ); -LEPT_DLL extern l_int32 fpixGetMax ( FPIX *fpix, l_float32 *pmaxval, l_int32 *pxmaxloc, l_int32 *pymaxloc ); -LEPT_DLL extern FPIX * fpixAddBorder ( FPIX *fpixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern FPIX * fpixRemoveBorder ( FPIX *fpixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern FPIX * fpixAddMirroredBorder ( FPIX *fpixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern l_int32 fpixRasterop ( FPIX *fpixd, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, FPIX *fpixs, l_int32 sx, l_int32 sy ); -LEPT_DLL extern FPIX * fpixScaleByInteger ( FPIX *fpixs, l_int32 factor ); -LEPT_DLL extern DPIX * dpixScaleByInteger ( DPIX *dpixs, l_int32 factor ); -LEPT_DLL extern FPIX * fpixLinearCombination ( FPIX *fpixd, FPIX *fpixs1, FPIX *fpixs2, l_float32 a, l_float32 b ); -LEPT_DLL extern l_int32 fpixAddMultConstant ( FPIX *fpix, l_float32 addc, l_float32 multc ); -LEPT_DLL extern PIX * pixReadStreamGif ( FILE *fp ); -LEPT_DLL extern l_int32 pixWriteStreamGif ( FILE *fp, PIX *pix ); -LEPT_DLL extern PIX * pixReadMemGif ( const l_uint8 *cdata, size_t size ); -LEPT_DLL extern l_int32 pixWriteMemGif ( l_uint8 **pdata, size_t *psize, PIX *pix ); -LEPT_DLL extern GPLOT * gplotCreate ( const char *rootname, l_int32 outformat, const char *title, const char *xlabel, const char *ylabel ); -LEPT_DLL extern void gplotDestroy ( GPLOT **pgplot ); -LEPT_DLL extern l_int32 gplotAddPlot ( GPLOT *gplot, NUMA *nax, NUMA *nay, l_int32 plotstyle, const char *plottitle ); -LEPT_DLL extern l_int32 gplotSetScaling ( GPLOT *gplot, l_int32 scaling ); -LEPT_DLL extern l_int32 gplotMakeOutput ( GPLOT *gplot ); -LEPT_DLL extern l_int32 gplotGenCommandFile ( GPLOT *gplot ); -LEPT_DLL extern l_int32 gplotGenDataFiles ( GPLOT *gplot ); -LEPT_DLL extern l_int32 gplotSimple1 ( NUMA *na, l_int32 outformat, const char *outroot, const char *title ); -LEPT_DLL extern l_int32 gplotSimple2 ( NUMA *na1, NUMA *na2, l_int32 outformat, const char *outroot, const char *title ); -LEPT_DLL extern l_int32 gplotSimpleN ( NUMAA *naa, l_int32 outformat, const char *outroot, const char *title ); -LEPT_DLL extern GPLOT * gplotRead ( const char *filename ); -LEPT_DLL extern l_int32 gplotWrite ( const char *filename, GPLOT *gplot ); -LEPT_DLL extern PTA * generatePtaLine ( l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2 ); -LEPT_DLL extern PTA * generatePtaWideLine ( l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width ); -LEPT_DLL extern PTA * generatePtaBox ( BOX *box, l_int32 width ); -LEPT_DLL extern PTA * generatePtaHashBox ( BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline ); -LEPT_DLL extern PTA * generatePtaBoxa ( BOXA *boxa, l_int32 width, l_int32 removedups ); -LEPT_DLL extern PTAA * generatePtaaBoxa ( BOXA *boxa ); -LEPT_DLL extern PTAA * generatePtaaHashBoxa ( BOXA *boxa, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline ); -LEPT_DLL extern PTA * generatePtaPolyline ( PTA *ptas, l_int32 width, l_int32 closeflag, l_int32 removedups ); -LEPT_DLL extern PTA * generatePtaFilledCircle ( l_int32 radius ); -LEPT_DLL extern PTA * generatePtaLineFromPt ( l_int32 x, l_int32 y, l_float64 length, l_float64 radang ); -LEPT_DLL extern l_int32 locatePtRadially ( l_int32 xr, l_int32 yr, l_float64 dist, l_float64 radang, l_float64 *px, l_float64 *py ); -LEPT_DLL extern l_int32 pixRenderPta ( PIX *pix, PTA *pta, l_int32 op ); -LEPT_DLL extern l_int32 pixRenderPtaArb ( PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval ); -LEPT_DLL extern l_int32 pixRenderPtaBlend ( PIX *pix, PTA *pta, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract ); -LEPT_DLL extern l_int32 pixRenderLine ( PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_int32 op ); -LEPT_DLL extern l_int32 pixRenderLineArb ( PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval ); -LEPT_DLL extern l_int32 pixRenderLineBlend ( PIX *pix, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract ); -LEPT_DLL extern l_int32 pixRenderBox ( PIX *pix, BOX *box, l_int32 width, l_int32 op ); -LEPT_DLL extern l_int32 pixRenderBoxArb ( PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval ); -LEPT_DLL extern l_int32 pixRenderBoxBlend ( PIX *pix, BOX *box, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract ); -LEPT_DLL extern l_int32 pixRenderHashBox ( PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 op ); -LEPT_DLL extern l_int32 pixRenderHashBoxArb ( PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixRenderHashBoxBlend ( PIX *pix, BOX *box, l_int32 spacing, l_int32 width, l_int32 orient, l_int32 outline, l_int32 rval, l_int32 gval, l_int32 bval, l_float32 fract ); -LEPT_DLL extern l_int32 pixRenderBoxa ( PIX *pix, BOXA *boxa, l_int32 width, l_int32 op ); -LEPT_DLL extern l_int32 pixRenderBoxaArb ( PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval ); -LEPT_DLL extern l_int32 pixRenderBoxaBlend ( PIX *pix, BOXA *boxa, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 removedups ); -LEPT_DLL extern l_int32 pixRenderPolyline ( PIX *pix, PTA *ptas, l_int32 width, l_int32 op, l_int32 closeflag ); -LEPT_DLL extern l_int32 pixRenderPolylineArb ( PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_int32 closeflag ); -LEPT_DLL extern l_int32 pixRenderPolylineBlend ( PIX *pix, PTA *ptas, l_int32 width, l_uint8 rval, l_uint8 gval, l_uint8 bval, l_float32 fract, l_int32 closeflag, l_int32 removedups ); -LEPT_DLL extern PIX * pixRenderRandomCmapPtaa ( PIX *pix, PTAA *ptaa, l_int32 polyflag, l_int32 width, l_int32 closeflag ); -LEPT_DLL extern PIX * pixRenderContours ( PIX *pixs, l_int32 startval, l_int32 incr, l_int32 outdepth ); -LEPT_DLL extern PIX * fpixRenderContours ( FPIX *fpixs, l_float32 startval, l_float32 incr, l_float32 proxim ); -LEPT_DLL extern PIX * pixErodeGray ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixDilateGray ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenGray ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseGray ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeGray3 ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixDilateGray3 ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenGray3 ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseGray3 ( PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern void dilateGrayLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 size, l_int32 direction, l_uint8 *buffer, l_uint8 *maxarray ); -LEPT_DLL extern void erodeGrayLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 size, l_int32 direction, l_uint8 *buffer, l_uint8 *minarray ); -LEPT_DLL extern PIX * pixDitherToBinary ( PIX *pixs ); -LEPT_DLL extern PIX * pixDitherToBinarySpec ( PIX *pixs, l_int32 lowerclip, l_int32 upperclip ); -LEPT_DLL extern PIX * pixThresholdToBinary ( PIX *pixs, l_int32 thresh ); -LEPT_DLL extern PIX * pixVarThresholdToBinary ( PIX *pixs, PIX *pixg ); -LEPT_DLL extern PIX * pixDitherToBinaryLUT ( PIX *pixs, l_int32 lowerclip, l_int32 upperclip ); -LEPT_DLL extern PIX * pixGenerateMaskByValue ( PIX *pixs, l_int32 val, l_int32 usecmap ); -LEPT_DLL extern PIX * pixGenerateMaskByBand ( PIX *pixs, l_int32 lower, l_int32 upper, l_int32 inband, l_int32 usecmap ); -LEPT_DLL extern PIX * pixDitherTo2bpp ( PIX *pixs, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixDitherTo2bppSpec ( PIX *pixs, l_int32 lowerclip, l_int32 upperclip, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixThresholdTo2bpp ( PIX *pixs, l_int32 nlevels, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixThresholdTo4bpp ( PIX *pixs, l_int32 nlevels, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixThresholdOn8bpp ( PIX *pixs, l_int32 nlevels, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixThresholdGrayArb ( PIX *pixs, const char *edgevals, l_int32 outdepth, l_int32 use_average, l_int32 setblack, l_int32 setwhite ); -LEPT_DLL extern l_int32 * makeGrayQuantIndexTable ( l_int32 nlevels ); -LEPT_DLL extern l_int32 * makeGrayQuantTargetTable ( l_int32 nlevels, l_int32 depth ); -LEPT_DLL extern l_int32 makeGrayQuantTableArb ( NUMA *na, l_int32 outdepth, l_int32 **ptab, PIXCMAP **pcmap ); -LEPT_DLL extern l_int32 makeGrayQuantColormapArb ( PIX *pixs, l_int32 *tab, l_int32 outdepth, PIXCMAP **pcmap ); -LEPT_DLL extern PIX * pixGenerateMaskByBand32 ( PIX *pixs, l_uint32 refval, l_int32 delm, l_int32 delp ); -LEPT_DLL extern PIX * pixGenerateMaskByDiscr32 ( PIX *pixs, l_uint32 refval1, l_uint32 refval2, l_int32 distflag ); -LEPT_DLL extern PIX * pixGrayQuantFromHisto ( PIX *pixd, PIX *pixs, PIX *pixm, l_float32 minfract, l_int32 maxsize ); -LEPT_DLL extern PIX * pixGrayQuantFromCmap ( PIX *pixs, PIXCMAP *cmap, l_int32 mindepth ); -LEPT_DLL extern void ditherToBinaryLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 lowerclip, l_int32 upperclip ); -LEPT_DLL extern void ditherToBinaryLineLow ( l_uint32 *lined, l_int32 w, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 lowerclip, l_int32 upperclip, l_int32 lastlineflag ); -LEPT_DLL extern void thresholdToBinaryLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 d, l_int32 wpls, l_int32 thresh ); -LEPT_DLL extern void thresholdToBinaryLineLow ( l_uint32 *lined, l_int32 w, l_uint32 *lines, l_int32 d, l_int32 thresh ); -LEPT_DLL extern void ditherToBinaryLUTLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 *tabval, l_int32 *tab38, l_int32 *tab14 ); -LEPT_DLL extern void ditherToBinaryLineLUTLow ( l_uint32 *lined, l_int32 w, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 *tabval, l_int32 *tab38, l_int32 *tab14, l_int32 lastlineflag ); -LEPT_DLL extern l_int32 make8To1DitherTables ( l_int32 **ptabval, l_int32 **ptab38, l_int32 **ptab14, l_int32 lowerclip, l_int32 upperclip ); -LEPT_DLL extern void ditherTo2bppLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 *tabval, l_int32 *tab38, l_int32 *tab14 ); -LEPT_DLL extern void ditherTo2bppLineLow ( l_uint32 *lined, l_int32 w, l_uint32 *bufs1, l_uint32 *bufs2, l_int32 *tabval, l_int32 *tab38, l_int32 *tab14, l_int32 lastlineflag ); -LEPT_DLL extern l_int32 make8To2DitherTables ( l_int32 **ptabval, l_int32 **ptab38, l_int32 **ptab14, l_int32 cliptoblack, l_int32 cliptowhite ); -LEPT_DLL extern void thresholdTo2bppLow ( l_uint32 *datad, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 *tab ); -LEPT_DLL extern void thresholdTo4bppLow ( l_uint32 *datad, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 *tab ); -LEPT_DLL extern L_HEAP * lheapCreate ( l_int32 nalloc, l_int32 direction ); -LEPT_DLL extern void lheapDestroy ( L_HEAP **plh, l_int32 freeflag ); -LEPT_DLL extern l_int32 lheapAdd ( L_HEAP *lh, void *item ); -LEPT_DLL extern l_int32 lheapExtendArray ( L_HEAP *lh ); -LEPT_DLL extern void * lheapRemove ( L_HEAP *lh ); -LEPT_DLL extern l_int32 lheapGetCount ( L_HEAP *lh ); -LEPT_DLL extern l_int32 lheapSwapUp ( L_HEAP *lh, l_int32 index ); -LEPT_DLL extern l_int32 lheapSwapDown ( L_HEAP *lh ); -LEPT_DLL extern l_int32 lheapSort ( L_HEAP *lh ); -LEPT_DLL extern l_int32 lheapSortStrictOrder ( L_HEAP *lh ); -LEPT_DLL extern l_int32 lheapPrint ( FILE *fp, L_HEAP *lh ); -LEPT_DLL extern JBCLASSER * jbRankHausInit ( l_int32 components, l_int32 maxwidth, l_int32 maxheight, l_int32 size, l_float32 rank ); -LEPT_DLL extern JBCLASSER * jbCorrelationInit ( l_int32 components, l_int32 maxwidth, l_int32 maxheight, l_float32 thresh, l_float32 weightfactor ); -LEPT_DLL extern JBCLASSER * jbCorrelationInitWithoutComponents ( l_int32 components, l_int32 maxwidth, l_int32 maxheight, l_float32 thresh, l_float32 weightfactor ); -LEPT_DLL extern l_int32 jbAddPages ( JBCLASSER *classer, SARRAY *safiles ); -LEPT_DLL extern l_int32 jbAddPage ( JBCLASSER *classer, PIX *pixs ); -LEPT_DLL extern l_int32 jbAddPageComponents ( JBCLASSER *classer, PIX *pixs, BOXA *boxas, PIXA *pixas ); -LEPT_DLL extern l_int32 jbClassifyRankHaus ( JBCLASSER *classer, BOXA *boxa, PIXA *pixas ); -LEPT_DLL extern l_int32 pixHaustest ( PIX *pix1, PIX *pix2, PIX *pix3, PIX *pix4, l_float32 delx, l_float32 dely, l_int32 maxdiffw, l_int32 maxdiffh ); -LEPT_DLL extern l_int32 pixRankHaustest ( PIX *pix1, PIX *pix2, PIX *pix3, PIX *pix4, l_float32 delx, l_float32 dely, l_int32 maxdiffw, l_int32 maxdiffh, l_int32 area1, l_int32 area3, l_float32 rank, l_int32 *tab8 ); -LEPT_DLL extern l_int32 jbClassifyCorrelation ( JBCLASSER *classer, BOXA *boxa, PIXA *pixas ); -LEPT_DLL extern l_int32 jbGetComponents ( PIX *pixs, l_int32 components, l_int32 maxwidth, l_int32 maxheight, BOXA **pboxad, PIXA **ppixad ); -LEPT_DLL extern PIX * pixWordMaskByDilation ( PIX *pixs, l_int32 maxsize, l_int32 *psize ); -LEPT_DLL extern PIXA * jbAccumulateComposites ( PIXAA *pixaa, NUMA **pna, PTA **pptat ); -LEPT_DLL extern PIXA * jbTemplatesFromComposites ( PIXA *pixac, NUMA *na ); -LEPT_DLL extern JBCLASSER * jbClasserCreate ( l_int32 method, l_int32 components ); -LEPT_DLL extern void jbClasserDestroy ( JBCLASSER **pclasser ); -LEPT_DLL extern JBDATA * jbDataSave ( JBCLASSER *classer ); -LEPT_DLL extern void jbDataDestroy ( JBDATA **pdata ); -LEPT_DLL extern l_int32 jbDataWrite ( const char *rootout, JBDATA *jbdata ); -LEPT_DLL extern JBDATA * jbDataRead ( const char *rootname ); -LEPT_DLL extern PIXA * jbDataRender ( JBDATA *data, l_int32 debugflag ); -LEPT_DLL extern l_int32 jbGetULCorners ( JBCLASSER *classer, PIX *pixs, BOXA *boxa ); -LEPT_DLL extern l_int32 jbGetLLCorners ( JBCLASSER *classer ); -LEPT_DLL extern PIX * pixReadJpeg ( const char *filename, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn ); -LEPT_DLL extern PIX * pixReadStreamJpeg ( FILE *fp, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint ); -LEPT_DLL extern l_int32 readHeaderJpeg ( const char *filename, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk ); -LEPT_DLL extern l_int32 freadHeaderJpeg ( FILE *fp, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk ); -LEPT_DLL extern l_int32 fgetJpegResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 pixWriteJpeg ( const char *filename, PIX *pix, l_int32 quality, l_int32 progressive ); -LEPT_DLL extern l_int32 pixWriteStreamJpeg ( FILE *fp, PIX *pix, l_int32 quality, l_int32 progressive ); -LEPT_DLL extern PIX * pixReadMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 cmflag, l_int32 reduction, l_int32 *pnwarn, l_int32 hint ); -LEPT_DLL extern l_int32 readHeaderMemJpeg ( const l_uint8 *cdata, size_t size, l_int32 *pw, l_int32 *ph, l_int32 *pspp, l_int32 *pycck, l_int32 *pcmyk ); -LEPT_DLL extern l_int32 pixWriteMemJpeg ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 quality, l_int32 progressive ); -LEPT_DLL extern void l_jpegSetNoChromaSampling ( l_int32 flag ); -LEPT_DLL extern l_int32 extractJpegDataFromFile ( const char *filein, l_uint8 **pdata, size_t *pnbytes, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp ); -LEPT_DLL extern l_int32 extractJpegDataFromArray ( const void *data, size_t nbytes, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp ); -LEPT_DLL extern L_KERNEL * kernelCreate ( l_int32 height, l_int32 width ); -LEPT_DLL extern void kernelDestroy ( L_KERNEL **pkel ); -LEPT_DLL extern L_KERNEL * kernelCopy ( L_KERNEL *kels ); -LEPT_DLL extern l_int32 kernelGetElement ( L_KERNEL *kel, l_int32 row, l_int32 col, l_float32 *pval ); -LEPT_DLL extern l_int32 kernelSetElement ( L_KERNEL *kel, l_int32 row, l_int32 col, l_float32 val ); -LEPT_DLL extern l_int32 kernelGetParameters ( L_KERNEL *kel, l_int32 *psy, l_int32 *psx, l_int32 *pcy, l_int32 *pcx ); -LEPT_DLL extern l_int32 kernelSetOrigin ( L_KERNEL *kel, l_int32 cy, l_int32 cx ); -LEPT_DLL extern l_int32 kernelGetSum ( L_KERNEL *kel, l_float32 *psum ); -LEPT_DLL extern l_int32 kernelGetMinMax ( L_KERNEL *kel, l_float32 *pmin, l_float32 *pmax ); -LEPT_DLL extern L_KERNEL * kernelNormalize ( L_KERNEL *kels, l_float32 normsum ); -LEPT_DLL extern L_KERNEL * kernelInvert ( L_KERNEL *kels ); -LEPT_DLL extern l_float32 ** create2dFloatArray ( l_int32 sy, l_int32 sx ); -LEPT_DLL extern L_KERNEL * kernelRead ( const char *fname ); -LEPT_DLL extern L_KERNEL * kernelReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 kernelWrite ( const char *fname, L_KERNEL *kel ); -LEPT_DLL extern l_int32 kernelWriteStream ( FILE *fp, L_KERNEL *kel ); -LEPT_DLL extern L_KERNEL * kernelCreateFromString ( l_int32 h, l_int32 w, l_int32 cy, l_int32 cx, const char *kdata ); -LEPT_DLL extern L_KERNEL * kernelCreateFromFile ( const char *filename ); -LEPT_DLL extern L_KERNEL * kernelCreateFromPix ( PIX *pix, l_int32 cy, l_int32 cx ); -LEPT_DLL extern PIX * kernelDisplayInPix ( L_KERNEL *kel, l_int32 size, l_int32 gthick ); -LEPT_DLL extern NUMA * parseStringForNumbers ( const char *str, const char *seps ); -LEPT_DLL extern L_KERNEL * makeFlatKernel ( l_int32 height, l_int32 width, l_int32 cy, l_int32 cx ); -LEPT_DLL extern L_KERNEL * makeGaussianKernel ( l_int32 halfheight, l_int32 halfwidth, l_float32 stdev, l_float32 max ); -LEPT_DLL extern l_int32 makeGaussianKernelSep ( l_int32 halfheight, l_int32 halfwidth, l_float32 stdev, l_float32 max, L_KERNEL **pkelx, L_KERNEL **pkely ); -LEPT_DLL extern L_KERNEL * makeDoGKernel ( l_int32 halfheight, l_int32 halfwidth, l_float32 stdev, l_float32 ratio ); -LEPT_DLL extern char * getImagelibVersions ( ); -LEPT_DLL extern void listDestroy ( DLLIST **phead ); -LEPT_DLL extern l_int32 listAddToHead ( DLLIST **phead, void *data ); -LEPT_DLL extern l_int32 listAddToTail ( DLLIST **phead, DLLIST **ptail, void *data ); -LEPT_DLL extern l_int32 listInsertBefore ( DLLIST **phead, DLLIST *elem, void *data ); -LEPT_DLL extern l_int32 listInsertAfter ( DLLIST **phead, DLLIST *elem, void *data ); -LEPT_DLL extern void * listRemoveElement ( DLLIST **phead, DLLIST *elem ); -LEPT_DLL extern void * listRemoveFromHead ( DLLIST **phead ); -LEPT_DLL extern void * listRemoveFromTail ( DLLIST **phead, DLLIST **ptail ); -LEPT_DLL extern DLLIST * listFindElement ( DLLIST *head, void *data ); -LEPT_DLL extern DLLIST * listFindTail ( DLLIST *head ); -LEPT_DLL extern l_int32 listGetCount ( DLLIST *head ); -LEPT_DLL extern l_int32 listReverse ( DLLIST **phead ); -LEPT_DLL extern l_int32 listJoin ( DLLIST **phead1, DLLIST **phead2 ); -LEPT_DLL extern PIX * generateBinaryMaze ( l_int32 w, l_int32 h, l_int32 xi, l_int32 yi, l_float32 wallps, l_float32 ranis ); -LEPT_DLL extern PTA * pixSearchBinaryMaze ( PIX *pixs, l_int32 xi, l_int32 yi, l_int32 xf, l_int32 yf, PIX **ppixd ); -LEPT_DLL extern PTA * pixSearchGrayMaze ( PIX *pixs, l_int32 xi, l_int32 yi, l_int32 xf, l_int32 yf, PIX **ppixd ); -LEPT_DLL extern l_int32 pixFindLargestRectangle ( PIX *pixs, l_int32 polarity, BOX **pbox, const char *debugfile ); -LEPT_DLL extern PIX * pixDilate ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixErode ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixHMT ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixOpen ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixClose ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixCloseSafe ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixOpenGeneralized ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixCloseGeneralized ( PIX *pixd, PIX *pixs, SEL *sel ); -LEPT_DLL extern PIX * pixDilateBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseSafeBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern l_int32 selectComposableSels ( l_int32 size, l_int32 direction, SEL **psel1, SEL **psel2 ); -LEPT_DLL extern l_int32 selectComposableSizes ( l_int32 size, l_int32 *pfactor1, l_int32 *pfactor2 ); -LEPT_DLL extern PIX * pixDilateCompBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeCompBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenCompBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseCompBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseSafeCompBrick ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern void resetMorphBoundaryCondition ( l_int32 bc ); -LEPT_DLL extern l_uint32 getMorphBorderPixelColor ( l_int32 type, l_int32 depth ); -LEPT_DLL extern PIX * pixExtractBoundary ( PIX *pixs, l_int32 type ); -LEPT_DLL extern PIX * pixMorphSequenceMasked ( PIX *pixs, PIX *pixm, const char *sequence, l_int32 dispsep ); -LEPT_DLL extern PIX * pixMorphSequenceByComponent ( PIX *pixs, const char *sequence, l_int32 connectivity, l_int32 minw, l_int32 minh, BOXA **pboxa ); -LEPT_DLL extern PIXA * pixaMorphSequenceByComponent ( PIXA *pixas, const char *sequence, l_int32 minw, l_int32 minh ); -LEPT_DLL extern PIX * pixMorphSequenceByRegion ( PIX *pixs, PIX *pixm, const char *sequence, l_int32 connectivity, l_int32 minw, l_int32 minh, BOXA **pboxa ); -LEPT_DLL extern PIXA * pixaMorphSequenceByRegion ( PIX *pixs, PIXA *pixam, const char *sequence, l_int32 minw, l_int32 minh ); -LEPT_DLL extern PIX * pixUnionOfMorphOps ( PIX *pixs, SELA *sela, l_int32 type ); -LEPT_DLL extern PIX * pixIntersectionOfMorphOps ( PIX *pixs, SELA *sela, l_int32 type ); -LEPT_DLL extern PIX * pixSelectiveConnCompFill ( PIX *pixs, l_int32 connectivity, l_int32 minw, l_int32 minh ); -LEPT_DLL extern l_int32 pixRemoveMatchedPattern ( PIX *pixs, PIX *pixp, PIX *pixe, l_int32 x0, l_int32 y0, l_int32 dsize ); -LEPT_DLL extern PIX * pixDisplayMatchedPattern ( PIX *pixs, PIX *pixp, PIX *pixe, l_int32 x0, l_int32 y0, l_uint32 color, l_float32 scale, l_int32 nlevels ); -LEPT_DLL extern PIX * pixSeedfillMorph ( PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern NUMA * pixRunHistogramMorph ( PIX *pixs, l_int32 runtype, l_int32 direction, l_int32 maxsize ); -LEPT_DLL extern PIX * pixTophat ( PIX *pixs, l_int32 hsize, l_int32 vsize, l_int32 type ); -LEPT_DLL extern PIX * pixHDome ( PIX *pixs, l_int32 height, l_int32 connectivity ); -LEPT_DLL extern PIX * pixFastTophat ( PIX *pixs, l_int32 xsize, l_int32 ysize, l_int32 type ); -LEPT_DLL extern PIX * pixMorphGradient ( PIX *pixs, l_int32 hsize, l_int32 vsize, l_int32 smoothing ); -LEPT_DLL extern PTA * pixaCentroids ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixCentroid ( PIX *pix, l_int32 *centtab, l_int32 *sumtab, l_float32 *pxave, l_float32 *pyave ); -LEPT_DLL extern PIX * pixDilateBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixDilateCompBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeCompBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenCompBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseCompBrickDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixDilateCompBrickExtendDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixErodeCompBrickExtendDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixOpenCompBrickExtendDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern PIX * pixCloseCompBrickExtendDwa ( PIX *pixd, PIX *pixs, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern l_int32 getExtendedCompositeParameters ( l_int32 size, l_int32 *pn, l_int32 *pextra, l_int32 *pactualsize ); -LEPT_DLL extern PIX * pixMorphSequence ( PIX *pixs, const char *sequence, l_int32 dispsep ); -LEPT_DLL extern PIX * pixMorphCompSequence ( PIX *pixs, const char *sequence, l_int32 dispsep ); -LEPT_DLL extern PIX * pixMorphSequenceDwa ( PIX *pixs, const char *sequence, l_int32 dispsep ); -LEPT_DLL extern PIX * pixMorphCompSequenceDwa ( PIX *pixs, const char *sequence, l_int32 dispsep ); -LEPT_DLL extern l_int32 morphSequenceVerify ( SARRAY *sa ); -LEPT_DLL extern PIX * pixGrayMorphSequence ( PIX *pixs, const char *sequence, l_int32 dispsep, l_int32 dispy ); -LEPT_DLL extern PIX * pixColorMorphSequence ( PIX *pixs, const char *sequence, l_int32 dispsep, l_int32 dispy ); -LEPT_DLL extern NUMA * numaCreate ( l_int32 n ); -LEPT_DLL extern NUMA * numaCreateFromIArray ( l_int32 *iarray, l_int32 size ); -LEPT_DLL extern NUMA * numaCreateFromFArray ( l_float32 *farray, l_int32 size, l_int32 copyflag ); -LEPT_DLL extern void numaDestroy ( NUMA **pna ); -LEPT_DLL extern NUMA * numaCopy ( NUMA *na ); -LEPT_DLL extern NUMA * numaClone ( NUMA *na ); -LEPT_DLL extern l_int32 numaEmpty ( NUMA *na ); -LEPT_DLL extern l_int32 numaAddNumber ( NUMA *na, l_float32 val ); -LEPT_DLL extern l_int32 numaExtendArray ( NUMA *na ); -LEPT_DLL extern l_int32 numaInsertNumber ( NUMA *na, l_int32 index, l_float32 val ); -LEPT_DLL extern l_int32 numaRemoveNumber ( NUMA *na, l_int32 index ); -LEPT_DLL extern l_int32 numaReplaceNumber ( NUMA *na, l_int32 index, l_float32 val ); -LEPT_DLL extern l_int32 numaGetCount ( NUMA *na ); -LEPT_DLL extern l_int32 numaSetCount ( NUMA *na, l_int32 newcount ); -LEPT_DLL extern l_int32 numaGetFValue ( NUMA *na, l_int32 index, l_float32 *pval ); -LEPT_DLL extern l_int32 numaGetIValue ( NUMA *na, l_int32 index, l_int32 *pival ); -LEPT_DLL extern l_int32 numaSetValue ( NUMA *na, l_int32 index, l_float32 val ); -LEPT_DLL extern l_int32 numaShiftValue ( NUMA *na, l_int32 index, l_float32 diff ); -LEPT_DLL extern l_int32 * numaGetIArray ( NUMA *na ); -LEPT_DLL extern l_float32 * numaGetFArray ( NUMA *na, l_int32 copyflag ); -LEPT_DLL extern l_int32 numaGetRefcount ( NUMA *na ); -LEPT_DLL extern l_int32 numaChangeRefcount ( NUMA *na, l_int32 delta ); -LEPT_DLL extern l_int32 numaGetXParameters ( NUMA *na, l_float32 *pstartx, l_float32 *pdelx ); -LEPT_DLL extern l_int32 numaSetXParameters ( NUMA *na, l_float32 startx, l_float32 delx ); -LEPT_DLL extern l_int32 numaCopyXParameters ( NUMA *nad, NUMA *nas ); -LEPT_DLL extern NUMA * numaRead ( const char *filename ); -LEPT_DLL extern NUMA * numaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 numaWrite ( const char *filename, NUMA *na ); -LEPT_DLL extern l_int32 numaWriteStream ( FILE *fp, NUMA *na ); -LEPT_DLL extern NUMAA * numaaCreate ( l_int32 n ); -LEPT_DLL extern void numaaDestroy ( NUMAA **pnaa ); -LEPT_DLL extern l_int32 numaaAddNuma ( NUMAA *naa, NUMA *na, l_int32 copyflag ); -LEPT_DLL extern l_int32 numaaExtendArray ( NUMAA *naa ); -LEPT_DLL extern l_int32 numaaGetCount ( NUMAA *naa ); -LEPT_DLL extern l_int32 numaaGetNumaCount ( NUMAA *naa, l_int32 index ); -LEPT_DLL extern l_int32 numaaGetNumberCount ( NUMAA *naa ); -LEPT_DLL extern NUMA ** numaaGetPtrArray ( NUMAA *naa ); -LEPT_DLL extern NUMA * numaaGetNuma ( NUMAA *naa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern l_int32 numaaReplaceNuma ( NUMAA *naa, l_int32 index, NUMA *na ); -LEPT_DLL extern l_int32 numaaGetValue ( NUMAA *naa, l_int32 i, l_int32 j, l_float32 *pval ); -LEPT_DLL extern l_int32 numaaAddNumber ( NUMAA *naa, l_int32 index, l_float32 val ); -LEPT_DLL extern NUMAA * numaaRead ( const char *filename ); -LEPT_DLL extern NUMAA * numaaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 numaaWrite ( const char *filename, NUMAA *naa ); -LEPT_DLL extern l_int32 numaaWriteStream ( FILE *fp, NUMAA *naa ); -LEPT_DLL extern NUMA2D * numa2dCreate ( l_int32 nrows, l_int32 ncols, l_int32 initsize ); -LEPT_DLL extern void numa2dDestroy ( NUMA2D **pna2d ); -LEPT_DLL extern l_int32 numa2dAddNumber ( NUMA2D *na2d, l_int32 row, l_int32 col, l_float32 val ); -LEPT_DLL extern l_int32 numa2dGetCount ( NUMA2D *na2d, l_int32 row, l_int32 col ); -LEPT_DLL extern NUMA * numa2dGetNuma ( NUMA2D *na2d, l_int32 row, l_int32 col ); -LEPT_DLL extern l_int32 numa2dGetFValue ( NUMA2D *na2d, l_int32 row, l_int32 col, l_int32 index, l_float32 *pval ); -LEPT_DLL extern l_int32 numa2dGetIValue ( NUMA2D *na2d, l_int32 row, l_int32 col, l_int32 index, l_int32 *pval ); -LEPT_DLL extern NUMAHASH * numaHashCreate ( l_int32 nbuckets, l_int32 initsize ); -LEPT_DLL extern void numaHashDestroy ( NUMAHASH **pnahash ); -LEPT_DLL extern NUMA * numaHashGetNuma ( NUMAHASH *nahash, l_uint32 key ); -LEPT_DLL extern l_int32 numaHashAdd ( NUMAHASH *nahash, l_uint32 key, l_float32 value ); -LEPT_DLL extern NUMA * numaArithOp ( NUMA *nad, NUMA *na1, NUMA *na2, l_int32 op ); -LEPT_DLL extern NUMA * numaLogicalOp ( NUMA *nad, NUMA *na1, NUMA *na2, l_int32 op ); -LEPT_DLL extern NUMA * numaInvert ( NUMA *nad, NUMA *nas ); -LEPT_DLL extern l_int32 numaGetMin ( NUMA *na, l_float32 *pminval, l_int32 *piminloc ); -LEPT_DLL extern l_int32 numaGetMax ( NUMA *na, l_float32 *pmaxval, l_int32 *pimaxloc ); -LEPT_DLL extern l_int32 numaGetSum ( NUMA *na, l_float32 *psum ); -LEPT_DLL extern NUMA * numaGetPartialSums ( NUMA *na ); -LEPT_DLL extern l_int32 numaGetSumOnInterval ( NUMA *na, l_int32 first, l_int32 last, l_float32 *psum ); -LEPT_DLL extern l_int32 numaHasOnlyIntegers ( NUMA *na, l_int32 maxsamples, l_int32 *pallints ); -LEPT_DLL extern NUMA * numaSubsample ( NUMA *nas, l_int32 subfactor ); -LEPT_DLL extern NUMA * numaMakeDelta ( NUMA *nas ); -LEPT_DLL extern NUMA * numaMakeSequence ( l_float32 startval, l_float32 increment, l_int32 size ); -LEPT_DLL extern NUMA * numaMakeConstant ( l_float32 val, l_int32 size ); -LEPT_DLL extern NUMA * numaAddBorder ( NUMA *nas, l_int32 left, l_int32 right, l_float32 val ); -LEPT_DLL extern NUMA * numaAddSpecifiedBorder ( NUMA *nas, l_int32 left, l_int32 right, l_int32 type ); -LEPT_DLL extern NUMA * numaRemoveBorder ( NUMA *nas, l_int32 left, l_int32 right ); -LEPT_DLL extern l_int32 numaGetNonzeroRange ( NUMA *na, l_float32 eps, l_int32 *pfirst, l_int32 *plast ); -LEPT_DLL extern l_int32 numaGetCountRelativeToZero ( NUMA *na, l_int32 type, l_int32 *pcount ); -LEPT_DLL extern NUMA * numaClipToInterval ( NUMA *nas, l_int32 first, l_int32 last ); -LEPT_DLL extern NUMA * numaMakeThresholdIndicator ( NUMA *nas, l_float32 thresh, l_int32 type ); -LEPT_DLL extern NUMA * numaUniformSampling ( NUMA *nas, l_int32 nsamp ); -LEPT_DLL extern NUMA * numaLowPassIntervals ( NUMA *nas, l_float32 thresh, l_float32 maxn ); -LEPT_DLL extern NUMA * numaThresholdEdges ( NUMA *nas, l_float32 thresh1, l_float32 thresh2, l_float32 maxn ); -LEPT_DLL extern l_int32 numaGetSpanValues ( NUMA *na, l_int32 span, l_int32 *pstart, l_int32 *pend ); -LEPT_DLL extern l_int32 numaGetEdgeValues ( NUMA *na, l_int32 edge, l_int32 *pstart, l_int32 *pend, l_int32 *psign ); -LEPT_DLL extern l_int32 numaInterpolateEqxVal ( l_float32 startx, l_float32 deltax, NUMA *nay, l_int32 type, l_float32 xval, l_float32 *pyval ); -LEPT_DLL extern l_int32 numaInterpolateArbxVal ( NUMA *nax, NUMA *nay, l_int32 type, l_float32 xval, l_float32 *pyval ); -LEPT_DLL extern l_int32 numaInterpolateEqxInterval ( l_float32 startx, l_float32 deltax, NUMA *nasy, l_int32 type, l_float32 x0, l_float32 x1, l_int32 npts, NUMA **pnax, NUMA **pnay ); -LEPT_DLL extern l_int32 numaInterpolateArbxInterval ( NUMA *nax, NUMA *nay, l_int32 type, l_float32 x0, l_float32 x1, l_int32 npts, NUMA **pnadx, NUMA **pnady ); -LEPT_DLL extern l_int32 numaFitMax ( NUMA *na, l_float32 *pmaxval, NUMA *naloc, l_float32 *pmaxloc ); -LEPT_DLL extern l_int32 numaDifferentiateInterval ( NUMA *nax, NUMA *nay, l_float32 x0, l_float32 x1, l_int32 npts, NUMA **pnadx, NUMA **pnady ); -LEPT_DLL extern l_int32 numaIntegrateInterval ( NUMA *nax, NUMA *nay, l_float32 x0, l_float32 x1, l_int32 npts, l_float32 *psum ); -LEPT_DLL extern NUMA * numaSort ( NUMA *naout, NUMA *nain, l_int32 sortorder ); -LEPT_DLL extern NUMA * numaGetSortIndex ( NUMA *na, l_int32 sortorder ); -LEPT_DLL extern NUMA * numaSortByIndex ( NUMA *nas, NUMA *naindex ); -LEPT_DLL extern l_int32 numaIsSorted ( NUMA *nas, l_int32 sortorder, l_int32 *psorted ); -LEPT_DLL extern l_int32 numaSortPair ( NUMA *nax, NUMA *nay, l_int32 sortorder, NUMA **pnasx, NUMA **pnasy ); -LEPT_DLL extern NUMA * numaPseudorandomSequence ( l_int32 size, l_int32 seed ); -LEPT_DLL extern NUMA * numaRandomPermutation ( NUMA *nas, l_int32 seed ); -LEPT_DLL extern l_int32 numaGetRankValue ( NUMA *na, l_float32 fract, l_float32 *pval ); -LEPT_DLL extern l_int32 numaGetMedian ( NUMA *na, l_float32 *pval ); -LEPT_DLL extern l_int32 numaGetMode ( NUMA *na, l_float32 *pval, l_int32 *pcount ); -LEPT_DLL extern l_int32 numaJoin ( NUMA *nad, NUMA *nas, l_int32 istart, l_int32 iend ); -LEPT_DLL extern NUMA * numaaFlattenToNuma ( NUMAA *naa ); -LEPT_DLL extern NUMA * numaErode ( NUMA *nas, l_int32 size ); -LEPT_DLL extern NUMA * numaDilate ( NUMA *nas, l_int32 size ); -LEPT_DLL extern NUMA * numaOpen ( NUMA *nas, l_int32 size ); -LEPT_DLL extern NUMA * numaClose ( NUMA *nas, l_int32 size ); -LEPT_DLL extern NUMA * numaTransform ( NUMA *nas, l_float32 shift, l_float32 scale ); -LEPT_DLL extern l_int32 numaWindowedStats ( NUMA *nas, l_int32 wc, NUMA **pnam, NUMA **pnams, NUMA **pnav, NUMA **pnarv ); -LEPT_DLL extern NUMA * numaWindowedMean ( NUMA *nas, l_int32 wc ); -LEPT_DLL extern NUMA * numaWindowedMeanSquare ( NUMA *nas, l_int32 wc ); -LEPT_DLL extern l_int32 numaWindowedVariance ( NUMA *nam, NUMA *nams, NUMA **pnav, NUMA **pnarv ); -LEPT_DLL extern NUMA * numaConvertToInt ( NUMA *nas ); -LEPT_DLL extern NUMA * numaMakeHistogram ( NUMA *na, l_int32 maxbins, l_int32 *pbinsize, l_int32 *pbinstart ); -LEPT_DLL extern NUMA * numaMakeHistogramAuto ( NUMA *na, l_int32 maxbins ); -LEPT_DLL extern NUMA * numaMakeHistogramClipped ( NUMA *na, l_float32 binsize, l_float32 maxsize ); -LEPT_DLL extern NUMA * numaRebinHistogram ( NUMA *nas, l_int32 newsize ); -LEPT_DLL extern NUMA * numaNormalizeHistogram ( NUMA *nas, l_float32 area ); -LEPT_DLL extern l_int32 numaGetStatsUsingHistogram ( NUMA *na, l_int32 maxbins, l_float32 *pmin, l_float32 *pmax, l_float32 *pmean, l_float32 *pvariance, l_float32 *pmedian, l_float32 rank, l_float32 *prval, NUMA **phisto ); -LEPT_DLL extern l_int32 numaGetHistogramStats ( NUMA *nahisto, l_float32 startx, l_float32 deltax, l_float32 *pxmean, l_float32 *pxmedian, l_float32 *pxmode, l_float32 *pxvariance ); -LEPT_DLL extern l_int32 numaGetHistogramStatsOnInterval ( NUMA *nahisto, l_float32 startx, l_float32 deltax, l_int32 ifirst, l_int32 ilast, l_float32 *pxmean, l_float32 *pxmedian, l_float32 *pxmode, l_float32 *pxvariance ); -LEPT_DLL extern l_int32 numaMakeRankFromHistogram ( l_float32 startx, l_float32 deltax, NUMA *nasy, l_int32 npts, NUMA **pnax, NUMA **pnay ); -LEPT_DLL extern l_int32 numaHistogramGetRankFromVal ( NUMA *na, l_float32 rval, l_float32 *prank ); -LEPT_DLL extern l_int32 numaHistogramGetValFromRank ( NUMA *na, l_float32 rank, l_float32 *prval ); -LEPT_DLL extern l_int32 numaDiscretizeRankAndIntensity ( NUMA *na, l_int32 nbins, NUMA **pnarbin, NUMA **pnam, NUMA **pnar, NUMA **pnabb ); -LEPT_DLL extern l_int32 numaGetRankBinValues ( NUMA *na, l_int32 nbins, NUMA **pnarbin, NUMA **pnam ); -LEPT_DLL extern l_int32 numaSplitDistribution ( NUMA *na, l_float32 scorefract, l_int32 *psplitindex, l_float32 *pave1, l_float32 *pave2, l_float32 *pnum1, l_float32 *pnum2, NUMA **pnascore ); -LEPT_DLL extern NUMA * numaFindPeaks ( NUMA *nas, l_int32 nmax, l_float32 fract1, l_float32 fract2 ); -LEPT_DLL extern NUMA * numaFindExtrema ( NUMA *nas, l_float32 delta ); -LEPT_DLL extern l_int32 numaCountReversals ( NUMA *nas, l_float32 minreversal, l_int32 *pnr, l_float32 *pnrpl ); -LEPT_DLL extern l_int32 numaSelectCrossingThreshold ( NUMA *nax, NUMA *nay, l_float32 estthresh, l_float32 *pbestthresh ); -LEPT_DLL extern NUMA * numaCrossingsByThreshold ( NUMA *nax, NUMA *nay, l_float32 thresh ); -LEPT_DLL extern NUMA * numaCrossingsByPeaks ( NUMA *nax, NUMA *nay, l_float32 delta ); -LEPT_DLL extern l_int32 numaEvalBestHaarParameters ( NUMA *nas, l_float32 relweight, l_int32 nwidth, l_int32 nshift, l_float32 minwidth, l_float32 maxwidth, l_float32 *pbestwidth, l_float32 *pbestshift, l_float32 *pbestscore ); -LEPT_DLL extern l_int32 numaEvalHaarSum ( NUMA *nas, l_float32 width, l_float32 shift, l_float32 relweight, l_float32 *pscore ); -LEPT_DLL extern l_int32 pixGetRegionsBinary ( PIX *pixs, PIX **ppixhm, PIX **ppixtm, PIX **ppixtb, l_int32 debug ); -LEPT_DLL extern PIX * pixGenHalftoneMask ( PIX *pixs, PIX **ppixtext, l_int32 *phtfound, l_int32 debug ); -LEPT_DLL extern PIX * pixGenTextlineMask ( PIX *pixs, PIX **ppixvws, l_int32 *ptlfound, l_int32 debug ); -LEPT_DLL extern PIX * pixGenTextblockMask ( PIX *pixs, PIX *pixvws, l_int32 debug ); -LEPT_DLL extern l_int32 pixSetSelectCmap ( PIX *pixs, BOX *box, l_int32 sindex, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixColorGrayCmap ( PIX *pixs, BOX *box, l_int32 type, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 addColorizedGrayToCmap ( PIXCMAP *cmap, l_int32 type, l_int32 rval, l_int32 gval, l_int32 bval, NUMA **pna ); -LEPT_DLL extern l_int32 pixSetSelectMaskedCmap ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 sindex, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixSetMaskedCmap ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern char * parseForProtos ( const char *filein, const char *prestring ); -LEPT_DLL extern BOXA * boxaGetWhiteblocks ( BOXA *boxas, BOX *box, l_int32 sortflag, l_int32 maxboxes, l_float32 maxoverlap, l_int32 maxperim, l_float32 fract, l_int32 maxpops ); -LEPT_DLL extern BOXA * boxaPruneSortedOnOverlap ( BOXA *boxas, l_float32 maxoverlap ); -LEPT_DLL extern l_int32 convertFilesToPdf ( const char *dirname, const char *substr, l_int32 res, l_float32 scalefactor, l_int32 quality, const char *title, const char *fileout ); -LEPT_DLL extern l_int32 saConvertFilesToPdf ( SARRAY *sa, l_int32 res, l_float32 scalefactor, l_int32 quality, const char *title, const char *fileout ); -LEPT_DLL extern l_int32 saConvertFilesToPdfData ( SARRAY *sa, l_int32 res, l_float32 scalefactor, l_int32 quality, const char *title, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern l_int32 selectDefaultPdfEncoding ( PIX *pix, l_int32 *ptype ); -LEPT_DLL extern l_int32 convertToPdf ( const char *filein, l_int32 type, l_int32 quality, const char *fileout, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 convertImageDataToPdf ( l_uint8 *imdata, size_t size, l_int32 type, l_int32 quality, const char *fileout, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 convertToPdfData ( const char *filein, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 convertImageDataToPdfData ( l_uint8 *imdata, size_t size, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 pixConvertToPdf ( PIX *pix, l_int32 type, l_int32 quality, const char *fileout, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 pixConvertToPdfData ( PIX *pix, l_int32 type, l_int32 quality, l_uint8 **pdata, size_t *pnbytes, l_int32 x, l_int32 y, l_int32 res, L_PDF_DATA **plpd, l_int32 position, const char *title ); -LEPT_DLL extern l_int32 pixWriteStreamPdf ( FILE *fp, PIX *pix, l_int32 res, const char *title ); -LEPT_DLL extern l_int32 convertSegmentedFilesToPdf ( const char *dirname, const char *substr, l_int32 res, l_int32 type, l_int32 thresh, BOXAA *baa, l_int32 quality, l_float32 scalefactor, const char *title, const char *fileout ); -LEPT_DLL extern l_int32 convertToPdfSegmented ( const char *filein, l_int32 res, l_int32 type, l_int32 thresh, BOXA *boxa, l_int32 quality, l_float32 scalefactor, const char *fileout ); -LEPT_DLL extern l_int32 pixConvertToPdfSegmented ( PIX *pixs, l_int32 res, l_int32 type, l_int32 thresh, BOXA *boxa, l_int32 quality, l_float32 scalefactor, const char *fileout, const char *title ); -LEPT_DLL extern l_int32 convertToPdfDataSegmented ( const char *filein, l_int32 res, l_int32 type, l_int32 thresh, BOXA *boxa, l_int32 quality, l_float32 scalefactor, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern l_int32 pixConvertToPdfDataSegmented ( PIX *pixs, l_int32 res, l_int32 type, l_int32 thresh, BOXA *boxa, l_int32 quality, l_float32 scalefactor, l_uint8 **pdata, size_t *pnbytes, const char *title ); -LEPT_DLL extern l_int32 concatenatePdf ( const char *dirname, const char *substr, const char *fileout ); -LEPT_DLL extern l_int32 saConcatenatePdf ( SARRAY *sa, const char *fileout ); -LEPT_DLL extern l_int32 ptraConcatenatePdf ( L_PTRA *pa, const char *fileout ); -LEPT_DLL extern l_int32 concatenatePdfToData ( const char *dirname, const char *substr, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern l_int32 saConcatenatePdfToData ( SARRAY *sa, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern l_int32 ptraConcatenatePdfToData ( L_PTRA *pa_data, SARRAY *sa, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern void l_pdfSetG4ImageMask ( l_int32 flag ); -LEPT_DLL extern void l_pdfSetDateAndVersion ( l_int32 flag ); -LEPT_DLL extern void setPixMemoryManager ( void * ( allocator ( size_t ) ), void ( deallocator ( void * ) ) ); -LEPT_DLL extern PIX * pixCreate ( l_int32 width, l_int32 height, l_int32 depth ); -LEPT_DLL extern PIX * pixCreateNoInit ( l_int32 width, l_int32 height, l_int32 depth ); -LEPT_DLL extern PIX * pixCreateTemplate ( PIX *pixs ); -LEPT_DLL extern PIX * pixCreateTemplateNoInit ( PIX *pixs ); -LEPT_DLL extern PIX * pixCreateHeader ( l_int32 width, l_int32 height, l_int32 depth ); -LEPT_DLL extern PIX * pixClone ( PIX *pixs ); -LEPT_DLL extern void pixDestroy ( PIX **ppix ); -LEPT_DLL extern PIX * pixCopy ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 pixResizeImageData ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 pixCopyColormap ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 pixSizesEqual ( PIX *pix1, PIX *pix2 ); -LEPT_DLL extern l_int32 pixTransferAllData ( PIX *pixd, PIX **ppixs, l_int32 copytext, l_int32 copyformat ); -LEPT_DLL extern l_int32 pixGetWidth ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetWidth ( PIX *pix, l_int32 width ); -LEPT_DLL extern l_int32 pixGetHeight ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetHeight ( PIX *pix, l_int32 height ); -LEPT_DLL extern l_int32 pixGetDepth ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetDepth ( PIX *pix, l_int32 depth ); -LEPT_DLL extern l_int32 pixGetDimensions ( PIX *pix, l_int32 *pw, l_int32 *ph, l_int32 *pd ); -LEPT_DLL extern l_int32 pixSetDimensions ( PIX *pix, l_int32 w, l_int32 h, l_int32 d ); -LEPT_DLL extern l_int32 pixCopyDimensions ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 pixGetWpl ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetWpl ( PIX *pix, l_int32 wpl ); -LEPT_DLL extern l_int32 pixGetRefcount ( PIX *pix ); -LEPT_DLL extern l_int32 pixChangeRefcount ( PIX *pix, l_int32 delta ); -LEPT_DLL extern l_int32 pixGetXRes ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetXRes ( PIX *pix, l_int32 res ); -LEPT_DLL extern l_int32 pixGetYRes ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetYRes ( PIX *pix, l_int32 res ); -LEPT_DLL extern l_int32 pixGetResolution ( PIX *pix, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 pixSetResolution ( PIX *pix, l_int32 xres, l_int32 yres ); -LEPT_DLL extern l_int32 pixCopyResolution ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern l_int32 pixScaleResolution ( PIX *pix, l_float32 xscale, l_float32 yscale ); -LEPT_DLL extern l_int32 pixGetInputFormat ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetInputFormat ( PIX *pix, l_int32 informat ); -LEPT_DLL extern l_int32 pixCopyInputFormat ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern char * pixGetText ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetText ( PIX *pix, const char *textstring ); -LEPT_DLL extern l_int32 pixAddText ( PIX *pix, const char *textstring ); -LEPT_DLL extern l_int32 pixCopyText ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIXCMAP * pixGetColormap ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetColormap ( PIX *pix, PIXCMAP *colormap ); -LEPT_DLL extern l_int32 pixDestroyColormap ( PIX *pix ); -LEPT_DLL extern l_uint32 * pixGetData ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetData ( PIX *pix, l_uint32 *data ); -LEPT_DLL extern l_uint32 * pixExtractData ( PIX *pixs ); -LEPT_DLL extern l_int32 pixFreeData ( PIX *pix ); -LEPT_DLL extern void ** pixGetLinePtrs ( PIX *pix, l_int32 *psize ); -LEPT_DLL extern l_int32 pixPrintStreamInfo ( FILE *fp, PIX *pix, const char *text ); -LEPT_DLL extern l_int32 pixGetPixel ( PIX *pix, l_int32 x, l_int32 y, l_uint32 *pval ); -LEPT_DLL extern l_int32 pixSetPixel ( PIX *pix, l_int32 x, l_int32 y, l_uint32 val ); -LEPT_DLL extern l_int32 pixGetRGBPixel ( PIX *pix, l_int32 x, l_int32 y, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern l_int32 pixSetRGBPixel ( PIX *pix, l_int32 x, l_int32 y, l_int32 rval, l_int32 gval, l_int32 bval ); -LEPT_DLL extern l_int32 pixGetRandomPixel ( PIX *pix, l_uint32 *pval, l_int32 *px, l_int32 *py ); -LEPT_DLL extern l_int32 pixClearPixel ( PIX *pix, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixFlipPixel ( PIX *pix, l_int32 x, l_int32 y ); -LEPT_DLL extern void setPixelLow ( l_uint32 *line, l_int32 x, l_int32 depth, l_uint32 val ); -LEPT_DLL extern l_int32 pixClearAll ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetAll ( PIX *pix ); -LEPT_DLL extern l_int32 pixSetAllArbitrary ( PIX *pix, l_uint32 val ); -LEPT_DLL extern l_int32 pixSetBlackOrWhite ( PIX *pixs, l_int32 op ); -LEPT_DLL extern l_int32 pixClearInRect ( PIX *pix, BOX *box ); -LEPT_DLL extern l_int32 pixSetInRect ( PIX *pix, BOX *box ); -LEPT_DLL extern l_int32 pixSetInRectArbitrary ( PIX *pix, BOX *box, l_uint32 val ); -LEPT_DLL extern l_int32 pixBlendInRect ( PIX *pixs, BOX *box, l_uint32 val, l_float32 fract ); -LEPT_DLL extern l_int32 pixSetPadBits ( PIX *pix, l_int32 val ); -LEPT_DLL extern l_int32 pixSetPadBitsBand ( PIX *pix, l_int32 by, l_int32 bh, l_int32 val ); -LEPT_DLL extern l_int32 pixSetOrClearBorder ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_int32 op ); -LEPT_DLL extern l_int32 pixSetBorderVal ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val ); -LEPT_DLL extern l_int32 pixSetBorderRingVal ( PIX *pixs, l_int32 dist, l_uint32 val ); -LEPT_DLL extern l_int32 pixSetMirroredBorder ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixCopyBorder ( PIX *pixd, PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixAddBorder ( PIX *pixs, l_int32 npix, l_uint32 val ); -LEPT_DLL extern PIX * pixAddBlackBorder ( PIX *pixs, l_int32 npix ); -LEPT_DLL extern PIX * pixAddBorderGeneral ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val ); -LEPT_DLL extern PIX * pixRemoveBorder ( PIX *pixs, l_int32 npix ); -LEPT_DLL extern PIX * pixRemoveBorderGeneral ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixAddMirroredBorder ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixAddRepeatedBorder ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixAddMixedBorder ( PIX *pixs, l_int32 left, l_int32 right, l_int32 top, l_int32 bot ); -LEPT_DLL extern PIX * pixCreateRGBImage ( PIX *pixr, PIX *pixg, PIX *pixb ); -LEPT_DLL extern PIX * pixGetRGBComponent ( PIX *pixs, l_int32 color ); -LEPT_DLL extern l_int32 pixSetRGBComponent ( PIX *pixd, PIX *pixs, l_int32 color ); -LEPT_DLL extern PIX * pixGetRGBComponentCmap ( PIX *pixs, l_int32 color ); -LEPT_DLL extern l_int32 composeRGBPixel ( l_int32 rval, l_int32 gval, l_int32 bval, l_uint32 *ppixel ); -LEPT_DLL extern void extractRGBValues ( l_uint32 pixel, l_int32 *prval, l_int32 *pgval, l_int32 *pbval ); -LEPT_DLL extern l_int32 extractMinMaxComponent ( l_uint32 pixel, l_int32 type ); -LEPT_DLL extern l_int32 pixGetRGBLine ( PIX *pixs, l_int32 row, l_uint8 *bufr, l_uint8 *bufg, l_uint8 *bufb ); -LEPT_DLL extern PIX * pixEndianByteSwapNew ( PIX *pixs ); -LEPT_DLL extern l_int32 pixEndianByteSwap ( PIX *pixs ); -LEPT_DLL extern l_int32 lineEndianByteSwap ( l_uint32 *datad, l_uint32 *datas, l_int32 wpl ); -LEPT_DLL extern PIX * pixEndianTwoByteSwapNew ( PIX *pixs ); -LEPT_DLL extern l_int32 pixEndianTwoByteSwap ( PIX *pixs ); -LEPT_DLL extern l_int32 pixGetRasterData ( PIX *pixs, l_uint8 **pdata, size_t *pnbytes ); -LEPT_DLL extern l_uint8 ** pixSetupByteProcessing ( PIX *pix, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern l_int32 pixCleanupByteProcessing ( PIX *pix, l_uint8 **lineptrs ); -LEPT_DLL extern void l_setAlphaMaskBorder ( l_float32 val1, l_float32 val2 ); -LEPT_DLL extern l_int32 pixSetMasked ( PIX *pixd, PIX *pixm, l_uint32 val ); -LEPT_DLL extern l_int32 pixSetMaskedGeneral ( PIX *pixd, PIX *pixm, l_uint32 val, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixCombineMasked ( PIX *pixd, PIX *pixs, PIX *pixm ); -LEPT_DLL extern l_int32 pixCombineMaskedGeneral ( PIX *pixd, PIX *pixs, PIX *pixm, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixPaintThroughMask ( PIX *pixd, PIX *pixm, l_int32 x, l_int32 y, l_uint32 val ); -LEPT_DLL extern l_int32 pixPaintSelfThroughMask ( PIX *pixd, PIX *pixm, l_int32 x, l_int32 y, l_int32 tilesize, l_int32 searchdir ); -LEPT_DLL extern PIX * pixMakeMaskFromLUT ( PIX *pixs, l_int32 *tab ); -LEPT_DLL extern PIX * pixSetUnderTransparency ( PIX *pixs, l_uint32 val, l_int32 debugflag ); -LEPT_DLL extern PIX * pixInvert ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIX * pixOr ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixAnd ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixXor ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixSubtract ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern l_int32 pixZero ( PIX *pix, l_int32 *pempty ); -LEPT_DLL extern l_int32 pixCountPixels ( PIX *pix, l_int32 *pcount, l_int32 *tab8 ); -LEPT_DLL extern NUMA * pixaCountPixels ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixCountPixelsInRow ( PIX *pix, l_int32 row, l_int32 *pcount, l_int32 *tab8 ); -LEPT_DLL extern NUMA * pixCountPixelsByRow ( PIX *pix, l_int32 *tab8 ); -LEPT_DLL extern NUMA * pixCountPixelsByColumn ( PIX *pix ); -LEPT_DLL extern NUMA * pixSumPixelsByRow ( PIX *pix, l_int32 *tab8 ); -LEPT_DLL extern NUMA * pixSumPixelsByColumn ( PIX *pix ); -LEPT_DLL extern l_int32 pixThresholdPixelSum ( PIX *pix, l_int32 thresh, l_int32 *pabove, l_int32 *tab8 ); -LEPT_DLL extern l_int32 * makePixelSumTab8 ( void ); -LEPT_DLL extern l_int32 * makePixelCentroidTab8 ( void ); -LEPT_DLL extern l_int32 pixSumPixelValues ( PIX *pix, BOX *box, l_float64 *psum ); -LEPT_DLL extern PIX * pixMirroredTiling ( PIX *pixs, l_int32 w, l_int32 h ); -LEPT_DLL extern NUMA * pixGetGrayHistogram ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern NUMA * pixGetGrayHistogramMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor ); -LEPT_DLL extern l_int32 pixGetColorHistogram ( PIX *pixs, l_int32 factor, NUMA **pnar, NUMA **pnag, NUMA **pnab ); -LEPT_DLL extern l_int32 pixGetColorHistogramMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, NUMA **pnar, NUMA **pnag, NUMA **pnab ); -LEPT_DLL extern NUMA * pixGetCmapHistogram ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern NUMA * pixGetCmapHistogramMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor ); -LEPT_DLL extern l_int32 pixGetRankValueMaskedRGB ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_float32 rank, l_float32 *prval, l_float32 *pgval, l_float32 *pbval ); -LEPT_DLL extern l_int32 pixGetRankValueMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_float32 rank, l_float32 *pval, NUMA **pna ); -LEPT_DLL extern l_int32 pixGetAverageMaskedRGB ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_int32 type, l_float32 *prval, l_float32 *pgval, l_float32 *pbval ); -LEPT_DLL extern l_int32 pixGetAverageMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_int32 factor, l_int32 type, l_float32 *pval ); -LEPT_DLL extern l_int32 pixGetAverageTiledRGB ( PIX *pixs, l_int32 sx, l_int32 sy, l_int32 type, PIX **ppixr, PIX **ppixg, PIX **ppixb ); -LEPT_DLL extern PIX * pixGetAverageTiled ( PIX *pixs, l_int32 sx, l_int32 sy, l_int32 type ); -LEPT_DLL extern l_int32 pixRowStats ( PIX *pixs, NUMA **pnamean, NUMA **pnamedian, NUMA **pnamode, NUMA **pnamodecount, NUMA **pnavar, NUMA **pnarootvar ); -LEPT_DLL extern l_int32 pixColumnStats ( PIX *pixs, NUMA **pnamean, NUMA **pnamedian, NUMA **pnamode, NUMA **pnamodecount, NUMA **pnavar, NUMA **pnarootvar ); -LEPT_DLL extern l_int32 pixGetComponentRange ( PIX *pixs, l_int32 factor, l_int32 color, l_int32 *pminval, l_int32 *pmaxval ); -LEPT_DLL extern l_int32 pixGetExtremeValue ( PIX *pixs, l_int32 factor, l_int32 type, l_int32 *prval, l_int32 *pgval, l_int32 *pbval, l_int32 *pgrayval ); -LEPT_DLL extern l_int32 pixGetMaxValueInRect ( PIX *pixs, BOX *box, l_uint32 *pmaxval, l_int32 *pxmax, l_int32 *pymax ); -LEPT_DLL extern l_int32 pixGetBinnedComponentRange ( PIX *pixs, l_int32 nbins, l_int32 factor, l_int32 color, l_int32 *pminval, l_int32 *pmaxval, l_uint32 **pcarray, l_int32 debugflag ); -LEPT_DLL extern l_int32 pixGetRankColorArray ( PIX *pixs, l_int32 nbins, l_int32 type, l_int32 factor, l_uint32 **pcarray, l_int32 debugflag ); -LEPT_DLL extern l_int32 pixGetBinnedColor ( PIX *pixs, PIX *pixg, l_int32 factor, l_int32 nbins, NUMA *nalut, l_uint32 **pcarray, l_int32 debugflag ); -LEPT_DLL extern PIX * pixDisplayColorArray ( l_uint32 *carray, l_int32 ncolors, l_int32 side, l_int32 ncols, l_int32 textflag ); -LEPT_DLL extern PIX * pixaGetAlignedStats ( PIXA *pixa, l_int32 type, l_int32 nbins, l_int32 thresh ); -LEPT_DLL extern l_int32 pixaExtractColumnFromEachPix ( PIXA *pixa, l_int32 col, PIX *pixd ); -LEPT_DLL extern l_int32 pixGetRowStats ( PIX *pixs, l_int32 type, l_int32 nbins, l_int32 thresh, l_float32 *colvect ); -LEPT_DLL extern l_int32 pixGetColumnStats ( PIX *pixs, l_int32 type, l_int32 nbins, l_int32 thresh, l_float32 *rowvect ); -LEPT_DLL extern l_int32 pixSetPixelColumn ( PIX *pix, l_int32 col, l_float32 *colvect ); -LEPT_DLL extern l_int32 pixThresholdForFgBg ( PIX *pixs, l_int32 factor, l_int32 thresh, l_int32 *pfgval, l_int32 *pbgval ); -LEPT_DLL extern l_int32 pixSplitDistributionFgBg ( PIX *pixs, l_float32 scorefract, l_int32 factor, l_int32 *pthresh, l_int32 *pfgval, l_int32 *pbgval, l_int32 debugflag ); -LEPT_DLL extern l_int32 pixaFindDimensions ( PIXA *pixa, NUMA **pnaw, NUMA **pnah ); -LEPT_DLL extern NUMA * pixaFindAreaPerimRatio ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixFindAreaPerimRatio ( PIX *pixs, l_int32 *tab, l_float32 *pfract ); -LEPT_DLL extern NUMA * pixaFindPerimSizeRatio ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixFindPerimSizeRatio ( PIX *pixs, l_int32 *tab, l_float32 *pratio ); -LEPT_DLL extern NUMA * pixaFindAreaFraction ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixFindAreaFraction ( PIX *pixs, l_int32 *tab, l_float32 *pfract ); -LEPT_DLL extern NUMA * pixaFindWidthHeightRatio ( PIXA *pixa ); -LEPT_DLL extern NUMA * pixaFindWidthHeightProduct ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixFindOverlapFraction ( PIX *pixs1, PIX *pixs2, l_int32 x2, l_int32 y2, l_int32 *tab, l_float32 *pratio, l_int32 *pnoverlap ); -LEPT_DLL extern BOXA * pixFindRectangleComps ( PIX *pixs, l_int32 dist, l_int32 minw, l_int32 minh ); -LEPT_DLL extern l_int32 pixConformsToRectangle ( PIX *pixs, BOX *box, l_int32 dist, l_int32 *pconforms ); -LEPT_DLL extern PIX * pixClipRectangle ( PIX *pixs, BOX *box, BOX **pboxc ); -LEPT_DLL extern PIX * pixClipMasked ( PIX *pixs, PIX *pixm, l_int32 x, l_int32 y, l_uint32 outval ); -LEPT_DLL extern PIX * pixResizeToMatch ( PIX *pixs, PIX *pixt, l_int32 w, l_int32 h ); -LEPT_DLL extern l_int32 pixClipToForeground ( PIX *pixs, PIX **ppixd, BOX **pbox ); -LEPT_DLL extern l_int32 pixClipBoxToForeground ( PIX *pixs, BOX *boxs, PIX **ppixd, BOX **pboxd ); -LEPT_DLL extern l_int32 pixScanForForeground ( PIX *pixs, BOX *box, l_int32 scanflag, l_int32 *ploc ); -LEPT_DLL extern l_int32 pixClipBoxToEdges ( PIX *pixs, BOX *boxs, l_int32 lowthresh, l_int32 highthresh, l_int32 maxwidth, l_int32 factor, PIX **ppixd, BOX **pboxd ); -LEPT_DLL extern l_int32 pixScanForEdge ( PIX *pixs, BOX *box, l_int32 lowthresh, l_int32 highthresh, l_int32 maxwidth, l_int32 factor, l_int32 scanflag, l_int32 *ploc ); -LEPT_DLL extern NUMA * pixExtractOnLine ( PIX *pixs, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 factor ); -LEPT_DLL extern l_float32 pixAverageOnLine ( PIX *pixs, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2, l_int32 factor ); -LEPT_DLL extern NUMA * pixAverageIntensityProfile ( PIX *pixs, l_float32 fract, l_int32 dir, l_int32 first, l_int32 last, l_int32 factor1, l_int32 factor2 ); -LEPT_DLL extern NUMA * pixReversalProfile ( PIX *pixs, l_float32 fract, l_int32 dir, l_int32 first, l_int32 last, l_int32 minreversal, l_int32 factor1, l_int32 factor2 ); -LEPT_DLL extern PIX * pixRankRowTransform ( PIX *pixs ); -LEPT_DLL extern PIX * pixRankColumnTransform ( PIX *pixs ); -LEPT_DLL extern PIXA * pixaCreate ( l_int32 n ); -LEPT_DLL extern PIXA * pixaCreateFromPix ( PIX *pixs, l_int32 n, l_int32 cellw, l_int32 cellh ); -LEPT_DLL extern PIXA * pixaCreateFromBoxa ( PIX *pixs, BOXA *boxa, l_int32 *pcropwarn ); -LEPT_DLL extern PIXA * pixaSplitPix ( PIX *pixs, l_int32 nx, l_int32 ny, l_int32 borderwidth, l_uint32 bordercolor ); -LEPT_DLL extern void pixaDestroy ( PIXA **ppixa ); -LEPT_DLL extern PIXA * pixaCopy ( PIXA *pixa, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaAddPix ( PIXA *pixa, PIX *pix, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaExtendArray ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixaExtendArrayToSize ( PIXA *pixa, l_int32 size ); -LEPT_DLL extern l_int32 pixaAddBox ( PIXA *pixa, BOX *box, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaGetCount ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixaChangeRefcount ( PIXA *pixa, l_int32 delta ); -LEPT_DLL extern PIX * pixaGetPix ( PIXA *pixa, l_int32 index, l_int32 accesstype ); -LEPT_DLL extern l_int32 pixaGetPixDimensions ( PIXA *pixa, l_int32 index, l_int32 *pw, l_int32 *ph, l_int32 *pd ); -LEPT_DLL extern BOXA * pixaGetBoxa ( PIXA *pixa, l_int32 accesstype ); -LEPT_DLL extern l_int32 pixaGetBoxaCount ( PIXA *pixa ); -LEPT_DLL extern BOX * pixaGetBox ( PIXA *pixa, l_int32 index, l_int32 accesstype ); -LEPT_DLL extern l_int32 pixaGetBoxGeometry ( PIXA *pixa, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern PIX ** pixaGetPixArray ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixaReplacePix ( PIXA *pixa, l_int32 index, PIX *pix, BOX *box ); -LEPT_DLL extern l_int32 pixaInsertPix ( PIXA *pixa, l_int32 index, PIX *pixs, BOX *box ); -LEPT_DLL extern l_int32 pixaRemovePix ( PIXA *pixa, l_int32 index ); -LEPT_DLL extern l_int32 pixaInitFull ( PIXA *pixa, PIX *pix, BOX *box ); -LEPT_DLL extern l_int32 pixaClear ( PIXA *pixa ); -LEPT_DLL extern l_int32 pixaJoin ( PIXA *pixad, PIXA *pixas, l_int32 istart, l_int32 iend ); -LEPT_DLL extern PIXAA * pixaaCreate ( l_int32 n ); -LEPT_DLL extern PIXAA * pixaaCreateFromPixa ( PIXA *pixa, l_int32 n, l_int32 type, l_int32 copyflag ); -LEPT_DLL extern void pixaaDestroy ( PIXAA **ppixaa ); -LEPT_DLL extern l_int32 pixaaAddPixa ( PIXAA *pixaa, PIXA *pixa, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaaExtendArray ( PIXAA *pixaa ); -LEPT_DLL extern l_int32 pixaaAddBox ( PIXAA *pixaa, BOX *box, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaaGetCount ( PIXAA *pixaa ); -LEPT_DLL extern PIXA * pixaaGetPixa ( PIXAA *pixaa, l_int32 index, l_int32 accesstype ); -LEPT_DLL extern BOXA * pixaaGetBoxa ( PIXAA *pixaa, l_int32 accesstype ); -LEPT_DLL extern PIXA * pixaRead ( const char *filename ); -LEPT_DLL extern PIXA * pixaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 pixaWrite ( const char *filename, PIXA *pixa ); -LEPT_DLL extern l_int32 pixaWriteStream ( FILE *fp, PIXA *pixa ); -LEPT_DLL extern PIXAA * pixaaRead ( const char *filename ); -LEPT_DLL extern PIXAA * pixaaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 pixaaWrite ( const char *filename, PIXAA *pixaa ); -LEPT_DLL extern l_int32 pixaaWriteStream ( FILE *fp, PIXAA *pixaa ); -LEPT_DLL extern PIXACC * pixaccCreate ( l_int32 w, l_int32 h, l_int32 negflag ); -LEPT_DLL extern PIXACC * pixaccCreateWithPix ( PIX *pix, l_int32 negflag ); -LEPT_DLL extern void pixaccDestroy ( PIXACC **ppixacc ); -LEPT_DLL extern PIX * pixaccFinal ( PIXACC *pixacc, l_int32 outdepth ); -LEPT_DLL extern PIX * pixaccGetPix ( PIXACC *pixacc ); -LEPT_DLL extern l_int32 pixaccGetOffset ( PIXACC *pixacc ); -LEPT_DLL extern l_int32 pixaccAdd ( PIXACC *pixacc, PIX *pix ); -LEPT_DLL extern l_int32 pixaccSubtract ( PIXACC *pixacc, PIX *pix ); -LEPT_DLL extern l_int32 pixaccMultConst ( PIXACC *pixacc, l_float32 factor ); -LEPT_DLL extern l_int32 pixaccMultConstAccumulate ( PIXACC *pixacc, PIX *pix, l_float32 factor ); -LEPT_DLL extern PIX * pixSelectBySize ( PIX *pixs, l_int32 width, l_int32 height, l_int32 connectivity, l_int32 type, l_int32 relation, l_int32 *pchanged ); -LEPT_DLL extern PIXA * pixaSelectBySize ( PIXA *pixas, l_int32 width, l_int32 height, l_int32 type, l_int32 relation, l_int32 *pchanged ); -LEPT_DLL extern PIX * pixSelectByAreaPerimRatio ( PIX *pixs, l_float32 thresh, l_int32 connectivity, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIXA * pixaSelectByAreaPerimRatio ( PIXA *pixas, l_float32 thresh, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIX * pixSelectByAreaFraction ( PIX *pixs, l_float32 thresh, l_int32 connectivity, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIXA * pixaSelectByAreaFraction ( PIXA *pixas, l_float32 thresh, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIX * pixSelectByWidthHeightRatio ( PIX *pixs, l_float32 thresh, l_int32 connectivity, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIXA * pixaSelectByWidthHeightRatio ( PIXA *pixas, l_float32 thresh, l_int32 type, l_int32 *pchanged ); -LEPT_DLL extern PIXA * pixaSelectWithIndicator ( PIXA *pixas, NUMA *na, l_int32 *pchanged ); -LEPT_DLL extern l_int32 pixRemoveWithIndicator ( PIX *pixs, PIXA *pixa, NUMA *na ); -LEPT_DLL extern l_int32 pixAddWithIndicator ( PIX *pixs, PIXA *pixa, NUMA *na ); -LEPT_DLL extern PIXA * pixaSort ( PIXA *pixas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex, l_int32 copyflag ); -LEPT_DLL extern PIXA * pixaBinSort ( PIXA *pixas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex, l_int32 copyflag ); -LEPT_DLL extern PIXA * pixaSortByIndex ( PIXA *pixas, NUMA *naindex, l_int32 copyflag ); -LEPT_DLL extern PIXAA * pixaSort2dByIndex ( PIXA *pixas, NUMAA *naa, l_int32 copyflag ); -LEPT_DLL extern PIXA * pixaAddBorderGeneral ( PIXA *pixad, PIXA *pixas, l_int32 left, l_int32 right, l_int32 top, l_int32 bot, l_uint32 val ); -LEPT_DLL extern PIXA * pixaaFlattenToPixa ( PIXAA *pixaa, NUMA **pnaindex, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixaSizeRange ( PIXA *pixa, l_int32 *pminw, l_int32 *pminh, l_int32 *pmaxw, l_int32 *pmaxh ); -LEPT_DLL extern PIXA * pixaClipToPix ( PIXA *pixas, PIX *pixs ); -LEPT_DLL extern l_int32 pixaAnyColormaps ( PIXA *pixa, l_int32 *phascmap ); -LEPT_DLL extern l_int32 pixaGetDepthInfo ( PIXA *pixa, l_int32 *pmaxdepth, l_int32 *psame ); -LEPT_DLL extern l_int32 pixaEqual ( PIXA *pixa1, PIXA *pixa2, l_int32 maxdist, NUMA **pnaindex, l_int32 *psame ); -LEPT_DLL extern PIX * pixaDisplay ( PIXA *pixa, l_int32 w, l_int32 h ); -LEPT_DLL extern PIX * pixaDisplayOnColor ( PIXA *pixa, l_int32 w, l_int32 h, l_uint32 bgcolor ); -LEPT_DLL extern PIX * pixaDisplayRandomCmap ( PIXA *pixa, l_int32 w, l_int32 h ); -LEPT_DLL extern PIX * pixaDisplayOnLattice ( PIXA *pixa, l_int32 xspace, l_int32 yspace ); -LEPT_DLL extern PIX * pixaDisplayUnsplit ( PIXA *pixa, l_int32 nx, l_int32 ny, l_int32 borderwidth, l_uint32 bordercolor ); -LEPT_DLL extern PIX * pixaDisplayTiled ( PIXA *pixa, l_int32 maxwidth, l_int32 background, l_int32 spacing ); -LEPT_DLL extern PIX * pixaDisplayTiledInRows ( PIXA *pixa, l_int32 outdepth, l_int32 maxwidth, l_float32 scalefactor, l_int32 background, l_int32 spacing, l_int32 border ); -LEPT_DLL extern PIX * pixaDisplayTiledAndScaled ( PIXA *pixa, l_int32 outdepth, l_int32 tilewidth, l_int32 ncols, l_int32 background, l_int32 spacing, l_int32 border ); -LEPT_DLL extern PIX * pixaaDisplay ( PIXAA *pixaa, l_int32 w, l_int32 h ); -LEPT_DLL extern PIX * pixaaDisplayByPixa ( PIXAA *pixaa, l_int32 xspace, l_int32 yspace, l_int32 maxw ); -LEPT_DLL extern PIXA * pixaaDisplayTiledAndScaled ( PIXAA *pixaa, l_int32 outdepth, l_int32 tilewidth, l_int32 ncols, l_int32 background, l_int32 spacing, l_int32 border ); -LEPT_DLL extern l_int32 pmsCreate ( size_t minsize, size_t smallest, NUMA *numalloc, const char *logfile ); -LEPT_DLL extern void pmsDestroy ( ); -LEPT_DLL extern void * pmsCustomAlloc ( size_t nbytes ); -LEPT_DLL extern void pmsCustomDealloc ( void *data ); -LEPT_DLL extern void * pmsGetAlloc ( size_t nbytes ); -LEPT_DLL extern l_int32 pmsGetLevelForAlloc ( size_t nbytes, l_int32 *plevel ); -LEPT_DLL extern l_int32 pmsGetLevelForDealloc ( void *data, l_int32 *plevel ); -LEPT_DLL extern void pmsLogInfo ( ); -LEPT_DLL extern l_int32 pixAddConstantGray ( PIX *pixs, l_int32 val ); -LEPT_DLL extern l_int32 pixMultConstantGray ( PIX *pixs, l_float32 val ); -LEPT_DLL extern PIX * pixAddGray ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixSubtractGray ( PIX *pixd, PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixThresholdToValue ( PIX *pixd, PIX *pixs, l_int32 threshval, l_int32 setval ); -LEPT_DLL extern PIX * pixInitAccumulate ( l_int32 w, l_int32 h, l_uint32 offset ); -LEPT_DLL extern PIX * pixFinalAccumulate ( PIX *pixs, l_uint32 offset, l_int32 depth ); -LEPT_DLL extern PIX * pixFinalAccumulateThreshold ( PIX *pixs, l_uint32 offset, l_uint32 threshold ); -LEPT_DLL extern l_int32 pixAccumulate ( PIX *pixd, PIX *pixs, l_int32 op ); -LEPT_DLL extern l_int32 pixMultConstAccumulate ( PIX *pixs, l_float32 factor, l_uint32 offset ); -LEPT_DLL extern PIX * pixAbsDifference ( PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PIX * pixMinOrMax ( PIX *pixd, PIX *pixs1, PIX *pixs2, l_int32 type ); -LEPT_DLL extern PIX * pixMaxDynamicRange ( PIX *pixs, l_int32 type ); -LEPT_DLL extern l_float32 * makeLogBase2Tab ( void ); -LEPT_DLL extern l_float32 getLogBase2 ( l_int32 val, l_float32 *logtab ); -LEPT_DLL extern PIXC * pixcompCreateFromPix ( PIX *pix, l_int32 comptype ); -LEPT_DLL extern PIXC * pixcompCreateFromString ( l_uint8 *data, size_t size, l_int32 copyflag ); -LEPT_DLL extern PIXC * pixcompCreateFromFile ( const char *filename, l_int32 comptype ); -LEPT_DLL extern void pixcompDestroy ( PIXC **ppixc ); -LEPT_DLL extern l_int32 pixcompGetDimensions ( PIXC *pixc, l_int32 *pw, l_int32 *ph, l_int32 *pd ); -LEPT_DLL extern l_int32 pixcompDetermineFormat ( l_int32 comptype, l_int32 d, l_int32 cmapflag, l_int32 *pformat ); -LEPT_DLL extern PIX * pixCreateFromPixcomp ( PIXC *pixc ); -LEPT_DLL extern PIXAC * pixacompCreate ( l_int32 n ); -LEPT_DLL extern PIXAC * pixacompCreateInitialized ( l_int32 n, PIX *pix, l_int32 comptype ); -LEPT_DLL extern PIXAC * pixacompCreateFromPixa ( PIXA *pixa, l_int32 comptype, l_int32 accesstype ); -LEPT_DLL extern PIXAC * pixacompCreateFromFiles ( const char *dirname, const char *substr, l_int32 comptype ); -LEPT_DLL extern PIXAC * pixacompCreateFromSA ( SARRAY *sa, l_int32 comptype ); -LEPT_DLL extern void pixacompDestroy ( PIXAC **ppixac ); -LEPT_DLL extern l_int32 pixacompAddPix ( PIXAC *pixac, PIX *pix, l_int32 comptype ); -LEPT_DLL extern l_int32 pixacompAddPixcomp ( PIXAC *pixac, PIXC *pixc ); -LEPT_DLL extern l_int32 pixacompExtendArray ( PIXAC *pixac ); -LEPT_DLL extern l_int32 pixacompReplacePix ( PIXAC *pixac, l_int32 index, PIX *pix, l_int32 comptype ); -LEPT_DLL extern l_int32 pixacompReplacePixcomp ( PIXAC *pixac, l_int32 index, PIXC *pixc ); -LEPT_DLL extern l_int32 pixacompAddBox ( PIXAC *pixac, BOX *box, l_int32 copyflag ); -LEPT_DLL extern l_int32 pixacompGetCount ( PIXAC *pixac ); -LEPT_DLL extern PIXC * pixacompGetPixcomp ( PIXAC *pixac, l_int32 index ); -LEPT_DLL extern PIX * pixacompGetPix ( PIXAC *pixac, l_int32 index ); -LEPT_DLL extern l_int32 pixacompGetPixDimensions ( PIXAC *pixac, l_int32 index, l_int32 *pw, l_int32 *ph, l_int32 *pd ); -LEPT_DLL extern BOXA * pixacompGetBoxa ( PIXAC *pixac, l_int32 accesstype ); -LEPT_DLL extern l_int32 pixacompGetBoxaCount ( PIXAC *pixac ); -LEPT_DLL extern BOX * pixacompGetBox ( PIXAC *pixac, l_int32 index, l_int32 accesstype ); -LEPT_DLL extern l_int32 pixacompGetBoxGeometry ( PIXAC *pixac, l_int32 index, l_int32 *px, l_int32 *py, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern PIXA * pixaCreateFromPixacomp ( PIXAC *pixac, l_int32 accesstype ); -LEPT_DLL extern PIXAC * pixacompRead ( const char *filename ); -LEPT_DLL extern PIXAC * pixacompReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 pixacompWrite ( const char *filename, PIXAC *pixac ); -LEPT_DLL extern l_int32 pixacompWriteStream ( FILE *fp, PIXAC *pixac ); -LEPT_DLL extern l_int32 pixacompWriteStreamInfo ( FILE *fp, PIXAC *pixac, const char *text ); -LEPT_DLL extern l_int32 pixcompWriteStreamInfo ( FILE *fp, PIXC *pixc, const char *text ); -LEPT_DLL extern PIX * pixacompDisplayTiledAndScaled ( PIXAC *pixac, l_int32 outdepth, l_int32 tilewidth, l_int32 ncols, l_int32 background, l_int32 spacing, l_int32 border ); -LEPT_DLL extern PIX * pixThreshold8 ( PIX *pixs, l_int32 d, l_int32 nlevels, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixRemoveColormap ( PIX *pixs, l_int32 type ); -LEPT_DLL extern l_int32 pixAddGrayColormap8 ( PIX *pixs ); -LEPT_DLL extern PIX * pixAddMinimalGrayColormap8 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertRGBToLuminance ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertRGBToGray ( PIX *pixs, l_float32 rwt, l_float32 gwt, l_float32 bwt ); -LEPT_DLL extern PIX * pixConvertRGBToGrayFast ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertRGBToGrayMinMax ( PIX *pixs, l_int32 type ); -LEPT_DLL extern PIX * pixConvertGrayToColormap ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertGrayToColormap8 ( PIX *pixs, l_int32 mindepth ); -LEPT_DLL extern PIX * pixColorizeGray ( PIX *pixs, l_uint32 color, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixConvertRGBToColormap ( PIX *pixs, l_int32 ditherflag ); -LEPT_DLL extern l_int32 pixQuantizeIfFewColors ( PIX *pixs, l_int32 maxcolors, l_int32 mingraycolors, l_int32 octlevel, PIX **ppixd ); -LEPT_DLL extern PIX * pixConvert16To8 ( PIX *pixs, l_int32 whichbyte ); -LEPT_DLL extern PIX * pixConvertGrayToFalseColor ( PIX *pixs, l_float32 gamma ); -LEPT_DLL extern PIX * pixUnpackBinary ( PIX *pixs, l_int32 depth, l_int32 invert ); -LEPT_DLL extern PIX * pixConvert1To16 ( PIX *pixd, PIX *pixs, l_uint16 val0, l_uint16 val1 ); -LEPT_DLL extern PIX * pixConvert1To32 ( PIX *pixd, PIX *pixs, l_uint32 val0, l_uint32 val1 ); -LEPT_DLL extern PIX * pixConvert1To2Cmap ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvert1To2 ( PIX *pixd, PIX *pixs, l_int32 val0, l_int32 val1 ); -LEPT_DLL extern PIX * pixConvert1To4Cmap ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvert1To4 ( PIX *pixd, PIX *pixs, l_int32 val0, l_int32 val1 ); -LEPT_DLL extern PIX * pixConvert1To8 ( PIX *pixd, PIX *pixs, l_uint8 val0, l_uint8 val1 ); -LEPT_DLL extern PIX * pixConvert2To8 ( PIX *pixs, l_uint8 val0, l_uint8 val1, l_uint8 val2, l_uint8 val3, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixConvert4To8 ( PIX *pixs, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixConvert8To16 ( PIX *pixs, l_int32 leftshift ); -LEPT_DLL extern PIX * pixConvertTo1 ( PIX *pixs, l_int32 threshold ); -LEPT_DLL extern PIX * pixConvertTo1BySampling ( PIX *pixs, l_int32 factor, l_int32 threshold ); -LEPT_DLL extern PIX * pixConvertTo8 ( PIX *pixs, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixConvertTo8BySampling ( PIX *pixs, l_int32 factor, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixConvertTo16 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertTo32 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertTo32BySampling ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern PIX * pixConvert8To32 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertTo8Or32 ( PIX *pixs, l_int32 copyflag, l_int32 warnflag ); -LEPT_DLL extern PIX * pixConvert24To32 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvert32To24 ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertLossless ( PIX *pixs, l_int32 d ); -LEPT_DLL extern PIX * pixConvertForPSWrap ( PIX *pixs ); -LEPT_DLL extern PIX * pixConvertToSubpixelRGB ( PIX *pixs, l_float32 scalex, l_float32 scaley, l_int32 order ); -LEPT_DLL extern PIX * pixConvertGrayToSubpixelRGB ( PIX *pixs, l_float32 scalex, l_float32 scaley, l_int32 order ); -LEPT_DLL extern PIX * pixConvertColorToSubpixelRGB ( PIX *pixs, l_float32 scalex, l_float32 scaley, l_int32 order ); -LEPT_DLL extern PIXTILING * pixTilingCreate ( PIX *pixs, l_int32 nx, l_int32 ny, l_int32 w, l_int32 h, l_int32 xoverlap, l_int32 yoverlap ); -LEPT_DLL extern void pixTilingDestroy ( PIXTILING **ppt ); -LEPT_DLL extern l_int32 pixTilingGetCount ( PIXTILING *pt, l_int32 *pnx, l_int32 *pny ); -LEPT_DLL extern l_int32 pixTilingGetSize ( PIXTILING *pt, l_int32 *pw, l_int32 *ph ); -LEPT_DLL extern PIX * pixTilingGetTile ( PIXTILING *pt, l_int32 i, l_int32 j ); -LEPT_DLL extern l_int32 pixTilingNoStripOnPaint ( PIXTILING *pt ); -LEPT_DLL extern l_int32 pixTilingPaintTile ( PIX *pixd, l_int32 i, l_int32 j, PIX *pixs, PIXTILING *pt ); -LEPT_DLL extern PIX * pixReadStreamPng ( FILE *fp ); -LEPT_DLL extern l_int32 readHeaderPng ( const char *filename, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 freadHeaderPng ( FILE *fp, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 sreadHeaderPng ( const l_uint8 *data, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 fgetPngResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 pixWritePng ( const char *filename, PIX *pix, l_float32 gamma ); -LEPT_DLL extern l_int32 pixWriteStreamPng ( FILE *fp, PIX *pix, l_float32 gamma ); -LEPT_DLL extern PIX * pixReadRGBAPng ( const char *filename ); -LEPT_DLL extern l_int32 pixWriteRGBAPng ( const char *filename, PIX *pix ); -LEPT_DLL extern void l_pngSetStrip16To8 ( l_int32 flag ); -LEPT_DLL extern void l_pngSetStripAlpha ( l_int32 flag ); -LEPT_DLL extern void l_pngSetWriteAlpha ( l_int32 flag ); -LEPT_DLL extern void l_pngSetZlibCompression ( l_int32 val ); -LEPT_DLL extern PIX * pixReadMemPng ( const l_uint8 *cdata, size_t size ); -LEPT_DLL extern l_int32 pixWriteMemPng ( l_uint8 **pdata, size_t *psize, PIX *pix, l_float32 gamma ); -LEPT_DLL extern PIX * pixReadStreamPnm ( FILE *fp ); -LEPT_DLL extern l_int32 readHeaderPnm ( const char *filename, PIX **ppix, l_int32 *pwidth, l_int32 *pheight, l_int32 *pdepth, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp ); -LEPT_DLL extern l_int32 freadHeaderPnm ( FILE *fp, PIX **ppix, l_int32 *pwidth, l_int32 *pheight, l_int32 *pdepth, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp ); -LEPT_DLL extern l_int32 pixWriteStreamPnm ( FILE *fp, PIX *pix ); -LEPT_DLL extern l_int32 pixWriteStreamAsciiPnm ( FILE *fp, PIX *pix ); -LEPT_DLL extern PIX * pixReadMemPnm ( const l_uint8 *cdata, size_t size ); -LEPT_DLL extern l_int32 sreadHeaderPnm ( const l_uint8 *cdata, size_t size, l_int32 *pwidth, l_int32 *pheight, l_int32 *pdepth, l_int32 *ptype, l_int32 *pbps, l_int32 *pspp ); -LEPT_DLL extern l_int32 pixWriteMemPnm ( l_uint8 **pdata, size_t *psize, PIX *pix ); -LEPT_DLL extern PIX * pixProjectiveSampledPta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixProjectiveSampled ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixProjectivePta ( PIX *pixs, PTA *ptad, PTA *ptas, l_int32 incolor ); -LEPT_DLL extern PIX * pixProjective ( PIX *pixs, l_float32 *vc, l_int32 incolor ); -LEPT_DLL extern PIX * pixProjectivePtaColor ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint32 colorval ); -LEPT_DLL extern PIX * pixProjectiveColor ( PIX *pixs, l_float32 *vc, l_uint32 colorval ); -LEPT_DLL extern PIX * pixProjectivePtaGray ( PIX *pixs, PTA *ptad, PTA *ptas, l_uint8 grayval ); -LEPT_DLL extern PIX * pixProjectiveGray ( PIX *pixs, l_float32 *vc, l_uint8 grayval ); -LEPT_DLL extern PIX * pixProjectivePtaWithAlpha ( PIX *pixs, PTA *ptad, PTA *ptas, PIX *pixg, l_float32 fract, l_int32 border ); -LEPT_DLL extern PIX * pixProjectivePtaGammaXform ( PIX *pixs, l_float32 gamma, PTA *ptad, PTA *ptas, l_float32 fract, l_int32 border ); -LEPT_DLL extern l_int32 getProjectiveXformCoeffs ( PTA *ptas, PTA *ptad, l_float32 **pvc ); -LEPT_DLL extern l_int32 projectiveXformSampledPt ( l_float32 *vc, l_int32 x, l_int32 y, l_int32 *pxp, l_int32 *pyp ); -LEPT_DLL extern l_int32 projectiveXformPt ( l_float32 *vc, l_int32 x, l_int32 y, l_float32 *pxp, l_float32 *pyp ); -LEPT_DLL extern l_int32 convertFilesToPS ( const char *dirin, const char *substr, l_int32 res, const char *fileout ); -LEPT_DLL extern l_int32 sarrayConvertFilesToPS ( SARRAY *sa, l_int32 res, const char *fileout ); -LEPT_DLL extern l_int32 convertFilesFittedToPS ( const char *dirin, const char *substr, l_float32 xpts, l_float32 ypts, const char *fileout ); -LEPT_DLL extern l_int32 sarrayConvertFilesFittedToPS ( SARRAY *sa, l_float32 xpts, l_float32 ypts, const char *fileout ); -LEPT_DLL extern l_int32 writeImageCompressedToPSFile ( const char *filein, const char *fileout, l_int32 res, l_int32 *pfirstfile, l_int32 *pindex ); -LEPT_DLL extern l_int32 convertSegmentedPagesToPS ( const char *pagedir, const char *pagestr, const char *maskdir, const char *maskstr, l_int32 numpre, l_int32 numpost, l_int32 maxnum, l_float32 textscale, l_float32 imagescale, l_int32 threshold, const char *fileout ); -LEPT_DLL extern l_int32 pixWriteSegmentedPageToPS ( PIX *pixs, PIX *pixm, l_float32 textscale, l_float32 imagescale, l_int32 threshold, l_int32 pageno, const char *fileout ); -LEPT_DLL extern l_int32 pixWriteMixedToPS ( PIX *pixb, PIX *pixc, l_float32 scale, l_int32 pageno, const char *fileout ); -LEPT_DLL extern l_int32 convertToPSEmbed ( const char *filein, const char *fileout, l_int32 level ); -LEPT_DLL extern l_int32 pixaWriteCompressedToPS ( PIXA *pixa, const char *fileout, l_int32 res, l_int32 level ); -LEPT_DLL extern l_int32 pixWritePSEmbed ( const char *filein, const char *fileout ); -LEPT_DLL extern l_int32 pixWriteStreamPS ( FILE *fp, PIX *pix, BOX *box, l_int32 res, l_float32 scale ); -LEPT_DLL extern char * pixWriteStringPS ( PIX *pixs, BOX *box, l_int32 res, l_float32 scale ); -LEPT_DLL extern char * generateUncompressedPS ( char *hexdata, l_int32 w, l_int32 h, l_int32 d, l_int32 psbpl, l_int32 bps, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 boxflag ); -LEPT_DLL extern void getScaledParametersPS ( BOX *box, l_int32 wpix, l_int32 hpix, l_int32 res, l_float32 scale, l_float32 *pxpt, l_float32 *pypt, l_float32 *pwpt, l_float32 *phpt ); -LEPT_DLL extern void convertByteToHexAscii ( l_uint8 byteval, char *pnib1, char *pnib2 ); -LEPT_DLL extern l_int32 convertJpegToPSEmbed ( const char *filein, const char *fileout ); -LEPT_DLL extern l_int32 convertJpegToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern l_int32 convertJpegToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern char * generateJpegPS ( const char *filein, L_COMPRESSED_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern L_COMPRESSED_DATA * pixGenerateJpegData ( PIX *pixs, l_int32 ascii85flag, l_int32 quality ); -LEPT_DLL extern L_COMPRESSED_DATA * l_generateJpegData ( const char *fname, l_int32 ascii85flag ); -LEPT_DLL extern void compressed_dataDestroy ( L_COMPRESSED_DATA **pcid ); -LEPT_DLL extern l_int32 convertG4ToPSEmbed ( const char *filein, const char *fileout ); -LEPT_DLL extern l_int32 convertG4ToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 maskflag, l_int32 endpage ); -LEPT_DLL extern l_int32 convertG4ToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 maskflag, l_int32 endpage ); -LEPT_DLL extern char * generateG4PS ( const char *filein, L_COMPRESSED_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 maskflag, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern L_COMPRESSED_DATA * pixGenerateG4Data ( PIX *pixs, l_int32 ascii85flag ); -LEPT_DLL extern L_COMPRESSED_DATA * l_generateG4Data ( const char *fname, l_int32 ascii85flag ); -LEPT_DLL extern l_int32 convertTiffMultipageToPS ( const char *filein, const char *fileout, const char *tempfile, l_float32 fillfract ); -LEPT_DLL extern l_int32 convertFlateToPSEmbed ( const char *filein, const char *fileout ); -LEPT_DLL extern l_int32 convertFlateToPS ( const char *filein, const char *fileout, const char *operation, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern l_int32 convertFlateToPSString ( const char *filein, char **poutstr, l_int32 *pnbytes, l_int32 x, l_int32 y, l_int32 res, l_float32 scale, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern char * generateFlatePS ( const char *filein, L_COMPRESSED_DATA *cid, l_float32 xpt, l_float32 ypt, l_float32 wpt, l_float32 hpt, l_int32 pageno, l_int32 endpage ); -LEPT_DLL extern L_COMPRESSED_DATA * l_generateFlateData ( const char *fname, l_int32 ascii85flag ); -LEPT_DLL extern L_COMPRESSED_DATA * pixGenerateFlateData ( PIX *pixs, l_int32 ascii85flag ); -LEPT_DLL extern l_int32 pixWriteMemPS ( l_uint8 **pdata, size_t *psize, PIX *pix, BOX *box, l_int32 res, l_float32 scale ); -LEPT_DLL extern l_int32 getResLetterPage ( l_int32 w, l_int32 h, l_float32 fillfract ); -LEPT_DLL extern l_int32 getResA4Page ( l_int32 w, l_int32 h, l_float32 fillfract ); -LEPT_DLL extern char * encodeAscii85 ( l_uint8 *inarray, l_int32 insize, l_int32 *poutsize ); -LEPT_DLL extern l_uint8 * decodeAscii85 ( char *ina, l_int32 insize, l_int32 *poutsize ); -LEPT_DLL extern void l_psWriteBoundingBox ( l_int32 flag ); -LEPT_DLL extern PTA * ptaCreate ( l_int32 n ); -LEPT_DLL extern PTA * ptaCreateFromNuma ( NUMA *nax, NUMA *nay ); -LEPT_DLL extern void ptaDestroy ( PTA **ppta ); -LEPT_DLL extern PTA * ptaCopy ( PTA *pta ); -LEPT_DLL extern PTA * ptaClone ( PTA *pta ); -LEPT_DLL extern l_int32 ptaEmpty ( PTA *pta ); -LEPT_DLL extern l_int32 ptaAddPt ( PTA *pta, l_float32 x, l_float32 y ); -LEPT_DLL extern l_int32 ptaExtendArrays ( PTA *pta ); -LEPT_DLL extern l_int32 ptaGetRefcount ( PTA *pta ); -LEPT_DLL extern l_int32 ptaChangeRefcount ( PTA *pta, l_int32 delta ); -LEPT_DLL extern l_int32 ptaGetCount ( PTA *pta ); -LEPT_DLL extern l_int32 ptaGetPt ( PTA *pta, l_int32 index, l_float32 *px, l_float32 *py ); -LEPT_DLL extern l_int32 ptaGetIPt ( PTA *pta, l_int32 index, l_int32 *px, l_int32 *py ); -LEPT_DLL extern l_int32 ptaSetPt ( PTA *pta, l_int32 index, l_float32 x, l_float32 y ); -LEPT_DLL extern l_int32 ptaGetArrays ( PTA *pta, NUMA **pnax, NUMA **pnay ); -LEPT_DLL extern PTA * ptaRead ( const char *filename ); -LEPT_DLL extern PTA * ptaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 ptaWrite ( const char *filename, PTA *pta, l_int32 type ); -LEPT_DLL extern l_int32 ptaWriteStream ( FILE *fp, PTA *pta, l_int32 type ); -LEPT_DLL extern PTAA * ptaaCreate ( l_int32 n ); -LEPT_DLL extern void ptaaDestroy ( PTAA **pptaa ); -LEPT_DLL extern l_int32 ptaaAddPta ( PTAA *ptaa, PTA *pta, l_int32 copyflag ); -LEPT_DLL extern l_int32 ptaaExtendArray ( PTAA *ptaa ); -LEPT_DLL extern l_int32 ptaaGetCount ( PTAA *ptaa ); -LEPT_DLL extern PTA * ptaaGetPta ( PTAA *ptaa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern l_int32 ptaaGetPt ( PTAA *ptaa, l_int32 ipta, l_int32 jpt, l_float32 *px, l_float32 *py ); -LEPT_DLL extern PTAA * ptaaRead ( const char *filename ); -LEPT_DLL extern PTAA * ptaaReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 ptaaWrite ( const char *filename, PTAA *ptaa, l_int32 type ); -LEPT_DLL extern l_int32 ptaaWriteStream ( FILE *fp, PTAA *ptaa, l_int32 type ); -LEPT_DLL extern PTA * ptaSubsample ( PTA *ptas, l_int32 subfactor ); -LEPT_DLL extern l_int32 ptaJoin ( PTA *ptad, PTA *ptas, l_int32 istart, l_int32 iend ); -LEPT_DLL extern PTA * ptaReverse ( PTA *ptas, l_int32 type ); -LEPT_DLL extern PTA * ptaCyclicPerm ( PTA *ptas, l_int32 xs, l_int32 ys ); -LEPT_DLL extern PTA * ptaSort ( PTA *ptas, l_int32 sorttype, l_int32 sortorder, NUMA **pnaindex ); -LEPT_DLL extern PTA * ptaRemoveDuplicates ( PTA *ptas, l_uint32 factor ); -LEPT_DLL extern PTAA * ptaaSortByIndex ( PTAA *ptaas, NUMA *naindex ); -LEPT_DLL extern BOX * ptaGetBoundingRegion ( PTA *pta ); -LEPT_DLL extern l_int32 ptaGetRange ( PTA *pta, l_float32 *pminx, l_float32 *pmaxx, l_float32 *pminy, l_float32 *pmaxy ); -LEPT_DLL extern PTA * ptaGetInsideBox ( PTA *ptas, BOX *box ); -LEPT_DLL extern PTA * pixFindCornerPixels ( PIX *pixs ); -LEPT_DLL extern l_int32 ptaContainsPt ( PTA *pta, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 ptaTestIntersection ( PTA *pta1, PTA *pta2 ); -LEPT_DLL extern PTA * ptaTransform ( PTA *ptas, l_int32 shiftx, l_int32 shifty, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern l_int32 ptaGetLinearLSF ( PTA *pta, l_float32 *pa, l_float32 *pb, NUMA **pnafit ); -LEPT_DLL extern l_int32 ptaGetQuadraticLSF ( PTA *pta, l_float32 *pa, l_float32 *pb, l_float32 *pc, NUMA **pnafit ); -LEPT_DLL extern l_int32 ptaGetCubicLSF ( PTA *pta, l_float32 *pa, l_float32 *pb, l_float32 *pc, l_float32 *pd, NUMA **pnafit ); -LEPT_DLL extern l_int32 ptaGetQuarticLSF ( PTA *pta, l_float32 *pa, l_float32 *pb, l_float32 *pc, l_float32 *pd, l_float32 *pe, NUMA **pnafit ); -LEPT_DLL extern l_int32 applyLinearFit ( l_float32 a, l_float32 b, l_float32 x, l_float32 *py ); -LEPT_DLL extern l_int32 applyQuadraticFit ( l_float32 a, l_float32 b, l_float32 c, l_float32 x, l_float32 *py ); -LEPT_DLL extern l_int32 applyCubicFit ( l_float32 a, l_float32 b, l_float32 c, l_float32 d, l_float32 x, l_float32 *py ); -LEPT_DLL extern l_int32 applyQuarticFit ( l_float32 a, l_float32 b, l_float32 c, l_float32 d, l_float32 e, l_float32 x, l_float32 *py ); -LEPT_DLL extern l_int32 pixPlotAlongPta ( PIX *pixs, PTA *pta, l_int32 outformat, const char *title ); -LEPT_DLL extern PTA * ptaGetPixelsFromPix ( PIX *pixs, BOX *box ); -LEPT_DLL extern PIX * pixGenerateFromPta ( PTA *pta, l_int32 w, l_int32 h ); -LEPT_DLL extern PTA * ptaGetBoundaryPixels ( PIX *pixs, l_int32 type ); -LEPT_DLL extern PTAA * ptaaGetBoundaryPixels ( PIX *pixs, l_int32 type, l_int32 connectivity, BOXA **pboxa, PIXA **ppixa ); -LEPT_DLL extern PIX * pixDisplayPta ( PIX *pixd, PIX *pixs, PTA *pta ); -LEPT_DLL extern PIX * pixDisplayPtaa ( PIX *pixs, PTAA *ptaa ); -LEPT_DLL extern L_PTRA * ptraCreate ( l_int32 n ); -LEPT_DLL extern void ptraDestroy ( L_PTRA **ppa, l_int32 freeflag, l_int32 warnflag ); -LEPT_DLL extern l_int32 ptraAdd ( L_PTRA *pa, void *item ); -LEPT_DLL extern l_int32 ptraExtendArray ( L_PTRA *pa ); -LEPT_DLL extern l_int32 ptraInsert ( L_PTRA *pa, l_int32 index, void *item, l_int32 shiftflag ); -LEPT_DLL extern void * ptraGetHandle ( L_PTRA *pa, l_int32 index ); -LEPT_DLL extern void * ptraRemove ( L_PTRA *pa, l_int32 index, l_int32 flag ); -LEPT_DLL extern void * ptraRemoveLast ( L_PTRA *pa ); -LEPT_DLL extern void * ptraReplace ( L_PTRA *pa, l_int32 index, void *item, l_int32 freeflag ); -LEPT_DLL extern l_int32 ptraSwap ( L_PTRA *pa, l_int32 index1, l_int32 index2 ); -LEPT_DLL extern l_int32 ptraCompactArray ( L_PTRA *pa ); -LEPT_DLL extern l_int32 ptraReverse ( L_PTRA *pa ); -LEPT_DLL extern l_int32 ptraJoin ( L_PTRA *pa1, L_PTRA *pa2 ); -LEPT_DLL extern l_int32 ptraGetMaxIndex ( L_PTRA *pa, l_int32 *pmaxindex ); -LEPT_DLL extern l_int32 ptraGetActualCount ( L_PTRA *pa, l_int32 *pcount ); -LEPT_DLL extern void * ptraGetPtrToItem ( L_PTRA *pa, l_int32 index ); -LEPT_DLL extern L_PTRAA * ptraaCreate ( l_int32 n ); -LEPT_DLL extern void ptraaDestroy ( L_PTRAA **ppaa, l_int32 freeflag, l_int32 warnflag ); -LEPT_DLL extern l_int32 ptraaGetSize ( L_PTRAA *paa, l_int32 *psize ); -LEPT_DLL extern l_int32 ptraaInsertPtra ( L_PTRAA *paa, l_int32 index, L_PTRA *pa ); -LEPT_DLL extern L_PTRA * ptraaGetPtra ( L_PTRAA *paa, l_int32 index, l_int32 accessflag ); -LEPT_DLL extern L_PTRA * ptraaFlattenToPtra ( L_PTRAA *paa ); -LEPT_DLL extern NUMA * numaGetBinSortIndex ( NUMA *nas, l_int32 sortorder ); -LEPT_DLL extern l_int32 pixQuadtreeMean ( PIX *pixs, l_int32 nlevels, PIX *pix_ma, FPIXA **pfpixa ); -LEPT_DLL extern l_int32 pixQuadtreeVariance ( PIX *pixs, l_int32 nlevels, PIX *pix_ma, DPIX *dpix_msa, FPIXA **pfpixa_v, FPIXA **pfpixa_rv ); -LEPT_DLL extern l_int32 pixMeanInRectangle ( PIX *pixs, BOX *box, PIX *pixma, l_float32 *pval ); -LEPT_DLL extern l_int32 pixVarianceInRectangle ( PIX *pixs, BOX *box, PIX *pix_ma, DPIX *dpix_msa, l_float32 *pvar, l_float32 *prvar ); -LEPT_DLL extern BOXAA * boxaaQuadtreeRegions ( l_int32 w, l_int32 h, l_int32 nlevels ); -LEPT_DLL extern l_int32 quadtreeGetParent ( FPIXA *fpixa, l_int32 level, l_int32 x, l_int32 y, l_float32 *pval ); -LEPT_DLL extern l_int32 quadtreeGetChildren ( FPIXA *fpixa, l_int32 level, l_int32 x, l_int32 y, l_float32 *pval00, l_float32 *pval10, l_float32 *pval01, l_float32 *pval11 ); -LEPT_DLL extern l_int32 quadtreeMaxLevels ( l_int32 w, l_int32 h ); -LEPT_DLL extern PIX * fpixaDisplayQuadtree ( FPIXA *fpixa, l_int32 factor ); -LEPT_DLL extern L_QUEUE * lqueueCreate ( l_int32 nalloc ); -LEPT_DLL extern void lqueueDestroy ( L_QUEUE **plq, l_int32 freeflag ); -LEPT_DLL extern l_int32 lqueueAdd ( L_QUEUE *lq, void *item ); -LEPT_DLL extern l_int32 lqueueExtendArray ( L_QUEUE *lq ); -LEPT_DLL extern void * lqueueRemove ( L_QUEUE *lq ); -LEPT_DLL extern l_int32 lqueueGetCount ( L_QUEUE *lq ); -LEPT_DLL extern l_int32 lqueuePrint ( FILE *fp, L_QUEUE *lq ); -LEPT_DLL extern PIX * pixRankFilter ( PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank ); -LEPT_DLL extern PIX * pixRankFilterRGB ( PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank ); -LEPT_DLL extern PIX * pixRankFilterGray ( PIX *pixs, l_int32 wf, l_int32 hf, l_float32 rank ); -LEPT_DLL extern PIX * pixMedianFilter ( PIX *pixs, l_int32 wf, l_int32 hf ); -LEPT_DLL extern SARRAY * pixProcessBarcodes ( PIX *pixs, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag ); -LEPT_DLL extern PIXA * pixExtractBarcodes ( PIX *pixs, l_int32 debugflag ); -LEPT_DLL extern SARRAY * pixReadBarcodes ( PIXA *pixa, l_int32 format, l_int32 method, SARRAY **psaw, l_int32 debugflag ); -LEPT_DLL extern NUMA * pixReadBarcodeWidths ( PIX *pixs, l_int32 method, l_int32 debugflag ); -LEPT_DLL extern BOXA * pixLocateBarcodes ( PIX *pixs, l_int32 thresh, PIX **ppixb, PIX **ppixm ); -LEPT_DLL extern PIX * pixDeskewBarcode ( PIX *pixs, PIX *pixb, BOX *box, l_int32 margin, l_int32 threshold, l_float32 *pangle, l_float32 *pconf ); -LEPT_DLL extern NUMA * pixExtractBarcodeWidths1 ( PIX *pixs, l_float32 thresh, l_float32 binfract, NUMA **pnaehist, NUMA **pnaohist, l_int32 debugflag ); -LEPT_DLL extern NUMA * pixExtractBarcodeWidths2 ( PIX *pixs, l_float32 thresh, l_float32 *pwidth, NUMA **pnac, l_int32 debugflag ); -LEPT_DLL extern NUMA * pixExtractBarcodeCrossings ( PIX *pixs, l_float32 thresh, l_int32 debugflag ); -LEPT_DLL extern NUMA * numaQuantizeCrossingsByWidth ( NUMA *nas, l_float32 binfract, NUMA **pnaehist, NUMA **pnaohist, l_int32 debugflag ); -LEPT_DLL extern NUMA * numaQuantizeCrossingsByWindow ( NUMA *nas, l_float32 ratio, l_float32 *pwidth, l_float32 *pfirstloc, NUMA **pnac, l_int32 debugflag ); -LEPT_DLL extern PIXA * pixaReadFiles ( const char *dirname, const char *substr ); -LEPT_DLL extern PIXA * pixaReadFilesSA ( SARRAY *sa ); -LEPT_DLL extern PIX * pixRead ( const char *filename ); -LEPT_DLL extern PIX * pixReadWithHint ( const char *filename, l_int32 hint ); -LEPT_DLL extern PIX * pixReadIndexed ( SARRAY *sa, l_int32 index ); -LEPT_DLL extern PIX * pixReadStream ( FILE *fp, l_int32 hint ); -LEPT_DLL extern l_int32 pixReadHeader ( const char *filename, l_int32 *pformat, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 findFileFormat ( const char *filename, l_int32 *pformat ); -LEPT_DLL extern l_int32 findFileFormatStream ( FILE *fp, l_int32 *pformat ); -LEPT_DLL extern l_int32 findFileFormatBuffer ( const l_uint8 *buf, l_int32 *pformat ); -LEPT_DLL extern l_int32 fileFormatIsTiff ( FILE *fp ); -LEPT_DLL extern PIX * pixReadMem ( const l_uint8 *data, size_t size ); -LEPT_DLL extern l_int32 pixReadHeaderMem ( const l_uint8 *data, size_t size, l_int32 *pformat, l_int32 *pw, l_int32 *ph, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 ioFormatTest ( const char *filename ); -LEPT_DLL extern l_int32 regTestSetup ( l_int32 argc, char **argv, L_REGPARAMS **prp ); -LEPT_DLL extern l_int32 regTestCleanup ( L_REGPARAMS *rp ); -LEPT_DLL extern l_int32 regTestComparePix ( L_REGPARAMS *rp, PIX *pix1, PIX *pix2 ); -LEPT_DLL extern l_int32 regTestCompareSimilarPix ( L_REGPARAMS *rp, PIX *pix1, PIX *pix2, l_int32 mindiff, l_float32 maxfract, l_int32 printstats ); -LEPT_DLL extern l_int32 regTestCheckFile ( L_REGPARAMS *rp, const char *localname ); -LEPT_DLL extern l_int32 regTestCompareFiles ( L_REGPARAMS *rp, l_int32 index1, l_int32 index2 ); -LEPT_DLL extern l_int32 regTestWritePixAndCheck ( L_REGPARAMS *rp, PIX *pix, l_int32 format ); -LEPT_DLL extern l_int32 pixRasterop ( PIX *pixd, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, PIX *pixs, l_int32 sx, l_int32 sy ); -LEPT_DLL extern l_int32 pixRasteropVip ( PIX *pixd, l_int32 bx, l_int32 bw, l_int32 vshift, l_int32 incolor ); -LEPT_DLL extern l_int32 pixRasteropHip ( PIX *pixd, l_int32 by, l_int32 bh, l_int32 hshift, l_int32 incolor ); -LEPT_DLL extern PIX * pixTranslate ( PIX *pixd, PIX *pixs, l_int32 hshift, l_int32 vshift, l_int32 incolor ); -LEPT_DLL extern l_int32 pixRasteropIP ( PIX *pixd, l_int32 hshift, l_int32 vshift, l_int32 incolor ); -LEPT_DLL extern l_int32 pixRasteropFullImage ( PIX *pixd, PIX *pixs, l_int32 op ); -LEPT_DLL extern void rasteropVipLow ( l_uint32 *data, l_int32 pixw, l_int32 pixh, l_int32 depth, l_int32 wpl, l_int32 x, l_int32 w, l_int32 shift ); -LEPT_DLL extern void rasteropHipLow ( l_uint32 *data, l_int32 pixh, l_int32 depth, l_int32 wpl, l_int32 y, l_int32 h, l_int32 shift ); -LEPT_DLL extern void shiftDataHorizontalLow ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 shift ); -LEPT_DLL extern void rasteropUniLow ( l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op ); -LEPT_DLL extern void rasteropLow ( l_uint32 *datad, l_int32 dpixw, l_int32 dpixh, l_int32 depth, l_int32 dwpl, l_int32 dx, l_int32 dy, l_int32 dw, l_int32 dh, l_int32 op, l_uint32 *datas, l_int32 spixw, l_int32 spixh, l_int32 swpl, l_int32 sx, l_int32 sy ); -LEPT_DLL extern PIX * pixRotate ( PIX *pixs, l_float32 angle, l_int32 type, l_int32 incolor, l_int32 width, l_int32 height ); -LEPT_DLL extern PIX * pixEmbedForRotation ( PIX *pixs, l_float32 angle, l_int32 incolor, l_int32 width, l_int32 height ); -LEPT_DLL extern PIX * pixRotateBySampling ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotateBinaryNice ( PIX *pixs, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotateWithAlpha ( PIX *pixs, l_float32 angle, PIX *pixg, l_float32 fract ); -LEPT_DLL extern PIX * pixRotateGammaXform ( PIX *pixs, l_float32 gamma, l_float32 angle, l_float32 fract ); -LEPT_DLL extern PIX * pixRotateAM ( PIX *pixs, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotateAMColor ( PIX *pixs, l_float32 angle, l_uint32 colorval ); -LEPT_DLL extern PIX * pixRotateAMGray ( PIX *pixs, l_float32 angle, l_uint8 grayval ); -LEPT_DLL extern PIX * pixRotateAMCorner ( PIX *pixs, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotateAMColorCorner ( PIX *pixs, l_float32 angle, l_uint32 fillval ); -LEPT_DLL extern PIX * pixRotateAMGrayCorner ( PIX *pixs, l_float32 angle, l_uint8 grayval ); -LEPT_DLL extern PIX * pixRotateAMColorFast ( PIX *pixs, l_float32 angle, l_uint32 colorval ); -LEPT_DLL extern void rotateAMColorLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 angle, l_uint32 colorval ); -LEPT_DLL extern void rotateAMGrayLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 angle, l_uint8 grayval ); -LEPT_DLL extern void rotateAMColorCornerLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 angle, l_uint32 colorval ); -LEPT_DLL extern void rotateAMGrayCornerLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 angle, l_uint8 grayval ); -LEPT_DLL extern void rotateAMColorFastLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 angle, l_uint32 colorval ); -LEPT_DLL extern PIX * pixRotateOrth ( PIX *pixs, l_int32 quads ); -LEPT_DLL extern PIX * pixRotate180 ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIX * pixRotate90 ( PIX *pixs, l_int32 direction ); -LEPT_DLL extern PIX * pixFlipLR ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern PIX * pixFlipTB ( PIX *pixd, PIX *pixs ); -LEPT_DLL extern void rotate90Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 d, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 direction ); -LEPT_DLL extern void flipLRLow ( l_uint32 *data, l_int32 w, l_int32 h, l_int32 d, l_int32 wpl, l_uint8 *tab, l_uint32 *buffer ); -LEPT_DLL extern void flipTBLow ( l_uint32 *data, l_int32 h, l_int32 wpl, l_uint32 *buffer ); -LEPT_DLL extern l_uint8 * makeReverseByteTab1 ( void ); -LEPT_DLL extern l_uint8 * makeReverseByteTab2 ( void ); -LEPT_DLL extern l_uint8 * makeReverseByteTab4 ( void ); -LEPT_DLL extern PIX * pixRotateShear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotate2Shear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotate3Shear ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern l_int32 pixRotateShearIP ( PIX *pixs, l_int32 xcen, l_int32 ycen, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRotateShearCenter ( PIX *pixs, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern l_int32 pixRotateShearCenterIP ( PIX *pixs, l_float32 angle, l_int32 incolor ); -LEPT_DLL extern PIX * pixRunlengthTransform ( PIX *pixs, l_int32 color, l_int32 direction, l_int32 depth ); -LEPT_DLL extern l_int32 pixFindHorizontalRuns ( PIX *pix, l_int32 y, l_int32 *xstart, l_int32 *xend, l_int32 *pn ); -LEPT_DLL extern l_int32 pixFindVerticalRuns ( PIX *pix, l_int32 x, l_int32 *ystart, l_int32 *yend, l_int32 *pn ); -LEPT_DLL extern l_int32 runlengthMembershipOnLine ( l_int32 *buffer, l_int32 size, l_int32 depth, l_int32 *start, l_int32 *end, l_int32 n ); -LEPT_DLL extern l_int32 * makeMSBitLocTab ( l_int32 bitval ); -LEPT_DLL extern SARRAY * sarrayCreate ( l_int32 n ); -LEPT_DLL extern SARRAY * sarrayCreateInitialized ( l_int32 n, char *initstr ); -LEPT_DLL extern SARRAY * sarrayCreateWordsFromString ( const char *string ); -LEPT_DLL extern SARRAY * sarrayCreateLinesFromString ( char *string, l_int32 blankflag ); -LEPT_DLL extern void sarrayDestroy ( SARRAY **psa ); -LEPT_DLL extern SARRAY * sarrayCopy ( SARRAY *sa ); -LEPT_DLL extern SARRAY * sarrayClone ( SARRAY *sa ); -LEPT_DLL extern l_int32 sarrayAddString ( SARRAY *sa, char *string, l_int32 copyflag ); -LEPT_DLL extern l_int32 sarrayExtendArray ( SARRAY *sa ); -LEPT_DLL extern char * sarrayRemoveString ( SARRAY *sa, l_int32 index ); -LEPT_DLL extern l_int32 sarrayReplaceString ( SARRAY *sa, l_int32 index, char *newstr, l_int32 copyflag ); -LEPT_DLL extern l_int32 sarrayClear ( SARRAY *sa ); -LEPT_DLL extern l_int32 sarrayGetCount ( SARRAY *sa ); -LEPT_DLL extern char ** sarrayGetArray ( SARRAY *sa, l_int32 *pnalloc, l_int32 *pn ); -LEPT_DLL extern char * sarrayGetString ( SARRAY *sa, l_int32 index, l_int32 copyflag ); -LEPT_DLL extern l_int32 sarrayGetRefcount ( SARRAY *sa ); -LEPT_DLL extern l_int32 sarrayChangeRefcount ( SARRAY *sa, l_int32 delta ); -LEPT_DLL extern char * sarrayToString ( SARRAY *sa, l_int32 addnlflag ); -LEPT_DLL extern char * sarrayToStringRange ( SARRAY *sa, l_int32 first, l_int32 nstrings, l_int32 addnlflag ); -LEPT_DLL extern l_int32 sarrayConcatenate ( SARRAY *sa1, SARRAY *sa2 ); -LEPT_DLL extern l_int32 sarrayAppendRange ( SARRAY *sa1, SARRAY *sa2, l_int32 start, l_int32 end ); -LEPT_DLL extern l_int32 sarrayPadToSameSize ( SARRAY *sa1, SARRAY *sa2, char *padstring ); -LEPT_DLL extern SARRAY * sarrayConvertWordsToLines ( SARRAY *sa, l_int32 linesize ); -LEPT_DLL extern l_int32 sarraySplitString ( SARRAY *sa, const char *str, const char *separators ); -LEPT_DLL extern SARRAY * sarraySelectBySubstring ( SARRAY *sain, const char *substr ); -LEPT_DLL extern SARRAY * sarraySelectByRange ( SARRAY *sain, l_int32 first, l_int32 last ); -LEPT_DLL extern l_int32 sarrayParseRange ( SARRAY *sa, l_int32 start, l_int32 *pactualstart, l_int32 *pend, l_int32 *pnewstart, const char *substr, l_int32 loc ); -LEPT_DLL extern SARRAY * sarraySort ( SARRAY *saout, SARRAY *sain, l_int32 sortorder ); -LEPT_DLL extern l_int32 stringCompareLexical ( const char *str1, const char *str2 ); -LEPT_DLL extern SARRAY * sarrayRead ( const char *filename ); -LEPT_DLL extern SARRAY * sarrayReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 sarrayWrite ( const char *filename, SARRAY *sa ); -LEPT_DLL extern l_int32 sarrayWriteStream ( FILE *fp, SARRAY *sa ); -LEPT_DLL extern l_int32 sarrayAppend ( const char *filename, SARRAY *sa ); -LEPT_DLL extern SARRAY * getNumberedPathnamesInDirectory ( const char *dirname, const char *substr, l_int32 numpre, l_int32 numpost, l_int32 maxnum ); -LEPT_DLL extern SARRAY * getSortedPathnamesInDirectory ( const char *dirname, const char *substr, l_int32 firstpage, l_int32 npages ); -LEPT_DLL extern SARRAY * getFilenamesInDirectory ( const char *dirname ); -LEPT_DLL extern PIX * pixScale ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleToSize ( PIX *pixs, l_int32 wd, l_int32 hd ); -LEPT_DLL extern PIX * pixScaleGeneral ( PIX *pixs, l_float32 scalex, l_float32 scaley, l_float32 sharpfract, l_int32 sharpwidth ); -LEPT_DLL extern PIX * pixScaleLI ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleColorLI ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleColor2xLI ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleColor4xLI ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleGrayLI ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleGray2xLI ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleGray4xLI ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleBySampling ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleByIntSubsampling ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern PIX * pixScaleRGBToGrayFast ( PIX *pixs, l_int32 factor, l_int32 color ); -LEPT_DLL extern PIX * pixScaleRGBToBinaryFast ( PIX *pixs, l_int32 factor, l_int32 thresh ); -LEPT_DLL extern PIX * pixScaleGrayToBinaryFast ( PIX *pixs, l_int32 factor, l_int32 thresh ); -LEPT_DLL extern PIX * pixScaleSmooth ( PIX *pix, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleRGBToGray2 ( PIX *pixs, l_float32 rwt, l_float32 gwt, l_float32 bwt ); -LEPT_DLL extern PIX * pixScaleAreaMap ( PIX *pix, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleAreaMap2 ( PIX *pix ); -LEPT_DLL extern PIX * pixScaleBinary ( PIX *pixs, l_float32 scalex, l_float32 scaley ); -LEPT_DLL extern PIX * pixScaleToGray ( PIX *pixs, l_float32 scalefactor ); -LEPT_DLL extern PIX * pixScaleToGrayFast ( PIX *pixs, l_float32 scalefactor ); -LEPT_DLL extern PIX * pixScaleToGray2 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGray3 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGray4 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGray6 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGray8 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGray16 ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleToGrayMipmap ( PIX *pixs, l_float32 scalefactor ); -LEPT_DLL extern PIX * pixScaleMipmap ( PIX *pixs1, PIX *pixs2, l_float32 scale ); -LEPT_DLL extern PIX * pixExpandReplicate ( PIX *pixs, l_int32 factor ); -LEPT_DLL extern PIX * pixScaleGray2xLIThresh ( PIX *pixs, l_int32 thresh ); -LEPT_DLL extern PIX * pixScaleGray2xLIDither ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleGray4xLIThresh ( PIX *pixs, l_int32 thresh ); -LEPT_DLL extern PIX * pixScaleGray4xLIDither ( PIX *pixs ); -LEPT_DLL extern PIX * pixScaleGrayMinMax ( PIX *pixs, l_int32 xfact, l_int32 yfact, l_int32 type ); -LEPT_DLL extern PIX * pixScaleGrayMinMax2 ( PIX *pixs, l_int32 type ); -LEPT_DLL extern PIX * pixScaleGrayRankCascade ( PIX *pixs, l_int32 level1, l_int32 level2, l_int32 level3, l_int32 level4 ); -LEPT_DLL extern PIX * pixScaleGrayRank2 ( PIX *pixs, l_int32 rank ); -LEPT_DLL extern PIX * pixScaleWithAlpha ( PIX *pixs, l_float32 scalex, l_float32 scaley, PIX *pixg, l_float32 fract ); -LEPT_DLL extern PIX * pixScaleGammaXform ( PIX *pixs, l_float32 gamma, l_float32 scalex, l_float32 scaley, l_float32 fract ); -LEPT_DLL extern void scaleColorLILow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleGrayLILow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleColor2xLILow ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleColor2xLILineLow ( l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag ); -LEPT_DLL extern void scaleGray2xLILow ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleGray2xLILineLow ( l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag ); -LEPT_DLL extern void scaleGray4xLILow ( l_uint32 *datad, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleGray4xLILineLow ( l_uint32 *lined, l_int32 wpld, l_uint32 *lines, l_int32 ws, l_int32 wpls, l_int32 lastlineflag ); -LEPT_DLL extern l_int32 scaleBySamplingLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 d, l_int32 wpls ); -LEPT_DLL extern l_int32 scaleSmoothLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 d, l_int32 wpls, l_int32 size ); -LEPT_DLL extern void scaleRGBToGray2Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_float32 rwt, l_float32 gwt, l_float32 bwt ); -LEPT_DLL extern void scaleColorAreaMapLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleGrayAreaMapLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleAreaMapLow2 ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 d, l_int32 wpls ); -LEPT_DLL extern l_int32 scaleBinaryLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 ws, l_int32 hs, l_int32 wpls ); -LEPT_DLL extern void scaleToGray2Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *sumtab, l_uint8 *valtab ); -LEPT_DLL extern l_uint32 * makeSumTabSG2 ( void ); -LEPT_DLL extern l_uint8 * makeValTabSG2 ( void ); -LEPT_DLL extern void scaleToGray3Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *sumtab, l_uint8 *valtab ); -LEPT_DLL extern l_uint32 * makeSumTabSG3 ( void ); -LEPT_DLL extern l_uint8 * makeValTabSG3 ( void ); -LEPT_DLL extern void scaleToGray4Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_uint32 *sumtab, l_uint8 *valtab ); -LEPT_DLL extern l_uint32 * makeSumTabSG4 ( void ); -LEPT_DLL extern l_uint8 * makeValTabSG4 ( void ); -LEPT_DLL extern void scaleToGray6Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 *tab8, l_uint8 *valtab ); -LEPT_DLL extern l_uint8 * makeValTabSG6 ( void ); -LEPT_DLL extern void scaleToGray8Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 *tab8, l_uint8 *valtab ); -LEPT_DLL extern l_uint8 * makeValTabSG8 ( void ); -LEPT_DLL extern void scaleToGray16Low ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas, l_int32 wpls, l_int32 *tab8 ); -LEPT_DLL extern l_int32 scaleMipmapLow ( l_uint32 *datad, l_int32 wd, l_int32 hd, l_int32 wpld, l_uint32 *datas1, l_int32 wpls1, l_uint32 *datas2, l_int32 wpls2, l_float32 red ); -LEPT_DLL extern PIX * pixSeedfillBinary ( PIX *pixd, PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern PIX * pixSeedfillBinaryRestricted ( PIX *pixd, PIX *pixs, PIX *pixm, l_int32 connectivity, l_int32 xmax, l_int32 ymax ); -LEPT_DLL extern PIX * pixHolesByFilling ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern PIX * pixFillClosedBorders ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern PIX * pixExtractBorderConnComps ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern PIX * pixRemoveBorderConnComps ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern PIX * pixFillHolesToBoundingRect ( PIX *pixs, l_int32 minsize, l_float32 maxhfract, l_float32 minfgfract ); -LEPT_DLL extern l_int32 pixSeedfillGray ( PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixSeedfillGrayInv ( PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixSeedfillGraySimple ( PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixSeedfillGrayInvSimple ( PIX *pixs, PIX *pixm, l_int32 connectivity ); -LEPT_DLL extern PIX * pixSeedfillGrayBasin ( PIX *pixb, PIX *pixm, l_int32 delta, l_int32 connectivity ); -LEPT_DLL extern PIX * pixDistanceFunction ( PIX *pixs, l_int32 connectivity, l_int32 outdepth, l_int32 boundcond ); -LEPT_DLL extern PIX * pixSeedspread ( PIX *pixs, l_int32 connectivity ); -LEPT_DLL extern l_int32 pixLocalExtrema ( PIX *pixs, l_int32 maxmin, l_int32 minmax, PIX **ppixmin, PIX **ppixmax ); -LEPT_DLL extern l_int32 pixSelectedLocalExtrema ( PIX *pixs, l_int32 mindist, PIX **ppixmin, PIX **ppixmax ); -LEPT_DLL extern PIX * pixFindEqualValues ( PIX *pixs1, PIX *pixs2 ); -LEPT_DLL extern PTA * pixSelectMinInConnComp ( PIX *pixs, PIX *pixm, NUMA **pnav ); -LEPT_DLL extern PIX * pixRemoveSeededComponents ( PIX *pixd, PIX *pixs, PIX *pixm, l_int32 connectivity, l_int32 bordersize ); -LEPT_DLL extern void seedfillBinaryLow ( l_uint32 *datas, l_int32 hs, l_int32 wpls, l_uint32 *datam, l_int32 hm, l_int32 wplm, l_int32 connectivity ); -LEPT_DLL extern void seedfillGrayLow ( l_uint32 *datas, l_int32 w, l_int32 h, l_int32 wpls, l_uint32 *datam, l_int32 wplm, l_int32 connectivity ); -LEPT_DLL extern void seedfillGrayInvLow ( l_uint32 *datas, l_int32 w, l_int32 h, l_int32 wpls, l_uint32 *datam, l_int32 wplm, l_int32 connectivity ); -LEPT_DLL extern void seedfillGrayLowSimple ( l_uint32 *datas, l_int32 w, l_int32 h, l_int32 wpls, l_uint32 *datam, l_int32 wplm, l_int32 connectivity ); -LEPT_DLL extern void seedfillGrayInvLowSimple ( l_uint32 *datas, l_int32 w, l_int32 h, l_int32 wpls, l_uint32 *datam, l_int32 wplm, l_int32 connectivity ); -LEPT_DLL extern void distanceFunctionLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 d, l_int32 wpld, l_int32 connectivity ); -LEPT_DLL extern void seedspreadLow ( l_uint32 *datad, l_int32 w, l_int32 h, l_int32 wpld, l_uint32 *datat, l_int32 wplt, l_int32 connectivity ); -LEPT_DLL extern SELA * selaCreate ( l_int32 n ); -LEPT_DLL extern void selaDestroy ( SELA **psela ); -LEPT_DLL extern SEL * selCreate ( l_int32 height, l_int32 width, const char *name ); -LEPT_DLL extern void selDestroy ( SEL **psel ); -LEPT_DLL extern SEL * selCopy ( SEL *sel ); -LEPT_DLL extern SEL * selCreateBrick ( l_int32 h, l_int32 w, l_int32 cy, l_int32 cx, l_int32 type ); -LEPT_DLL extern SEL * selCreateComb ( l_int32 factor1, l_int32 factor2, l_int32 direction ); -LEPT_DLL extern l_int32 ** create2dIntArray ( l_int32 sy, l_int32 sx ); -LEPT_DLL extern l_int32 selaAddSel ( SELA *sela, SEL *sel, const char *selname, l_int32 copyflag ); -LEPT_DLL extern l_int32 selaExtendArray ( SELA *sela ); -LEPT_DLL extern l_int32 selaGetCount ( SELA *sela ); -LEPT_DLL extern SEL * selaGetSel ( SELA *sela, l_int32 i ); -LEPT_DLL extern char * selGetName ( SEL *sel ); -LEPT_DLL extern l_int32 selSetName ( SEL *sel, const char *name ); -LEPT_DLL extern l_int32 selaFindSelByName ( SELA *sela, const char *name, l_int32 *pindex, SEL **psel ); -LEPT_DLL extern l_int32 selGetElement ( SEL *sel, l_int32 row, l_int32 col, l_int32 *ptype ); -LEPT_DLL extern l_int32 selSetElement ( SEL *sel, l_int32 row, l_int32 col, l_int32 type ); -LEPT_DLL extern l_int32 selGetParameters ( SEL *sel, l_int32 *psy, l_int32 *psx, l_int32 *pcy, l_int32 *pcx ); -LEPT_DLL extern l_int32 selSetOrigin ( SEL *sel, l_int32 cy, l_int32 cx ); -LEPT_DLL extern l_int32 selGetTypeAtOrigin ( SEL *sel, l_int32 *ptype ); -LEPT_DLL extern char * selaGetBrickName ( SELA *sela, l_int32 hsize, l_int32 vsize ); -LEPT_DLL extern char * selaGetCombName ( SELA *sela, l_int32 size, l_int32 direction ); -LEPT_DLL extern l_int32 getCompositeParameters ( l_int32 size, l_int32 *psize1, l_int32 *psize2, char **pnameh1, char **pnameh2, char **pnamev1, char **pnamev2 ); -LEPT_DLL extern SARRAY * selaGetSelnames ( SELA *sela ); -LEPT_DLL extern l_int32 selFindMaxTranslations ( SEL *sel, l_int32 *pxp, l_int32 *pyp, l_int32 *pxn, l_int32 *pyn ); -LEPT_DLL extern SEL * selRotateOrth ( SEL *sel, l_int32 quads ); -LEPT_DLL extern SELA * selaRead ( const char *fname ); -LEPT_DLL extern SELA * selaReadStream ( FILE *fp ); -LEPT_DLL extern SEL * selRead ( const char *fname ); -LEPT_DLL extern SEL * selReadStream ( FILE *fp ); -LEPT_DLL extern l_int32 selaWrite ( const char *fname, SELA *sela ); -LEPT_DLL extern l_int32 selaWriteStream ( FILE *fp, SELA *sela ); -LEPT_DLL extern l_int32 selWrite ( const char *fname, SEL *sel ); -LEPT_DLL extern l_int32 selWriteStream ( FILE *fp, SEL *sel ); -LEPT_DLL extern SEL * selCreateFromString ( const char *text, l_int32 h, l_int32 w, const char *name ); -LEPT_DLL extern char * selPrintToString ( SEL *sel ); -LEPT_DLL extern SELA * selaCreateFromFile ( const char *filename ); -LEPT_DLL extern SEL * selCreateFromPta ( PTA *pta, l_int32 cy, l_int32 cx, const char *name ); -LEPT_DLL extern SEL * selCreateFromPix ( PIX *pix, l_int32 cy, l_int32 cx, const char *name ); -LEPT_DLL extern SEL * selReadFromColorImage ( const char *pathname ); -LEPT_DLL extern SEL * selCreateFromColorPix ( PIX *pixs, char *selname ); -LEPT_DLL extern PIX * selDisplayInPix ( SEL *sel, l_int32 size, l_int32 gthick ); -LEPT_DLL extern PIX * selaDisplayInPix ( SELA *sela, l_int32 size, l_int32 gthick, l_int32 spacing, l_int32 ncols ); -LEPT_DLL extern SELA * selaAddBasic ( SELA *sela ); -LEPT_DLL extern SELA * selaAddHitMiss ( SELA *sela ); -LEPT_DLL extern SELA * selaAddDwaLinear ( SELA *sela ); -LEPT_DLL extern SELA * selaAddDwaCombs ( SELA *sela ); -LEPT_DLL extern SELA * selaAddCrossJunctions ( SELA *sela, l_float32 hlsize, l_float32 mdist, l_int32 norient, l_int32 debugflag ); -LEPT_DLL extern SELA * selaAddTJunctions ( SELA *sela, l_float32 hlsize, l_float32 mdist, l_int32 norient, l_int32 debugflag ); -LEPT_DLL extern SEL * pixGenerateSelWithRuns ( PIX *pixs, l_int32 nhlines, l_int32 nvlines, l_int32 distance, l_int32 minlength, l_int32 toppix, l_int32 botpix, l_int32 leftpix, l_int32 rightpix, PIX **ppixe ); -LEPT_DLL extern SEL * pixGenerateSelRandom ( PIX *pixs, l_float32 hitfract, l_float32 missfract, l_int32 distance, l_int32 toppix, l_int32 botpix, l_int32 leftpix, l_int32 rightpix, PIX **ppixe ); -LEPT_DLL extern SEL * pixGenerateSelBoundary ( PIX *pixs, l_int32 hitdist, l_int32 missdist, l_int32 hitskip, l_int32 missskip, l_int32 topflag, l_int32 botflag, l_int32 leftflag, l_int32 rightflag, PIX **ppixe ); -LEPT_DLL extern NUMA * pixGetRunCentersOnLine ( PIX *pixs, l_int32 x, l_int32 y, l_int32 minlength ); -LEPT_DLL extern NUMA * pixGetRunsOnLine ( PIX *pixs, l_int32 x1, l_int32 y1, l_int32 x2, l_int32 y2 ); -LEPT_DLL extern PTA * pixSubsampleBoundaryPixels ( PIX *pixs, l_int32 skip ); -LEPT_DLL extern l_int32 adjacentOnPixelInRaster ( PIX *pixs, l_int32 x, l_int32 y, l_int32 *pxa, l_int32 *pya ); -LEPT_DLL extern PIX * pixDisplayHitMissSel ( PIX *pixs, SEL *sel, l_int32 scalefactor, l_uint32 hitcolor, l_uint32 misscolor ); -LEPT_DLL extern PIX * pixHShear ( PIX *pixd, PIX *pixs, l_int32 liney, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixVShear ( PIX *pixd, PIX *pixs, l_int32 linex, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixHShearCorner ( PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixVShearCorner ( PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixHShearCenter ( PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixVShearCenter ( PIX *pixd, PIX *pixs, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern l_int32 pixHShearIP ( PIX *pixs, l_int32 liney, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern l_int32 pixVShearIP ( PIX *pixs, l_int32 linex, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixHShearLI ( PIX *pixs, l_int32 liney, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixVShearLI ( PIX *pixs, l_int32 linex, l_float32 radang, l_int32 incolor ); -LEPT_DLL extern PIX * pixDeskew ( PIX *pixs, l_int32 redsearch ); -LEPT_DLL extern PIX * pixFindSkewAndDeskew ( PIX *pixs, l_int32 redsearch, l_float32 *pangle, l_float32 *pconf ); -LEPT_DLL extern PIX * pixDeskewGeneral ( PIX *pixs, l_int32 redsweep, l_float32 sweeprange, l_float32 sweepdelta, l_int32 redsearch, l_int32 thresh, l_float32 *pangle, l_float32 *pconf ); -LEPT_DLL extern l_int32 pixFindSkew ( PIX *pixs, l_float32 *pangle, l_float32 *pconf ); -LEPT_DLL extern l_int32 pixFindSkewSweep ( PIX *pixs, l_float32 *pangle, l_int32 reduction, l_float32 sweeprange, l_float32 sweepdelta ); -LEPT_DLL extern l_int32 pixFindSkewSweepAndSearch ( PIX *pixs, l_float32 *pangle, l_float32 *pconf, l_int32 redsweep, l_int32 redsearch, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta ); -LEPT_DLL extern l_int32 pixFindSkewSweepAndSearchScore ( PIX *pixs, l_float32 *pangle, l_float32 *pconf, l_float32 *pendscore, l_int32 redsweep, l_int32 redsearch, l_float32 sweepcenter, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta ); -LEPT_DLL extern l_int32 pixFindSkewSweepAndSearchScorePivot ( PIX *pixs, l_float32 *pangle, l_float32 *pconf, l_float32 *pendscore, l_int32 redsweep, l_int32 redsearch, l_float32 sweepcenter, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta, l_int32 pivot ); -LEPT_DLL extern l_int32 pixFindSkewOrthogonalRange ( PIX *pixs, l_float32 *pangle, l_float32 *pconf, l_int32 redsweep, l_int32 redsearch, l_float32 sweeprange, l_float32 sweepdelta, l_float32 minbsdelta, l_float32 confprior ); -LEPT_DLL extern l_int32 pixFindDifferentialSquareSum ( PIX *pixs, l_float32 *psum ); -LEPT_DLL extern l_int32 pixFindNormalizedSquareSum ( PIX *pixs, l_float32 *phratio, l_float32 *pvratio, l_float32 *pfract ); -LEPT_DLL extern PIX * pixReadStreamSpix ( FILE *fp ); -LEPT_DLL extern l_int32 readHeaderSpix ( const char *filename, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 freadHeaderSpix ( FILE *fp, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 sreadHeaderSpix ( const l_uint32 *data, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *piscmap ); -LEPT_DLL extern l_int32 pixWriteStreamSpix ( FILE *fp, PIX *pix ); -LEPT_DLL extern PIX * pixReadMemSpix ( const l_uint8 *data, size_t size ); -LEPT_DLL extern l_int32 pixWriteMemSpix ( l_uint8 **pdata, size_t *psize, PIX *pix ); -LEPT_DLL extern l_int32 pixSerializeToMemory ( PIX *pixs, l_uint32 **pdata, size_t *pnbytes ); -LEPT_DLL extern PIX * pixDeserializeFromMemory ( const l_uint32 *data, size_t nbytes ); -LEPT_DLL extern L_STACK * lstackCreate ( l_int32 nalloc ); -LEPT_DLL extern void lstackDestroy ( L_STACK **plstack, l_int32 freeflag ); -LEPT_DLL extern l_int32 lstackAdd ( L_STACK *lstack, void *item ); -LEPT_DLL extern void * lstackRemove ( L_STACK *lstack ); -LEPT_DLL extern l_int32 lstackExtendArray ( L_STACK *lstack ); -LEPT_DLL extern l_int32 lstackGetCount ( L_STACK *lstack ); -LEPT_DLL extern l_int32 lstackPrint ( FILE *fp, L_STACK *lstack ); -LEPT_DLL extern l_int32 * sudokuReadFile ( const char *filename ); -LEPT_DLL extern l_int32 * sudokuReadString ( const char *str ); -LEPT_DLL extern L_SUDOKU * sudokuCreate ( l_int32 *array ); -LEPT_DLL extern void sudokuDestroy ( L_SUDOKU **psud ); -LEPT_DLL extern l_int32 sudokuSolve ( L_SUDOKU *sud ); -LEPT_DLL extern l_int32 sudokuTestUniqueness ( l_int32 *array, l_int32 *punique ); -LEPT_DLL extern L_SUDOKU * sudokuGenerate ( l_int32 *array, l_int32 seed, l_int32 minelems, l_int32 maxtries ); -LEPT_DLL extern l_int32 sudokuOutput ( L_SUDOKU *sud, l_int32 arraytype ); -LEPT_DLL extern PIX * pixAddSingleTextblock ( PIX *pixs, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 location, l_int32 *poverflow ); -LEPT_DLL extern l_int32 pixSetTextblock ( PIX *pixs, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 x0, l_int32 y0, l_int32 wtext, l_int32 firstindent, l_int32 *poverflow ); -LEPT_DLL extern l_int32 pixSetTextline ( PIX *pixs, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 x0, l_int32 y0, l_int32 *pwidth, l_int32 *poverflow ); -LEPT_DLL extern SARRAY * bmfGetLineStrings ( L_BMF *bmf, const char *textstr, l_int32 maxw, l_int32 firstindent, l_int32 *ph ); -LEPT_DLL extern NUMA * bmfGetWordWidths ( L_BMF *bmf, const char *textstr, SARRAY *sa ); -LEPT_DLL extern l_int32 bmfGetStringWidth ( L_BMF *bmf, const char *textstr, l_int32 *pw ); -LEPT_DLL extern SARRAY * splitStringToParagraphs ( char *textstr, l_int32 splitflag ); -LEPT_DLL extern PIX * pixReadTiff ( const char *filename, l_int32 n ); -LEPT_DLL extern PIX * pixReadStreamTiff ( FILE *fp, l_int32 n ); -LEPT_DLL extern l_int32 pixWriteTiff ( const char *filename, PIX *pix, l_int32 comptype, const char *modestring ); -LEPT_DLL extern l_int32 pixWriteTiffCustom ( const char *filename, PIX *pix, l_int32 comptype, const char *modestring, NUMA *natags, SARRAY *savals, SARRAY *satypes, NUMA *nasizes ); -LEPT_DLL extern l_int32 pixWriteStreamTiff ( FILE *fp, PIX *pix, l_int32 comptype ); -LEPT_DLL extern PIXA * pixaReadMultipageTiff ( const char *filename ); -LEPT_DLL extern l_int32 writeMultipageTiff ( const char *dirin, const char *substr, const char *fileout ); -LEPT_DLL extern l_int32 writeMultipageTiffSA ( SARRAY *sa, const char *fileout ); -LEPT_DLL extern l_int32 fprintTiffInfo ( FILE *fpout, const char *tiffile ); -LEPT_DLL extern l_int32 tiffGetCount ( FILE *fp, l_int32 *pn ); -LEPT_DLL extern l_int32 getTiffResolution ( FILE *fp, l_int32 *pxres, l_int32 *pyres ); -LEPT_DLL extern l_int32 readHeaderTiff ( const char *filename, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat ); -LEPT_DLL extern l_int32 freadHeaderTiff ( FILE *fp, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat ); -LEPT_DLL extern l_int32 readHeaderMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n, l_int32 *pwidth, l_int32 *pheight, l_int32 *pbps, l_int32 *pspp, l_int32 *pres, l_int32 *pcmap, l_int32 *pformat ); -LEPT_DLL extern l_int32 findTiffCompression ( FILE *fp, l_int32 *pcomptype ); -LEPT_DLL extern l_int32 extractG4DataFromFile ( const char *filein, l_uint8 **pdata, size_t *pnbytes, l_int32 *pw, l_int32 *ph, l_int32 *pminisblack ); -LEPT_DLL extern PIX * pixReadMemTiff ( const l_uint8 *cdata, size_t size, l_int32 n ); -LEPT_DLL extern l_int32 pixWriteMemTiff ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 comptype ); -LEPT_DLL extern l_int32 pixWriteMemTiffCustom ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 comptype, NUMA *natags, SARRAY *savals, SARRAY *satypes, NUMA *nasizes ); -LEPT_DLL extern l_int32 returnErrorInt ( const char *msg, const char *procname, l_int32 ival ); -LEPT_DLL extern l_float32 returnErrorFloat ( const char *msg, const char *procname, l_float32 fval ); -LEPT_DLL extern void * returnErrorPtr ( const char *msg, const char *procname, void *pval ); -LEPT_DLL extern void l_error ( const char *msg, const char *procname ); -LEPT_DLL extern void l_errorString ( const char *msg, const char *procname, const char *str ); -LEPT_DLL extern void l_errorInt ( const char *msg, const char *procname, l_int32 ival ); -LEPT_DLL extern void l_errorFloat ( const char *msg, const char *procname, l_float32 fval ); -LEPT_DLL extern void l_warning ( const char *msg, const char *procname ); -LEPT_DLL extern void l_warningString ( const char *msg, const char *procname, const char *str ); -LEPT_DLL extern void l_warningInt ( const char *msg, const char *procname, l_int32 ival ); -LEPT_DLL extern void l_warningInt2 ( const char *msg, const char *procname, l_int32 ival1, l_int32 ival2 ); -LEPT_DLL extern void l_warningFloat ( const char *msg, const char *procname, l_float32 fval ); -LEPT_DLL extern void l_warningFloat2 ( const char *msg, const char *procname, l_float32 fval1, l_float32 fval2 ); -LEPT_DLL extern void l_info ( const char *msg, const char *procname ); -LEPT_DLL extern void l_infoString ( const char *msg, const char *procname, const char *str ); -LEPT_DLL extern void l_infoInt ( const char *msg, const char *procname, l_int32 ival ); -LEPT_DLL extern void l_infoInt2 ( const char *msg, const char *procname, l_int32 ival1, l_int32 ival2 ); -LEPT_DLL extern void l_infoFloat ( const char *msg, const char *procname, l_float32 fval ); -LEPT_DLL extern void l_infoFloat2 ( const char *msg, const char *procname, l_float32 fval1, l_float32 fval2 ); -LEPT_DLL extern char * stringNew ( const char *src ); -LEPT_DLL extern l_int32 stringCopy ( char *dest, const char *src, l_int32 n ); -LEPT_DLL extern l_int32 stringReplace ( char **pdest, const char *src ); -LEPT_DLL extern l_int32 stringLength ( const char *src, size_t size ); -LEPT_DLL extern l_int32 stringCat ( char *dest, size_t size, const char *src ); -LEPT_DLL extern char * stringJoin ( const char *src1, const char *src2 ); -LEPT_DLL extern char * stringReverse ( const char *src ); -LEPT_DLL extern char * strtokSafe ( char *cstr, const char *seps, char **psaveptr ); -LEPT_DLL extern l_int32 stringSplitOnToken ( char *cstr, const char *seps, char **phead, char **ptail ); -LEPT_DLL extern char * stringRemoveChars ( const char *src, const char *remchars ); -LEPT_DLL extern l_int32 stringFindSubstr ( const char *src, const char *sub, l_int32 *ploc ); -LEPT_DLL extern char * stringReplaceSubstr ( const char *src, const char *sub1, const char *sub2, l_int32 *pfound, l_int32 *ploc ); -LEPT_DLL extern char * stringReplaceEachSubstr ( const char *src, const char *sub1, const char *sub2, l_int32 *pcount ); -LEPT_DLL extern NUMA * arrayFindEachSequence ( const l_uint8 *data, l_int32 datalen, const l_uint8 *sequence, l_int32 seqlen ); -LEPT_DLL extern l_int32 arrayFindSequence ( const l_uint8 *data, l_int32 datalen, const l_uint8 *sequence, l_int32 seqlen, l_int32 *poffset, l_int32 *pfound ); -LEPT_DLL extern void * reallocNew ( void **pindata, l_int32 oldsize, l_int32 newsize ); -LEPT_DLL extern l_uint8 * l_binaryRead ( const char *filename, size_t *pnbytes ); -LEPT_DLL extern l_uint8 * l_binaryReadStream ( FILE *fp, size_t *pnbytes ); -LEPT_DLL extern l_int32 l_binaryWrite ( const char *filename, const char *operation, void *data, size_t nbytes ); -LEPT_DLL extern size_t nbytesInFile ( const char *filename ); -LEPT_DLL extern size_t fnbytesInFile ( FILE *fp ); -LEPT_DLL extern l_uint8 * l_binaryCopy ( l_uint8 *datas, size_t size ); -LEPT_DLL extern l_int32 fileCopy ( const char *srcfile, const char *newfile ); -LEPT_DLL extern l_int32 fileConcatenate ( const char *srcfile, const char *destfile ); -LEPT_DLL extern l_int32 fileAppendString ( const char *filename, const char *str ); -LEPT_DLL extern l_int32 filesAreIdentical ( const char *fname1, const char *fname2, l_int32 *psame ); -LEPT_DLL extern l_uint16 convertOnLittleEnd16 ( l_uint16 shortin ); -LEPT_DLL extern l_uint16 convertOnBigEnd16 ( l_uint16 shortin ); -LEPT_DLL extern l_uint32 convertOnLittleEnd32 ( l_uint32 wordin ); -LEPT_DLL extern l_uint32 convertOnBigEnd32 ( l_uint32 wordin ); -LEPT_DLL extern FILE * fopenReadStream ( const char *filename ); -LEPT_DLL extern FILE * fopenWriteStream ( const char *filename, const char *modestring ); -LEPT_DLL extern FILE * lept_fopen ( const char *filename, const char *mode ); -LEPT_DLL extern l_int32 lept_fclose ( FILE *fp ); -LEPT_DLL extern void * lept_calloc ( size_t nmemb, size_t size ); -LEPT_DLL extern void lept_free ( void *ptr ); -LEPT_DLL extern l_int32 lept_mkdir ( const char *subdir ); -LEPT_DLL extern l_int32 lept_rmdir ( const char *subdir ); -LEPT_DLL extern l_int32 lept_rm ( const char *subdir, const char *filename ); -LEPT_DLL extern l_int32 lept_mv ( const char *srcfile, const char *newfile ); -LEPT_DLL extern l_int32 lept_cp ( const char *srcfile, const char *newfile ); -LEPT_DLL extern l_int32 splitPathAtDirectory ( const char *pathname, char **pdir, char **ptail ); -LEPT_DLL extern l_int32 splitPathAtExtension ( const char *pathname, char **pbasename, char **pextension ); -LEPT_DLL extern char * pathJoin ( const char *dir, const char *fname ); -LEPT_DLL extern char * genPathname ( const char *dir, const char *fname ); -LEPT_DLL extern char * genTempFilename ( const char *dir, const char *tail, l_int32 usetime, l_int32 usepid ); -LEPT_DLL extern l_int32 extractNumberFromFilename ( const char *fname, l_int32 numpre, l_int32 numpost ); -LEPT_DLL extern l_int32 genRandomIntegerInRange ( l_int32 range, l_int32 seed, l_int32 *pval ); -LEPT_DLL extern char * getLeptonicaVersion ( ); -LEPT_DLL extern void startTimer ( void ); -LEPT_DLL extern l_float32 stopTimer ( void ); -LEPT_DLL extern L_TIMER startTimerNested ( void ); -LEPT_DLL extern l_float32 stopTimerNested ( L_TIMER rusage_start ); -LEPT_DLL extern void l_getCurrentTime ( l_int32 *sec, l_int32 *usec ); -LEPT_DLL extern char * l_getFormattedDate ( ); -LEPT_DLL extern l_uint8 * arrayRead ( const char *fname, l_int32 *pnbytes ); -LEPT_DLL extern l_uint8 * arrayReadStream ( FILE *fp, l_int32 *pnbytes ); -LEPT_DLL extern l_int32 pixHtmlViewer ( const char *dirin, const char *dirout, const char *rootname, l_int32 thumbwidth, l_int32 viewwidth, l_int32 copyorig ); -LEPT_DLL extern PIX * pixSimpleCaptcha ( PIX *pixs, l_int32 border, l_int32 nterms, l_uint32 seed, l_uint32 color, l_int32 cmapflag ); -LEPT_DLL extern PIX * pixRandomHarmonicWarp ( PIX *pixs, l_float32 xmag, l_float32 ymag, l_float32 xfreq, l_float32 yfreq, l_int32 nx, l_int32 ny, l_uint32 seed, l_int32 grayval ); -LEPT_DLL extern PIX * pixWarpStereoscopic ( PIX *pixs, l_int32 zbend, l_int32 zshiftt, l_int32 zshiftb, l_int32 ybendt, l_int32 ybendb, l_int32 redleft ); -LEPT_DLL extern PIX * pixStretchHorizontal ( PIX *pixs, l_int32 dir, l_int32 type, l_int32 hmax, l_int32 operation, l_int32 incolor ); -LEPT_DLL extern PIX * pixStretchHorizontalSampled ( PIX *pixs, l_int32 dir, l_int32 type, l_int32 hmax, l_int32 incolor ); -LEPT_DLL extern PIX * pixStretchHorizontalLI ( PIX *pixs, l_int32 dir, l_int32 type, l_int32 hmax, l_int32 incolor ); -LEPT_DLL extern PIX * pixQuadraticVShear ( PIX *pixs, l_int32 dir, l_int32 vmaxt, l_int32 vmaxb, l_int32 operation, l_int32 incolor ); -LEPT_DLL extern PIX * pixQuadraticVShearSampled ( PIX *pixs, l_int32 dir, l_int32 vmaxt, l_int32 vmaxb, l_int32 incolor ); -LEPT_DLL extern PIX * pixQuadraticVShearLI ( PIX *pixs, l_int32 dir, l_int32 vmaxt, l_int32 vmaxb, l_int32 incolor ); -LEPT_DLL extern PIX * pixStereoFromPair ( PIX *pix1, PIX *pix2, l_float32 rwt, l_float32 gwt, l_float32 bwt ); -LEPT_DLL extern L_WSHED * wshedCreate ( PIX *pixs, PIX *pixm, l_int32 mindepth, l_int32 debugflag ); -LEPT_DLL extern void wshedDestroy ( L_WSHED **pwshed ); -LEPT_DLL extern l_int32 wshedApply ( L_WSHED *wshed ); -LEPT_DLL extern l_int32 wshedBasins ( L_WSHED *wshed, PIXA **ppixa, NUMA **pnalevels ); -LEPT_DLL extern PIX * wshedRenderFill ( L_WSHED *wshed ); -LEPT_DLL extern PIX * wshedRenderColors ( L_WSHED *wshed ); -LEPT_DLL extern PIX * pixReadStreamWebP ( FILE *fp ); -LEPT_DLL extern l_int32 readHeaderWebP ( const char *filename, l_int32 *pwidth, l_int32 *pheight ); -LEPT_DLL extern l_int32 pixWriteWebP ( const char *filename, PIX *pixs, l_int32 quality ); -LEPT_DLL extern l_int32 pixWriteStreamWebP ( FILE *fp, PIX *pixs, l_int32 quality ); -LEPT_DLL extern l_int32 pixWriteWebPwithTargetPSNR ( const char *filename, PIX *pixs, l_float64 target_psnr, l_int32 *pquality ); -LEPT_DLL extern l_int32 pixaWriteFiles ( const char *rootname, PIXA *pixa, l_int32 format ); -LEPT_DLL extern l_int32 pixWrite ( const char *filename, PIX *pix, l_int32 format ); -LEPT_DLL extern l_int32 pixWriteStream ( FILE *fp, PIX *pix, l_int32 format ); -LEPT_DLL extern l_int32 pixWriteImpliedFormat ( const char *filename, PIX *pix, l_int32 quality, l_int32 progressive ); -LEPT_DLL extern l_int32 pixWriteTempfile ( const char *dir, const char *tail, PIX *pix, l_int32 format, char **pfilename ); -LEPT_DLL extern l_int32 pixChooseOutputFormat ( PIX *pix ); -LEPT_DLL extern l_int32 getImpliedFileFormat ( const char *filename ); -LEPT_DLL extern const char * getFormatExtension ( l_int32 format ); -LEPT_DLL extern l_int32 pixWriteMem ( l_uint8 **pdata, size_t *psize, PIX *pix, l_int32 format ); -LEPT_DLL extern l_int32 pixDisplay ( PIX *pixs, l_int32 x, l_int32 y ); -LEPT_DLL extern l_int32 pixDisplayWithTitle ( PIX *pixs, l_int32 x, l_int32 y, const char *title, l_int32 dispflag ); -LEPT_DLL extern l_int32 pixDisplayMultiple ( const char *filepattern ); -LEPT_DLL extern l_int32 pixDisplayWrite ( PIX *pixs, l_int32 reduction ); -LEPT_DLL extern l_int32 pixDisplayWriteFormat ( PIX *pixs, l_int32 reduction, l_int32 format ); -LEPT_DLL extern l_int32 pixSaveTiled ( PIX *pixs, PIXA *pixa, l_int32 reduction, l_int32 newrow, l_int32 space, l_int32 dp ); -LEPT_DLL extern l_int32 pixSaveTiledOutline ( PIX *pixs, PIXA *pixa, l_int32 reduction, l_int32 newrow, l_int32 space, l_int32 linewidth, l_int32 dp ); -LEPT_DLL extern l_int32 pixSaveTiledWithText ( PIX *pixs, PIXA *pixa, l_int32 outwidth, l_int32 newrow, l_int32 space, l_int32 linewidth, L_BMF *bmf, const char *textstr, l_uint32 val, l_int32 location ); -LEPT_DLL extern void l_chooseDisplayProg ( l_int32 selection ); -LEPT_DLL extern l_uint8 * zlibCompress ( l_uint8 *datain, size_t nin, size_t *pnout ); -LEPT_DLL extern l_uint8 * zlibUncompress ( l_uint8 *datain, size_t nin, size_t *pnout ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/leptwin.h b/iOS/OCRPlugin/dependencies/include/leptonica/leptwin.h deleted file mode 100644 index a3066b8c..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/leptwin.h +++ /dev/null @@ -1,34 +0,0 @@ -/*====================================================================* - - Copyright (C) 2010 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifdef _WIN32 -#ifndef LEPTONICA_LEPTWIN_H -#define LEPTONICA_LEPTWIN_H - -#include "allheaders.h" -#include - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -LEPT_DLL extern HBITMAP pixGetWindowsHBITMAP( PIX *pixs ); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* LEPTONICA_LEPTWIN_H */ -#endif /* _WIN32 */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/list.h b/iOS/OCRPlugin/dependencies/include/leptonica/list.h deleted file mode 100644 index 6adf2c50..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/list.h +++ /dev/null @@ -1,76 +0,0 @@ - -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_LIST_H -#define LEPTONICA_LIST_H - -/* - * list.h - * - * Cell for double-linked lists - * - * This allows composition of a list of cells with - * prev, next and data pointers. Generic data - * structures hang on the list cell data pointers. - * - * The list is not circular because that would add much - * complexity in traversing the list under general - * conditions where list cells can be added and removed. - * The only disadvantage of not having the head point to - * the last cell is that the list must be traversed to - * find its tail. However, this traversal is fast, and - * the listRemoveFromTail() function updates the tail - * so there is no searching overhead with repeated use. - * - * The list macros are used to run through a list, and their - * use is encouraged. They are invoked, e.g., as - * - * DLLIST *head, *elem; - * ... - * L_BEGIN_LIST_FORWARD(head, elem) - * data > - * L_END_LIST - * - */ - -struct DoubleLinkedList -{ - struct DoubleLinkedList *prev; - struct DoubleLinkedList *next; - void *data; -}; -typedef struct DoubleLinkedList DLLIST; - - - /* Simple list traverse macros */ -#define L_BEGIN_LIST_FORWARD(head, element) \ - { \ - DLLIST *_leptvar_nextelem_; \ - for ((element) = (head); (element); (element) = _leptvar_nextelem_) { \ - _leptvar_nextelem_ = (element)->next; - - -#define L_BEGIN_LIST_REVERSE(tail, element) \ - { \ - DLLIST *_leptvar_prevelem_; \ - for ((element) = (tail); (element); (element) = _leptvar_prevelem_) { \ - _leptvar_prevelem_ = (element)->prev; - - -#define L_END_LIST }} - - -#endif /* LEPTONICA_LIST_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/morph.h b/iOS/OCRPlugin/dependencies/include/leptonica/morph.h deleted file mode 100644 index cf4a4e52..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/morph.h +++ /dev/null @@ -1,218 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_MORPH_H -#define LEPTONICA_MORPH_H - -/* - * morph.h - * - * Contains the following structs: - * struct Sel - * struct Sela - * struct Kernel - * - * Contains definitions for: - * morphological b.c. flags - * structuring element types - * runlength flags for granulometry - * direction flags for grayscale morphology - * morphological operation flags - * standard border size - * grayscale intensity scaling flags - * morphological tophat flags - * arithmetic and logical operator flags - * grayscale morphology selection flags - * distance function b.c. flags - * image comparison flags - * color content flags - */ - -/*-------------------------------------------------------------------------* - * Sel and Sel array * - *-------------------------------------------------------------------------*/ -#define SEL_VERSION_NUMBER 1 - -struct Sel -{ - l_int32 sy; /* sel height */ - l_int32 sx; /* sel width */ - l_int32 cy; /* y location of sel origin */ - l_int32 cx; /* x location of sel origin */ - l_int32 **data; /* {0,1,2}; data[i][j] in [row][col] order */ - char *name; /* used to find sel by name */ -}; -typedef struct Sel SEL; - -struct Sela -{ - l_int32 n; /* number of sel actually stored */ - l_int32 nalloc; /* size of allocated ptr array */ - struct Sel **sel; /* sel ptr array */ -}; -typedef struct Sela SELA; - - -/*-------------------------------------------------------------------------* - * Kernel * - *-------------------------------------------------------------------------*/ -#define KERNEL_VERSION_NUMBER 2 - -struct L_Kernel -{ - l_int32 sy; /* kernel height */ - l_int32 sx; /* kernel width */ - l_int32 cy; /* y location of kernel origin */ - l_int32 cx; /* x location of kernel origin */ - l_float32 **data; /* data[i][j] in [row][col] order */ -}; -typedef struct L_Kernel L_KERNEL; - - -/*-------------------------------------------------------------------------* - * Morphological boundary condition flags * - * - * Two types of boundary condition for erosion. - * The global variable MORPH_BC takes on one of these two values. - * See notes in morph.c for usage. - *-------------------------------------------------------------------------*/ -enum { - SYMMETRIC_MORPH_BC = 0, - ASYMMETRIC_MORPH_BC = 1 -}; - - -/*-------------------------------------------------------------------------* - * Structuring element types * - *-------------------------------------------------------------------------*/ -enum { - SEL_DONT_CARE = 0, - SEL_HIT = 1, - SEL_MISS = 2 -}; - - -/*-------------------------------------------------------------------------* - * Runlength flags for granulometry * - *-------------------------------------------------------------------------*/ -enum { - L_RUN_OFF = 0, - L_RUN_ON = 1 -}; - - -/*-------------------------------------------------------------------------* - * Direction flags for grayscale morphology, granulometry, * - * composable Sels, and convolution * - *-------------------------------------------------------------------------*/ -enum { - L_HORIZ = 1, - L_VERT = 2, - L_BOTH_DIRECTIONS = 3 -}; - - -/*-------------------------------------------------------------------------* - * Morphological operation flags * - *-------------------------------------------------------------------------*/ -enum { - L_MORPH_DILATE = 1, - L_MORPH_ERODE = 2, - L_MORPH_OPEN = 3, - L_MORPH_CLOSE = 4, - L_MORPH_HMT = 5 -}; - - -/*-------------------------------------------------------------------------* - * Grayscale intensity scaling flags * - *-------------------------------------------------------------------------*/ -enum { - L_LINEAR_SCALE = 1, - L_LOG_SCALE = 2 -}; - - -/*-------------------------------------------------------------------------* - * Morphological tophat flags * - *-------------------------------------------------------------------------*/ -enum { - L_TOPHAT_WHITE = 0, - L_TOPHAT_BLACK = 1 -}; - - -/*-------------------------------------------------------------------------* - * Arithmetic and logical operator flags * - * (use on grayscale images and Numas) * - *-------------------------------------------------------------------------*/ -enum { - L_ARITH_ADD = 1, - L_ARITH_SUBTRACT = 2, - L_ARITH_MULTIPLY = 3, /* on numas only */ - L_ARITH_DIVIDE = 4, /* on numas only */ - L_UNION = 5, /* on numas only */ - L_INTERSECTION = 6, /* on numas only */ - L_SUBTRACTION = 7, /* on numas only */ - L_EXCLUSIVE_OR = 8 /* on numas only */ -}; - - -/*-------------------------------------------------------------------------* - * Min/max selection flags * - *-------------------------------------------------------------------------*/ -enum { - L_CHOOSE_MIN = 1, /* useful in a downscaling "erosion" */ - L_CHOOSE_MAX = 2, /* useful in a downscaling "dilation" */ - L_CHOOSE_MAX_MIN_DIFF = 3 /* useful in a downscaling contrast */ -}; - - -/*-------------------------------------------------------------------------* - * Distance function b.c. flags * - *-------------------------------------------------------------------------*/ -enum { - L_BOUNDARY_BG = 1, /* assume bg outside image */ - L_BOUNDARY_FG = 2 /* assume fg outside image */ -}; - - -/*-------------------------------------------------------------------------* - * Image comparison flags * - *-------------------------------------------------------------------------*/ -enum { - L_COMPARE_XOR = 1, - L_COMPARE_SUBTRACT = 2, - L_COMPARE_ABS_DIFF = 3 -}; - - -/*-------------------------------------------------------------------------* - * Color content flags * - *-------------------------------------------------------------------------*/ -enum { - L_MAX_DIFF_FROM_AVERAGE_2 = 1, - L_MAX_MIN_DIFF_FROM_2 = 2, - L_MAX_DIFF = 3 -}; - - -/*-------------------------------------------------------------------------* - * Standard size of border added around images for special processing * - *-------------------------------------------------------------------------*/ -static const l_int32 ADDED_BORDER = 32; /* pixels, not bits */ - - -#endif /* LEPTONICA_MORPH_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/pix.h b/iOS/OCRPlugin/dependencies/include/leptonica/pix.h deleted file mode 100644 index b59028fd..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/pix.h +++ /dev/null @@ -1,945 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_PIX_H -#define LEPTONICA_PIX_H - -/* - * pix.h - * - * Contains the following structures: - * struct Pix - * struct PixColormap - * struct RGBA_Quad - * struct Pixa - * struct Pixaa - * struct Box - * struct Boxa - * struct Boxaa - * struct Pta - * struct Ptaa - * struct Pixacc - * struct PixTiling - * struct FPix - * struct FPixa - * struct DPix - * struct PixComp - * struct PixaComp - * - * Contains definitions for: - * Colors for RGB - * Perceptual color weights - * Colormap conversion flags - * Rasterop bit flags - * Structure access flags (for insert, copy, clone, copy-clone) - * Sorting flags (by type and direction) - * Blending flags - * Graphics pixel setting flags - * Size filtering flags - * Color component selection flags - * Rotation and shear flags - * Affine transform order flags - * Grayscale filling flags - * Flags for setting to white or black - * Dithering flags - * Distance flags - * Statistical measures - * Set selection flags - * Text orientation flags - * Edge orientation flags - * Line orientation flags - * Scan direction flags - * Horizontal warp - * Pixel selection for resampling - * Thinning flags - * Runlength flags - * Edge filter flags - * Handling negative values in conversion to unsigned int - * Subpixel color component ordering in LCD display - * Relative to zero flags - * HSV histogram flags - * Region flags (inclusion, exclusion) - * Flags for adding text to a pix - * Flags for selecting display program - */ - - -/*-------------------------------------------------------------------------* - * Basic Pix * - *-------------------------------------------------------------------------*/ -struct Pix -{ - l_uint32 w; /* width in pixels */ - l_uint32 h; /* height in pixels */ - l_uint32 d; /* depth in bits */ - l_uint32 wpl; /* 32-bit words/line */ - l_uint32 refcount; /* reference count (1 if no clones) */ - l_int32 xres; /* image res (ppi) in x direction */ - /* (use 0 if unknown) */ - l_int32 yres; /* image res (ppi) in y direction */ - /* (use 0 if unknown) */ - l_int32 informat; /* input file format, IFF_* */ - char *text; /* text string associated with pix */ - struct PixColormap *colormap; /* colormap (may be null) */ - l_uint32 *data; /* the image data */ -}; -typedef struct Pix PIX; - - -struct PixColormap -{ - void *array; /* colormap table (array of RGBA_QUAD) */ - l_int32 depth; /* of pix (1, 2, 4 or 8 bpp) */ - l_int32 nalloc; /* number of color entries allocated */ - l_int32 n; /* number of color entries used */ -}; -typedef struct PixColormap PIXCMAP; - - - /* Colormap table entry (after the BMP version). - * Note that the BMP format stores the colormap table exactly - * as it appears here, with color samples being stored sequentially, - * in the order (b,g,r,a). */ -struct RGBA_Quad -{ - l_uint8 blue; - l_uint8 green; - l_uint8 red; - l_uint8 reserved; -}; -typedef struct RGBA_Quad RGBA_QUAD; - - - -/*-------------------------------------------------------------------------* - * Colors for 32 bpp * - *-------------------------------------------------------------------------*/ -/* Notes: - * (1) These are the byte indices for colors in 32 bpp images. - * They are used through the GET/SET_DATA_BYTE accessors. - * The 4th byte, typically known as the "alpha channel" and used - * for blending, is not explicitly used in leptonica. - * (2) If you redefine these values, functions that have the shifts - * hardcoded (instead of using the constants below) will break. - * These functions are labelled with "***" next to their names - * at the top of the files in which they are defined. - * Advice: Do not change these values! - * (3) The shifts to extract the red, green and blue components - * from a 32 bit pixel are defined in terms of these colors. - */ -enum { - COLOR_RED = 0, - COLOR_GREEN = 1, - COLOR_BLUE = 2, - L_ALPHA_CHANNEL = 3 -}; - -static const l_int32 L_RED_SHIFT = - 8 * (sizeof(l_uint32) - 1 - COLOR_RED); /* 24 */ -static const l_int32 L_GREEN_SHIFT = - 8 * (sizeof(l_uint32) - 1 - COLOR_GREEN); /* 16 */ -static const l_int32 L_BLUE_SHIFT = - 8 * (sizeof(l_uint32) - 1 - COLOR_BLUE); /* 8 */ -static const l_int32 L_ALPHA_SHIFT = - 8 * (sizeof(l_uint32) - 1 - L_ALPHA_CHANNEL); /* 0 */ - - -/*-------------------------------------------------------------------------* - * Perceptual color weights * - *-------------------------------------------------------------------------*/ -/* Notes: - * (1) These numbers are ad-hoc, but they do add up to 1. - * Unlike, for example, the weighting factor for conversion - * of RGB to luminance, or more specifically to Y in the - * YUV colorspace. Those numbers come from the - * International Telecommunications Union, via ITU-R. - */ -static const l_float32 L_RED_WEIGHT = 0.3; -static const l_float32 L_GREEN_WEIGHT = 0.5; -static const l_float32 L_BLUE_WEIGHT = 0.2; - - -/*-------------------------------------------------------------------------* - * Flags for colormap conversion * - *-------------------------------------------------------------------------*/ -enum { - REMOVE_CMAP_TO_BINARY = 0, - REMOVE_CMAP_TO_GRAYSCALE = 1, - REMOVE_CMAP_TO_FULL_COLOR = 2, - REMOVE_CMAP_BASED_ON_SRC = 3 -}; - - -/*-------------------------------------------------------------------------* - * - * The following operation bit flags have been modified from - * Sun's pixrect.h. - * - * The 'op' in 'rasterop' is represented by an integer - * composed with Boolean functions using the set of five integers - * given below. The integers, and the op codes resulting from - * boolean expressions on them, need only be in the range from 0 to 15. - * The function is applied on a per-pixel basis. - * - * Examples: the op code representing ORing the src and dest - * is computed using the bit OR, as PIX_SRC | PIX_DST; the op - * code representing XORing src and dest is found from - * PIX_SRC ^ PIX_DST; the op code representing ANDing src and dest - * is found from PIX_SRC & PIX_DST. Note that - * PIX_NOT(PIX_CLR) = PIX_SET, and v.v., as they must be. - * - * We would like to use the following set of definitions: - * - * #define PIX_SRC 0xc - * #define PIX_DST 0xa - * #define PIX_NOT(op) ((op) ^ 0xf) - * #define PIX_CLR 0x0 - * #define PIX_SET 0xf - * - * Now, these definitions differ from Sun's, in that Sun - * left-shifted each value by 1 pixel, and used the least - * significant bit as a flag for the "pseudo-operation" of - * clipping. We don't need this bit, because it is both - * efficient and safe ALWAYS to clip the rectangles to the src - * and dest images, which is what we do. See the notes in rop.h - * on the general choice of these bit flags. - * - * However, if you include Sun's xview package, you will get their - * definitions, and because I like using these flags, we will - * adopt the original Sun definitions to avoid redefinition conflicts. - * - * Then we have, for reference, the following 16 unique op flags: - * - * PIX_CLR 00000 0x0 - * PIX_SET 11110 0x1e - * PIX_SRC 11000 0x18 - * PIX_DST 10100 0x14 - * PIX_NOT(PIX_SRC) 00110 0x06 - * PIX_NOT(PIX_DST) 01010 0x0a - * PIX_SRC | PIX_DST 11100 0x1c - * PIX_SRC & PIX_DST 10000 0x10 - * PIX_SRC ^ PIX_DST 01100 0x0c - * PIX_NOT(PIX_SRC) | PIX_DST 10110 0x16 - * PIX_NOT(PIX_SRC) & PIX_DST 00100 0x04 - * PIX_SRC | PIX_NOT(PIX_DST) 11010 0x1a - * PIX_SRC & PIX_NOT(PIX_DST) 01000 0x08 - * PIX_NOT(PIX_SRC | PIX_DST) 00010 0x02 - * PIX_NOT(PIX_SRC & PIX_DST) 01110 0x0e - * PIX_NOT(PIX_SRC ^ PIX_DST) 10010 0x12 - * - *-------------------------------------------------------------------------*/ -#define PIX_SRC (0xc << 1) -#define PIX_DST (0xa << 1) -#define PIX_NOT(op) ((op) ^ 0x1e) -#define PIX_CLR (0x0 << 1) -#define PIX_SET (0xf << 1) - -#define PIX_PAINT (PIX_SRC | PIX_DST) -#define PIX_MASK (PIX_SRC & PIX_DST) -#define PIX_SUBTRACT (PIX_DST & PIX_NOT(PIX_SRC)) -#define PIX_XOR (PIX_SRC ^ PIX_DST) - - -/*-------------------------------------------------------------------------* - * - * Important Notes: - * - * (1) The image data is stored in a single contiguous - * array of l_uint32, into which the pixels are packed. - * By "packed" we mean that there are no unused bits - * between pixels, except for end-of-line padding to - * satisfy item (2) below. - * - * (2) Every image raster line begins on a 32-bit word - * boundary within this array. - * - * (3) Pix image data is stored in 32-bit units, with the - * pixels ordered from left to right in the image being - * stored in order from the MSB to LSB within the word, - * for both big-endian and little-endian machines. - * This is the natural ordering for big-endian machines, - * as successive bytes are stored and fetched progressively - * to the right. However, for little-endians, when storing - * we re-order the bytes from this byte stream order, and - * reshuffle again for byte access on 32-bit entities. - * So if the bytes come in sequence from left to right, we - * store them on little-endians in byte order: - * 3 2 1 0 7 6 5 4 ... - * This MSB to LSB ordering allows left and right shift - * operations on 32 bit words to move the pixels properly. - * - * (4) For 24-bit color images, use 32 bpp data, leaving - * the fourth byte unused. Within each 4 byte pixel, the - * colors are ordered from MSB to LSB, as follows: - * - * | MSB | 2nd MSB | 3rd MSB | LSB | - * red green blue unused - * 0 1 2 3 (big-endian) - * 3 2 1 0 (little-endian) - * - * Because we use MSB to LSB ordering within the 32-bit word, - * the individual 8-bit samples can be accessed with - * GET_DATA_BYTE and SET_DATA_BYTE macros, using the - * (implicitly big-ending) ordering - * red: byte 0 (MSB) - * green: byte 1 (2nd MSB) - * blue: byte 2 (3rd MSB) - * - * This specific color assignment is made in this file, - * through the definitions of COLOR_RED, etc. Then the R, G - * and B sample values can be retrieved using - * redval = GET_DATA_BYTE(&pixel, COLOR_RED); - * greenval = GET_DATA_BYTE(&pixel, COLOR_GREEN); - * blueval = GET_DATA_BYTE(&pixel, COLOR_BLUE); - * and they can be set with - * SET_DATA_BYTE(&pixel, COLOR_RED, redval); - * SET_DATA_BYTE(&pixel, COLOR_GREEN, greenval); - * SET_DATA_BYTE(&pixel, COLOR_BLUE, blueval); - * - * For extra speed we extract the R, G and B colors directly - * by shifting and masking, explicitly using the values in - * L_RED_SHIFT, L_GREEN_SHIFT and L_BLUE_SHIFT: - * (pixel32 >> L_RED_SHIFT) & 0xff; (red) - * (pixel32 >> L_GREEN_SHIFT) & 0xff; (green) - * (pixel32 >> L_BLUE_SHIFT) & 0xff; (blue) - * All these operations work properly on both big- and little-endians. - * - * For a few situations, these color shift values are hard-coded. - * Changing the RGB color component ordering through the assignments - * in this file will cause functions marked with "***" to fail. - * - * (5) A reference count is held within each pix, giving the - * number of ptrs to the pix. When a pixClone() call - * is made, the ref count is increased by 1, and - * when a pixDestroy() call is made, the reference count - * of the pix is decremented. The pix is only destroyed - * when the reference count goes to zero. - * - * (6) The version numbers (below) are used in the serialization - * of these data structures. They are placed in the files, - * and rarely (if ever) change. Provision is currently made for - * backward compatibility in reading from boxaa version 2. - * - * (7) The serialization dependencies are as follows: - * pixaa : pixa : boxa - * boxaa : boxa - * So, for example, pixaa and boxaa can be changed without - * forcing a change in pixa or boxa. However, if pixa is - * changed, it forces a change in pixaa, and if boxa is - * changed, if forces a change in the other three. - * We define four version numbers: - * PIXAA_VERSION_NUMBER - * PIXA_VERSION_NUMBER - * BOXAA_VERSION_NUMBER - * BOXA_VERSION_NUMBER - * - *-------------------------------------------------------------------------*/ - - - -/*-------------------------------------------------------------------------* - * Array of pix * - *-------------------------------------------------------------------------*/ - - /* Serialization for primary data structures */ -#define PIXAA_VERSION_NUMBER 2 -#define PIXA_VERSION_NUMBER 2 -#define BOXA_VERSION_NUMBER 2 -#define BOXAA_VERSION_NUMBER 3 - - -struct Pixa -{ - l_int32 n; /* number of Pix in ptr array */ - l_int32 nalloc; /* number of Pix ptrs allocated */ - l_uint32 refcount; /* reference count (1 if no clones) */ - struct Pix **pix; /* the array of ptrs to pix */ - struct Boxa *boxa; /* array of boxes */ -}; -typedef struct Pixa PIXA; - - -struct Pixaa -{ - l_int32 n; /* number of Pixa in ptr array */ - l_int32 nalloc; /* number of Pixa ptrs allocated */ - struct Pixa **pixa; /* array of ptrs to pixa */ - struct Boxa *boxa; /* array of boxes */ -}; -typedef struct Pixaa PIXAA; - - -/*-------------------------------------------------------------------------* - * Basic rectangle and rectangle arrays * - *-------------------------------------------------------------------------*/ -struct Box -{ - l_int32 x; - l_int32 y; - l_int32 w; - l_int32 h; - l_uint32 refcount; /* reference count (1 if no clones) */ - -}; -typedef struct Box BOX; - -struct Boxa -{ - l_int32 n; /* number of box in ptr array */ - l_int32 nalloc; /* number of box ptrs allocated */ - l_uint32 refcount; /* reference count (1 if no clones) */ - struct Box **box; /* box ptr array */ -}; -typedef struct Boxa BOXA; - -struct Boxaa -{ - l_int32 n; /* number of boxa in ptr array */ - l_int32 nalloc; /* number of boxa ptrs allocated */ - struct Boxa **boxa; /* boxa ptr array */ -}; -typedef struct Boxaa BOXAA; - - -/*-------------------------------------------------------------------------* - * Array of points * - *-------------------------------------------------------------------------*/ -#define PTA_VERSION_NUMBER 1 - -struct Pta -{ - l_int32 n; /* actual number of pts */ - l_int32 nalloc; /* size of allocated arrays */ - l_int32 refcount; /* reference count (1 if no clones) */ - l_float32 *x, *y; /* arrays of floats */ -}; -typedef struct Pta PTA; - - -/*-------------------------------------------------------------------------* - * Array of Pta * - *-------------------------------------------------------------------------*/ -struct Ptaa -{ - l_int32 n; /* number of pta in ptr array */ - l_int32 nalloc; /* number of pta ptrs allocated */ - struct Pta **pta; /* pta ptr array */ -}; -typedef struct Ptaa PTAA; - - -/*-------------------------------------------------------------------------* - * Pix accumulator container * - *-------------------------------------------------------------------------*/ -struct Pixacc -{ - l_int32 w; /* array width */ - l_int32 h; /* array height */ - l_int32 offset; /* used to allow negative */ - /* intermediate results */ - struct Pix *pix; /* the 32 bit accumulator pix */ -}; -typedef struct Pixacc PIXACC; - - -/*-------------------------------------------------------------------------* - * Pix tiling * - *-------------------------------------------------------------------------*/ -struct PixTiling -{ - struct Pix *pix; /* input pix (a clone) */ - l_int32 nx; /* number of tiles horizontally */ - l_int32 ny; /* number of tiles vertically */ - l_int32 w; /* tile width */ - l_int32 h; /* tile height */ - l_int32 xoverlap; /* overlap on left and right */ - l_int32 yoverlap; /* overlap on top and bottom */ - l_int32 strip; /* strip for paint; default is TRUE */ -}; -typedef struct PixTiling PIXTILING; - - -/*-------------------------------------------------------------------------* - * FPix: pix with float array * - *-------------------------------------------------------------------------*/ -#define FPIX_VERSION_NUMBER 1 - -struct FPix -{ - l_int32 w; /* width in pixels */ - l_int32 h; /* height in pixels */ - l_int32 wpl; /* 32-bit words/line */ - l_int32 refcount; /* reference count (1 if no clones) */ - l_int32 xres; /* image res (ppi) in x direction */ - /* (use 0 if unknown) */ - l_int32 yres; /* image res (ppi) in y direction */ - /* (use 0 if unknown) */ - l_float32 *data; /* the float image data */ -}; -typedef struct FPix FPIX; - - -struct FPixa -{ - l_int32 n; /* number of Pix in ptr array */ - l_int32 nalloc; /* number of Pix ptrs allocated */ - l_uint32 refcount; /* reference count (1 if no clones) */ - struct FPix **fpix; /* the array of ptrs to fpix */ -}; -typedef struct FPixa FPIXA; - - -/*-------------------------------------------------------------------------* - * DPix: pix with double array * - *-------------------------------------------------------------------------*/ -#define DPIX_VERSION_NUMBER 1 - -struct DPix -{ - l_int32 w; /* width in pixels */ - l_int32 h; /* height in pixels */ - l_int32 wpl; /* 32-bit words/line */ - l_int32 refcount; /* reference count (1 if no clones) */ - l_int32 xres; /* image res (ppi) in x direction */ - /* (use 0 if unknown) */ - l_int32 yres; /* image res (ppi) in y direction */ - /* (use 0 if unknown) */ - l_float64 *data; /* the double image data */ -}; -typedef struct DPix DPIX; - - -/*-------------------------------------------------------------------------* - * PixComp: compressed pix * - *-------------------------------------------------------------------------*/ -struct PixComp -{ - l_int32 w; /* width in pixels */ - l_int32 h; /* height in pixels */ - l_int32 d; /* depth in bits */ - l_int32 xres; /* image res (ppi) in x direction */ - /* (use 0 if unknown) */ - l_int32 yres; /* image res (ppi) in y direction */ - /* (use 0 if unknown) */ - l_int32 comptype; /* compressed format (IFF_TIFF_G4, */ - /* IFF_PNG, IFF_JFIF_JPEG) */ - char *text; /* text string associated with pix */ - l_int32 cmapflag; /* flag (1 for cmap, 0 otherwise) */ - l_uint8 *data; /* the compressed image data */ - size_t size; /* size of the data array */ -}; -typedef struct PixComp PIXC; - - -/*-------------------------------------------------------------------------* - * PixaComp: array of compressed pix * - *-------------------------------------------------------------------------*/ -#define PIXACOMP_VERSION_NUMBER 1 - -struct PixaComp -{ - l_int32 n; /* number of PixComp in ptr array */ - l_int32 nalloc; /* number of PixComp ptrs allocated */ - struct PixComp **pixc; /* the array of ptrs to PixComp */ - struct Boxa *boxa; /* array of boxes */ -}; -typedef struct PixaComp PIXAC; - - -/*-------------------------------------------------------------------------* - * Access and storage flags * - *-------------------------------------------------------------------------*/ -/* - * For Pix, Box, Pta and Numa, there are 3 standard methods for handling - * the retrieval or insertion of a struct: - * (1) direct insertion (Don't do this if there is another handle - * somewhere to this same struct!) - * (2) copy (Always safe, sets up a refcount of 1 on the new object. - * Can be undesirable if very large, such as an image or - * an array of images.) - * (3) clone (Makes another handle to the same struct, and bumps the - * refcount up by 1. Safe to do unless you're changing - * data through one of the handles but don't want those - * changes to be seen by the other handle.) - * - * For Pixa and Boxa, which are structs that hold an array of clonable - * structs, there is an additional method: - * (4) copy-clone (Makes a new higher-level struct with a refcount - * of 1, but clones all the structs in the array.) - * - * Unlike the other structs, when retrieving a string from an Sarray, - * you are allowed to get a handle without a copy or clone (i.e., that - * you don't own!). You must not free or insert such a string! - * Specifically, for an Sarray, the copyflag for retrieval is either: - * TRUE (or 1 or L_COPY) - * or - * FALSE (or 0 or L_NOCOPY) - * For insertion, the copyflag is either: - * TRUE (or 1 or L_COPY) - * or - * FALSE (or 0 or L_INSERT) - * Note that L_COPY is always 1, and L_INSERT and L_NOCOPY are always 0. - */ -enum { - L_INSERT = 0, /* stuff it in; no copy, clone or copy-clone */ - L_COPY = 1, /* make/use a copy of the object */ - L_CLONE = 2, /* make/use clone (ref count) of the object */ - L_COPY_CLONE = 3 /* make a new object and fill with with clones */ - /* of each object in the array(s) */ -}; -static const l_int32 L_NOCOPY = 0; /* copyflag value in sarrayGetString() */ - - -/*--------------------------------------------------------------------------* - * Sort flags * - *--------------------------------------------------------------------------*/ -enum { - L_SORT_INCREASING = 1, /* sort in increasing order */ - L_SORT_DECREASING = 2 /* sort in decreasing order */ -}; - -enum { - L_SORT_BY_X = 3, /* sort box or c.c. by horiz location */ - L_SORT_BY_Y = 4, /* sort box or c.c. by vert location */ - L_SORT_BY_WIDTH = 5, /* sort box or c.c. by width */ - L_SORT_BY_HEIGHT = 6, /* sort box or c.c. by height */ - L_SORT_BY_MIN_DIMENSION = 7, /* sort box or c.c. by min dimension */ - L_SORT_BY_MAX_DIMENSION = 8, /* sort box or c.c. by max dimension */ - L_SORT_BY_PERIMETER = 9, /* sort box or c.c. by perimeter */ - L_SORT_BY_AREA = 10, /* sort box or c.c. by area */ - L_SORT_BY_ASPECT_RATIO = 11 /* sort box or c.c. by width/height ratio */ -}; - - -/*-------------------------------------------------------------------------* - * Blend flags * - *-------------------------------------------------------------------------*/ -enum { - L_BLEND_WITH_INVERSE = 1, /* add some of src inverse to itself */ - L_BLEND_TO_WHITE = 2, /* shift src colors towards white */ - L_BLEND_TO_BLACK = 3, /* shift src colors towards black */ - L_BLEND_GRAY = 4, /* blend src directly with blender */ - L_BLEND_GRAY_WITH_INVERSE = 5 /* add amount of src inverse to itself, */ - /* based on blender pix value */ -}; - -enum { - L_PAINT_LIGHT = 1, /* colorize non-black pixels */ - L_PAINT_DARK = 2 /* colorize non-white pixels */ -}; - - -/*-------------------------------------------------------------------------* - * Graphics pixel setting * - *-------------------------------------------------------------------------*/ -enum { - L_SET_PIXELS = 1, /* set all bits in each pixel to 1 */ - L_CLEAR_PIXELS = 2, /* set all bits in each pixel to 0 */ - L_FLIP_PIXELS = 3 /* flip all bits in each pixel */ -}; - - -/*-------------------------------------------------------------------------* - * Size filter flags * - *-------------------------------------------------------------------------*/ -enum { - L_SELECT_WIDTH = 1, /* width must satisfy constraint */ - L_SELECT_HEIGHT = 2, /* height must satisfy constraint */ - L_SELECT_IF_EITHER = 3, /* either width or height can satisfy */ - L_SELECT_IF_BOTH = 4 /* both width and height must satisfy */ -}; - -enum { - L_SELECT_IF_LT = 1, /* save if value is less than threshold */ - L_SELECT_IF_GT = 2, /* save if value is more than threshold */ - L_SELECT_IF_LTE = 3, /* save if value is <= to the threshold */ - L_SELECT_IF_GTE = 4 /* save if value is >= to the threshold */ -}; - - -/*-------------------------------------------------------------------------* - * Color component selection flags * - *-------------------------------------------------------------------------*/ -enum { - L_SELECT_RED = 1, /* use red component */ - L_SELECT_GREEN = 2, /* use green component */ - L_SELECT_BLUE = 3, /* use blue component */ - L_SELECT_MIN = 4, /* use min color component */ - L_SELECT_MAX = 5 /* use max color component */ -}; - - -/*-------------------------------------------------------------------------* - * Rotate and shear flags * - *-------------------------------------------------------------------------*/ -enum { - L_ROTATE_AREA_MAP = 1, /* use area map rotation, if possible */ - L_ROTATE_SHEAR = 2, /* use shear rotation */ - L_ROTATE_SAMPLING = 3 /* use sampling */ -}; - -enum { - L_BRING_IN_WHITE = 1, /* bring in white pixels from the outside */ - L_BRING_IN_BLACK = 2 /* bring in black pixels from the outside */ -}; - -enum { - L_SHEAR_ABOUT_CORNER = 1, /* shear image about UL corner */ - L_SHEAR_ABOUT_CENTER = 2 /* shear image about center */ -}; - - -/*-------------------------------------------------------------------------* - * Affine transform order flags * - *-------------------------------------------------------------------------*/ -enum { - L_TR_SC_RO = 1, /* translate, scale, rotate */ - L_SC_RO_TR = 2, /* scale, rotate, translate */ - L_RO_TR_SC = 3, /* rotate, translate, scale */ - L_TR_RO_SC = 4, /* translate, rotate, scale */ - L_RO_SC_TR = 5, /* rotate, scale, translate */ - L_SC_TR_RO = 6 /* scale, translate, rotate */ -}; - - -/*-------------------------------------------------------------------------* - * Grayscale filling flags * - *-------------------------------------------------------------------------*/ -enum { - L_FILL_WHITE = 1, /* fill white pixels (e.g, in fg map) */ - L_FILL_BLACK = 2 /* fill black pixels (e.g., in bg map) */ -}; - - -/*-------------------------------------------------------------------------* - * Flags for setting to white or black * - *-------------------------------------------------------------------------*/ -enum { - L_SET_WHITE = 1, /* set pixels to white */ - L_SET_BLACK = 2 /* set pixels to black */ -}; - - -/*-------------------------------------------------------------------------* - * Dither parameters * - * If within this grayscale distance from black or white, * - * do not propagate excess or deficit to neighboring pixels. * - *-------------------------------------------------------------------------*/ -enum { - DEFAULT_CLIP_LOWER_1 = 10, /* dist to black with no prop; 1 bpp */ - DEFAULT_CLIP_UPPER_1 = 10, /* dist to black with no prop; 1 bpp */ - DEFAULT_CLIP_LOWER_2 = 5, /* dist to black with no prop; 2 bpp */ - DEFAULT_CLIP_UPPER_2 = 5 /* dist to black with no prop; 2 bpp */ -}; - - -/*-------------------------------------------------------------------------* - * Distance flags * - *-------------------------------------------------------------------------*/ -enum { - L_MANHATTAN_DISTANCE = 1, /* L1 distance (e.g., in color space) */ - L_EUCLIDEAN_DISTANCE = 2 /* L2 distance */ -}; - - -/*-------------------------------------------------------------------------* - * Statistical measures * - *-------------------------------------------------------------------------*/ -enum { - L_MEAN_ABSVAL = 1, /* average of abs values */ - L_MEDIAN_VAL = 2, /* median value of set */ - L_MODE_VAL = 3, /* mode value of set */ - L_MODE_COUNT = 4, /* mode count of set */ - L_ROOT_MEAN_SQUARE = 5, /* rms of values */ - L_STANDARD_DEVIATION = 6, /* standard deviation from mean */ - L_VARIANCE = 7 /* variance of values */ -}; - - -/*-------------------------------------------------------------------------* - * Set selection flags * - *-------------------------------------------------------------------------*/ -enum { - L_CHOOSE_CONSECUTIVE = 1, /* select 'n' consecutive */ - L_CHOOSE_SKIP_BY = 2 /* select at intervals of 'n' */ -}; - - -/*-------------------------------------------------------------------------* - * Text orientation flags * - *-------------------------------------------------------------------------*/ -enum { - L_TEXT_ORIENT_UNKNOWN = 0, /* low confidence on text orientation */ - L_TEXT_ORIENT_UP = 1, /* portrait, text rightside-up */ - L_TEXT_ORIENT_LEFT = 2, /* landscape, text up to left */ - L_TEXT_ORIENT_DOWN = 3, /* portrait, text upside-down */ - L_TEXT_ORIENT_RIGHT = 4 /* landscape, text up to right */ -}; - - -/*-------------------------------------------------------------------------* - * Edge orientation flags * - *-------------------------------------------------------------------------*/ -enum { - L_HORIZONTAL_EDGES = 0, /* filters for horizontal edges */ - L_VERTICAL_EDGES = 1, /* filters for vertical edges */ - L_ALL_EDGES = 2 /* filters for all edges */ -}; - - -/*-------------------------------------------------------------------------* - * Line orientation flags * - *-------------------------------------------------------------------------*/ -enum { - L_HORIZONTAL_LINE = 0, /* horizontal line */ - L_POS_SLOPE_LINE = 1, /* 45 degree line with positive slope */ - L_VERTICAL_LINE = 2, /* vertical line */ - L_NEG_SLOPE_LINE = 3, /* 45 degree line with negative slope */ - L_OBLIQUE_LINE = 4 /* neither horizontal nor vertical */ -}; - - -/*-------------------------------------------------------------------------* - * Scan direction flags * - *-------------------------------------------------------------------------*/ -enum { - L_FROM_LEFT = 0, /* scan from left */ - L_FROM_RIGHT = 1, /* scan from right */ - L_FROM_TOP = 2, /* scan from top */ - L_FROM_BOTTOM = 3 /* scan from bottom */ -}; - - -/*-------------------------------------------------------------------------* - * Horizontal warp * - *-------------------------------------------------------------------------*/ -enum { - L_WARP_TO_LEFT = 1, /* increasing stretch or contraction to left */ - L_WARP_TO_RIGHT = 2 /* increasing stretch or contraction to right */ -}; - -enum { - L_LINEAR_WARP = 1, /* stretch or contraction grows linearly */ - L_QUADRATIC_WARP = 2 /* stretch or contraction grows quadratically */ -}; - - -/*-------------------------------------------------------------------------* - * Pixel selection for resampling * - *-------------------------------------------------------------------------*/ -enum { - L_INTERPOLATED = 1, /* linear interpolation from src pixels */ - L_SAMPLED = 2 /* nearest src pixel sampling only */ -}; - - -/*-------------------------------------------------------------------------* - * Thinning flags * - *-------------------------------------------------------------------------*/ -enum { - L_THIN_FG = 1, /* thin foreground of 1 bpp image */ - L_THIN_BG = 2 /* thin background of 1 bpp image */ -}; - - -/*-------------------------------------------------------------------------* - * Runlength flags * - *-------------------------------------------------------------------------*/ -enum { - L_HORIZONTAL_RUNS = 0, /* determine runlengths of horizontal runs */ - L_VERTICAL_RUNS = 1 /* determine runlengths of vertical runs */ -}; - - -/*-------------------------------------------------------------------------* - * Edge filter flags * - *-------------------------------------------------------------------------*/ -enum { - L_SOBEL_EDGE = 1, /* Sobel edge filter */ - L_TWO_SIDED_EDGE = 2 /* Two-sided edge filter */ -}; - - -/*-------------------------------------------------------------------------* - * Handling negative values in conversion to unsigned int * - *-------------------------------------------------------------------------*/ -enum { - L_CLIP_TO_ZERO = 1, /* Clip negative values to 0 */ - L_TAKE_ABSVAL = 2 /* Convert to positive using L_ABS() */ -}; - - -/*-------------------------------------------------------------------------* - * Subpixel color component ordering in LCD display * - *-------------------------------------------------------------------------*/ -enum { - L_SUBPIXEL_ORDER_RGB = 1, /* sensor order left-to-right RGB */ - L_SUBPIXEL_ORDER_BGR = 2, /* sensor order left-to-right BGR */ - L_SUBPIXEL_ORDER_VRGB = 3, /* sensor order top-to-bottom RGB */ - L_SUBPIXEL_ORDER_VBGR = 4 /* sensor order top-to-bottom BGR */ -}; - - -/*-------------------------------------------------------------------------* - * Relative to zero flags * - *-------------------------------------------------------------------------*/ -enum { - L_LESS_THAN_ZERO = 1, /* Choose values less than zero */ - L_EQUAL_TO_ZERO = 2, /* Choose values equal to zero */ - L_GREATER_THAN_ZERO = 3 /* Choose values greater than zero */ -}; - - -/*-------------------------------------------------------------------------* - * HSV histogram flags * - *-------------------------------------------------------------------------*/ -enum { - L_HS_HISTO = 1, /* Use hue-saturation histogram */ - L_HV_HISTO = 2, /* Use hue-value histogram */ - L_SV_HISTO = 3 /* Use saturation-value histogram */ -}; - - -/*-------------------------------------------------------------------------* - * Region flags (inclusion, exclusion) * - *-------------------------------------------------------------------------*/ -enum { - L_INCLUDE_REGION = 1, /* Use hue-saturation histogram */ - L_EXCLUDE_REGION = 2 /* Use hue-value histogram */ -}; - - -/*-------------------------------------------------------------------------* - * Flags for adding text to a pix * - *-------------------------------------------------------------------------*/ -enum { - L_ADD_ABOVE = 1, /* Add text above the image */ - L_ADD_AT_TOP = 2, /* Add text over the top of the image */ - L_ADD_AT_BOTTOM = 3, /* Add text over the bottom of the image */ - L_ADD_BELOW = 4 /* Add text below the image */ -}; - - -/*-------------------------------------------------------------------------* - * Flags for selecting display program * - *-------------------------------------------------------------------------*/ -enum { - L_DISPLAY_WITH_XV = 1, /* Use xv with pixDisplay() */ - L_DISPLAY_WITH_XLI = 2, /* Use xli with pixDisplay() */ - L_DISPLAY_WITH_XZGV = 3, /* Use xzgv with pixDisplay() */ - L_DISPLAY_WITH_IV = 4 /* Use irfvanview with pixDisplay() */ -}; - -#endif /* LEPTONICA_PIX_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/ptra.h b/iOS/OCRPlugin/dependencies/include/leptonica/ptra.h deleted file mode 100644 index 2834d7b0..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/ptra.h +++ /dev/null @@ -1,80 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_PTRA_H -#define LEPTONICA_PTRA_H - -/* - * Contains the following structs: - * struct L_Ptra - * struct L_Ptraa - * - * Contains definitions for: - * L_Ptra compaction flags for removal - * L_Ptra shifting flags for insert - * L_Ptraa accessor flags - */ - - -/*------------------------------------------------------------------------* - * Generic Ptr Array Structs * - *------------------------------------------------------------------------*/ - - /* Generic pointer array */ -struct L_Ptra -{ - l_int32 nalloc; /* size of allocated ptr array */ - l_int32 imax; /* greatest valid index */ - l_int32 nactual; /* actual number of stored elements */ - void **array; /* ptr array */ -}; -typedef struct L_Ptra L_PTRA; - - - /* Array of generic pointer arrays */ -struct L_Ptraa -{ - l_int32 nalloc; /* size of allocated ptr array */ - struct L_Ptra **ptra; /* array of ptra */ -}; -typedef struct L_Ptraa L_PTRAA; - - - -/*------------------------------------------------------------------------* - * Array flags * - *------------------------------------------------------------------------*/ - - /* Flags for removal from L_Ptra */ -enum { - L_NO_COMPACTION = 1, /* null the pointer only */ - L_COMPACTION = 2 /* compact the array */ -}; - - /* Flags for insertion into L_Ptra */ -enum { - L_AUTO_DOWNSHIFT = 0, /* choose based on number of holes */ - L_MIN_DOWNSHIFT = 1, /* downshifts min # of ptrs below insert */ - L_FULL_DOWNSHIFT = 2 /* downshifts all ptrs below insert */ -}; - - /* Accessor flags for L_Ptraa */ -enum { - L_HANDLE_ONLY = 0, /* ptr to L_Ptra; caller can inspect only */ - L_REMOVE = 1 /* caller owns; destroy or save in L_Ptraa */ -}; - - -#endif /* LEPTONICA_PTRA_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/queue.h b/iOS/OCRPlugin/dependencies/include/leptonica/queue.h deleted file mode 100644 index 2650738e..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/queue.h +++ /dev/null @@ -1,63 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_QUEUE_H -#define LEPTONICA_QUEUE_H - -/* - * queue.h - * - * Expandable pointer queue for arbitrary void* data. - * - * The L_Queue is a fifo that implements a queue of void* pointers. - * It can be used to hold a queue of any type of struct. - * - * Internally, it maintains two counters: - * nhead: location of head (in ptrs) from the beginning - * of the array. - * nelem: number of ptr elements stored in the queue. - * - * The element at the head of the queue, which is the next to - * be removed, is array[nhead]. The location at the tail of the - * queue to which the next element will be added is - * array[nhead + nelem]. - * - * As items are added to the queue, nelem increases. - * As items are removed, nhead increases and nelem decreases. - * Any time the tail reaches the end of the allocated array, - * all the pointers are shifted to the left, so that the head - * is at the beginning of the array. - * If the array becomes more than 3/4 full, it doubles in size. - * - * The auxiliary stack can be used in a wrapper for re-using - * items popped from the queue. It is not made by default. - * - * For further implementation details, see queue.c. - */ - -struct L_Queue -{ - l_int32 nalloc; /* size of allocated ptr array */ - l_int32 nhead; /* location of head (in ptrs) from the */ - /* beginning of the array */ - l_int32 nelem; /* number of elements stored in the queue */ - void **array; /* ptr array */ - struct L_Stack *stack; /* auxiliary stack */ - -}; -typedef struct L_Queue L_QUEUE; - - -#endif /* LEPTONICA_QUEUE_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/readbarcode.h b/iOS/OCRPlugin/dependencies/include/leptonica/readbarcode.h deleted file mode 100644 index 0fa31b1b..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/readbarcode.h +++ /dev/null @@ -1,220 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_READBARCODE_H -#define LEPTONICA_READBARCODE_H - - /* ----------------------------------------------------------------- * - * Flags for method of extracting barcode widths * - * ----------------------------------------------------------------- */ -enum { - L_USE_WIDTHS = 1, /* use histogram of barcode widths */ - L_USE_WINDOWS = 2 /* find best window for decoding transitions */ -}; - - /* ----------------------------------------------------------------- * - * Flags for barcode formats * - * These are used both to identify a barcode format and to identify * - * the decoding method to use on a barcode. * - * ----------------------------------------------------------------- */ -enum { - L_BF_UNKNOWN = 0, /* unknown format */ - L_BF_ANY = 1, /* try decoding with all known formats */ - L_BF_CODE128 = 2, /* decode with Code128 format */ - L_BF_EAN8 = 3, /* decode with EAN8 format */ - L_BF_EAN13 = 4, /* decode with EAN13 format */ - L_BF_CODE2OF5 = 5, /* decode with Code 2 of 5 format */ - L_BF_CODEI2OF5 = 6, /* decode with Interleaved 2 of 5 format */ - L_BF_CODE39 = 7, /* decode with Code39 format */ - L_BF_CODE93 = 8, /* decode with Code93 format */ - L_BF_CODABAR = 9, /* decode with Code93 format */ - L_BF_UPCA = 10 /* decode with UPC A format */ -}; - - /* ----------------------------------------------------------------- * - * Currently supported formats * - * Update these arrays as new formats are added. * - * ----------------------------------------------------------------- */ -static const l_int32 SupportedBarcodeFormat[] = { - L_BF_CODE2OF5, - L_BF_CODEI2OF5, - L_BF_CODE93, - L_BF_CODE39, - L_BF_CODABAR, - L_BF_UPCA, - L_BF_EAN13 -}; -static const char *SupportedBarcodeFormatName[] = { - "Code2of5", - "CodeI2of5", - "Code93", - "Code39", - "Codabar", - "Upca", - "Ean13" -}; -static const l_int32 NumSupportedBarcodeFormats = 7; - - - /* ----------------------------------------------------------------- * - * Code 2 of 5 symbology * - * ----------------------------------------------------------------- */ -static const char *Code2of5[] = { - "111121211", "211111112", "112111112", "212111111", /* 0 - 3 */ - "111121112", "211121111", "112121111", "111111212", /* 4 - 7 */ - "211111211", "112111211", /* 8 - 9 */ - "21211", "21112" /* Start, Stop */ -}; - -static const l_int32 C25_START = 10; -static const l_int32 C25_STOP = 11; - - - /* ----------------------------------------------------------------- * - * Code Interleaved 2 of 5 symbology * - * ----------------------------------------------------------------- */ -static const char *CodeI2of5[] = { - "11221", "21112", "12112", "22111", "11212", /* 0 - 4 */ - "21211", "12211", "11122", "21121", "12121", /* 5 - 9 */ - "1111", "211" /* start, stop */ -}; - -static const l_int32 CI25_START = 10; -static const l_int32 CI25_STOP = 11; - - - /* ----------------------------------------------------------------- * - * Code 93 symbology * - * ----------------------------------------------------------------- */ -static const char *Code93[] = { - "131112", "111213", "111312", "111411", "121113", /* 0: 0 - 4 */ - "121212", "121311", "111114", "131211", "141111", /* 5: 5 - 9 */ - "211113", "211212", "211311", "221112", "221211", /* 10: A - E */ - "231111", "112113", "112212", "112311", "122112", /* 15: F - J */ - "132111", "111123", "111222", "111321", "121122", /* 20: K - O */ - "131121", "212112", "212211", "211122", "211221", /* 25: P - T */ - "221121", "222111", "112122", "112221", "122121", /* 30: U - Y */ - "123111", "121131", "311112", "311211", "321111", /* 35: Z,-,.,SP,$ */ - "112131", "113121", "211131", "131221", "312111", /* 40: /,+,%,($),(%) */ - "311121", "122211", "111141" /* 45: (/),(+), Start */ -}; - - /* Use "[]{}#" to represent special codes 43-47 */ -static const char Code93Val[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%[]{}#"; - -static const l_int32 C93_START = 47; -static const l_int32 C93_STOP = 47; - - - /* ----------------------------------------------------------------- * - * Code 39 symbology * - * ----------------------------------------------------------------- */ -static const char *Code39[] = { - "111221211", "211211112", "112211112", "212211111", /* 0: 0 - 3 */ - "111221112", "211221111", "112221111", "111211212", /* 4: 4 - 7 */ - "211211211", "112211211", "211112112", "112112112", /* 8: 8 - B */ - "212112111", "111122112", "211122111", "112122111", /* 12: C - F */ - "111112212", "211112211", "112112211", "111122211", /* 16: G - J */ - "211111122", "112111122", "212111121", "111121122", /* 20: K - N */ - "211121121", "112121121", "111111222", "211111221", /* 24: O - R */ - "112111221", "111121221", "221111112", "122111112", /* 28: S - V */ - "222111111", "121121112", "221121111", "122121111", /* 32: W - Z */ - "121111212", "221111211", "122111211", "121212111", /* 36: -,.,SP,$ */ - "121211121", "121112121", "111212121", "121121211" /* 40: /,+,%,* */ -}; - - /* Use "*" to represent the Start and Stop codes (43) */ -static const char Code39Val[] = - "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ-. $/+%*"; - -static const l_int32 C39_START = 43; -static const l_int32 C39_STOP = 43; - - - /* ----------------------------------------------------------------- * - * Codabar symbology * - * ----------------------------------------------------------------- */ -static const char *Codabar[] = { - "1111122", "1111221", "1112112", "2211111", "1121121", /* 0: 0 - 4 */ - "2111121", "1211112", "1211211", "1221111", "2112111", /* 5: 5 - 9 */ - "1112211", "1122111", "2111212", "2121112", "2121211", /* 10: -,$,:,/,. */ - "1121212", "1122121", "1212112", "1112122", "1112221" /* 15: +,A,B,C,D */ -}; - - /* Ascii representations for codes 16-19: (A or T), (B or N), (C or *), - * (D or E). These are used in pairs for the Start and Stop codes. */ -static const char CodabarVal[] = "0123456789-$:/.+ABCD"; - - - /* ----------------------------------------------------------------- * - * UPC-A symbology * - * ----------------------------------------------------------------- */ -static const char *Upca[] = { - "3211", "2221", "2122", "1411", "1132", /* 0: 0 - 4 */ - "1231", "1114", "1312", "1213", "3112", /* 5: 5 - 9 */ - "111", "111", "11111" /* 10: Start, Stop, Mid */ -}; - -static const l_int32 UPCA_START = 10; -static const l_int32 UPCA_STOP = 11; -static const l_int32 UPCA_MID = 12; - - - /* ----------------------------------------------------------------- * - * Code128 symbology * - * ----------------------------------------------------------------- */ -static const char *Code128[] = { - "212222", "222122", "222221", "121223", "121322", /* 0 - 4 */ - "131222", "122213", "122312", "132212", "221213", /* 5 - 9 */ - "221312", "231212", "112232", "122132", "122231", /* 10 - 14 */ - "113222", "123122", "123221", "223211", "221132", /* 15 - 19 */ - "221231", "213212", "223112", "312131", "311222", /* 20 - 24 */ - "321122", "321221", "312212", "322112", "322211", /* 25 - 29 */ - "212123", "212321", "232121", "111323", "131123", /* 30 - 34 */ - "131321", "112313", "132113", "132311", "211313", /* 35 - 39 */ - "231113", "231311", "112133", "112331", "132131", /* 40 - 44 */ - "113123", "113321", "133121", "313121", "211331", /* 45 - 49 */ - "231131", "213113", "213311", "213131", "311123", /* 50 - 54 */ - "311321", "331121", "312113", "312311", "332111", /* 55 - 59 */ - "314111", "221411", "431111", "111224", "111422", /* 60 - 64 */ - "121124", "121421", "141122", "141221", "112214", /* 65 - 69 */ - "112412", "122114", "122411", "142112", "142211", /* 70 - 74 */ - "241211", "221114", "413111", "241112", "134111", /* 75 - 79 */ - "111242", "121142", "121241", "114212", "124112", /* 80 - 84 */ - "124211", "411212", "421112", "421211", "212141", /* 85 - 89 */ - "214121", "412121", "111143", "111341", "131141", /* 90 - 94 */ - "114113", "114311", "411113", "411311", "113141", /* 95 - 99 */ - "114131", "311141", "411131", "211412", "211214", /* 100 - 104 */ - "211232", "2331112" /* 105 - 106 */ -}; - -static const l_int32 C128_FUN_3 = 96; /* in A or B only; in C it is 96 */ -static const l_int32 C128_FUNC_2 = 97; /* in A or B only; in C it is 97 */ -static const l_int32 C128_SHIFT = 98; /* in A or B only; in C it is 98 */ -static const l_int32 C128_GOTO_C = 99; /* in A or B only; in C it is 99 */ -static const l_int32 C128_GOTO_B = 100; -static const l_int32 C128_GOTO_A = 101; -static const l_int32 C128_FUNC_1 = 102; -static const l_int32 C128_START_A = 103; -static const l_int32 C128_START_B = 104; -static const l_int32 C128_START_C = 105; -static const l_int32 C128_STOP = 106; - /* code 128 symbols are 11 units */ -static const l_int32 C128_SYMBOL_WIDTH = 11; - - - -#endif /* LEPTONICA_READBARCODE_H */ diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/regutils.h b/iOS/OCRPlugin/dependencies/include/leptonica/regutils.h deleted file mode 100644 index 8029dbec..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/regutils.h +++ /dev/null @@ -1,122 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_REGUTILS_H -#define LEPTONICA_REGUTILS_H - -/* - * regutils.h - * - * Contains this regression test parameter packaging struct - * struct L_RegParams - * - * - * The regression test utility allows you to write regression tests - * that compare results with existing "golden files". - * - * Such regression tests can be called in three ways. - * For example, for distance_reg: - * - * Case 1: distance_reg generate - * This generates golden files in /tmp for the reg test. - * - * Case 2: distance_reg compare - * This runs the test against the set of golden files. It - * appends to 'outfile.txt' either "SUCCESS" or "FAILURE", - * as well as the details of any parts of the test that failed. - * It writes to a temporary file stream (fp) - * - * Case 3: distance_reg [display] - * This runs the test but makes no comparison of the output - * against the set of golden files. In addition, this displays - * images and plots that are specified in the test under - * control of the display variable. Display is enabled only - * for this case. Using 'display' on the command line is optional. - * - * Regression tests follow the pattern given below. In an actual - * case, comparisons of pix and of files can occur in any order. - * We give a specific order here for clarity. - * - * L_REGPARAMS *rp; // holds data required by the test functions - * - * // Setup variables; optionally open stream - * if (regTestSetup(argc, argv, &rp)) - * return 1; - * - * // Test pairs of generated pix for identity. This compares - * // two pix; no golden file is generated. - * regTestComparePix(rp, pix1, pix2); - * - * // Test pairs of generated pix for similarity. This compares - * // two pix; no golden file is generated. The last arg determines - * // if stats are to be written to stderr. - * regTestCompareSimilarPix(rp, pix1, pix2, 15, 0.001, 0); - * - * // Generation of outputs and testing for identity - * // These files can be anything, of course. - * regTestCheckFile(rp, ); - * regTestCheckFile(rp, ); - * - * // Test pairs of output golden files for identity. Here we - * // are comparing golden files 4 and 5. - * regTestCompareFiles(rp, 4, 5); - * - * // "Write and check". This writes a pix using a canonical - * // formulation for the local filename and either: - * // case 1: generates a golden file - * // case 2: compares the local file with a golden file - * // case 3: generates local files and displays - * // Here we write the pix compressed with png and jpeg, respectively; - * // Then check against the golden file. The internal @index - * // is incremented; it is embedded in the local filename and, - * // if generating, in the golden file as well. - * regTestWritePixAndCheck(rp, pix1, IFF_PNG); - * regTestWritePixAndCheck(rp, pix2, IFF_JFIF_JPEG); - * - * // Display if reg test was called in 'display' mode - * pixDisplayWithTitle(pix1, 100, 100, NULL, rp->display); - * - * // Clean up and output result - * regTestCleanup(rp); - */ - - -/*-------------------------------------------------------------------------* - * Regression test parameter packer * - *-------------------------------------------------------------------------*/ -struct L_RegParams -{ - FILE *fp; /* stream to temporary output file for compare mode */ - char *testname; /* name of test, without '_reg' */ - char *tempfile; /* name of temp file for compare mode output */ - l_int32 mode; /* generate, compare or display */ - l_int32 index; /* index into saved files for this test; 0-based */ - l_int32 success; /* overall result of the test */ - l_int32 display; /* 1 if in display mode; 0 otherwise */ - L_TIMER tstart; /* marks beginning of the reg test */ -}; -typedef struct L_RegParams L_REGPARAMS; - - - /* Running modes for the test */ -enum { - L_REG_GENERATE = 0, - L_REG_COMPARE = 1, - L_REG_DISPLAY = 2 -}; - - -#endif /* LEPTONICA_REGUTILS_H */ - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/stack.h b/iOS/OCRPlugin/dependencies/include/leptonica/stack.h deleted file mode 100644 index eb1de767..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/stack.h +++ /dev/null @@ -1,55 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_STACK_H -#define LEPTONICA_STACK_H - -/* - * stack.h - * - * Expandable pointer stack for arbitrary void* data. - * - * The L_Stack is an array of void * ptrs, onto which arbitrary - * objects can be stored. At any time, the number of - * stored objects is stack->n. The object at the bottom - * of the stack is at array[0]; the object at the top of - * the stack is at array[n-1]. New objects are added - * to the top of the stack, at the first available location, - * which is array[n]. Objects are removed from the top of the - * stack. When an attempt is made to remove an object from an - * empty stack, the result is null. When the stack becomes - * filled, so that n = nalloc, the size is doubled. - * - * The auxiliary stack can be used to store and remove - * objects for re-use. It must be created by a separate - * call to pstackCreate(). [Just imagine the chaos if - * pstackCreate() created the auxiliary stack!] - * pstackDestroy() checks for the auxiliary stack and removes it. - */ - - - /* Note that array[n] is the first null ptr in the array */ -struct L_Stack -{ - l_int32 nalloc; /* size of ptr array */ - l_int32 n; /* number of stored elements */ - void **array; /* ptr array */ - struct L_Stack *auxstack; /* auxiliary stack */ -}; -typedef struct L_Stack L_STACK; - - -#endif /* LEPTONICA_STACK_H */ - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/sudoku.h b/iOS/OCRPlugin/dependencies/include/leptonica/sudoku.h deleted file mode 100644 index 10205580..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/sudoku.h +++ /dev/null @@ -1,62 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef SUDOKU_H_INCLUDED -#define SUDOKU_H_INCLUDED - -/* - * sudoku.h - * - * The L_Sudoku holds all the information of the current state. - * - * The input to sudokuCreate() is a file with any number of lines - * starting with '#', followed by 9 lines consisting of 9 numbers - * in each line. These have the known values and use 0 for the unknowns. - * Blank lines are ignored. - * - * The @locs array holds the indices of the unknowns, numbered - * left-to-right and top-to-bottom from 0 to 80. The array size - * is initialized to @num. @current is the index into the @locs - * array of the current guess: locs[current]. - * - * The @state array is used to determine the validity of each guess. - * It is of size 81, and is initialized by setting the unknowns to 0 - * and the knowns to their input values. - */ -struct L_Sudoku -{ - l_int32 num; /* number of unknowns */ - l_int32 *locs; /* location of unknowns */ - l_int32 current; /* index into @locs of current location */ - l_int32 *init; /* initial state, with 0 representing */ - /* the unknowns */ - l_int32 *state; /* present state, including inits and */ - /* guesses of unknowns up to @current */ - l_int32 nguess; /* shows current number of guesses */ - l_int32 finished; /* set to 1 when solved */ - l_int32 failure; /* set to 1 if no solution is possible */ -}; -typedef struct L_Sudoku L_SUDOKU; - - - /* For printing out array data */ -enum { - L_SUDOKU_INIT = 0, - L_SUDOKU_STATE = 1 -}; - -#endif /* SUDOKU_H_INCLUDED */ - - diff --git a/iOS/OCRPlugin/dependencies/include/leptonica/watershed.h b/iOS/OCRPlugin/dependencies/include/leptonica/watershed.h deleted file mode 100644 index 4e473ec1..00000000 --- a/iOS/OCRPlugin/dependencies/include/leptonica/watershed.h +++ /dev/null @@ -1,52 +0,0 @@ -/*====================================================================* - - Copyright (C) 2001 Leptonica. All rights reserved. - - This software is distributed in the hope that it will be - - useful, but with NO WARRANTY OF ANY KIND. - - No author or distributor accepts responsibility to anyone for the - - consequences of using this software, or for whether it serves any - - particular purpose or works at all, unless he or she says so in - - writing. Everyone is granted permission to copy, modify and - - redistribute this source code, for commercial or non-commercial - - purposes, with the following restrictions: (1) the origin of this - - source code must not be misrepresented; (2) modified versions must - - be plainly marked as such; and (3) this notice may not be removed - - or altered from any source or modified source distribution. - *====================================================================*/ - -#ifndef LEPTONICA_WATERSHED_H -#define LEPTONICA_WATERSHED_H - -/* - * watershed.h - * - * Simple data structure to hold watershed data. - * All data here is owned by the L_WShed and must be freed. - */ - -struct L_WShed -{ - struct Pix *pixs; /* clone of input 8 bpp pixs */ - struct Pix *pixm; /* clone of input 1 bpp seed (marker) pixm */ - l_int32 mindepth; /* minimum depth allowed for a watershed */ - struct Pix *pixlab; /* 16 bpp label pix */ - struct Pix *pixt; /* scratch pix for computing wshed regions */ - void **lines8; /* line ptrs for pixs */ - void **linem1; /* line ptrs for pixm */ - void **linelab32; /* line ptrs for pixlab */ - void **linet1; /* line ptrs for pixt */ - struct Pixa *pixad; /* result: 1 bpp pixa of watersheds */ - struct Pta *ptas; /* pta of initial seed pixels */ - struct Numa *nasi; /* numa of seed indicators; 0 if completed */ - struct Numa *nash; /* numa of initial seed heights */ - struct Numa *namh; /* numa of initial minima heights */ - struct Numa *nalevels; /* result: numa of watershed levels */ - l_int32 nseeds; /* number of seeds (markers) */ - l_int32 nother; /* number of minima different from seeds */ - l_int32 *lut; /* lut for pixel indices */ - struct Numa **links; /* back-links into lut, for updates */ - l_int32 arraysize; /* size of links array */ - l_int32 debug; /* set to 1 for debug output */ -}; -typedef struct L_WShed L_WSHED; - -#endif /* LEPTONICA_WATERSHED_H */ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/apitypes.h b/iOS/OCRPlugin/dependencies/include/tesseract/apitypes.h deleted file mode 100644 index 3527a9c6..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/apitypes.h +++ /dev/null @@ -1,31 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: apitypes.h -// Description: Types used in both the API and internally -// Author: Ray Smith -// Created: Wed Mar 03 09:22:53 PST 2010 -// -// (C) Copyright 2010, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_API_APITYPES_H__ -#define TESSERACT_API_APITYPES_H__ - -#include "publictypes.h" - -// The types used by the API and Page/ResultIterator can be found in -// ccstruct/publictypes.h. -// API interfaces and API users should be sure to include this file, rather -// than the lower-level one, and lower-level code should be sure to include -// only the lower-level file. - -#endif // TESSERACT_API_APITYPES_H__ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/baseapi.h b/iOS/OCRPlugin/dependencies/include/tesseract/baseapi.h deleted file mode 100644 index 5ce2517a..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/baseapi.h +++ /dev/null @@ -1,664 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: baseapi.h -// Description: Simple API for calling tesseract. -// Author: Ray Smith -// Created: Fri Oct 06 15:35:01 PDT 2006 -// -// (C) Copyright 2006, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_API_BASEAPI_H__ -#define TESSERACT_API_BASEAPI_H__ - -// To avoid collision with other typenames include the ABSOLUTE MINIMUM -// complexity of includes here. Use forward declarations wherever possible -// and hide includes of complex types in baseapi.cpp. -#include "apitypes.h" -#include "genericvector.h" -#include "thresholder.h" -#include "unichar.h" -#include "tesscallback.h" - -class PAGE_RES; -class PAGE_RES_IT; -class BLOCK_LIST; -class DENORM; -class IMAGE; -class PBLOB; -class ROW; -class STRING; -class WERD; -struct Pix; -struct Box; -struct Pixa; -struct Boxa; -class ETEXT_DESC; -struct OSResults; -class TBOX; - -#define MAX_NUM_INT_FEATURES 512 -struct INT_FEATURE_STRUCT; -typedef INT_FEATURE_STRUCT *INT_FEATURE; -typedef INT_FEATURE_STRUCT INT_FEATURE_ARRAY[MAX_NUM_INT_FEATURES]; -struct TBLOB; - -#ifdef TESSDLL_EXPORTS -#define TESSDLL_API __declspec(dllexport) -#elif defined(TESSDLL_IMPORTS) -#define TESSDLL_API __declspec(dllimport) -#else -#define TESSDLL_API -#endif - - -namespace tesseract { - -class CubeRecoContext; -class Dawg; -class Dict; -class PageIterator; -class ResultIterator; -class Tesseract; -class Trie; - -typedef int (Dict::*DictFunc)(void* void_dawg_args, - UNICHAR_ID unichar_id, bool word_end); -typedef double (Dict::*ProbabilityInContextFunc)(const char* lang, - const char* context, - int context_bytes, - const char* character, - int character_bytes); -typedef TessCallback2 TruthCallback; - -/** - * Base class for all tesseract APIs. - * Specific classes can add ability to work on different inputs or produce - * different outputs. - * This class is mostly an interface layer on top of the Tesseract instance - * class to hide the data types so that users of this class don't have to - * include any other Tesseract headers. - */ -class TESSDLL_API TessBaseAPI { - public: - TessBaseAPI(); - virtual ~TessBaseAPI(); - - /** - * Returns the version identifier as a static string. Do not delete. - */ - static const char* Version(); - - /** - * Set the name of the input file. Needed only for training and - * reading a UNLV zone file. - */ - void SetInputName(const char* name); - - /** Set the name of the bonus output files. Needed only for debugging. */ - void SetOutputName(const char* name); - - /** - * Set the value of an internal "parameter." - * Supply the name of the parameter and the value as a string, just as - * you would in a config file. - * Returns false if the name lookup failed. - * Eg SetVariable("tessedit_char_blacklist", "xyz"); to ignore x, y and z. - * Or SetVariable("classify_bln_numeric_mode", "1"); to set numeric-only mode. - * SetVariable may be used before Init, but settings will revert to - * defaults on End(). - * TODO(rays) Add a command-line option to dump the parameters to stdout - * and add a pointer to it in the FAQ - * - * Note: Must be called after Init(). Only works for non-init variables - * (init variables should be passed to Init()). - */ - bool SetVariable(const char* name, const char* value); - - // Returns true if the parameter was found among Tesseract parameters. - // Fills in value with the value of the parameter. - bool GetIntVariable(const char *name, int *value) const; - bool GetBoolVariable(const char *name, bool *value) const; - bool GetDoubleVariable(const char *name, double *value) const; - // Returns the pointer to the string that represents the value of the - // parameter if it was found among Tesseract parameters. - const char *GetStringVariable(const char *name) const; - - // Print Tesseract parameters to the given file. - void PrintVariables(FILE *fp) const; - // Get value of named variable as a string, if it exists. - bool GetVariableAsString(const char *name, STRING *val); - - /** - * Instances are now mostly thread-safe and totally independent, - * but some global parameters remain. Basically it is safe to use multiple - * TessBaseAPIs in different threads in parallel, UNLESS: - * you use SetVariable on some of the Params in classify and textord. - * If you do, then the effect will be to change it for all your instances. - * - * Start tesseract. Returns zero on success and -1 on failure. - * NOTE that the only members that may be called before Init are those - * listed above here in the class definition. - * - * The datapath must be the name of the parent directory of tessdata and - * must end in / . Any name after the last / will be stripped. - * The language is (usually) an ISO 639-3 string or NULL will default to eng. - * It is entirely safe (and eventually will be efficient too) to call - * Init multiple times on the same instance to change language, or just - * to reset the classifier. - * WARNING: On changing languages, all Tesseract parameters are reset - * back to their default values. (Which may vary between languages.) - * If you have a rare need to set a Variable that controls - * initialization for a second call to Init you should explicitly - * call End() and then use SetVariable before Init. This is only a very - * rare use case, since there are very few uses that require any parameters - * to be set before Init. - */ - int Init(const char* datapath, const char* language, OcrEngineMode mode, - char **configs, int configs_size, - const GenericVector *vars_vec, - const GenericVector *vars_values, - bool set_only_init_params); - int Init(const char* datapath, const char* language, OcrEngineMode oem) { - return Init(datapath, language, oem, NULL, 0, NULL, NULL, false); - } - int Init(const char* datapath, const char* language) { - return Init(datapath, language, OEM_DEFAULT, NULL, 0, NULL, NULL, false); - } - - /** - * Init only the lang model component of Tesseract. The only functions - * that work after this init are SetVariable and IsValidWord. - * WARNING: temporary! This function will be removed from here and placed - * in a separate API at some future time. - */ - int InitLangMod(const char* datapath, const char* language); - - // Init only for page layout analysis. Use only for calls to SetImage and - // AnalysePage. Calls that attempt recognition will generate an error. - void InitForAnalysePage(); - - /** - * Read a "config" file containing a set of variable, value pairs. - * Searches the standard places: tessdata/configs, tessdata/tessconfigs - * and also accepts a relative or absolute path name. - * If init_only is true, only sets the parameters marked with a special - * INIT flag, which are typically of functional/algorithmic effect - * rather than debug effect. Used to separate debug settings from - * working settings. - */ - void ReadConfigFile(const char* filename, bool init_only); - - /** - * Set the current page segmentation mode. Defaults to PSM_SINGLE_BLOCK. - * The mode is stored as an IntParam so it can also be modified by - * ReadConfigFile or SetVariable("tessedit_pageseg_mode", mode as string). - */ - void SetPageSegMode(PageSegMode mode); - - /** Return the current page segmentation mode. */ - PageSegMode GetPageSegMode() const; - - /** - * Recognize a rectangle from an image and return the result as a string. - * May be called many times for a single Init. - * Currently has no error checking. - * Greyscale of 8 and color of 24 or 32 bits per pixel may be given. - * Palette color images will not work properly and must be converted to - * 24 bit. - * Binary images of 1 bit per pixel may also be given but they must be - * byte packed with the MSB of the first byte being the first pixel, and a - * 1 represents WHITE. For binary images set bytes_per_pixel=0. - * The recognized text is returned as a char* which is coded - * as UTF8 and must be freed with the delete [] operator. - * - * Note that TesseractRect is the simplified convenience interface. - * For advanced uses, use SetImage, (optionally) SetRectangle, Recognize, - * and one or more of the Get*Text functions below. - */ - char* TesseractRect(const unsigned char* imagedata, - int bytes_per_pixel, int bytes_per_line, - int left, int top, int width, int height); - - /** - * Call between pages or documents etc to free up memory and forget - * adaptive data. - */ - void ClearAdaptiveClassifier(); - - /** - * @defgroup AdvancedAPI Advanced API - * The following methods break TesseractRect into pieces, so you can - * get hold of the thresholded image, get the text in different formats, - * get bounding boxes, confidences etc. - */ - /* @{ */ - - /** - * Provide an image for Tesseract to recognize. Format is as - * TesseractRect above. Does not copy the image buffer, or take - * ownership. The source image may be destroyed after Recognize is called, - * either explicitly or implicitly via one of the Get*Text functions. - * SetImage clears all recognition results, and sets the rectangle to the - * full image, so it may be followed immediately by a GetUTF8Text, and it - * will automatically perform recognition. - */ - void SetImage(const unsigned char* imagedata, int width, int height, - int bytes_per_pixel, int bytes_per_line); - - /** - * Provide an image for Tesseract to recognize. As with SetImage above, - * Tesseract doesn't take a copy or ownership or pixDestroy the image, so - * it must persist until after Recognize. - * Pix vs raw, which to use? - * Use Pix where possible. A future version of Tesseract may choose to use Pix - * as its internal representation and discard IMAGE altogether. - * Because of that, an implementation that sources and targets Pix may end up - * with less copies than an implementation that does not. - */ - void SetImage(const Pix* pix); - - /** - * Restrict recognition to a sub-rectangle of the image. Call after SetImage. - * Each SetRectangle clears the recogntion results so multiple rectangles - * can be recognized with the same image. - */ - void SetRectangle(int left, int top, int width, int height); - - /** - * In extreme cases only, usually with a subclass of Thresholder, it - * is possible to provide a different Thresholder. The Thresholder may - * be preloaded with an image, settings etc, or they may be set after. - * Note that Tesseract takes ownership of the Thresholder and will - * delete it when it it is replaced or the API is destructed. - */ - void SetThresholder(ImageThresholder* thresholder) { - if (thresholder_ != NULL) - delete thresholder_; - thresholder_ = thresholder; - ClearResults(); - } - - /** - * Get a copy of the internal thresholded image from Tesseract. - * Caller takes ownership of the Pix and must pixDestroy it. - * May be called any time after SetImage, or after TesseractRect. - */ - Pix* GetThresholdedImage(); - - /** - * Get the result of page layout analysis as a leptonica-style - * Boxa, Pixa pair, in reading order. - * Can be called before or after Recognize. - */ - Boxa* GetRegions(Pixa** pixa); - - /** - * Get the textlines as a leptonica-style - * Boxa, Pixa pair, in reading order. - * Can be called before or after Recognize. - * If blockids is not NULL, the block-id of each line is also returned - * as an array of one element per line. delete [] after use. - */ - Boxa* GetTextlines(Pixa** pixa, int** blockids); - - /** - * Get the words as a leptonica-style - * Boxa, Pixa pair, in reading order. - * Can be called before or after Recognize. - */ - Boxa* GetWords(Pixa** pixa); - - // Gets the individual connected (text) components (created - // after pages segmentation step, but before recognition) - // as a leptonica-style Boxa, Pixa pair, in reading order. - // Can be called before or after Recognize. - // Note: the caller is responsible for calling boxaDestroy() - // on the returned Boxa array and pixaDestroy() on cc array. - Boxa* GetConnectedComponents(Pixa** cc); - - // Get the given level kind of components (block, textline, word etc.) as a - // leptonica-style Boxa, Pixa pair, in reading order. - // Can be called before or after Recognize. - // If blockids is not NULL, the block-id of each component is also returned - // as an array of one element per component. delete [] after use. - Boxa* GetComponentImages(PageIteratorLevel level, - Pixa** pixa, int** blockids); - - /** - * Dump the internal binary image to a PGM file. - * @deprecated Use GetThresholdedImage and write the image using pixWrite - * instead if possible. - */ - void DumpPGM(const char* filename); - - // Runs page layout analysis in the mode set by SetPageSegMode. - // May optionally be called prior to Recognize to get access to just - // the page layout results. Returns an iterator to the results. - // Returns NULL on error. - // The returned iterator must be deleted after use. - // WARNING! This class points to data held within the TessBaseAPI class, and - // therefore can only be used while the TessBaseAPI class still exists and - // has not been subjected to a call of Init, SetImage, Recognize, Clear, End - // DetectOS, or anything else that changes the internal PAGE_RES. - PageIterator* AnalyseLayout(); - - /** - * Recognize the image from SetAndThresholdImage, generating Tesseract - * internal structures. Returns 0 on success. - * Optional. The Get*Text functions below will call Recognize if needed. - * After Recognize, the output is kept internally until the next SetImage. - */ - int Recognize(ETEXT_DESC* monitor); - - /** - * Methods to retrieve information after SetAndThresholdImage(), - * Recognize() or TesseractRect(). (Recognize is called implicitly if needed.) - */ - - /** Variant on Recognize used for testing chopper. */ - int RecognizeForChopTest(ETEXT_DESC* monitor); - - /** - * Recognizes all the pages in the named file, as a multi-page tiff or - * list of filenames, or single image, and gets the appropriate kind of text - * according to parameters: tessedit_create_boxfile, - * tessedit_make_boxes_from_boxes, tessedit_write_unlv, tessedit_create_hocr. - * Calls ProcessPage on each page in the input file, which may be a - * multi-page tiff, single-page other file format, or a plain text list of - * images to read. If tessedit_page_number is non-negative, processing begins - * at that page of a multi-page tiff file, or filelist. - * The text is returned in text_out. Returns false on error. - * If non-zero timeout_millisec terminates processing after the timeout on - * a single page. - * If non-NULL and non-empty, and some page fails for some reason, - * the page is reprocessed with the retry_config config file. Useful - * for interactively debugging a bad page. - */ - bool ProcessPages(const char* filename, - const char* retry_config, int timeout_millisec, - STRING* text_out); - - /** - * Recognizes a single page for ProcessPages, appending the text to text_out. - * The pix is the image processed - filename and page_index are metadata - * used by side-effect processes, such as reading a box file or formatting - * as hOCR. - * If non-zero timeout_millisec terminates processing after the timeout. - * If non-NULL and non-empty, and some page fails for some reason, - * the page is reprocessed with the retry_config config file. Useful - * for interactively debugging a bad page. - * The text is returned in text_out. Returns false on error. - */ - bool ProcessPage(Pix* pix, int page_index, const char* filename, - const char* retry_config, int timeout_millisec, - STRING* text_out); - - // Get an iterator to the results of LayoutAnalysis and/or Recognize. - // The returned iterator must be deleted after use. - // WARNING! This class points to data held within the TessBaseAPI class, and - // therefore can only be used while the TessBaseAPI class still exists and - // has not been subjected to a call of Init, SetImage, Recognize, Clear, End - // DetectOS, or anything else that changes the internal PAGE_RES. - ResultIterator* GetIterator(); - - /** - * The recognized text is returned as a char* which is coded - * as UTF8 and must be freed with the delete [] operator. - */ - char* GetUTF8Text(); - /** - * Make a HTML-formatted string with hOCR markup from the internal - * data structures. - * page_number is 0-based but will appear in the output as 1-based. - */ - char* GetHOCRText(int page_number); - /** - * The recognized text is returned as a char* which is coded in the same - * format as a box file used in training. Returned string must be freed with - * the delete [] operator. - * Constructs coordinates in the original image - not just the rectangle. - * page_number is a 0-based page index that will appear in the box file. - */ - char* GetBoxText(int page_number); - /** - * The recognized text is returned as a char* which is coded - * as UNLV format Latin-1 with specific reject and suspect codes - * and must be freed with the delete [] operator. - */ - char* GetUNLVText(); - /** Returns the (average) confidence value between 0 and 100. */ - int MeanTextConf(); - /** - * Returns all word confidences (between 0 and 100) in an array, terminated - * by -1. The calling function must delete [] after use. - * The number of confidences should correspond to the number of space- - * delimited words in GetUTF8Text. - */ - int* AllWordConfidences(); - - /** - * Applies the given word to the adaptive classifier if possible. - * The word must be SPACE-DELIMITED UTF-8 - l i k e t h i s , so it can - * tell the boundaries of the graphemes. - * Assumes that SetImage/SetRectangle have been used to set the image - * to the given word. The mode arg should be PSM_SINGLE_WORD or - * PSM_CIRCLE_WORD, as that will be used to control layout analysis. - * The currently set PageSegMode is preserved. - * Returns false if adaption was not possible for some reason. - */ - bool AdaptToWordStr(PageSegMode mode, const char* wordstr); - - /** - * Free up recognition results and any stored image data, without actually - * freeing any recognition data that would be time-consuming to reload. - * Afterwards, you must call SetImage or TesseractRect before doing - * any Recognize or Get* operation. - */ - void Clear(); - - /** - * Close down tesseract and free up all memory. End() is equivalent to - * destructing and reconstructing your TessBaseAPI. - * Once End() has been used, none of the other API functions may be used - * other than Init and anything declared above it in the class definition. - */ - void End(); - - /** - * Check whether a word is valid according to Tesseract's language model - * @return 0 if the word is invalid, non-zero if valid. - * @warning temporary! This function will be removed from here and placed - * in a separate API at some future time. - */ - int IsValidWord(const char *word); - - bool GetTextDirection(int* out_offset, float* out_slope); - - /** Sets Dict::letter_is_okay_ function to point to the given function. */ - void SetDictFunc(DictFunc f); - - /** Sets Dict::probability_in_context_ function to point to the given - * function. - */ - void SetProbabilityInContextFunc(ProbabilityInContextFunc f); - - /** - * Estimates the Orientation And Script of the image. - * @return true if the image was processed successfully. - */ - bool DetectOS(OSResults*); - - /** This method returns the features associated with the input image. */ - void GetFeaturesForBlob(TBLOB* blob, const DENORM& denorm, - INT_FEATURE_ARRAY int_features, - int* num_features, int* FeatureOutlineIndex); - - // This method returns the row to which a box of specified dimensions would - // belong. If no good match is found, it returns NULL. - static ROW* FindRowForBox(BLOCK_LIST* blocks, int left, int top, - int right, int bottom); - - // Method to run adaptive classifier on a blob. - // It returns at max num_max_matches results. - void RunAdaptiveClassifier(TBLOB* blob, const DENORM& denorm, - int num_max_matches, - int* unichar_ids, - float* ratings, - int* num_matches_returned); - - // This method returns the string form of the specified unichar. - const char* GetUnichar(int unichar_id); - - /** Return the pointer to the i-th dawg loaded into tesseract_ object. */ - const Dawg *GetDawg(int i) const; - - /** Return the number of dawgs loaded into tesseract_ object. */ - int NumDawgs() const; - - /** Return the language used in the last valid initialization. */ - const char* GetLastInitLanguage() const; - - // Returns a ROW object created from the input row specification. - static ROW *MakeTessOCRRow(float baseline, float xheight, - float descender, float ascender); - - // Returns a TBLOB corresponding to the entire input image. - static TBLOB *MakeTBLOB(Pix *pix); - - // This method baseline normalizes a TBLOB in-place. The input row is used - // for normalization. The denorm is an optional parameter in which the - // normalization-antidote is returned. - static void NormalizeTBLOB(TBLOB *tblob, ROW *row, - bool numeric_mode, DENORM *denorm); - - Tesseract* const tesseract() const { - return tesseract_; - } - - void InitTruthCallback(TruthCallback *cb) { truth_cb_ = cb; } - - // Return a pointer to underlying CubeRecoContext object if present. - CubeRecoContext *GetCubeRecoContext() const; - - void set_min_orientation_margin(double margin); - - // Return text orientation of each block as determined by an earlier run - // of layout analysis. - void GetBlockTextOrientations(int** block_orientation, - bool** vertical_writing); - - /** Find lines from the image making the BLOCK_LIST. */ - BLOCK_LIST* FindLinesCreateBlockList(); - - /** - * Delete a block list. - * This is to keep BLOCK_LIST pointer opaque - * and let go of including the other headers. - */ - static void DeleteBlockList(BLOCK_LIST* block_list); - /* @} */ - - protected: - - /** Common code for setting the image. Returns true if Init has been called. */ - bool InternalSetImage(); - - /** - * Run the thresholder to make the thresholded image. If pix is not NULL, - * the source is thresholded to pix instead of the internal IMAGE. - */ - virtual void Threshold(Pix** pix); - - /** - * Find lines from the image making the BLOCK_LIST. - * @return 0 on success. - */ - int FindLines(); - - /** Delete the pageres and block list ready for a new page. */ - void ClearResults(); - - /** - * Return the length of the output text string, as UTF8, assuming - * one newline per line and one per block, with a terminator, - * and assuming a single character reject marker for each rejected character. - * Also return the number of recognized blobs in blob_count. - */ - int TextLength(int* blob_count); - - /** @defgroup ocropusAddOns ocropus add-ons */ - /* @{ */ - - /** - * Adapt to recognize the current image as the given character. - * The image must be preloaded and be just an image of a single character. - */ - void AdaptToCharacter(const char *unichar_repr, - int length, - float baseline, - float xheight, - float descender, - float ascender); - - /** Recognize text doing one pass only, using settings for a given pass. */ - PAGE_RES* RecognitionPass1(BLOCK_LIST* block_list); - PAGE_RES* RecognitionPass2(BLOCK_LIST* block_list, PAGE_RES* pass1_result); - - /** - * Extract the OCR results, costs (penalty points for uncertainty), - * and the bounding boxes of the characters. - */ - static int TesseractExtractResult(char** text, - int** lengths, - float** costs, - int** x0, - int** y0, - int** x1, - int** y1, - PAGE_RES* page_res); - - const PAGE_RES* GetPageRes() const { - return page_res_; - }; - - protected: - Tesseract* tesseract_; ///< The underlying data object. - Tesseract* osd_tesseract_; ///< For orientation & script detection. - ImageThresholder* thresholder_; ///< Image thresholding module. - BLOCK_LIST* block_list_; ///< The page layout. - PAGE_RES* page_res_; ///< The page-level data. - STRING* input_file_; ///< Name used by training code. - STRING* output_file_; ///< Name used by debug code. - STRING* datapath_; ///< Current location of tessdata. - STRING* language_; ///< Last initialized language. - OcrEngineMode last_oem_requested_; ///< Last ocr language mode requested. - bool recognition_done_; ///< page_res_ contains recognition data. - TruthCallback *truth_cb_; /// fxn for setting truth_* in WERD_RES - - /** - * @defgroup ThresholderParams - * Parameters saved from the Thresholder. Needed to rebuild coordinates. - */ - /* @{ */ - int rect_left_; - int rect_top_; - int rect_width_; - int rect_height_; - int image_width_; - int image_height_; - /* @} */ -}; - -} // namespace tesseract. - -#endif // TESSERACT_API_BASEAPI_H__ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/errcode.h b/iOS/OCRPlugin/dependencies/include/tesseract/errcode.h deleted file mode 100644 index 1eff6c2d..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/errcode.h +++ /dev/null @@ -1,104 +0,0 @@ -/********************************************************************** - * File: errcode.h (Formerly error.h) - * Description: Header file for generic error handler class - * Author: Ray Smith - * Created: Tue May 1 16:23:36 BST 1990 - * - * (C) Copyright 1990, Hewlett-Packard Ltd. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -#ifndef ERRCODE_H -#define ERRCODE_H - -#include "host.h" - -/*Control parameters for error()*/ -#define DBG -1 /*log without alert */ -#define TESSLOG 0 /*alert user */ -#define TESSEXIT 1 /*exit after erro */ -#define ABORT 2 /*abort after error */ - -/* Explicit Error Abort codes */ -#define NO_ABORT_CODE 0 -#define LIST_ABORT 1 -#define MEMORY_ABORT 2 -#define FILE_ABORT 3 - -/* Location of code at error codes Reserve 0..2 (status codes 0..23 for UNLV)*/ -#define LOC_UNUSED0 0 -#define LOC_UNUSED1 1 -#define LOC_UNUSED2 2 -#define LOC_INIT 3 -#define LOC_EDGE_PROG 4 -#define LOC_TEXT_ORD_ROWS 5 -#define LOC_TEXT_ORD_WORDS 6 -#define LOC_PASS1 7 -#define LOC_PASS2 8 -/* Reserve up to 8..13 for adding subloc 0/3 plus subsubloc 0/1/2 */ -#define LOC_FUZZY_SPACE 14 -/* Reserve up to 14..20 for adding subloc 0/3 plus subsubloc 0/1/2 */ -#define LOC_MM_ADAPT 21 -#define LOC_DOC_BLK_REJ 22 -#define LOC_WRITE_RESULTS 23 -#define LOC_ADAPTIVE 24 -/* DONT DEFINE ANY LOCATION > 31 !!! */ - -/* Sub locatation determines whether pass2 was in normal mode or fix xht mode*/ -#define SUBLOC_NORM 0 -#define SUBLOC_FIX_XHT 3 - -/* Sub Sub locatation determines whether match_word_pass2 was in Tess - matcher, NN matcher or somewhere else */ - -#define SUBSUBLOC_OTHER 0 -#define SUBSUBLOC_TESS 1 -#define SUBSUBLOC_NN 2 - -class DLLSYM ERRCODE //error handler class -{ - const char *message; //error message - public: - void error ( //error print function - const char *caller, //function location - inT8 action, //action to take - const char *format, ... //fprintf format - ) const; - ERRCODE(const char *string) { - message = string; - } //initialize with string -}; - -const ERRCODE ASSERT_FAILED = "Assert failed"; - -#define ASSERT_HOST(x) if (!(x)) \ -{ \ - ASSERT_FAILED.error(#x,ABORT,"in file %s, line %d", \ - __FILE__,__LINE__); \ -} - -void signal_exit( // - int signal_code //Signal which - ); -extern "C" -{ - void err_exit(); - //The real signal - void signal_termination_handler(int sig); -}; - -void set_global_loc_code(int loc_code); - -void set_global_subloc_code(int loc_code); - -void set_global_subsubloc_code(int loc_code); -#endif diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/genericvector.h b/iOS/OCRPlugin/dependencies/include/tesseract/genericvector.h deleted file mode 100644 index e1372317..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/genericvector.h +++ /dev/null @@ -1,763 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: genericvector.h -// Description: Generic vector class -// Author: Daria Antonova -// Created: Mon Jun 23 11:26:43 PDT 2008 -// -// (C) Copyright 2007, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// -// -#ifndef TESSERACT_CCUTIL_GENERICVECTOR_H_ -#define TESSERACT_CCUTIL_GENERICVECTOR_H_ - -#include -#include - -#include "tesscallback.h" -#include "errcode.h" -#include "helpers.h" -#include "ndminx.h" - -// Use PointerVector below in preference to GenericVector, as that -// provides automatic deletion of pointers, [De]Serialize that works, and -// sort that works. -template -class GenericVector { - public: - GenericVector() { this->init(kDefaultVectorSize); } - explicit GenericVector(int size) { this->init(size); } - - // Copy - GenericVector(const GenericVector& other) { - this->init(other.size()); - this->operator+=(other); - } - GenericVector &operator+=(const GenericVector& other); - GenericVector &operator=(const GenericVector& other); - - virtual ~GenericVector(); - - // Reserve some memory. - void reserve(int size); - // Double the size of the internal array. - void double_the_size(); - - // Resizes to size and sets all values to t. - void init_to_size(int size, T t); - - // Return the size used. - int size() const { - return size_used_; - } - - int length() const { - return size_used_; - } - - // Return true if empty. - bool empty() const { - return size_used_ == 0; - } - - // Return the object from an index. - T &get(int index) const; - T &operator[](int index) const; - - // Return the index of the T object. - // This method NEEDS a compare_callback to be passed to - // set_compare_callback. - int get_index(T object) const; - - // Return true if T is in the array - bool contains(T object) const; - - // Return true if the index is valid - T contains_index(int index) const; - - // Push an element in the end of the array - int push_back(T object); - void operator+=(T t); - - // Push an element in the front of the array - // Note: This function is O(n) - int push_front(T object); - - // Set the value at the given index - void set(T t, int index); - - // Insert t at the given index, push other elements to the right. - void insert(T t, int index); - - // Removes an element at the given index and - // shifts the remaining elements to the left. - virtual void remove(int index); - - // Truncates the array to the given size by removing the end. - // If the current size is less, the array is not expanded. - virtual void truncate(int size) { - if (size < size_used_) - size_used_ = size; - } - - // Add a callback to be called to delete the elements when the array took - // their ownership. - void set_clear_callback(TessCallback1* cb); - - // Add a callback to be called to compare the elements when needed (contains, - // get_id, ...) - void set_compare_callback(TessResultCallback2* cb); - - // Clear the array, calling the clear callback function if any. - // All the owned callbacks are also deleted. - // If you don't want the callbacks to be deleted, before calling clear, set - // the callback to NULL. - virtual void clear(); - - // Delete objects pointed to by data_[i] - void delete_data_pointers(); - - // This method clears the current object, then, does a shallow copy of - // its argument, and finally invalidate its argument. - // Callbacks are moved to the current object; - void move(GenericVector* from); - - // Read/Write the array to a file. This does _NOT_ read/write the callbacks. - // The callback given must be permanent since they will be called more than - // once. The given callback will be deleted at the end. - // If the callbacks are NULL, then the data is simply read/written using - // fread (and swapping)/fwrite. - // Returns false on error or if the callback returns false. - // DEPRECATED. Use [De]Serialize[Classes] instead. - bool write(FILE* f, TessResultCallback2* cb) const; - bool read(FILE* f, TessResultCallback3* cb, bool swap); - // Writes a vector of simple types to the given file. Assumes that bitwise - // read/write of T will work. Returns false in case of error. - virtual bool Serialize(FILE* fp) const; - // Reads a vector of simple types from the given file. Assumes that bitwise - // read/write will work with ReverseN according to sizeof(T). - // Returns false in case of error. - // If swap is true, assumes a big/little-endian swap is needed. - virtual bool DeSerialize(bool swap, FILE* fp); - // Writes a vector of classes to the given file. Assumes the existence of - // bool T::Serialize(FILE* fp) const that returns false in case of error. - // Returns false in case of error. - bool SerializeClasses(FILE* fp) const; - // Reads a vector of classes from the given file. Assumes the existence of - // bool T::Deserialize(bool swap, FILE* fp) that returns false in case of - // error. Also needs T::T() and T::T(constT&), as init_to_size is used in - // this function. Returns false in case of error. - // If swap is true, assumes a big/little-endian swap is needed. - bool DeSerializeClasses(bool swap, FILE* fp); - - // Allocates a new array of double the current_size, copies over the - // information from data to the new location, deletes data and returns - // the pointed to the new larger array. - // This function uses memcpy to copy the data, instead of invoking - // operator=() for each element like double_the_size() does. - static T *double_the_size_memcpy(int current_size, T *data) { - T *data_new = new T[current_size * 2]; - memcpy(data_new, data, sizeof(T) * current_size); - delete[] data; - return data_new; - } - - // Sorts the members of this vector using the less than comparator (cmp_lt), - // which compares the values. Useful for GenericVectors to primitive types. - // Will not work so great for pointers (unless you just want to sort some - // pointers). You need to provide a specialization to sort_cmp to use - // your type. - void sort(); - - // Sort the array into the order defined by the qsort function comparator. - // The comparator function is as defined by qsort, ie. it receives pointers - // to two Ts and returns negative if the first element is to appear earlier - // in the result and positive if it is to appear later, with 0 for equal. - void sort(int (*comparator)(const void*, const void*)) { - qsort(data_, size_used_, sizeof(*data_), comparator); - } - - // Searches the array (assuming sorted in ascending order, using sort()) for - // an element equal to target and returns true if it is present. - // Use binary_search to get the index of target, or its nearest candidate. - bool bool_binary_search(const T& target) const { - int index = binary_search(target); - if (index >= size_used_) - return false; - return data_[index] == target; - } - // Searches the array (assuming sorted in ascending order, using sort()) for - // an element equal to target and returns the index of the best candidate. - // The return value is the largest index i such that data_[i] <= target or 0. - int binary_search(const T& target) const { - int bottom = 0; - int top = size_used_; - do { - int middle = (bottom + top) / 2; - if (data_[middle] > target) - top = middle; - else - bottom = middle; - } - while (top - bottom > 1); - return bottom; - } - - // Compact the vector by deleting elements using operator!= on basic types. - // The vector must be sorted. - void compact_sorted() { - if (size_used_ == 0) - return; - - // First element is in no matter what, hence the i = 1. - int last_write = 0; - for (int i = 1; i < size_used_; ++i) { - // Finds next unique item and writes it. - if (data_[last_write] != data_[i]) - data_[++last_write] = data_[i]; - } - // last_write is the index of a valid data cell, so add 1. - size_used_ = last_write + 1; - } - - // Compact the vector by deleting elements for which delete_cb returns - // true. delete_cb is a permanent callback and will be deleted. - void compact(TessResultCallback1* delete_cb) { - int new_size = 0; - int old_index = 0; - // Until the callback returns true, the elements stay the same. - while (old_index < size_used_ && !delete_cb->Run(old_index++)) - ++new_size; - // Now just copy anything else that gets false from delete_cb. - for (; old_index < size_used_; ++old_index) { - if (!delete_cb->Run(old_index)) { - data_[new_size++] = data_[old_index]; - } - } - size_used_ = new_size; - delete delete_cb; - } - - T dot_product(const GenericVector& other) const { - T result = static_cast(0); - for (int i = MIN(size_used_, other.size_used_) - 1; i >= 0; --i) - result += data_[i] * other.data_[i]; - return result; - } - - protected: - - // Init the object, allocating size memory. - void init(int size); - - // We are assuming that the object generally placed in thie - // vector are small enough that for efficiency it makes sence - // to start with a larger initial size. - static const int kDefaultVectorSize = 4; - inT32 size_used_; - inT32 size_reserved_; - T* data_; - TessCallback1* clear_cb_; - // Mutable because Run method is not const - mutable TessResultCallback2* compare_cb_; -}; - -namespace tesseract { - -template -bool cmp_eq(T const & t1, T const & t2) { - return t1 == t2; -} - -// Used by sort() -// return < 0 if t1 < t2 -// return 0 if t1 == t2 -// return > 0 if t1 > t2 -template -int sort_cmp(const void* t1, const void* t2) { - const T* a = static_cast (t1); - const T* b = static_cast (t2); - if (*a < *b) { - return -1; - } else if (*b < *a) { - return 1; - } else { - return 0; - } -} - -// Used by PointerVector::sort() -// return < 0 if t1 < t2 -// return 0 if t1 == t2 -// return > 0 if t1 > t2 -template -int sort_ptr_cmp(const void* t1, const void* t2) { - const T* a = *reinterpret_cast(t1); - const T* b = *reinterpret_cast(t2); - if (*a < *b) { - return -1; - } else if (*b < *a) { - return 1; - } else { - return 0; - } -} - -// Subclass for a vector of pointers. Use in preference to GenericVector -// as it provides automatic deletion and correct serialization, with the -// corollary that all copy operations are deep copies of the pointed-to objects. -template -class PointerVector : public GenericVector { - public: - PointerVector() : GenericVector() { } - explicit PointerVector(int size) : GenericVector(size) { } - virtual ~PointerVector() { - // Clear must be called here, even though it is called again by the base, - // as the base will call the wrong clear. - clear(); - } - // Copy must be deep, as the pointers will be automatically deleted on - // destruction. - PointerVector(const PointerVector& other) { - init(other.size()); - this->operator+=(other); - } - PointerVector& operator+=(const PointerVector& other) { - reserve(this->size_used_ + other.size_used_); - for (int i = 0; i < other.size(); ++i) { - push_back(new T(*other.data_[i])); - } - return *this; - } - - PointerVector& operator=(const PointerVector& other) { - this->truncate(0); - this->operator+=(other); - return *this; - } - - // Removes an element at the given index and - // shifts the remaining elements to the left. - virtual void remove(int index) { - delete GenericVector::data_[index]; - GenericVector::remove(index); - } - - // Truncates the array to the given size by removing the end. - // If the current size is less, the array is not expanded. - virtual void truncate(int size) { - for (int i = size; i < GenericVector::size_used_; ++i) - delete GenericVector::data_[i]; - GenericVector::truncate(size); - } - - // Clear the array, calling the clear callback function if any. - // All the owned callbacks are also deleted. - // If you don't want the callbacks to be deleted, before calling clear, set - // the callback to NULL. - virtual void clear() { - GenericVector::delete_data_pointers(); - GenericVector::clear(); - } - - // Writes a vector of simple types to the given file. Assumes that bitwise - // read/write of T will work. Returns false in case of error. - virtual bool Serialize(FILE* fp) const { - inT32 used = GenericVector::size_used_; - if (fwrite(&used, sizeof(used), 1, fp) != 1) return false; - for (int i = 0; i < used; ++i) { - inT8 non_null = GenericVector::data_[i] != NULL; - if (fwrite(&non_null, sizeof(non_null), 1, fp) != 1) return false; - if (non_null && !GenericVector::data_[i]->Serialize(fp)) return false; - } - return true; - } - // Reads a vector of simple types from the given file. Assumes that bitwise - // read/write will work with ReverseN according to sizeof(T). - // Also needs T::T(), as new T is used in this function. - // Returns false in case of error. - // If swap is true, assumes a big/little-endian swap is needed. - virtual bool DeSerialize(bool swap, FILE* fp) { - inT32 reserved; - if (fread(&reserved, sizeof(reserved), 1, fp) != 1) return false; - if (swap) Reverse32(&reserved); - GenericVector::reserve(reserved); - for (int i = 0; i < reserved; ++i) { - inT8 non_null; - if (fread(&non_null, sizeof(non_null), 1, fp) != 1) return false; - T* item = NULL; - if (non_null) { - item = new T; - if (!item->DeSerialize(swap, fp)) return false; - } - push_back(item); - } - return true; - } - - // Sorts the items pointed to by the members of this vector using - // t::operator<(). - void sort() { - sort(&sort_ptr_cmp); - } -}; - -} // namespace tesseract - -// A useful vector that uses operator== to do comparisons. -template -class GenericVectorEqEq : public GenericVector { - public: - GenericVectorEqEq() { - GenericVector::set_compare_callback( - NewPermanentTessCallback(tesseract::cmp_eq)); - } - GenericVectorEqEq(int size) : GenericVector(size) { - GenericVector::set_compare_callback( - NewPermanentTessCallback(tesseract::cmp_eq)); - } -}; - -template -void GenericVector::init(int size) { - size_used_ = 0; - size_reserved_ = 0; - data_ = 0; - clear_cb_ = 0; - compare_cb_ = 0; - reserve(size); -} - -template -GenericVector::~GenericVector() { - clear(); -} - -// Reserve some memory. If the internal array contains elements, they are -// copied. -template -void GenericVector::reserve(int size) { - if (size_reserved_ >= size || size <= 0) - return; - T* new_array = new T[size]; - for (int i = 0; i < size_used_; ++i) - new_array[i] = data_[i]; - if (data_ != NULL) delete[] data_; - data_ = new_array; - size_reserved_ = size; -} - -template -void GenericVector::double_the_size() { - if (size_reserved_ == 0) { - reserve(kDefaultVectorSize); - } - else { - reserve(2 * size_reserved_); - } -} - -// Resizes to size and sets all values to t. -template -void GenericVector::init_to_size(int size, T t) { - reserve(size); - size_used_ = size; - for (int i = 0; i < size; ++i) - data_[i] = t; -} - - -// Return the object from an index. -template -T &GenericVector::get(int index) const { - ASSERT_HOST(index >= 0 && index < size_used_); - return data_[index]; -} - -template -T &GenericVector::operator[](int index) const { - return data_[index]; -} - -// Return the object from an index. -template -void GenericVector::set(T t, int index) { - ASSERT_HOST(index >= 0 && index < size_used_); - data_[index] = t; -} - -// Shifts the rest of the elements to the right to make -// space for the new elements and inserts the given element -// at the specified index. -template -void GenericVector::insert(T t, int index) { - ASSERT_HOST(index >= 0 && index < size_used_); - if (size_reserved_ == size_used_) - double_the_size(); - for (int i = size_used_; i > index; --i) { - data_[i] = data_[i-1]; - } - data_[index] = t; - size_used_++; -} - -// Removes an element at the given index and -// shifts the remaining elements to the left. -template -void GenericVector::remove(int index) { - ASSERT_HOST(index >= 0 && index < size_used_); - for (int i = index; i < size_used_ - 1; ++i) { - data_[i] = data_[i+1]; - } - size_used_--; -} - -// Return true if the index is valindex -template -T GenericVector::contains_index(int index) const { - return index >= 0 && index < size_used_; -} - -// Return the index of the T object. -template -int GenericVector::get_index(T object) const { - for (int i = 0; i < size_used_; ++i) { - ASSERT_HOST(compare_cb_ != NULL); - if (compare_cb_->Run(object, data_[i])) - return i; - } - return -1; -} - -// Return true if T is in the array -template -bool GenericVector::contains(T object) const { - return get_index(object) != -1; -} - -// Add an element in the array -template -int GenericVector::push_back(T object) { - int index = 0; - if (size_used_ == size_reserved_) - double_the_size(); - index = size_used_++; - data_[index] = object; - return index; -} - -// Add an element in the array (front) -template -int GenericVector::push_front(T object) { - if (size_used_ == size_reserved_) - double_the_size(); - for (int i = size_used_; i > 0; --i) - data_[i] = data_[i-1]; - data_[0] = object; - ++size_used_; - return 0; -} - -template -void GenericVector::operator+=(T t) { - push_back(t); -} - -template -GenericVector &GenericVector::operator+=(const GenericVector& other) { - this->reserve(size_used_ + other.size_used_); - for (int i = 0; i < other.size(); ++i) { - this->operator+=(other.data_[i]); - } - return *this; -} - -template -GenericVector &GenericVector::operator=(const GenericVector& other) { - this->truncate(0); - this->operator+=(other); - return *this; -} - -// Add a callback to be called to delete the elements when the array took -// their ownership. -template -void GenericVector::set_clear_callback(TessCallback1* cb) { - clear_cb_ = cb; -} - -// Add a callback to be called to delete the elements when the array took -// their ownership. -template -void GenericVector::set_compare_callback(TessResultCallback2* cb) { - compare_cb_ = cb; -} - -// Clear the array, calling the callback function if any. -template -void GenericVector::clear() { - if (size_reserved_ > 0) { - if (clear_cb_ != NULL) - for (int i = 0; i < size_used_; ++i) - clear_cb_->Run(data_[i]); - delete[] data_; - data_ = NULL; - size_used_ = 0; - size_reserved_ = 0; - } - if (clear_cb_ != NULL) { - delete clear_cb_; - clear_cb_ = NULL; - } - if (compare_cb_ != NULL) { - delete compare_cb_; - compare_cb_ = NULL; - } -} - -template -void GenericVector::delete_data_pointers() { - for (int i = 0; i < size_used_; ++i) - if (data_[i]) { - delete data_[i]; - } -} - - -template -bool GenericVector::write( - FILE* f, TessResultCallback2* cb) const { - if (fwrite(&size_reserved_, sizeof(size_reserved_), 1, f) != 1) return false; - if (fwrite(&size_used_, sizeof(size_used_), 1, f) != 1) return false; - if (cb != NULL) { - for (int i = 0; i < size_used_; ++i) { - if (!cb->Run(f, data_[i])) { - delete cb; - return false; - } - } - delete cb; - } else { - if (fwrite(data_, sizeof(T), size_used_, f) != size_used_) return false; - } - return true; -} - -template -bool GenericVector::read(FILE* f, - TessResultCallback3* cb, - bool swap) { - inT32 reserved; - if (fread(&reserved, sizeof(reserved), 1, f) != 1) return false; - if (swap) Reverse32(&reserved); - reserve(reserved); - if (fread(&size_used_, sizeof(size_used_), 1, f) != 1) return false; - if (swap) Reverse32(&size_used_); - if (cb != NULL) { - for (int i = 0; i < size_used_; ++i) { - if (!cb->Run(f, data_ + i, swap)) { - delete cb; - return false; - } - } - delete cb; - } else { - if (fread(data_, sizeof(T), size_used_, f) != size_used_) return false; - if (swap) { - for (int i = 0; i < size_used_; ++i) - ReverseN(&data_[i], sizeof(T)); - } - } - return true; -} - -// Writes a vector of simple types to the given file. Assumes that bitwise -// read/write of T will work. Returns false in case of error. -template -bool GenericVector::Serialize(FILE* fp) const { - if (fwrite(&size_used_, sizeof(size_used_), 1, fp) != 1) return false; - if (fwrite(data_, sizeof(*data_), size_used_, fp) != size_used_) return false; - return true; -} - -// Reads a vector of simple types from the given file. Assumes that bitwise -// read/write will work with ReverseN according to sizeof(T). -// Returns false in case of error. -// If swap is true, assumes a big/little-endian swap is needed. -template -bool GenericVector::DeSerialize(bool swap, FILE* fp) { - inT32 reserved; - if (fread(&reserved, sizeof(reserved), 1, fp) != 1) return false; - if (swap) Reverse32(&reserved); - reserve(reserved); - size_used_ = reserved; - if (fread(data_, sizeof(T), size_used_, fp) != size_used_) return false; - if (swap) { - for (int i = 0; i < size_used_; ++i) - ReverseN(&data_[i], sizeof(data_[i])); - } - return true; -} - -// Writes a vector of classes to the given file. Assumes the existence of -// bool T::Serialize(FILE* fp) const that returns false in case of error. -// Returns false in case of error. -template -bool GenericVector::SerializeClasses(FILE* fp) const { - if (fwrite(&size_used_, sizeof(size_used_), 1, fp) != 1) return false; - for (int i = 0; i < size_used_; ++i) { - if (!data_[i].Serialize(fp)) return false; - } - return true; -} - -// Reads a vector of classes from the given file. Assumes the existence of -// bool T::Deserialize(bool swap, FILE* fp) that returns false in case of -// error. Alse needs T::T() and T::T(constT&), as init_to_size is used in -// this function. Returns false in case of error. -// If swap is true, assumes a big/little-endian swap is needed. -template -bool GenericVector::DeSerializeClasses(bool swap, FILE* fp) { - uinT32 reserved; - if (fread(&reserved, sizeof(reserved), 1, fp) != 1) return false; - if (swap) Reverse32(&reserved); - T empty; - init_to_size(reserved, empty); - for (int i = 0; i < reserved; ++i) { - if (!data_[i].DeSerialize(swap, fp)) return false; - } - return true; -} - -// This method clear the current object, then, does a shallow copy of -// its argument, and finally invalindate its argument. -template -void GenericVector::move(GenericVector* from) { - this->clear(); - this->data_ = from->data_; - this->size_reserved_ = from->size_reserved_; - this->size_used_ = from->size_used_; - this->compare_cb_ = from->compare_cb_; - this->clear_cb_ = from->clear_cb_; - from->data_ = NULL; - from->clear_cb_ = NULL; - from->compare_cb_ = NULL; - from->size_used_ = 0; - from->size_reserved_ = 0; -} - -template -void GenericVector::sort() { - sort(&tesseract::sort_cmp); -} - -#endif // TESSERACT_CCUTIL_GENERICVECTOR_H_ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/helpers.h b/iOS/OCRPlugin/dependencies/include/tesseract/helpers.h deleted file mode 100644 index 511492b6..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/helpers.h +++ /dev/null @@ -1,139 +0,0 @@ -/* -*-C-*- - ******************************************************************************** - * - * File: helpers.h - * Description: General utility functions - * Author: Daria Antonova - * Created: Wed Apr 8 14:37:00 2009 - * Language: C++ - * Package: N/A - * Status: Reusable Software Component - * - * (c) Copyright 2009, Google Inc. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - ********************************************************************************/ - -#ifndef TESSERACT_CCUTIL_HELPERS_H_ -#define TESSERACT_CCUTIL_HELPERS_H_ - -#include -#include - -// Remove newline (if any) at the end of the string. -inline void chomp_string(char *str) { - int last_index = strlen(str) - 1; - if (last_index >= 0 && str[last_index] == '\n') { - str[last_index] = '\0'; - } -} - -// Advance the current pointer of the file if it points to a newline character. -inline void SkipNewline(FILE *file) { - if (fgetc(file) != '\n') fseek(file, -1, SEEK_CUR); -} - -// qsort function to sort 2 floats. -inline int sort_floats(const void *arg1, const void *arg2) { - float diff = *((float *) arg1) - *((float *) arg2); - if (diff > 0) { - return 1; - } else if (diff < 0) { - return -1; - } else { - return 0; - } -} - -// return the smallest multiple of block_size greater than or equal to n. -inline int RoundUp(int n, int block_size) { - return block_size * ((n + block_size - 1) / block_size); -} - -// Clip a numeric value to the interval [lower_bound, upper_bound]. -template -inline T ClipToRange(const T& x, const T& lower_bound, const T& upper_bound) { - if (x < lower_bound) - return lower_bound; - if (x > upper_bound) - return upper_bound; - return x; -} - -// Extend the range [lower_bound, upper_bound] to include x. -template -inline void UpdateRange(const T1& x, T2* lower_bound, T2* upper_bound) { - if (x < *lower_bound) - *lower_bound = x; - if (x > *upper_bound) - *upper_bound = x; -} - -// Decrease lower_bound to be <= x_lo AND increase upper_bound to be >= x_hi. -template -inline void UpdateRange(const T1& x_lo, const T1& x_hi, - T2* lower_bound, T2* upper_bound) { - if (x_lo < *lower_bound) - *lower_bound = x_lo; - if (x_hi > *upper_bound) - *upper_bound = x_hi; -} - -// Proper modulo arithmetic operator. Returns a mod b that works for -ve a. -// For any integer a and positive b, returns r : 0<=r= 0 ? (a + b / 2) / b : (a - b / 2) / b; -} - -// Return a double cast to int with rounding. -inline int IntCastRounded(double x) { - return x >= 0.0 ? static_cast(x + 0.5) : -static_cast(-x + 0.5); -} - -// Reverse the order of bytes in a n byte quantity for big/little-endian switch. -inline void ReverseN(void* ptr, int num_bytes) { - char *cptr = reinterpret_cast(ptr); - int halfsize = num_bytes / 2; - for (int i = 0; i < halfsize; ++i) { - char tmp = cptr[i]; - cptr[i] = cptr[num_bytes - 1 - i]; - cptr[num_bytes - 1 - i] = tmp; - } -} - -// Reverse the order of bytes in a 16 bit quantity for big/little-endian switch. -inline void Reverse16(void *ptr) { - ReverseN(ptr, 2); -} - -// Reverse the order of bytes in a 32 bit quantity for big/little-endian switch. -inline void Reverse32(void *ptr) { - ReverseN(ptr, 4); -} - -// Reverse the order of bytes in a 64 bit quantity for big/little-endian switch. -inline void Reverse64(void* ptr) { - ReverseN(ptr, 8); -} - - -#endif // TESSERACT_CCUTIL_HELPERS_H_ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/host.h b/iOS/OCRPlugin/dependencies/include/tesseract/host.h deleted file mode 100644 index d9023af5..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/host.h +++ /dev/null @@ -1,180 +0,0 @@ -/****************************************************************************** - ** Filename: Host.h - ** Purpose: This is the system independent typedefs and defines - ** Author: MN, JG, MD - ** Version: 5.4.1 - ** History: 11/7/94 MCD received the modification that Lennart made - ** to port to 32 bit world and modify this file so that it - ** will be shared between platform. - ** 11/9/94 MCD Make MSW32 subset of MSW. Now MSW means - ** MicroSoft Window and MSW32 means the 32 bit worlds - ** of MicroSoft Window. Therefore you want the environment - ** to be MicroSoft Window and in the 32 bit world - - ** __MSW__ and __MSW32__ must be uncommented out. - ** 11/30/94 MCD Incorporated comments received for more - ** readability and the missing typedef for FLOAT. - ** 12/1/94 MCD Added PFVOID typedef - ** 5/1/95 MCD. Made many changes based on the inputs. - ** Changes: - ** 1) Rearrange the #ifdef so that there're definitions for - ** particular platforms. - ** 2) Took out the #define for computer and environment - ** that developer can uncomment - ** 3) Added __OLDCODE__ where the defines will be - ** obsoleted in the next version and advise not to use. - ** 4) Added the definitions for the following: - ** FILE_HANDLE, MEMORY_HANDLE, BOOL8, - ** MAX_INT8, MAX_INT16, MAX_INT32, MAX_UINT8 - ** MAX_UINT16, MAX_UINT32, MAX_FLOAT32 - ** 06/19/96 MCD. Took out MAX_FLOAT32 - ** 07/15/96 MCD. Fixed the comments error - ** Add back BOOL8. - ** - ** (c) Copyright Hewlett-Packard Company, 1988-1996. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - */ - -#ifndef __HOST__ -#define __HOST__ - -/****************************************************************************** - ** IMPORTANT!!! ** - ** ** - ** Defines either __MSW__, __MSW32__, __MAC__, __UNIX__, __OS2__, __PM__ to - ** use the specified definitions indicated below in the preprocessor settings. ** - ** ** - ** Also define either __FarProc__ or __FarData__ and __MOTO__ to use the - ** specified definitions indicated below in the preprocessor settings. ** - ** ** - ** If a preprocessor settings is not allow in the compiler that is being use, - ** then it is recommended that a "platform.h" is created with the definition - ** of the computer and/or operating system. - ******************************************************************************/ - -#include "platform.h" -/* __MSW32__ */ -#ifdef __MSW32__ -#include -#include // winbase.h contains windows.h - -#define DLLIMPORT __declspec( dllimport) -#define DLLEXPORT __declspec( dllexport) - -#else -/********************************************************/ -/* __MSW__ */ -#ifdef __MSW__ -#include // provides standard definitions (like HANDLE) - -#define DLLIMPORT __import -#define DLLEXPORT __export -#endif -#endif - -/********************************************************/ -/* __MAC__ */ -#ifdef __MAC__ -#include -/*----------------------------*/ -/*----------------------------*/ -#define DLLIMPORT -#define DLLEXPORT - -#endif -/********************************************************/ -#if defined(__UNIX__) || defined( __DOS__ ) || defined(__OS2__) || defined(__PM__) -/*----------------------------*/ -/* FarProc and FarData */ -/*----------------------------*/ -#define DLLIMPORT -#define DLLEXPORT -/*----------------------------*/ -#endif -/***************************************************************************** - ** - ** Standard GHC Definitions - ** - *****************************************************************************/ - -#ifdef __MOTO__ -#define __NATIVE__ MOTO -#else -#define __NATIVE__ INTEL -#endif - -//typedef HANDLE FD* PHANDLE; - -// definitions of portable data types (numbers and characters) -typedef SIGNED char inT8; -typedef unsigned char uinT8; -typedef short inT16; -typedef unsigned short uinT16; -typedef int inT32; -typedef unsigned int uinT32; -#if (_MSC_VER >= 1200) //%%% vkr for VC 6.0 -typedef INT64 inT64; -typedef UINT64 uinT64; -#else -typedef long long int inT64; -typedef unsigned long long int uinT64; -#endif //%%% vkr for VC 6.0 -typedef float FLOAT32; -typedef double FLOAT64; -typedef unsigned char BOOL8; - -#define INT32FORMAT "%d" -#define INT64FORMAT "%lld" - -#define MAX_INT8 0x7f -#define MAX_INT16 0x7fff -#define MAX_INT32 0x7fffffff -#define MAX_UINT8 0xff -#define MAX_UINT16 0xffff -#define MAX_UINT32 0xffffffff -#define MAX_FLOAT32 ((float)3.40282347e+38) - -#define MIN_INT8 0x80 -#define MIN_INT16 0x8000 -#define MIN_INT32 0x80000000 -#define MIN_UINT8 0x00 -#define MIN_UINT16 0x0000 -#define MIN_UINT32 0x00000000 -#define MIN_FLOAT32 ((float)1.17549435e-38) - -// Defines - -#ifndef OKAY -#define OKAY 0 -#endif - -#ifndef HPERR -#define HPERR -1 -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifndef NULL -#define NULL 0L -#endif - -// Return true if x is within tolerance of y -template bool NearlyEqual(T x, T y, T tolerance) { - T diff = x - y; - return diff <= tolerance && -diff <= tolerance; -} - -#endif diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/ndminx.h b/iOS/OCRPlugin/dependencies/include/tesseract/ndminx.h deleted file mode 100644 index 9eee76c0..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/ndminx.h +++ /dev/null @@ -1,31 +0,0 @@ -/********************************************************************** - * File: ndminx.h (Formerly ndminmax.h) - * Description: Extended ascii chars - * Author: Phil Cheatle - * Created: Mon Mar 29 14:46:01 BST 1993 - * - * (C) Copyright 1991, Hewlett-Packard Ltd. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -#ifndef NDMINX_H -#define NDMINX_H - -#ifndef MAX -#define MAX(x,y) (((x) >= (y))?(x):(y)) -#endif - -#ifndef MIN -#define MIN(x,y) (((x) <= (y))?(x):(y)) -#endif - -#endif diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/ocrclass.h b/iOS/OCRPlugin/dependencies/include/tesseract/ocrclass.h deleted file mode 100644 index 87f55bf1..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/ocrclass.h +++ /dev/null @@ -1,335 +0,0 @@ -/********************************************************************** - * File: ocrclass.h - * Description: Class definitions and constants for the OCR API. - * Author: Hewlett-Packard Co - * - * (C) Copyright 1996, Hewlett-Packard Co. - ** Licensed under the Apache License, Version 2.0 (the "License"); - ** you may not use this file except in compliance with the License. - ** You may obtain a copy of the License at - ** http://www.apache.org/licenses/LICENSE-2.0 - ** Unless required by applicable law or agreed to in writing, software - ** distributed under the License is distributed on an "AS IS" BASIS, - ** WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - ** See the License for the specific language governing permissions and - ** limitations under the License. - * - **********************************************************************/ - -/********************************************************************** - * This file contains typedefs for all the structures used by - * the HP OCR interface. - * The code is designed to be used with either a C or C++ compiler. - * The structures are designed to allow them to be used with any - * structure alignment upto 8. - **********************************************************************/ - -#ifndef CCUTIL_OCRCLASS_H_ -#define CCUTIL_OCRCLASS_H_ - -#ifndef __GNUC__ -#ifdef __MSW32__ -#include -#include "gettimeofday.h" -#endif -#else -#include -#endif -#include -#include "host.h" - -/*Maximum lengths of various strings*/ -#define MAX_FONT_NAME 34 /*name of font */ -#define MAX_OCR_NAME 32 /*name of engine */ -#define MAX_OCR_VERSION 17 /*version code of engine */ - -/*Image parameters*/ -#define MIN_IMAGE_SIZE 64 /*smallest image that will be passed */ -#define IMAGE_ROUNDING 32 /*all sizes are multiple of this */ - -#if defined(__SLOW_TIMES__) -/*Maximum timeouts of various functions (in secs)*/ -#define STARTUP_TIMEOUT 100 /*start of OCR engine */ -#define SHUTDOWN_TIMEOUT 50 /*end of OCR engine */ -#define SENDIM_TIMEOUT 50 /*send of image */ -#define RELEASE_TIMEOUT 50 /*release of semaphore */ -#define READIM_TIMEOUT 100 /*read of image */ -#define READTEXT_TIMEOUT 50 /*read of text */ -#define PROGRESS_TIMEOUT 30 /*progress every 3 seconds */ -#define BADTIMES_TIMEOUT 7 /*max lack of progress */ -#else -/*Maximum timeouts of various functions (in secs)*/ -#define STARTUP_TIMEOUT 10 /*start of OCR engine */ -#define SHUTDOWN_TIMEOUT 6 /*end of OCR engine */ -#define SENDIM_TIMEOUT 5 /*send of image */ -#define RELEASE_TIMEOUT 5 /*release of semaphore */ -#define READIM_TIMEOUT 10 /*read of image */ -#define READTEXT_TIMEOUT 5 /*read of text */ -#define PROGRESS_TIMEOUT 3 /*progress every 3 seconds */ -#define BADTIMES_TIMEOUT 7 /*max lack of progress */ -#endif - -/*language definitions are identical to RTF*/ -#define LANGE_NONE 0x0400 /*no language */ -#define LANGE_ALBANIAN 0x041c /*Albanian */ -#define LANGE_BRITISH 0x0809 /*International English */ -#define LANGE_BULGARIAN 0x0402 /*Bulgarian */ -#define LANGE_CROATIAN 0x041a /*Croatian(latin alphabet) */ -#define LANGE_CZECH 0x0405 /*Czech */ -#define LANGE_DANISH 0x0406 /*Danish */ -#define LANGE_DUTCH 0x0413 /*Dutch */ -#define LANGE_FINNISH 0x040b /*Finnish */ -#define LANGE_FRENCH 0x040c /*French */ -#define LANGE_GERMAN 0x0407 /*German */ -#define LANGE_GREEK 0x0408 /*Greek */ -#define LANGE_HUNGARIAN 0x040e /*Hungarian */ -#define LANGE_ITALIAN 0x0410 /*Italian */ -#define LANGE_JAPANESE 0x0411 /*Japanese */ -#define LANGE_KOREAN 0x0412 /*Korean */ -#define LANGE_NORWEGIAN 0x0414 /*Bokmal */ -#define LANGE_POLISH 0x0415 /*Polish */ -#define LANGE_PORTUGESE 0x0416 /*Brazilian Portugese */ -#define LANGE_ROMANIAN 0x0418 /*Romanian */ -#define LANGE_RUSSIAN 0x0419 /*Russian */ -#define LANGE_SCHINESE 0x0804 /*Simplified Chinese */ -#define LANGE_SLOVAK 0x041b /*Slovak */ -#define LANGE_SPANISH 0x040a /*Castilian */ -#define LANGE_SWEDISH 0x041d /*Swedish */ -#define LANGE_TCHINESE 0x0404 /*Traditional Chinese */ -#define LANGE_TURKISH 0x041f /*Turkish */ -#define LANGE_USENGLISH 0x0409 /*American */ - -/*font family definitions are identical to RTF*/ -#define FFAM_NONE 0 /*unknown */ -#define FFAM_ROMAN 1 /*serifed prop */ -#define FFAM_SWISS 2 /*sans-serif prop */ -#define FFAM_MODERN 3 /*fixed pitch */ - -/*character set definitions are identical to RTF*/ -#define CHSET_ANSI 0 /*Ansi efigs */ -#define CHSET_SHIFT_JIS 128 /*JIS X 0208-1990 */ -#define CHSET_KOREAN 129 /*KS C 5601-1992 */ -#define CHSET_SCHINESE 134 /*GB 2312-80 */ -#define CHSET_BIG5 136 /*Big Five */ -#define CHSET_CYRILLIC 204 /*Cyrillic */ -#define CHSET_EEUROPE 238 /*Eastern Europe */ - -/*pitch set definitions are identical to RTF*/ -#define PITCH_DEF 0 /*default */ -#define PITCH_FIXED 1 /*fixed pitch */ -#define PITCH_VAR 2 /*variable pitch */ - -/*Bitmasks for character enhancements. -OR these together for enhancement in ocr_append_char*/ -#define EUC_BOLD 1 /*bold character */ -#define EUC_ITALIC 2 /*italic char */ -#define EUC_UNDERLINE 4 /*underlined char */ -#define EUC_SUBSCRIPT 8 /*subscript char */ -#define EUC_SUPERSCRIPT 16 /*superscript char */ - -/*enum for character rendering direction*/ -enum OCR_CHAR_DIRECTION { - OCR_CDIR_RIGHT_LEFT, /*right to left horizontal */ - OCR_CDIR_LEFT_RIGHT, /*left to right horizontal */ - OCR_CDIR_TOP_BOTTOM, /*top to bottom vertical */ - OCR_CDIR_BOTTOM_TOP /*bottom to top vertical */ -}; - -/*enum for line rendering direction*/ -enum OCR_LINE_DIRECTION { - OCR_LDIR_DOWN_RIGHT, /*horizontal lines go down */ - /*vertical lines go right */ - OCR_LDIR_UP_LEFT /*horizontal lines go up */ -}; - -/*enum for newline type*/ -enum OCR_NEWLINE_TYPE { - OCR_NL_NONE, /*not a newline */ - OCR_NL_NEWLINE, /*this is a newline but not new para */ - OCR_NL_NEWPARA /*this is a newline and a new para */ -}; - -/*error codes that can be returned from the API functions other than OKAY -and HPERR*/ -#define OCR_API_NO_MEM (-2) /*filled output buffer */ -#define OCR_API_BAD_CHAR (-3) /*whitespace sent to ocr_append_char */ -#define OCR_API_BAD_STATE (-4) /*invalid call sequence */ - -/*error codes used for passing errors back to the HP side*/ -enum OCR_ERR_CODE { - OCR_ERR_NONE, /*no error */ - OCR_ERR_CLEAN_EXIT, /*no error */ - OCR_ERR_NO_MEM, /*out of memory */ - OCR_ERR_FILE_READ, /*failed to read data file */ - OCR_ERR_TMP_WRITE, /*failed to write temp file */ - OCR_ERR_TMP_READ, /*failed to read temp file */ - OCR_ERR_BAD_DLL, /*missing or invalid dll subcomponent */ - OCR_ERR_BAD_EXE, /*missing or invalid exe subcomponent */ - OCR_ERR_BAD_LOAD, /*failed to load subcomponent */ - OCR_ERR_BAD_LANG, /*unable to recognize requested language */ - OCR_ERR_BAD_STATE, /*engine did call out of sequence */ - OCR_ERR_INTERNAL1, /*internal error type 1 */ - OCR_ERR_INTERNAL2, /*internal error type 1 */ - OCR_ERR_INTERNAL3, /*internal error type 1 */ - OCR_ERR_INTERNAL4, /*internal error type 1 */ - OCR_ERR_INTERNAL5, /*internal error type 1 */ - OCR_ERR_INTERNAL6, /*internal error type 1 */ - OCR_ERR_INTERNAL7, /*internal error type 1 */ - OCR_ERR_INTERNAL8, /*internal error type 1 */ - OCR_ERR_TIMEOUT /*timed out in comms */ -}; /*for calls to ocr_error */ - -/********************************************************************** - * EFONT_DESC - * Description of one font. - * The information required is basically that used by RTF. - * The name may be either a valid font on the system or the empty string. - **********************************************************************/ - -typedef struct { /*font description */ - uinT16 language; /*default language */ - uinT8 font_family; /*serif/not, fixed/not */ - uinT8 char_set; /*character set standard */ - uinT8 pitch; /*fixed or prop */ - inT8 name[MAX_FONT_NAME + 1]; /*plain ascii name */ -} EFONT_DESC; /*font description */ - -/********************************************************************** - * EOCR_DESC - * Description of the OCR engine provided at startup. - * The name and version may be reported to the user at some point. - * The fonts array should indicate the fonts that the OCR system - * can recognize. - **********************************************************************/ - -typedef struct { /*startup info */ - inT32 protocol; /*interface version */ - uinT32 font_count; /*number of fonts */ - uinT16 language; /*default language */ - uinT16 name[MAX_OCR_NAME + 1]; /*name of engine */ - /*version of engine */ - uinT16 version[MAX_OCR_VERSION + 1]; - EFONT_DESC fonts[1]; /*array of fonts */ -} EOCR_DESC; /*startup info */ - -/********************************************************************** - * ESTRIP_DESC - * Description of the image strip as it is passed to the engine. - * The image is always 1 bit, with 1=black. - * The width is always a multiple of 32, so padding is always OK. - * The height of the full image is always a multiple of 32. - * The top y coordinate is 0, and increases down. - * The top leftmost pixel is in the most significant bit of the first byte. - **********************************************************************/ - -typedef struct { /*bitmap strip */ - inT16 x_size; /*width in pixels */ - inT16 y_size; /*of full image */ - inT16 strip_size; /*of this strip */ - inT16 resolution; /*pixels per inch */ - uinT8 data[8]; /*image data */ -} ESTRIP_DESC; /*bitmap strip */ - -/********************************************************************** - * EANYCODE_CHAR - * Description of a single character. The character code is defined by - * the character set of the current font. - * Output text is sent as an array of these structures. - * Spaces and line endings in the output are represented in the - * structures of the surrounding characters. They are not directly - * represented as characters. - * The first character in a word has a positive value of blanks. - * Missing information should be set to the defaults in the comments. - * If word bounds are known, but not character bounds, then the top and - * bottom of each character should be those of the word. The left of the - * first and right of the last char in each word should be set. All other - * lefts and rights should be set to -1. - * If set, the values of right and bottom are left+width and top+height. - * Most of the members come directly from the parameters to ocr_append_char. - * The formatting member uses the enhancement parameter and combines the - * line direction stuff into the top 3 bits. - * The coding is 0=RL char, 1=LR char, 2=DR NL, 3=UL NL, 4=DR Para, - * 5=UL Para, 6=TB char, 7=BT char. API users do not need to know what - * the coding is, only that it is backwards compatible with the previous - * version. - **********************************************************************/ - -typedef struct { /*single character */ -// It should be noted that the format for char_code for version 2.0 and beyond -// is UTF8 which means that ASCII characters will come out as one structure but -// other characters will be returned in two or more instances of this structure -// with a single byte of the UTF8 code in each, but each will have the same -// bounding box. Programs which want to handle languagues with different -// characters sets will need to handle extended characters appropriately, but -// *all* code needs to be prepared to receive UTF8 coded characters for -// characters such as bullet and fancy quotes. - uinT16 char_code; /*character itself */ - inT16 left; /*of char (-1) */ - inT16 right; /*of char (-1) */ - inT16 top; /*of char (-1) */ - inT16 bottom; /*of char (-1) */ - inT16 font_index; /*what font (0) */ - uinT8 confidence; /*0=perfect, 100=reject (0/100) */ - uinT8 point_size; /*of char, 72=i inch, (10) */ - inT8 blanks; /*no of spaces before this char (1) */ - uinT8 formatting; /*char formatting (0) */ -} EANYCODE_CHAR; /*single character */ - -/********************************************************************** - * ETEXT_DESC - * Description of the output of the OCR engine. - * This structure is used as both a progress monitor and the final - * output header, since it needs to be a valid progress monitor while - * the OCR engine is storing its output to shared memory. - * During progress, all the buffer info is -1. - * Progress starts at 0 and increases to 100 during OCR. No other constraint. - * Every progress callback, the OCR engine must set ocr_alive to 1. - * The HP side will set ocr_alive to 0. Repeated failure to reset - * to 1 indicates that the OCR engine is dead. - * If the cancel function is not null then it is called with the number of - * user words found. If it returns true then operation is cancelled. - **********************************************************************/ -typedef bool (*CANCEL_FUNC)(void* cancel_this, int words); - -class ETEXT_DESC { // output header - public: - inT16 count; // chars in this buffer(0) - inT16 progress; // percent complete increasing (0-100) - inT8 more_to_come; // true if not last - volatile inT8 ocr_alive; // ocr sets to 1, HP 0 - inT8 err_code; // for errcode use - CANCEL_FUNC cancel; // returns true to cancel - void* cancel_this; // this or other data for cancel - struct timeval end_time; // time to stop. expected to be set only by call - // to set_deadline_msecs() - EANYCODE_CHAR text[1]; // character data - - ETEXT_DESC() : count(0), progress(0), more_to_come(0), ocr_alive(0), - err_code(0), cancel(NULL), cancel_this(NULL) { - end_time.tv_sec = 0; - end_time.tv_usec = 0; - } - - // Sets the end time to be deadline_msecs milliseconds from now. - void set_deadline_msecs(inT32 deadline_msecs) { - gettimeofday(&end_time, NULL); - inT32 deadline_secs = deadline_msecs / 1000; - end_time.tv_sec += deadline_secs; - end_time.tv_usec += (deadline_msecs - deadline_secs * 1000) * 1000; - if (end_time.tv_usec > 1000000) { - end_time.tv_usec -= 1000000; - ++end_time.tv_sec; - } - } - - // Returns false if we've not passed the end_time, or have not set a deadline. - bool deadline_exceeded() const { - if (end_time.tv_sec == 0 && end_time.tv_usec == 0) return false; - struct timeval now; - gettimeofday(&now, NULL); - return (now.tv_sec > end_time.tv_sec || (now.tv_sec == end_time.tv_sec && - now.tv_usec > end_time.tv_usec)); - } -}; - -#endif // CCUTIL_OCRCLASS_H_ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/platform.h b/iOS/OCRPlugin/dependencies/include/tesseract/platform.h deleted file mode 100644 index 5c1d4c16..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/platform.h +++ /dev/null @@ -1,48 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: platform.h -// Description: Place holder -// Author: -// Created: -// -// (C) Copyright 2006, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_CCUTIL_PLATFORM_H__ -#define TESSERACT_CCUTIL_PLATFORM_H__ - -#define DLLSYM -#ifdef __MSW32__ -#ifdef __GNUC__ -#define ultoa _ultoa -typedef struct _BLOB { - unsigned int cbSize; - char *pBlobData; -} BLOB, *LPBLOB; -#endif /* __GNUC__ */ -#define SIGNED -#define snprintf _snprintf -#if (_MSC_VER <= 1400) -#define vsnprintf _vsnprintf -#endif /* __MSW32__ */ -#else -#define __UNIX__ -#include -#ifndef PATH_MAX -#define MAX_PATH 4096 -#else -#define MAX_PATH PATH_MAX -#endif -#define SIGNED signed -#endif - -#endif // TESSERACT_CCUTIL_PLATFORM_H__ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/publictypes.h b/iOS/OCRPlugin/dependencies/include/tesseract/publictypes.h deleted file mode 100644 index 8ee746b0..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/publictypes.h +++ /dev/null @@ -1,202 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: publictypes.h -// Description: Types used in both the API and internally -// Author: Ray Smith -// Created: Wed Mar 03 09:22:53 PST 2010 -// -// (C) Copyright 2010, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_CCSTRUCT_PUBLICTYPES_H__ -#define TESSERACT_CCSTRUCT_PUBLICTYPES_H__ - -// This file contains types that are used both by the API and internally -// to Tesseract. In order to decouple the API from Tesseract and prevent cyclic -// dependencies, THIS FILE SHOULD NOT DEPEND ON ANY OTHER PART OF TESSERACT. -// Restated: It is OK for low-level Tesseract files to include publictypes.h, -// but not for the low-level tesseract code to include top-level API code. -// This file should not use other Tesseract types, as that would drag -// their includes into the API-level. -// API-level code should include apitypes.h in preference to this file. - -// Number of printers' points in an inch. The unit of the pointsize return. -const int kPointsPerInch = 72; - -// Possible types for a POLY_BLOCK or ColPartition. -// Must be kept in sync with kPBColors in polyblk.cpp and PTIs*Type functions -// below, as well as kPolyBlockNames in publictypes.cpp. -// Used extensively by ColPartition, and POLY_BLOCK. -enum PolyBlockType { - PT_UNKNOWN, // Type is not yet known. Keep as the first element. - PT_FLOWING_TEXT, // Text that lives inside a column. - PT_HEADING_TEXT, // Text that spans more than one column. - PT_PULLOUT_TEXT, // Text that is in a cross-column pull-out region. - PT_TABLE, // Partition belonging to a table region. - PT_VERTICAL_TEXT, // Text-line runs vertically. - PT_CAPTION_TEXT, // Text that belongs to an image. - PT_FLOWING_IMAGE, // Image that lives inside a column. - PT_HEADING_IMAGE, // Image that spans more than one column. - PT_PULLOUT_IMAGE, // Image that is in a cross-column pull-out region. - PT_HORZ_LINE, // Horizontal Line. - PT_VERT_LINE, // Vertical Line. - PT_NOISE, // Lies outside of any column. - PT_COUNT -}; - -// Returns true if PolyBlockType is of horizontal line type -inline bool PTIsLineType(PolyBlockType type) { - return type == PT_HORZ_LINE || type == PT_VERT_LINE; -} -// Returns true if PolyBlockType is of image type -inline bool PTIsImageType(PolyBlockType type) { - return type == PT_FLOWING_IMAGE || type == PT_HEADING_IMAGE || - type == PT_PULLOUT_IMAGE; -} -// Returns true if PolyBlockType is of text type -inline bool PTIsTextType(PolyBlockType type) { - return type == PT_FLOWING_TEXT || type == PT_HEADING_TEXT || - type == PT_PULLOUT_TEXT || type == PT_TABLE || - type == PT_VERTICAL_TEXT || type == PT_CAPTION_TEXT; -} - -// String name for each block type. Keep in sync with PolyBlockType. -extern const char* kPolyBlockNames[]; - -namespace tesseract { -// +------------------+ Orientation Example: -// | 1 Aaaa Aaaa Aaaa | ==================== -// | Aaa aa aaa aa | To left is a diagram of some (1) English and -// | aaaaaa A aa aaa. | (2) Chinese text and a (3) photo credit. -// | 2 | -// | ####### c c C | Upright Latin characters are represented as A and a. -// | ####### c c c | '<' represents a latin character rotated -// | < ####### c c c | anti-clockwise 90 degrees. -// | < ####### c c | -// | < ####### . c | Upright Chinese characters are represented C and c. -// | 3 ####### c | -// +------------------+ NOTA BENE: enum values here should match goodoc.proto - -// If you orient your head so that "up" aligns with Orientation, -// then the characters will appear "right side up" and readable. -// -// In the example above, both the English and Chinese paragraphs are oriented -// so their "up" is the top of the page (page up). The photo credit is read -// with one's head turned leftward ("up" is to page left). -// -// The values of this enum match the convention of Tesseract's osdetect.h -enum Orientation { - ORIENTATION_PAGE_UP = 0, - ORIENTATION_PAGE_RIGHT = 1, - ORIENTATION_PAGE_DOWN = 2, - ORIENTATION_PAGE_LEFT = 3, -}; - -// The grapheme clusters within a line of text are laid out logically -// in this direction, judged when looking at the text line rotated so that -// its Orientation is "page up". -// -// For English text, the writing direction is left-to-right. For the -// Chinese text in the above example, the writing direction is top-to-bottom. -enum WritingDirection { - WRITING_DIRECTION_LEFT_TO_RIGHT = 0, - WRITING_DIRECTION_RIGHT_TO_LEFT = 1, - WRITING_DIRECTION_TOP_TO_BOTTOM = 2, -}; - -// The text lines are read in the given sequence. -// -// In English, the order is top-to-bottom. -// In Chinese, vertical text lines are read right-to-left. Mongolian is -// written in vertical columns top to bottom like Chinese, but the lines -// order left-to right. -// -// Note that only some combinations make sense. For example, -// WRITING_DIRECTION_LEFT_TO_RIGHT implies TEXTLINE_ORDER_TOP_TO_BOTTOM -enum TextlineOrder { - TEXTLINE_ORDER_LEFT_TO_RIGHT = 0, - TEXTLINE_ORDER_RIGHT_TO_LEFT = 1, - TEXTLINE_ORDER_TOP_TO_BOTTOM = 2, -}; - -// Possible modes for page layout analysis. These *must* be kept in order -// of decreasing amount of layout analysis to be done, except for OSD_ONLY, -// so that the inequality test macros below work. -enum PageSegMode { - PSM_OSD_ONLY, ///< Orientation and script detection only. - PSM_AUTO_OSD, ///< Automatic page segmentation with orientation and - ///< script detection. (OSD) - PSM_AUTO_ONLY, ///< Automatic page segmentation, but no OSD, or OCR. - PSM_AUTO, ///< Fully automatic page segmentation, but no OSD. - PSM_SINGLE_COLUMN, ///< Assume a single column of text of variable sizes. - PSM_SINGLE_BLOCK_VERT_TEXT, ///< Assume a single uniform block of vertically - ///< aligned text. - PSM_SINGLE_BLOCK, ///< Assume a single uniform block of text. (Default.) - PSM_SINGLE_LINE, ///< Treat the image as a single text line. - PSM_SINGLE_WORD, ///< Treat the image as a single word. - PSM_CIRCLE_WORD, ///< Treat the image as a single word in a circle. - PSM_SINGLE_CHAR, ///< Treat the image as a single character. - - PSM_COUNT ///< Number of enum entries. -}; - -// Macros that act on a PageSegMode to determine whether components of -// layout analysis are enabled. -// *Depend critically on the order of elements of PageSegMode.* -#define PSM_OSD_ENABLED(pageseg_mode) ((pageseg_mode) <= PSM_AUTO_OSD) -#define PSM_COL_FIND_ENABLED(pageseg_mode) \ - ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_AUTO) -#define PSM_BLOCK_FIND_ENABLED(pageseg_mode) \ - ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_COLUMN) -#define PSM_LINE_FIND_ENABLED(pageseg_mode) \ - ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_BLOCK) -#define PSM_WORD_FIND_ENABLED(pageseg_mode) \ - ((pageseg_mode) >= PSM_AUTO_OSD && (pageseg_mode) <= PSM_SINGLE_LINE) - -// enum of the elements of the page hierarchy, used in ResultIterator -// to provide functions that operate on each level without having to -// have 5x as many functions. -// NOTE: At present RIL_PARA and RIL_BLOCK are equivalent as there is -// no paragraph internally yet. -// TODO(rays) Add paragraph detection. -enum PageIteratorLevel { - RIL_BLOCK, // Block of text/image/separator line. - RIL_PARA, // Paragraph within a block. - RIL_TEXTLINE, // Line within a paragraph. - RIL_WORD, // Word within a textline. - RIL_SYMBOL // Symbol/character within a word. -}; - -// When Tesseract/Cube is initialized we can choose to instantiate/load/run -// only the Tesseract part, only the Cube part or both along with the combiner. -// The preference of which engine to use is stored in tessedit_ocr_engine_mode. -// -// ATTENTION: When modifying this enum, please make sure to make the -// appropriate changes to all the enums mirroring it (e.g. OCREngine in -// cityblock/workflow/detection/detection_storage.proto). Such enums will -// mention the connection to OcrEngineMode in the comments. -enum OcrEngineMode { - OEM_TESSERACT_ONLY, // Run Tesseract only - fastest - OEM_CUBE_ONLY, // Run Cube only - better accuracy, but slower - OEM_TESSERACT_CUBE_COMBINED, // Run both and combine results - best accuracy - OEM_DEFAULT // Specify this mode when calling init_*(), - // to indicate that any of the above modes - // should be automatically inferred from the - // variables in the language-specific config, - // command-line configs, or if not specified - // in any of the above should be set to the - // default OEM_TESSERACT_ONLY. -}; - -} // namespace tesseract. - -#endif // TESSERACT_CCSTRUCT_PUBLICTYPES_H__ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/tesscallback.h b/iOS/OCRPlugin/dependencies/include/tesseract/tesscallback.h deleted file mode 100644 index e8fbb716..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/tesscallback.h +++ /dev/null @@ -1,1238 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: tesscallback.h -// Description: classes and functions to replace pointer-to-functions -// Author: Samuel Charron -// -// (C) Copyright 2006, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef _TESS_CALLBACK_SPECIALIZATIONS_H -#define _TESS_CALLBACK_SPECIALIZATIONS_H - -#include "host.h" // For NULL. - -struct TessCallbackUtils_ { - static void FailIsRepeatable(const char* name); -}; - - -class TessClosure { - public: - virtual ~TessClosure() { } - virtual void Run() = 0; -}; - -template -class TessResultCallback { - public: - virtual ~TessResultCallback() { } - virtual R Run() = 0; -}; - -template -class _ConstTessMemberResultCallback_0_0 : public TessResultCallback { - public: - typedef TessResultCallback base; - typedef R (T::*MemberSignature)() const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_0( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run() { - if (!del) { - R result = (object_->*member_)(); - return result; - } else { - R result = (object_->*member_)(); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _ConstTessMemberResultCallback_0_0 - : public TessClosure { - public: - typedef TessClosure base; - typedef void (T::*MemberSignature)() const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_0( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run() { - if (!del) { - (object_->*member_)(); - } else { - (object_->*member_)(); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_0::base* -NewTessCallback( - const T1* obj, R (T2::*member)() const) { - return new _ConstTessMemberResultCallback_0_0( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_0::base* -NewPermanentTessCallback( - const T1* obj, R (T2::*member)() const) { - return new _ConstTessMemberResultCallback_0_0( - obj, member); -} -#endif - -template -class _TessMemberResultCallback_0_0 : public TessResultCallback { - public: - typedef TessResultCallback base; - typedef R (T::*MemberSignature)() ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_0( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run() { - if (!del) { - R result = (object_->*member_)(); - return result; - } else { - R result = (object_->*member_)(); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessMemberResultCallback_0_0 - : public TessClosure { - public: - typedef TessClosure base; - typedef void (T::*MemberSignature)() ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_0( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run() { - if (!del) { - (object_->*member_)(); - } else { - (object_->*member_)(); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_0::base* -NewTessCallback( - T1* obj, R (T2::*member)() ) { - return new _TessMemberResultCallback_0_0( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_0::base* -NewPermanentTessCallback( - T1* obj, R (T2::*member)() ) { - return new _TessMemberResultCallback_0_0( - obj, member); -} -#endif - -template -class _TessFunctionResultCallback_0_0 : public TessResultCallback { - public: - typedef TessResultCallback base; - typedef R (*FunctionSignature)(); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_0( - FunctionSignature function) - : function_(function) { - } - - virtual R Run() { - if (!del) { - R result = (*function_)(); - return result; - } else { - R result = (*function_)(); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessFunctionResultCallback_0_0 - : public TessClosure { - public: - typedef TessClosure base; - typedef void (*FunctionSignature)(); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_0( - FunctionSignature function) - : function_(function) { - } - - virtual void Run() { - if (!del) { - (*function_)(); - } else { - (*function_)(); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - } - } -}; - -template -inline typename _TessFunctionResultCallback_0_0::base* -NewTessCallback(R (*function)()) { - return new _TessFunctionResultCallback_0_0(function); -} - -template -inline typename _TessFunctionResultCallback_0_0::base* -NewPermanentTessCallback(R (*function)()) { - return new _TessFunctionResultCallback_0_0(function); -} - -template -class TessCallback1 { - public: - virtual ~TessCallback1() { } - virtual void Run(A1) = 0; -}; - -template -class TessResultCallback1 { - public: - virtual ~TessResultCallback1() { } - virtual R Run(A1) = 0; -}; - -template -class _ConstTessMemberResultCallback_0_1 : public TessResultCallback1 { - public: - typedef TessResultCallback1 base; - typedef R (T::*MemberSignature)(A1) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_1( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1) { - if (!del) { - R result = (object_->*member_)(a1); - return result; - } else { - R result = (object_->*member_)(a1); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _ConstTessMemberResultCallback_0_1 - : public TessCallback1 { - public: - typedef TessCallback1 base; - typedef void (T::*MemberSignature)(A1) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_1( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1) { - if (!del) { - (object_->*member_)(a1); - } else { - (object_->*member_)(a1); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_1::base* -NewTessCallback( - const T1* obj, R (T2::*member)(A1) const) { - return new _ConstTessMemberResultCallback_0_1( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_1::base* -NewPermanentTessCallback( - const T1* obj, R (T2::*member)(A1) const) { - return new _ConstTessMemberResultCallback_0_1( - obj, member); -} -#endif - -template -class _TessMemberResultCallback_0_1 : public TessResultCallback1 { - public: - typedef TessResultCallback1 base; - typedef R (T::*MemberSignature)(A1) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_1( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1) { - if (!del) { - R result = (object_->*member_)(a1); - return result; - } else { - R result = (object_->*member_)(a1); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessMemberResultCallback_0_1 - : public TessCallback1 { - public: - typedef TessCallback1 base; - typedef void (T::*MemberSignature)(A1) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_1( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1) { - if (!del) { - (object_->*member_)(a1); - } else { - (object_->*member_)(a1); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_1::base* -NewTessCallback( - T1* obj, R (T2::*member)(A1) ) { - return new _TessMemberResultCallback_0_1( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_1::base* -NewPermanentTessCallback( - T1* obj, R (T2::*member)(A1) ) { - return new _TessMemberResultCallback_0_1( - obj, member); -} -#endif - -template -class _TessFunctionResultCallback_0_1 : public TessResultCallback1 { - public: - typedef TessResultCallback1 base; - typedef R (*FunctionSignature)(A1); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_1( - FunctionSignature function) - : function_(function) { - } - - virtual R Run(A1 a1) { - if (!del) { - R result = (*function_)(a1); - return result; - } else { - R result = (*function_)(a1); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessFunctionResultCallback_0_1 - : public TessCallback1 { - public: - typedef TessCallback1 base; - typedef void (*FunctionSignature)(A1); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_1( - FunctionSignature function) - : function_(function) { - } - - virtual void Run(A1 a1) { - if (!del) { - (*function_)(a1); - } else { - (*function_)(a1); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - } - } -}; - -template -inline typename _TessFunctionResultCallback_0_1::base* -NewTessCallback(R (*function)(A1)) { - return new _TessFunctionResultCallback_0_1(function); -} - -template -inline typename _TessFunctionResultCallback_0_1::base* -NewPermanentTessCallback(R (*function)(A1)) { - return new _TessFunctionResultCallback_0_1(function); -} - -template -class TessCallback2 { - public: - virtual ~TessCallback2() { } - virtual void Run(A1,A2) = 0; -}; - -template -class TessResultCallback2 { - public: - virtual ~TessResultCallback2() { } - virtual R Run(A1,A2) = 0; -}; - -template -class _ConstTessMemberResultCallback_0_2 : public TessResultCallback2 { - public: - typedef TessResultCallback2 base; - typedef R (T::*MemberSignature)(A1,A2) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_2( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1,A2 a2) { - if (!del) { - R result = (object_->*member_)(a1,a2); - return result; - } else { - R result = (object_->*member_)(a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _ConstTessMemberResultCallback_0_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (T::*MemberSignature)(A1,A2) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_2( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1,A2 a2) { - if (!del) { - (object_->*member_)(a1,a2); - } else { - (object_->*member_)(a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_2::base* -NewTessCallback( - const T1* obj, R (T2::*member)(A1,A2) const) { - return new _ConstTessMemberResultCallback_0_2( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_2::base* -NewPermanentTessCallback( - const T1* obj, R (T2::*member)(A1,A2) const) { - return new _ConstTessMemberResultCallback_0_2( - obj, member); -} -#endif - -template -class _TessMemberResultCallback_0_2 : public TessResultCallback2 { - public: - typedef TessResultCallback2 base; - typedef R (T::*MemberSignature)(A1,A2) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_2( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1,A2 a2) { - if (!del) { - R result = (object_->*member_)(a1,a2); - return result; - } else { - R result = (object_->*member_)(a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessMemberResultCallback_0_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (T::*MemberSignature)(A1,A2) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_2( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1,A2 a2) { - if (!del) { - (object_->*member_)(a1,a2); - } else { - (object_->*member_)(a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_2::base* -NewTessCallback( - T1* obj, R (T2::*member)(A1,A2) ) { - return new _TessMemberResultCallback_0_2( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_2::base* -NewPermanentTessCallback( - T1* obj, R (T2::*member)(A1,A2) ) { - return new _TessMemberResultCallback_0_2( - obj, member); -} -#endif - -template -class _TessFunctionResultCallback_0_2 : public TessResultCallback2 { - public: - typedef TessResultCallback2 base; - typedef R (*FunctionSignature)(A1,A2); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_2( - FunctionSignature function) - : function_(function) { - } - - virtual R Run(A1 a1,A2 a2) { - if (!del) { - R result = (*function_)(a1,a2); - return result; - } else { - R result = (*function_)(a1,a2); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessFunctionResultCallback_0_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (*FunctionSignature)(A1,A2); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_2( - FunctionSignature function) - : function_(function) { - } - - virtual void Run(A1 a1,A2 a2) { - if (!del) { - (*function_)(a1,a2); - } else { - (*function_)(a1,a2); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - } - } -}; - -template -inline typename _TessFunctionResultCallback_0_2::base* -NewTessCallback(R (*function)(A1,A2)) { - return new _TessFunctionResultCallback_0_2(function); -} - -template -inline typename _TessFunctionResultCallback_0_2::base* -NewPermanentTessCallback(R (*function)(A1,A2)) { - return new _TessFunctionResultCallback_0_2(function); -} - -template -class TessCallback3 { - public: - virtual ~TessCallback3() { } - virtual void Run(A1,A2,A3) = 0; -}; - -template -class TessResultCallback3 { - public: - virtual ~TessResultCallback3() { } - virtual R Run(A1,A2,A3) = 0; -}; - -template -class _ConstTessMemberResultCallback_0_3 : public TessResultCallback3 { - public: - typedef TessResultCallback3 base; - typedef R (T::*MemberSignature)(A1,A2,A3) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_3( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - R result = (object_->*member_)(a1,a2,a3); - return result; - } else { - R result = (object_->*member_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _ConstTessMemberResultCallback_0_3 - : public TessCallback3 { - public: - typedef TessCallback3 base; - typedef void (T::*MemberSignature)(A1,A2,A3) const; - - private: - const T* object_; - MemberSignature member_; - - public: - inline _ConstTessMemberResultCallback_0_3( - const T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - (object_->*member_)(a1,a2,a3); - } else { - (object_->*member_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_3::base* -NewTessCallback( - const T1* obj, R (T2::*member)(A1,A2,A3) const) { - return new _ConstTessMemberResultCallback_0_3( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_0_3::base* -NewPermanentTessCallback( - const T1* obj, R (T2::*member)(A1,A2,A3) const) { - return new _ConstTessMemberResultCallback_0_3( - obj, member); -} -#endif - -template -class _TessMemberResultCallback_0_3 : public TessResultCallback3 { - public: - typedef TessResultCallback3 base; - typedef R (T::*MemberSignature)(A1,A2,A3) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_3( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual R Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - R result = (object_->*member_)(a1,a2,a3); - return result; - } else { - R result = (object_->*member_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessMemberResultCallback_0_3 - : public TessCallback3 { - public: - typedef TessCallback3 base; - typedef void (T::*MemberSignature)(A1,A2,A3) ; - - private: - T* object_; - MemberSignature member_; - - public: - inline _TessMemberResultCallback_0_3( - T* object, MemberSignature member) - : object_(object), - member_(member) { - } - - virtual void Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - (object_->*member_)(a1,a2,a3); - } else { - (object_->*member_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_3::base* -NewTessCallback( - T1* obj, R (T2::*member)(A1,A2,A3) ) { - return new _TessMemberResultCallback_0_3( - obj, member); -} -#endif - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_0_3::base* -NewPermanentTessCallback( - T1* obj, R (T2::*member)(A1,A2,A3) ) { - return new _TessMemberResultCallback_0_3( - obj, member); -} -#endif - -template -class _TessFunctionResultCallback_0_3 : public TessResultCallback3 { - public: - typedef TessResultCallback3 base; - typedef R (*FunctionSignature)(A1,A2,A3); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_3( - FunctionSignature function) - : function_(function) { - } - - virtual R Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - R result = (*function_)(a1,a2,a3); - return result; - } else { - R result = (*function_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessFunctionResultCallback_0_3 - : public TessCallback3 { - public: - typedef TessCallback3 base; - typedef void (*FunctionSignature)(A1,A2,A3); - - private: - FunctionSignature function_; - - public: - inline _TessFunctionResultCallback_0_3( - FunctionSignature function) - : function_(function) { - } - - virtual void Run(A1 a1,A2 a2,A3 a3) { - if (!del) { - (*function_)(a1,a2,a3); - } else { - (*function_)(a1,a2,a3); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - } - } -}; - -template -inline typename _TessFunctionResultCallback_0_3::base* -NewTessCallback(R (*function)(A1,A2,A3)) { - return new _TessFunctionResultCallback_0_3(function); -} - -template -inline typename _TessFunctionResultCallback_0_3::base* -NewPermanentTessCallback(R (*function)(A1,A2,A3)) { - return new _TessFunctionResultCallback_0_3(function); -} - -// Specified by TR1 [4.7.2] Reference modifications. -template struct remove_reference; -template struct remove_reference { typedef T type; }; -template struct remove_reference { typedef T type; }; - -// Identity::type is a typedef of T. Useful for preventing the -// compiler from inferring the type of an argument in templates. -template -struct Identity { - typedef T type; -}; - -template -class _ConstTessMemberResultCallback_1_2 - : public TessResultCallback2 { - public: - typedef TessResultCallback2 base; - typedef R (T::*MemberSignature)(P1,A1,A2) const; - - private: - T* object_; - MemberSignature member_; - typename remove_reference::type p1_; - - public: - inline _ConstTessMemberResultCallback_1_2(T* object, - MemberSignature member, P1 p1) - : object_(object), member_(member), p1_(p1) { } - - virtual R Run(A1 a1, A2 a2) { - if (!del) { - R result = (object_->*member_)(p1_,a1,a2); - return result; - } else { - R result = (object_->*member_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _ConstTessMemberResultCallback_1_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (T::*MemberSignature)(P1,A1,A2) const; - - private: - T* object_; - MemberSignature member_; - typename remove_reference::type p1_; - - public: - inline _ConstTessMemberResultCallback_1_2(T* object, - MemberSignature member, P1 p1) - : object_(object), member_(member), p1_(p1) { } - - virtual void Run(A1 a1, A2 a2) { - if (!del) { - (object_->*member_)(p1_,a1,a2); - } else { - (object_->*member_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_1_2::base* -NewTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity::type p1) { - return new _ConstTessMemberResultCallback_1_2(obj, member, p1); -} -#endif - -#ifndef SWIG -template -inline typename _ConstTessMemberResultCallback_1_2::base* -NewPermanentTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity::type p1) { - return new _ConstTessMemberResultCallback_1_2(obj, member, p1); -} -#endif - -template -class _TessMemberResultCallback_1_2 : public TessResultCallback2 { - public: - typedef TessResultCallback2 base; - typedef R (T::*MemberSignature)(P1,A1,A2) ; - - private: - T* object_; - MemberSignature member_; - typename remove_reference::type p1_; - - public: - inline _TessMemberResultCallback_1_2(T* object, - MemberSignature member, P1 p1) - : object_(object), member_(member), p1_(p1) { } - - virtual R Run(A1 a1, A2 a2) { - if (!del) { - R result = (object_->*member_)(p1_,a1,a2); - return result; - } else { - R result = (object_->*member_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessMemberResultCallback_1_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (T::*MemberSignature)(P1,A1,A2) ; - - private: - T* object_; - MemberSignature member_; - typename remove_reference::type p1_; - - public: - inline _TessMemberResultCallback_1_2(T* object, - MemberSignature member, P1 p1) - : object_(object), member_(member), p1_(p1) { } - - virtual void Run(A1 a1, A2 a2) { - if (!del) { - (object_->*member_)(p1_,a1,a2); - } else { - (object_->*member_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - member_ = NULL; - delete this; - } - } -}; - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_1_2::base* -NewTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity::type p1) { - return new _TessMemberResultCallback_1_2(obj, member, p1); -} -#endif - -#ifndef SWIG -template -inline typename _TessMemberResultCallback_1_2::base* -NewPermanentTessCallback( T1* obj, R (T2::*member)(P1,A1,A2) , typename Identity::type p1) { - return new _TessMemberResultCallback_1_2(obj, member, p1); -} -#endif - -template -class _TessFunctionResultCallback_1_2 : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef R (*FunctionSignature)(P1,A1,A2); - - private: - FunctionSignature function_; - typename remove_reference::type p1_; - - public: - inline _TessFunctionResultCallback_1_2(FunctionSignature function, P1 p1) - : function_(function), p1_(p1) { } - - virtual R Run(A1 a1, A2 a2) { - if (!del) { - R result = (*function_)(p1_,a1,a2); - return result; - } else { - R result = (*function_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - return result; - } - } -}; - -template -class _TessFunctionResultCallback_1_2 - : public TessCallback2 { - public: - typedef TessCallback2 base; - typedef void (*FunctionSignature)(P1,A1,A2); - - private: - FunctionSignature function_; - typename remove_reference::type p1_; - - public: - inline _TessFunctionResultCallback_1_2(FunctionSignature function, P1 p1) - : function_(function), p1_(p1) { } - - virtual void Run(A1 a1, A2 a2) { - if (!del) { - (*function_)(p1_,a1,a2); - } else { - (*function_)(p1_,a1,a2); - // zero out the pointer to ensure segfault if used again - function_ = NULL; - delete this; - } - } -}; - -template -inline typename _TessFunctionResultCallback_1_2::base* -NewTessCallback(R (*function)(P1,A1,A2), typename Identity::type p1) { - return new _TessFunctionResultCallback_1_2(function, p1); -} - -template -inline typename _TessFunctionResultCallback_1_2::base* -NewPermanentTessCallback(R (*function)(P1,A1,A2), typename Identity::type p1) { - return new _TessFunctionResultCallback_1_2(function, p1); -} - -#endif /* _TESS_CALLBACK_SPECIALIZATIONS_H */ diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/thresholder.h b/iOS/OCRPlugin/dependencies/include/tesseract/thresholder.h deleted file mode 100644 index 7e21e259..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/thresholder.h +++ /dev/null @@ -1,170 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: thresholder.h -// Description: Base API for thresolding images in tesseract. -// Author: Ray Smith -// Created: Mon May 12 11:00:15 PDT 2008 -// -// (C) Copyright 2008, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_CCMAIN_THRESHOLDER_H__ -#define TESSERACT_CCMAIN_THRESHOLDER_H__ - -class IMAGE; -struct Pix; - -namespace tesseract { - -/// Base class for all tesseract image thresholding classes. -/// Specific classes can add new thresholding methods by -/// overriding ThresholdToPix. -/// Each instance deals with a single image, but the design is intended to -/// be useful for multiple calls to SetRectangle and ThresholdTo* if -/// desired. -class ImageThresholder { - public: - ImageThresholder(); - virtual ~ImageThresholder(); - - /// Destroy the Pix if there is one, freeing memory. - virtual void Clear(); - - /// Return true if no image has been set. - bool IsEmpty() const; - - /// SetImage makes a copy of only the metadata, not the underlying - /// image buffer. It promises to treat the source as read-only in either case, - /// but in return assumes that the Pix or image buffer remain valid - /// throughout the life of the ImageThresholder. - /// Greyscale of 8 and color of 24 or 32 bits per pixel may be given. - /// Palette color images will not work properly and must be converted to - /// 24 bit. - /// Binary images of 1 bit per pixel may also be given but they must be - /// byte packed with the MSB of the first byte being the first pixel, and a - /// one pixel is WHITE. For binary images set bytes_per_pixel=0. - void SetImage(const unsigned char* imagedata, int width, int height, - int bytes_per_pixel, int bytes_per_line); - - /// Store the coordinates of the rectangle to process for later use. - /// Doesn't actually do any thresholding. - void SetRectangle(int left, int top, int width, int height); - - /// Get enough parameters to be able to rebuild bounding boxes in the - /// original image (not just within the rectangle). - /// Left and top are enough with top-down coordinates, but - /// the height of the rectangle and the image are needed for bottom-up. - virtual void GetImageSizes(int* left, int* top, int* width, int* height, - int* imagewidth, int* imageheight); - - /// Return true if the source image is color. - bool IsColor() const { - return image_bytespp_ >= 3; - } - - /// Returns true if the source image is binary. - bool IsBinary() const { - return image_bytespp_ == 0; - } - - int GetScaleFactor() const { - return scale_; - } - int GetSourceYResolution() const { - return yres_; - } - int GetScaledYResolution() const { - return scale_ * yres_; - } - - /// Pix vs raw, which to use? - /// Implementations should provide the ability to source and target Pix - /// where possible. A future version of Tesseract may choose to use Pix - /// as its internal representation and discard IMAGE altogether. - /// Because of that, an implementation that sources and targets Pix may end up - /// with less copies than an implementation that does not. - /// NOTE: Opposite to SetImage for raw images, SetImage for Pix clones its - /// input, so the source pix may be pixDestroyed immediately after. - void SetImage(const Pix* pix); - - /// Threshold the source image as efficiently as possible to the output Pix. - /// Creates a Pix and sets pix to point to the resulting pointer. - /// Caller must use pixDestroy to free the created Pix. - virtual void ThresholdToPix(Pix** pix); - - /// Get a clone/copy of the source image rectangle. - /// The returned Pix must be pixDestroyed. - /// This function will be used in the future by the page layout analysis, and - /// the layout analysis that uses it will only be available with Leptonica, - /// so there is no raw equivalent. - Pix* GetPixRect(); - - /// Get a clone/copy of the source image rectangle, reduced to greyscale. - /// The returned Pix must be pixDestroyed. - /// This function will be used in the future by the page layout analysis, and - /// the layout analysis that uses it will only be available with Leptonica, - /// so there is no raw equivalent. - Pix* GetPixRectGrey(); - - protected: - // ---------------------------------------------------------------------- - // Utility functions that may be useful components for other thresholders. - - /// Common initialization shared between SetImage methods. - virtual void Init(); - - /// Return true if we are processing the full image. - bool IsFullImage() const { - return rect_left_ == 0 && rect_top_ == 0 && - rect_width_ == image_width_ && rect_height_ == image_height_; - } - - /// Otsu threshold the rectangle, taking everything except the image buffer - /// pointer from the class, to the output Pix. - void OtsuThresholdRectToPix(const unsigned char* imagedata, - int bytes_per_pixel, int bytes_per_line, - Pix** pix) const; - - /// Threshold the rectangle, taking everything except the image buffer pointer - /// from the class, using thresholds/hi_values to the output IMAGE. - void ThresholdRectToPix(const unsigned char* imagedata, - int bytes_per_pixel, int bytes_per_line, - const int* thresholds, const int* hi_values, - Pix** pix) const; - - /// Copy the raw image rectangle, taking all data from the class, to the Pix. - void RawRectToPix(Pix** pix) const; - - protected: - /// Clone or other copy of the source Pix. - /// The pix will always be PixDestroy()ed on destruction of the class. - Pix* pix_; - /// Exactly one of pix_ and image_data_ is not NULL. - const unsigned char* image_data_; //< Raw source image. - - int image_width_; //< Width of source image/pix. - int image_height_; //< Height of source image/pix. - int image_bytespp_; //< Bytes per pixel of source image/pix. - int image_bytespl_; //< Bytes per line of source image/pix. - // Limits of image rectangle to be processed. - int scale_; //< Scale factor from original image. - int yres_; //< y pixels/inch in source image - int rect_left_; - int rect_top_; - int rect_width_; - int rect_height_; -}; - -} // namespace tesseract. - -#endif // TESSERACT_CCMAIN_THRESHOLDER_H__ - diff --git a/iOS/OCRPlugin/dependencies/include/tesseract/unichar.h b/iOS/OCRPlugin/dependencies/include/tesseract/unichar.h deleted file mode 100644 index 7806f2fc..00000000 --- a/iOS/OCRPlugin/dependencies/include/tesseract/unichar.h +++ /dev/null @@ -1,85 +0,0 @@ -/////////////////////////////////////////////////////////////////////// -// File: unichar.h -// Description: Unicode character/ligature class. -// Author: Ray Smith -// Created: Wed Jun 28 17:05:01 PDT 2006 -// -// (C) Copyright 2006, Google Inc. -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// http://www.apache.org/licenses/LICENSE-2.0 -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -/////////////////////////////////////////////////////////////////////// - -#ifndef TESSERACT_CCUTIL_UNICHAR_H__ -#define TESSERACT_CCUTIL_UNICHAR_H__ - -#include -#include - -// Maximum number of characters that can be stored in a UNICHAR. Must be -// at least 4. Must not exceed 31 without changing the coding of length. -#define UNICHAR_LEN 24 - -// A UNICHAR_ID is the unique id of a unichar. -typedef int UNICHAR_ID; - -// A variable to indicate an invalid or uninitialized unichar id. -static const int INVALID_UNICHAR_ID = -1; -// A special unichar that corresponds to INVALID_UNICHAR_ID. -static const char INVALID_UNICHAR[] = "__INVALID_UNICHAR__"; - -// The UNICHAR class holds a single classification result. This may be -// a single Unicode character (stored as between 1 and 4 utf8 bytes) or -// multple Unicode characters representing the NFKC expansion of a ligature -// such as fi, ffl etc. These are also stored as utf8. -class UNICHAR { - public: - UNICHAR() { - memset(chars, 0, UNICHAR_LEN); - } - - // Construct from a utf8 string. If len<0 then the string is null terminated. - // If the string is too long to fit in the UNICHAR then it takes only what - // will fit. - UNICHAR(const char* utf8_str, int len); - - // Construct from a single UCS4 character. - explicit UNICHAR(int unicode); - - // Default copy constructor and operator= are OK. - - // Get the first character as UCS-4. - int first_uni() const; - - // Get the length of the UTF8 string. - int utf8_len() const { - int len = chars[UNICHAR_LEN - 1]; - return len >=0 && len < UNICHAR_LEN ? len : UNICHAR_LEN; - } - - // Get a UTF8 string, but NOT NULL terminated. - const char* utf8() const { - return chars; - } - - // Get a terminated UTF8 string: Must delete[] it after use. - char* utf8_str() const; - - // Get the number of bytes in the first character of the given utf8 string. - static int utf8_step(const char* utf8_str); - - private: - // A UTF-8 representation of 1 or more Unicode characters. - // The last element (chars[UNICHAR_LEN - 1]) is a length if - // its value < UNICHAR_LEN, otherwise it is a genuine character. - char chars[UNICHAR_LEN]; -}; - -#endif // TESSERACT_CCUTIL_UNICHAR_H__ diff --git a/iOS/OCRPlugin/dependencies/lib/liblept.a b/iOS/OCRPlugin/dependencies/lib/liblept.a deleted file mode 100644 index 92060a6e..00000000 Binary files a/iOS/OCRPlugin/dependencies/lib/liblept.a and /dev/null differ diff --git a/iOS/OCRPlugin/dependencies/lib/libtesseract_all.a b/iOS/OCRPlugin/dependencies/lib/libtesseract_all.a deleted file mode 100644 index 997fa5f8..00000000 Binary files a/iOS/OCRPlugin/dependencies/lib/libtesseract_all.a and /dev/null differ diff --git a/iOS/OCRPlugin/tessdata/eng.traineddata b/iOS/OCRPlugin/tessdata/eng.traineddata deleted file mode 100644 index 1f515680..00000000 Binary files a/iOS/OCRPlugin/tessdata/eng.traineddata and /dev/null differ diff --git a/iOS/OCRPlugin/www/OCRPlugin.js b/iOS/OCRPlugin/www/OCRPlugin.js deleted file mode 100644 index 92589ff2..00000000 --- a/iOS/OCRPlugin/www/OCRPlugin.js +++ /dev/null @@ -1,6 +0,0 @@ -var OCRPlugin = { - callNativeFunction: function (success, fail, resultType) { - - return Cordova.exec( success, fail, "com.jcesarmobile.OCRPlugin", "recogniseOCR", [resultType]); - } - }; \ No newline at end of file diff --git a/iOS/OCRPlugin/www/index.html b/iOS/OCRPlugin/www/index.html deleted file mode 100755 index 315e2901..00000000 --- a/iOS/OCRPlugin/www/index.html +++ /dev/null @@ -1,75 +0,0 @@ - - - Capture Photo - - - - - - -
-
- - - \ No newline at end of file diff --git a/iOS/PDFViewer/README.md b/iOS/PDFViewer/README.md new file mode 100644 index 00000000..a6309a12 --- /dev/null +++ b/iOS/PDFViewer/README.md @@ -0,0 +1,30 @@ +#[Cordova iOS Plugin Templates](https://github.com/RandyMcMillan/cdv-ios-plugin-templates) [^1] + +[^1]: This repo isn't endorsed or sanctioned by anybody except me and anybody who wishes to use and contribute to it. + + + $ git clone https://github.com/RandyMcMillan/cdv-ios-plugin-templates.git + +######The [Cordova iOS Plugin Templates](https://github.com/RandyMcMillan/cdv-ios-plugin-templates) will receive the most maintenance and I will be adding more templates as time permits. The templates in the repo are great examples of how to convert your own plugin to an Xcode template. If you author a template ( _AND PLAN TO MAINTAIN IT_ ) please send me a link to it. I will add the submodule to my repo. +
+ +##[PDFViewer for Cordova iOS](http://randymcmillan.github.com/PDFViewer/) + + $ git clone https://github.com/RandyMcMillan/PDFViewer.git + +
+ + + + +![image](https://raw.github.com/RandyMcMillan/PDFViewer/master/ScreenShot4.png) +
+![image](https://raw.github.com/RandyMcMillan/PDFViewer/master/ScreenShot6.png) + +
+
+ +This code is dependent on the Apache Cordova (iOS) project. +-- +[Apache Cordova (iOS) project](http://cordova.apache.org) +[git://git.apache.org/cordova-ios.git](git://git.apache.org/cordova-ios.git) \ No newline at end of file diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAddress.h b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAddress.h deleted file mode 100755 index 4976ac54..00000000 --- a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAddress.h +++ /dev/null @@ -1,30 +0,0 @@ -// -// MEPAddress.h -// PPMEP -// -// Created by richard smith on 2/25/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface MEPAddress : NSObject { - NSString *name; - NSString *street1; - NSString *street2; - NSString *city; - NSString *state; - NSString *postalcode; - NSString *countrycode; - NSString *country; -} -@property (readonly) NSString *name; -@property (readonly) NSString *street1; -@property (readonly) NSString *street2; -@property (readonly) NSString *city; -@property (readonly) NSString *state; -@property (readonly) NSString *postalcode; -@property (readonly) NSString *countrycode; -@property (readonly) NSString *country; -@end diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAmounts.h b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAmounts.h deleted file mode 100755 index 4d6df8df..00000000 --- a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/MEPAmounts.h +++ /dev/null @@ -1,22 +0,0 @@ -// -// MEPAmounts.h -// PPMEP -// -// Created by richard smith on 2/25/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - - -@interface MEPAmounts : NSObject { - NSString *currency; - NSString *payment_amount; - NSString *tax; - NSString *shipping; -} -@property (nonatomic, retain) NSString *currency; -@property (nonatomic, retain) NSString *payment_amount; -@property (nonatomic, retain) NSString *tax; -@property (nonatomic, retain) NSString *shipping; -@end diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPal.h b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPal.h deleted file mode 100755 index b2737d18..00000000 --- a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPal.h +++ /dev/null @@ -1,140 +0,0 @@ -// -// PayPalMEP.h -// PPMEP -// -// Created by johanna wilson on 10/1/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import - -@class PPMEPRootViewController; -@class PayPalContext; -@class MEPAmounts; -@class MEPAddress; -@class PayPalMEPPayment; -@class PayPalMEPButton; - -typedef enum PayPalResponse{ - PAYMENT_SUCCESS = 0, - PAYMENT_FAILED = 1, - PAYMENT_CANCELED = 2, -}PAYPAL_RESPONSE; - -typedef enum PayPalEnvironment { - ENV_LIVE, - ENV_SANDBOX, - ENV_NONE, -} PAYPAL_ENVIRONMENT; - -typedef enum PayPalButtonType { - BUTTON_68x24, - BUTTON_68x33, - BUTTON_118x24, - BUTTON_152x33, - BUTTON_194x37, - BUTTON_278x43, - BUTTON_294x43, - BUTTON_TYPE_COUNT, -}PayPalButtonType; - -typedef enum PayPalPaymentType { - HARD_GOODS, - SERVICE, - PERSONAL, - DONATION, -}PayPalPaymentType; - -typedef enum PayPalFailureType { - SYSTEM_ERROR, - RECIPIENT_ERROR, - APPLICATION_ERROR, - CONSUMER_ERROR, -}PAYPAL_FAILURE; - -@protocol PayPalMEPDelegate -@required --(void)paymentSuccess:(NSString const *)transactionID; --(void)paymentCanceled; --(void)paymentFailed:(PAYPAL_FAILURE)errorType; - -@optional --(MEPAmounts*)AdjustAmounts:(MEPAddress const *)defaultAddress Currency:(NSString const *)inCurrency Amount:(NSString const *)inAmount Tax:(NSString const *)inTax Shipping:(NSString const *)inShipping; -@end - -@interface PayPal : NSObject { - @private - id delegate; - BOOL paymentsEnabled; - PPMEPRootViewController *rootvc; - NSString *appID; - NSString *lang; - PAYPAL_ENVIRONMENT environment; - PayPalPaymentType paymentType; - - //items that can change with each purchased item - NSString *amount; - NSString *tax; - NSString *shipping; - NSString *currencyCode; - NSString *itemDesc; - BOOL shippable; //determines if quickpay is available or not - NSString *recipientEmail; //the email address the payment should go to - NSString *senderEmail; //the email address or phone number of the user making the payment - NSString *merchantName;//the merchant name - - PAYPAL_RESPONSE paymentStatus; - PayPalContext *payPalContext; - - BOOL initialized;//determines if the initialization call has finished and the PayPal object is initialized. - BOOL recipientPaysFee; - BOOL dynamicAmountUpdate; - - NSMutableArray *paypalButtons; - - @public - NSString *errorMessage; -} - -@property (nonatomic, retain) id delegate; -@property (nonatomic, retain, readonly) NSString *appID; -@property (nonatomic, retain) NSString *lang; -@property (nonatomic, retain) NSMutableArray *paypalButtons; - -//items that can change with each purchased item -@property (nonatomic, retain) NSString *amount; -@property (nonatomic, retain) NSString *tax; -@property (nonatomic, retain) NSString *shipping; -@property (nonatomic, retain) NSString *currencyCode; -@property (nonatomic, retain) NSString *itemDesc; -@property BOOL shippable; -@property (nonatomic, retain) NSString *recipientEmail; -@property (nonatomic, retain) NSString *senderEmail; -@property (nonatomic, retain) NSString *merchantName; -@property (readonly) NSString *totalAmount; -@property (nonatomic, retain) PayPalContext *payPalContext; -@property (nonatomic, readonly) PayPalPaymentType paymentType; -@property (readonly) BOOL initialized; -@property (nonatomic, retain) NSString *errorMessage; -@property BOOL recipientPaysFee; -@property BOOL dynamicAmountUpdate; - -+(PayPal*)getInstance; -+(PayPal*)initializeWithAppID:(NSString const *)inAppID; -+(PayPal*)initializeWithAppID:(NSString const *)inAppID forEnvironment:(PAYPAL_ENVIRONMENT)env; --(UIButton *)getPayButton:(UIViewController const *)target buttonType:(PayPalButtonType)buttonType startCheckOut:(SEL)payWithPayPal PaymentType:(PayPalPaymentType)inPaymentType withLeft:(int)left withTop:(int)top; --(void)Checkout:(PayPalMEPPayment *)currentPayment; --(void)paymentFinished:(PAYPAL_RESPONSE)reponse; --(void)setLang:(NSString *)language; --(void)finishPayment; --(void)setDefaults; --(void)EnableShipping; --(void)DisableShipping; --(void)SetSenderEmailorPhone:(NSString const *)sender; --(void)feePaidByReceiver; --(void)enableDynamicAmountUpdate; --(PAYPAL_ENVIRONMENT)GetEnvironment; --(NSString const *)getErrorMessage; - -@end - diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalContext.h b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalContext.h deleted file mode 100755 index df9e8fe3..00000000 --- a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalContext.h +++ /dev/null @@ -1,46 +0,0 @@ -// -// PayPalContext.h -// PPMEP -// -// Created by johanna wilson on 12/10/09. -// Copyright 2009 __MyCompanyName__. All rights reserved. -// - -#import -#import "PayPal.h" - -@interface PayPalContext : NSObject { - @private - NSString *sessionToken; - NSString *amount; - NSString *tax; - NSString *shipping; - NSString *currencyCode; - NSString *itemDesc; - BOOL shippable; - NSString *recipientEmail; - NSString *merchantName; - BOOL recipientPaysFee; - BOOL enableDynamicAmountUpdate; - PAYPAL_ENVIRONMENT environment; - PayPalPaymentType paymentType; -} - -@property (nonatomic, retain) NSString *sessionToken; -@property (nonatomic, retain) NSString *amount; -@property (nonatomic, retain) NSString *tax; -@property (nonatomic, retain) NSString *shipping; -@property (nonatomic, retain) NSString *currencyCode; -@property (nonatomic, retain) NSString *itemDesc; -@property BOOL shippable; -@property (nonatomic, retain) NSString *recipientEmail; -@property (nonatomic, retain) NSString *merchantName; -@property PAYPAL_ENVIRONMENT environment; -@property PayPalPaymentType paymentType; -@property BOOL recipientPaysFee; -@property BOOL enableDynamicAmountUpdate; - --(NSDictionary*)serialize; --(BOOL)deserialize:(NSDictionary*)contextData; - -@end diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalMEPPayment.h b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalMEPPayment.h deleted file mode 100755 index b9386596..00000000 --- a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/PayPalMEPPayment.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// PayPalMEPPayment.h -// PPMEP -// -// Created by richard smith on 4/8/10. -// Copyright 2010 __MyCompanyName__. All rights reserved. -// - -#import - -@interface PayPalMEPPayment : NSObject { - NSString *paymentCurrency; - NSString *paymentAmount; - NSString *itemDesc; - NSString *recipient; - NSString *taxAmount; - NSString *shippingAmount; - NSString *merchantName; -} -@property (nonatomic, retain) NSString *paymentCurrency; -@property (nonatomic, retain) NSString *paymentAmount; -@property (nonatomic, retain) NSString *itemDesc; -@property (nonatomic, retain) NSString *recipient; -@property (nonatomic, retain) NSString *taxAmount; -@property (nonatomic, retain) NSString *shippingAmount; -@property (nonatomic, retain) NSString *merchantName; - -@end diff --git a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/libPayPalMEP.a b/iOS/PayPalPlugin/PayPal_MobilePayments_Library/libPayPalMEP.a deleted file mode 100755 index 38718234..00000000 Binary files a/iOS/PayPalPlugin/PayPal_MobilePayments_Library/libPayPalMEP.a and /dev/null differ diff --git a/iOS/PayPalPlugin/README.md b/iOS/PayPalPlugin/README.md index 9783289e..580f8ef3 100644 --- a/iOS/PayPalPlugin/README.md +++ b/iOS/PayPalPlugin/README.md @@ -1,58 +1 @@ -Project examples located in PayPalPlugin/.EXAMPLES (hidden to minimize confusion when adding to xcode) - -# PhoneGap PayPal-Plugin # -by Shazron Abdullah - -## Adding the Plugin to your project ## - -Using this plugin requires [Cordova](http://github.com/apache/incubator-cordova-ios) and the PayPal Mobile Payments Library. The PayPal Mobile Payments Library can be downloaded [here](https://www.x.com/community/ppx/xspaces/mobile/mep). - -1. Make sure your Cordova Xcode project has been [updated for Cordova 1.6.0](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Plugin%20Upgrade%20Guide.md) -2. Add the "Paypal Mobile Payments" folder to your project (put in a suitable location under your project, then drag and drop it in) -3. Add the .h and .m files to your Plugins folder in your project (as a Group "yellow folder" not a Reference "blue folder") -4. Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as <script> tags in your html file(s) -5. In **Cordova.plist** (1.5.0 or greater) or **PhoneGap.plist** (1.4.1 or lesser), under the **Plugins** section, add an idential key and value of **"SAiOSPaypalPlugin"** -6. Make sure you check the **"RELEASE NOTES"** section below! - -## RELEASE NOTES ## - -### 20120409 ### -- Changed license to Apache 2.0 License -- Updated for Cordova 1.6.0 (backwards compatible to earlier versions as well) -- wrapped object in function closure (to prevent pollution of the global namespace) -- global constants are now namespaced under the global PayPal object - - e.g if it was **PayPalPaymentType.DONATION** before, it's **PayPal.PaymentType.Donation** now - and it is also accessible under **window.plugins.paypal.PaymentType.Donation** - - -### 20101008 ### -* Initial release -* By default the PayPalPlugin-Host runs in ENV_NONE (offline) with a dummy PayPal ID. Change these in the Objective-C source (the code warns you in the Console) -* Only tested with ENV_NONE (verified payment success and cancel work, payment failure has NOT been tested) -* You are not using the PayPal native button - the native button when overlaid on the UIWebView does not scroll up and down with the UIWebView. It is hidden, and through the .pay() function, it is triggered. You can style the .pay() trigger with an official web button image from PayPal itself. -* See the .js file for API docs, and the PayPalPlugin-Host/www/index.html for sample code - -## BUGS AND CONTRIBUTIONS ## - -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires an Apache iCLA), this should be easier. - -Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "PayPalPlugin" or on [Github](http://github.com/phonegap/phonegap-plugins/issues) -(preferred) - -## LICENSE ## - -Copyright 2012 Shazron Abdullah - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. - +This plugin has been moved to [http://github.com/shazron/PayPalPlugin](http://github.com/shazron/PayPalPlugin) \ No newline at end of file diff --git a/iOS/PayPalPlugin/SAiOSPaypalPlugin.h b/iOS/PayPalPlugin/SAiOSPaypalPlugin.h deleted file mode 100644 index e25b2d9a..00000000 --- a/iOS/PayPalPlugin/SAiOSPaypalPlugin.h +++ /dev/null @@ -1,43 +0,0 @@ -// -// SAiOSPaypalPlugin.h -// Paypal Plugin for PhoneGap -// -// Created by shazron on 10-10-08. -// Copyright 2010 Shazron Abdullah. All rights reserved. - -#import -#import -#import "PayPal.h" - -@interface PaypalPaymentInfo : NSObject -{ - NSString* paymentCurrency; - NSString* paymentAmount; - NSString* itemDesc; - NSString* recipient; - NSString* merchantName; -} - -@property (nonatomic, copy) NSString* paymentCurrency; -@property (nonatomic, copy) NSString* paymentAmount; -@property (nonatomic, copy) NSString* itemDesc; -@property (nonatomic, copy) NSString* recipient; -@property (nonatomic, copy) NSString* merchantName; - -@end - - -@interface SAiOSPaypalPlugin : CDVPlugin { - UIButton* paypalButton; - PaypalPaymentInfo* paymentInfo; -} - -@property (nonatomic, retain) UIButton* paypalButton; -@property (nonatomic, retain) PaypalPaymentInfo* paymentInfo; - -- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) pay:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) setPaymentInfo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void) payWithPaypal; -@end diff --git a/iOS/PayPalPlugin/SAiOSPaypalPlugin.js b/iOS/PayPalPlugin/SAiOSPaypalPlugin.js deleted file mode 100644 index 0e3c5f8b..00000000 --- a/iOS/PayPalPlugin/SAiOSPaypalPlugin.js +++ /dev/null @@ -1,152 +0,0 @@ -// ////////////////////////////////////// -// Paypal Cordova Plugin -// by Shazron Abdullah -// -// Oct 8th 2010 -// Initial implementation -// Apr 9th 2012 -// Updated for Cordova 1.6.0, wrapped in function closure, constants are namespaced under the global PayPal object -// e.g if it was PayPalPaymentType.DONATION before, it's PayPal.PaymentType.Donation now -// and it is also accessible under window.plugins.paypal.PaymentType.Donation -// - -// ///////////////////////// -var PayPal = (function() { -// ///////////////////////// - -/* - * buttonType (unused currently) - */ -SAiOSPaypalPlugin.ButtonType = { - 'BUTTON_68x24' : 0, - 'BUTTON_68x33' : 1, - 'BUTTON_118x24': 2, - 'BUTTON_152x33': 3, - 'BUTTON_194x37': 4, - 'BUTTON_278x43': 5, - 'BUTTON_294x43': 6, - 'BUTTON_TYPE_COUNT': 7 -}; - -/* - * PaymentType for window.plugins.prepare - */ -SAiOSPaypalPlugin.PaymentType = -{ - 'HARD_GOODS': 0, - 'SERVICE' : 1, - 'PERSONAL' : 2, - 'DONATION' : 3 -}; - -/* - * errorType for PaypalPaymentEvent.Failed - */ -SAiOSPaypalPlugin.FailureType = -{ - 'SYSTEM_ERROR' : 0, - 'RECIPIENT_ERROR' : 1, - 'APPLICATION_ERROR' : 2, - 'CONSUMER_ERROR' : 3 -}; - -/* - * Events to listen to after a user touches the payment button - */ -SAiOSPaypalPlugin.PaymentEvent = -{ - /** - * Listen for this event to signify Paypal payment success. The event object will have these properties: - * transactionID - a string value - */ - Success : "PaypalPaymentEvent.Success", - /** - * Listen for this event to signify Paypal payment canceled. The event object will have these properties: - * [no properties available] - */ - Canceled : "PaypalPaymentEvent.Canceled", - /** - * Listen for this event to signify Paypal payment failed. The event object will have these properties: - * errorType - an integer value - */ - Failed : "PaypalPaymentEvent.Failed" -}; - -// get local ref to global PhoneGap/Cordova/cordova object for exec function -var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks - -/** - * Constructor - */ -function SAiOSPaypalPlugin() -{ -} - -/** - * Prepare payment type - * paymentType is from the PayPalPaymentType enum - */ -SAiOSPaypalPlugin.prototype.prepare = function(paymentType) -{ - cordovaRef.exec("SAiOSPaypalPlugin.prepare", paymentType); -} - -/** - * Initiate payment - */ -SAiOSPaypalPlugin.prototype.pay = function() -{ - cordovaRef.exec("SAiOSPaypalPlugin.pay"); -} - -/** - * Sets the payment information for when the Paypal button is clicked. - * Takes in an object (paymentProperties). Properties available to be set: - * paymentCurrency - a string value (required) - * paymentAmount - a double value (required) - * itemDesc - a string value (required) - * recipient - a string value (e-mail address, required) - * merchantName - a string value (required) - */ -SAiOSPaypalPlugin.prototype.setPaymentInfo = function(paymentProperties) -{ - cordovaRef.exec("SAiOSPaypalPlugin.setPaymentInfo", paymentProperties); -} - -/** - * Install function - */ -SAiOSPaypalPlugin.install = function() -{ - if ( !window.plugins ) { - window.plugins = {}; - } - if ( !window.plugins.paypal ) { - window.plugins.paypal = new SAiOSPaypalPlugin(); - } -} - -/** - * Add to Cordova constructor - */ -if (cordovaRef && cordovaRef.addConstructor) { - cordovaRef.addConstructor(SAiOSPaypalPlugin.install); -} else { - console.log("PayPal Cordova Plugin could not be installed."); - return null; -} - -/** - * Return constants - */ - -return { - ButtonType : SAiOSPaypalPlugin.ButtonType, - PaymentType : SAiOSPaypalPlugin.PaymentType, - FailureType : SAiOSPaypalPlugin.FailureType, - PaymentEvent: SAiOSPaypalPlugin.PaymentEvent -}; - -// ///////////////////////// -})(); -// ///////////////////////// diff --git a/iOS/PayPalPlugin/SAiOSPaypalPlugin.m b/iOS/PayPalPlugin/SAiOSPaypalPlugin.m deleted file mode 100644 index b1259973..00000000 --- a/iOS/PayPalPlugin/SAiOSPaypalPlugin.m +++ /dev/null @@ -1,178 +0,0 @@ -// -// SAiOSPaypalPlugin.m -// Paypal Plugin for PhoneGap -// -// Created by shazron on 10-10-08. -// Copyright 2010 Shazron Abdullah. All rights reserved. - -#import "SAiOSPaypalPlugin.h" -#import "PayPal.h" -#import "PayPalMEPPayment.h" -#import "MEPAddress.h" // use for dynamic amount calculation -#import "MEPAmounts.h" // use for dynamic amount calculation - -@implementation PaypalPaymentInfo - -@synthesize paymentCurrency, paymentAmount, itemDesc, recipient, merchantName; - -- (void) dealloc -{ - self.paymentCurrency = nil; - self.paymentAmount = nil; - self.itemDesc = nil; - self.recipient = nil; - self.merchantName = nil; - - [super dealloc]; -} - -@end - -@implementation SAiOSPaypalPlugin - -@synthesize paypalButton, paymentInfo; - -#define NO_APP_ID @"dummy" - -/* Get one from Paypal at developer.paypal.com */ -#define PAYPAL_APP_ID NO_APP_ID - -/* valid values are ENV_SANDBOX, ENV_NONE (offline) and ENV_LIVE */ -#define PAYPAL_APP_ENV ENV_NONE - - --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView -{ - self = (SAiOSPaypalPlugin*)[super initWithWebView:(UIWebView*)theWebView]; - if (self) { - if ([PAYPAL_APP_ID isEqualToString:NO_APP_ID]) { - NSLog(@"WARNING: You are using a dummy PayPal App ID."); - } - if (PAYPAL_APP_ENV == ENV_NONE) { - NSLog(@"WARNING: You are using the offline PayPal ENV_NONE environment."); - } - - [PayPal initializeWithAppID:PAYPAL_APP_ID forEnvironment:PAYPAL_APP_ENV]; - } - return self; -} - -- (void) prepare:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - if (self.paypalButton != nil) { - [self.paypalButton removeFromSuperview]; - self.paypalButton = nil; - } - - int argc = [arguments count]; - if (argc < 1) { - NSLog(@"SAiOSPaypalPlugin.prepare - missing first argument for paymentType (integer)."); - return; - } - - NSString* strValue = [arguments objectAtIndex:0]; - NSInteger paymentType = [strValue intValue]; - - self.paypalButton = [[PayPal getInstance] getPayButton:(UIViewController*)self /* requiring it to be a UIViewController is dumb paypal, it should be 'id' - especially since it's just for delegate callbacks */ - buttonType:0 - startCheckOut:@selector(payWithPaypal) - PaymentType:paymentType - withLeft:0 - withTop:0]; - - [super.webView addSubview:self.paypalButton]; - self.paypalButton.hidden = YES; - - NSLog(@"SAiOSPaypalPlugin.prepare - set paymentType: %d", paymentType); -} - - -- (void) pay:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - if (self.paypalButton != nil) { - [self.paypalButton sendActionsForControlEvents:UIControlEventTouchUpInside]; - } else { - NSLog(@"SAiOSPaypalPlugin.pay - payment not initialized. Call SAiOSPaypalPlugin.prepare(paymentType)"); - } -} - -- (void) setPaymentInfo:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - self.paymentInfo = nil; - self.paymentInfo = [[PaypalPaymentInfo alloc] init]; - - [self.paymentInfo setValuesForKeysWithDictionary:options]; -} - -- (void) payWithPaypal -{ - if (self.paymentInfo) - { - PayPal *pp = [PayPal getInstance]; - PayPalMEPPayment *payment =[[PayPalMEPPayment alloc] init]; - - payment.paymentCurrency = self.paymentInfo.paymentCurrency; - payment.paymentAmount = self.paymentInfo.paymentAmount; - payment.itemDesc = self.paymentInfo.itemDesc; - payment.recipient = self.paymentInfo.recipient; - payment.merchantName = self.paymentInfo.merchantName; - - [pp Checkout:payment]; - [payment release]; - - NSLog(@"SAiOSPaypalPlugin.payWithPaypal - payment sent. currency:%@ amount:%@ desc:%@ recipient:%@ merchantName:%@", - self.paymentInfo.paymentCurrency, self.paymentInfo.paymentAmount, self.paymentInfo.itemDesc, - self.paymentInfo.recipient, self.paymentInfo.merchantName); - } - else - { - NSLog(@"SAiOSPaypalPlugin.payWithPaypal - no payment info. Set it using SAiOSPaypalPlugin.setPaymentInfo"); - } -} - -#pragma mark - -#pragma mark Paypal delegates - -- (void) paymentSuccess:(NSString*)transactionID -{ - NSString* jsString = - @"(function() {" - "var e = document.createEvent('Events');" - "e.initEvent('PaypalPaymentEvent.Success');" - "e.transactionID = '%@';" - "document.dispatchEvent(e);" - "})();"; - - [super writeJavascript:[NSString stringWithFormat:jsString, transactionID]]; - - NSLog(@"SAiOSPaypalPlugin.paymentSuccess - transactionId:%@", transactionID); -} - -- (void) paymentCanceled -{ - NSString* jsString = - @"(function() {" - "var e = document.createEvent('Events');" - "e.initEvent('PaypalPaymentEvent.Canceled');" - "document.dispatchEvent(e);" - "})();"; - - [super writeJavascript:jsString]; -} - -- (void) paymentFailed:(PAYPAL_FAILURE)errorType -{ - NSString* jsString = - @"(function() {" - "var e = document.createEvent('Events');" - "e.initEvent('PaypalPaymentEvent.Failed');" - "e.errorType = %d;" - "document.dispatchEvent(e);" - "})();"; - - [super writeJavascript:[NSString stringWithFormat:jsString, errorType]]; - - NSLog(@"SAiOSPaypalPlugin.paymentFailed - errorType:%d", errorType); -} - -@end diff --git a/iOS/PayPalPlugin/index.html b/iOS/PayPalPlugin/index.html deleted file mode 100755 index ef44c637..00000000 --- a/iOS/PayPalPlugin/index.html +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - - - paypal-plugin-host - - - - - - - - - - diff --git a/iOS/PayPalPlugin/master.css b/iOS/PayPalPlugin/master.css deleted file mode 100755 index 2c49b0b1..00000000 --- a/iOS/PayPalPlugin/master.css +++ /dev/null @@ -1,97 +0,0 @@ - -body { - background:#222 none repeat scroll 0 0; - color:#666; - font-family:Helvetica; - font-size:72%; - line-height:1.5em; - margin:0; - border-top:1px solid #393939; -} - -#info{ - background:#ffa; - border: 1px solid #ffd324; - -webkit-border-radius: 5px; - border-radius: 5px; - clear:both; - margin:15px 6px 0; - width:295px; - padding:4px 0px 2px 10px; -} - -#info h4{ - font-size:.95em; - margin:0; - padding:0; -} - -#stage.theme{ - padding-top:3px; -} - -/* Definition List */ -#Page1 > dl{ - padding-top:10px; - clear:both; - margin:0; - list-style-type:none; - padding-left:10px; - overflow:auto; -} - -#Page1 > dl > dt{ - font-weight:bold; - float:left; - margin-left:5px; -} - -#Page1 > dl > dd{ - width:45px; - float:left; - color:#a87; - font-weight:bold; -} - -/* Content Styling */ -h1, h2, p{ - margin:1em 0 .5em 13px; -} - -h1{ - color:#eee; - font-size:1.6em; - text-align:center; - margin:0; - margin-top:15px; - padding:0; -} - -h2{ - clear:both; - margin:0; - padding:3px; - font-size:1em; - text-align:center; -} - -/* Stage Buttons */ -#stage.theme a.btn{ - border: 1px solid #555; - -webkit-border-radius: 5px; - border-radius: 5px; - text-align:center; - display:block; - float:left; - background:#444; - width:150px; - color:#9ab; - font-size:1.1em; - text-decoration:none; - padding:1.2em 0; - margin:3px 0px 3px 5px; -} -#stage.theme a.btn.large{ - width:308px; - padding:1.2em 0; -} diff --git a/iOS/PickerView/PickerView.h b/iOS/PickerView/PickerView.h deleted file mode 100644 index 56a1fcfa..00000000 --- a/iOS/PickerView/PickerView.h +++ /dev/null @@ -1,39 +0,0 @@ -// -// PickerView.h -// -// Created by Olivier Louvignes on 11/28/2011. -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import -#ifdef CORDOVA_FRAMEWORK -#import -#else -#import "CDVPlugin.h" -#endif - -@interface PickerView : CDVPlugin { - - NSString* callbackID; - NSInteger systemMajorVersion; - UIActionSheet* actionSheet; - UIPopoverController* popoverController; - NSArray* items; - -} - -@property (nonatomic, copy) NSString* callbackID; -@property (nonatomic, readwrite) NSInteger systemMajorVersion; -@property (nonatomic, retain) UIActionSheet* actionSheet; -@property (nonatomic, retain) UIPopoverController* popoverController; -@property (nonatomic, retain) NSArray* items; - -// Instance Method -- (void) create:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) createForIpad:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -// Specific methods -- (void)popoverController:(UIPopoverController *)popoverController dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(Boolean)animated; -- (void)sendResultsFromPickerView:(UIPickerView *)pickerView withButtonIndex:(NSInteger)buttonIndex; - -@end diff --git a/iOS/PickerView/PickerView.js b/iOS/PickerView/PickerView.js deleted file mode 100644 index 50d88284..00000000 --- a/iOS/PickerView/PickerView.js +++ /dev/null @@ -1,54 +0,0 @@ -// -// PickerView.js -// -// Created by Olivier Louvignes on 11/28/2011. -// Added Cordova support on 04/09/2012 -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -function PickerView() {} - -PickerView.prototype.create = function(title, items, callback, options) { - if(!options) options = {}; - var scope = options.scope || null; - delete options.scope; - - var service = 'PickerView', - action = 'create', - callbackId = service + (cordova.callbackId + 1); - - var config = { - title : title || ' ', // avoid blur with a !empty title - items : items || {}, - style : options.style || 'default', - doneButtonLabel : options.doneButtonLabel || "Done", - cancelButtonLabel : options.cancelButtonLabel || "Cancel" - }; - - // Force strings for items data text - for (var key in items) { - for (var _key in items[key].data) { - items[key].data[_key].text = items[key].data[_key].text + ''; - } - } - - var _callback = function(result) { - var values = result.values, - buttonIndex = result.buttonIndex; - - if(buttonIndex !== 0) { // Done - callback.call(scope, values, buttonIndex); - } else { // Cancel - callback.call(scope, {}, buttonIndex); - } - }; - - return cordova.exec(_callback, _callback, service, action, [config]); - -}; - -cordova.addConstructor(function() { - if(!window.plugins) window.plugins = {}; - window.plugins.pickerView = new PickerView(); -}); diff --git a/iOS/PickerView/PickerView.m b/iOS/PickerView/PickerView.m deleted file mode 100644 index 5f823da4..00000000 --- a/iOS/PickerView/PickerView.m +++ /dev/null @@ -1,339 +0,0 @@ -// -// PickerView.m -// -// Created by Olivier Louvignes on 11/28/2011. -// -// Copyright 2011 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import "PickerView.h" - -// Private interface -@interface PickerView() -@property (nonatomic, retain) UIPickerView *pickerView; -@end - - -@implementation PickerView - -@synthesize pickerView = _pickerView; - -@synthesize callbackID; -@synthesize systemMajorVersion; -@synthesize actionSheet; -@synthesize popoverController; -@synthesize items; - --(void)create:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - - //NSLog(@"PickerView::create():arguments: %@", arguments); - //NSLog(@"PickerView::create():options: %@", options); - - // The first argument in the arguments parameter is the callbackID. - // We use this to send data back to the successCallback or failureCallback - // through PluginResult. - self.callbackID = [arguments pop]; - self.systemMajorVersion = [[[[UIDevice currentDevice] systemVersion] substringToIndex:1] intValue]; - - // Compiling options with defaults - NSString *title = [options objectForKey:@"title"] ?: @" "; - NSString *style = [options objectForKey:@"style"] ?: @"default"; - NSString *doneButtonLabel = [options objectForKey:@"doneButtonLabel"] ?: @"Done"; - NSString *cancelButtonLabel = [options objectForKey:@"cancelButtonLabel"] ?: @"Cancel"; - - // Hold slots items in an instance variable - self.items = [options objectForKey:@"items"]; - - // Initialize PickerView - self.pickerView = [[UIPickerView alloc] initWithFrame:CGRectMake(0, 40.0f, 320.0f, 162.0f)]; - self.pickerView.showsSelectionIndicator = YES; - self.pickerView.delegate = self; - - // Loop through slots to define default value - for(int i = 0; i < [self.items count]; i++) { - NSDictionary *slot = [self.items objectAtIndex:i]; - // Check for a default value - NSString *defaultValue = [NSString stringWithFormat:@"%@", [slot objectForKey:@"value"]]; - if([slot objectForKey:@"data"] && defaultValue) { - // Loop through slot data - for(int j = 0; j < [[slot objectForKey:@"data"] count]; j++) { - NSDictionary *slotData = [[slot objectForKey:@"data"] objectAtIndex:j]; - NSString *slotDataValue = [NSString stringWithFormat:@"%@", [slotData objectForKey:@"value"]]; - // Check for a default value match - if([slotDataValue isEqualToString:defaultValue]) { - [self.pickerView selectRow:j inComponent:i animated:NO]; - } - } - } - } - - // Check if device is iPad as we won't be able to use an ActionSheet there - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - return [self createForIpad:arguments withDict:options]; - } - - // Create actionSheet - self.actionSheet = [[UIActionSheet alloc] initWithTitle:title - delegate:self - cancelButtonTitle:nil - destructiveButtonTitle:nil - otherButtonTitles:nil]; - - // Style actionSheet, defaults to UIActionSheetStyleDefault - if([style isEqualToString:@"black-opaque"]) actionSheet.actionSheetStyle = UIActionSheetStyleBlackOpaque; - else if([style isEqualToString:@"black-translucent"]) actionSheet.actionSheetStyle = UIActionSheetStyleBlackTranslucent; - else actionSheet.actionSheetStyle = UIActionSheetStyleDefault; - - // Append pickerView - [actionSheet addSubview:self.pickerView]; - [self.pickerView release]; - - // Create segemented cancel button - UISegmentedControl *cancelButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:cancelButtonLabel]]; - cancelButton.momentary = YES; - cancelButton.frame = CGRectMake(5.0f, 7.0f, 50.0f, 30.0f); - cancelButton.segmentedControlStyle = UISegmentedControlStyleBar; - cancelButton.tintColor = [UIColor blackColor]; - [cancelButton addTarget:self action:@selector(segmentedControl:didDismissWithCancelButton:) forControlEvents:UIControlEventValueChanged]; - // Append close button - [actionSheet addSubview:cancelButton]; - [cancelButton release]; - - // Create segemented done button - UISegmentedControl *doneButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:doneButtonLabel]]; - doneButton.momentary = YES; - doneButton.frame = CGRectMake(265.0f, 7.0f, 50.0f, 30.0f); - doneButton.segmentedControlStyle = UISegmentedControlStyleBar; - doneButton.tintColor = [UIColor colorWithRed:51.0f/255.0f green:102.0f/255.0f blue:153.0f/255.0f alpha:1.0f]; - [doneButton addTarget:self action:@selector(segmentedControl:didDismissWithDoneButton:) forControlEvents:UIControlEventValueChanged]; - // Append done button - [actionSheet addSubview:doneButton]; - [doneButton release]; - - //[actionSheet sendSubviewToBack:pickerView]; - - // Toggle ActionSheet - [actionSheet showInView:self.webView.superview]; - - // Resize actionSheet was 360 - float actionSheetHeight; - if(systemMajorVersion == 5) { - actionSheetHeight = 360.0f; - } else { - actionSheetHeight = 472.0f; - } - [actionSheet setBounds:CGRectMake(0, 0, 320.0f, actionSheetHeight)]; - -} - --(void)createForIpad:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - - NSString *doneButtonLabel = [options objectForKey:@"doneButtonLabel"] ?: @"Done"; - NSString *cancelButtonLabel = [options objectForKey:@"cancelButtonLabel"] ?: @"Cancel"; - - // Create a generic content view controller - UINavigationController* popoverContent = [[UINavigationController alloc] init]; - // Create a generic container view - UIView* popoverView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320.0f, 162.0f)]; - popoverContent.view = popoverView; - - // Append pickerView - [popoverView addSubview:self.pickerView]; - [self.pickerView release]; - - /* - UIBarButtonItem *okButton = [[UIBarButtonItem alloc] initWithTitle:@"Ok" style:UIBarButtonItemStyleBordered target:self action:@selector(okayButtonPressed)]; - UIBarButtonItem *cancelButton = [[UIBarButtonItem alloc] initWithTitle:@"Cancel" style:UIBarButtonItemStyleBordered target:self action:@selector(cancelButtonPressed)]; - - [popoverContent.navigationItem setLeftBarButtonItem:cancelButton animated:NO]; - [popoverContent.navigationItem setRightBarButtonItem:okButton animated:NO]; - popoverContent.topViewController.navigationItem.title = @"MY TITLE!"; - popoverContent.navigationItem.title = @"MY TITLE!"; - */ - - // Create segemented cancel button - UISegmentedControl *cancelButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:cancelButtonLabel]]; - cancelButton.momentary = YES; - cancelButton.frame = CGRectMake(5.0f, 7.0f, 50.0f, 30.0f); - cancelButton.segmentedControlStyle = UISegmentedControlStyleBar; - cancelButton.tintColor = [UIColor blackColor]; - [cancelButton addTarget:self action:@selector(segmentedControl:didDismissWithCancelButton:) forControlEvents:UIControlEventValueChanged]; - // Append close button - [popoverView addSubview:cancelButton]; - [cancelButton release]; - - // Create segemented done button - UISegmentedControl *doneButton = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObject:doneButtonLabel]]; - doneButton.momentary = YES; - doneButton.frame = CGRectMake(265.0f, 7.0f, 50.0f, 30.0f); - doneButton.segmentedControlStyle = UISegmentedControlStyleBar; - doneButton.tintColor = [UIColor colorWithRed:51.0f/255.0f green:102.0f/255.0f blue:153.0f/255.0f alpha:1.0f]; - [doneButton addTarget:self action:@selector(segmentedControl:didDismissWithDoneButton:) forControlEvents:UIControlEventValueChanged]; - // Append done button - [popoverView addSubview:doneButton]; - [doneButton release]; - - // Resize the popover view shown - // in the current view to the view's size - popoverContent.contentSizeForViewInPopover = CGSizeMake(320.0f, 162.0f); - - // Create a popover controller - self.popoverController = [[UIPopoverController alloc] initWithContentViewController:popoverContent]; - popoverController.delegate = self; - - //present the popover view non-modal with a - //refrence to the button pressed within the current view - [popoverController presentPopoverFromRect:CGRectMake(374.0f, 1014.0f, 20.0f, 20.0f) - inView:self.webView.superview - permittedArrowDirections:UIPopoverArrowDirectionAny - animated:YES]; - - //release the popover content - [popoverView release]; - [popoverContent release]; - -} - -// -// Dismiss methods -// - -// Picker with segmentedControls dismissed with done -- (void)segmentedControl:(UISegmentedControl *)segmentedControl didDismissWithDoneButton:(NSInteger)buttonIndex -{ - //NSLog(@"didDismissWithDoneButton:%d", buttonIndex); - - // Check if device is iPad - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - // Emulate a new delegate method - [self popoverController:popoverController dismissWithClickedButtonIndex:1 animated:YES]; - } else { - [actionSheet dismissWithClickedButtonIndex:1 animated:YES]; - } -} - -// Picker with segmentedControls dismissed with cancel -- (void)segmentedControl:(UISegmentedControl *)segmentedControl didDismissWithCancelButton:(NSInteger)buttonIndex -{ - //NSLog(@"didDismissWithCancelButton:%d", buttonIndex); - - // Check if device is iPad - if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad) { - // Emulate a new delegate method - [self popoverController:popoverController dismissWithClickedButtonIndex:0 animated:YES]; - } else { - [actionSheet dismissWithClickedButtonIndex:0 animated:YES]; - } -} - -// Popover generic dismiss - iPad -- (void)popoverControllerDidDismissPopover:(UIPopoverController *)popoverController -{ - //NSLog(@"popoverControllerDidDismissPopover"); - - // Retreive pickerView - NSArray *subviews = [self.popoverController.contentViewController.view subviews]; - UIPickerView *pickerView = [subviews objectAtIndex:0]; - // Simulate a cancel click - [self sendResultsFromPickerView:pickerView withButtonIndex:0]; -} - -// Popover emulated button-powered dismiss - iPad -- (void)popoverController:(UIPopoverController *)popoverController dismissWithClickedButtonIndex:(NSInteger)buttonIndex animated:(Boolean)animated -{ - //NSLog(@"didDismissPopoverWithButtonIndex:%d", buttonIndex); - - // Manually dismiss the popover - [self.popoverController dismissPopoverAnimated:animated]; - // Retreive pickerView - NSArray *subviews = [self.popoverController.contentViewController.view subviews]; - UIPickerView *pickerView = [subviews objectAtIndex:0]; - [self sendResultsFromPickerView:pickerView withButtonIndex:buttonIndex]; - - // Release objects - [self.popoverController release]; -} - -// ActionSheet generic dismiss - iPhone -- (void)actionSheet:(UIActionSheet *)actionSheet didDismissWithButtonIndex:(NSInteger)buttonIndex -{ - //NSLog(@"didDismissWithButtonIndex:%d", buttonIndex); - - // Retreive pickerView - NSArray *subviews = [self.actionSheet subviews]; - UIPickerView *pickerView = [subviews objectAtIndex:1]; - [self sendResultsFromPickerView:pickerView withButtonIndex:buttonIndex]; - - // Release objects - [self.actionSheet release]; -} - -// -// Results -// - -- (void)sendResultsFromPickerView:(UIPickerView *)pickerView withButtonIndex:(NSInteger)buttonIndex { - - // Build returned result - NSMutableDictionary *result = [[NSMutableDictionary alloc] init]; - NSMutableDictionary *values = [[NSMutableDictionary alloc] init]; - - // Loop throught slots - for(int i = 0; i < [items count]; i++) { - NSInteger selectedRow = [pickerView selectedRowInComponent:i]; - NSString *selectedValue = [[[[items objectAtIndex:i] objectForKey:@"data"] objectAtIndex:selectedRow] objectForKey:@"value"]; - NSString *slotName = [[items objectAtIndex:i] objectForKey:@"name"] ?: [NSString stringWithFormat:@"%d", i]; - [values setObject:selectedValue forKey:slotName]; - } - - [result setObject:[NSNumber numberWithInteger:buttonIndex] forKey:@"buttonIndex"]; - [result setObject:values forKey:@"values"]; - - // Create Plugin Result - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:result]; - - // Checking if cancel was clicked - if (buttonIndex == 0) { - //Call the Failure Javascript function - [self writeJavascript: [pluginResult toErrorCallbackString:self.callbackID]]; - }else { - //Call the Success Javascript function - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - } - -} - -// -// Picker delegate -// - - -// Listen picker selected row -- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component { - //NSLog(@"didSelectRow %d", row); -} - -// Tell the picker how many rows are available for a given component -- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component { - return [[[items objectAtIndex:component] objectForKey:@"data"] count]; -} - -// Tell the picker how many components it will have -- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView { - return [items count]; -} - -// Tell the picker the title for a given component -- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component { - //NSLog(@"%d:%d", component, row); - return [[[[items objectAtIndex:component] objectForKey:@"data"] objectAtIndex:row] objectForKey:@"text"]; -} - -// Tell the picker the width of each row for a given component -- (CGFloat)pickerView:(UIPickerView *)pickerView widthForComponent:(NSInteger)component { - return 300.0f/[items count]; -} - -@end \ No newline at end of file diff --git a/iOS/PickerView/README.md b/iOS/PickerView/README.md index dd646ec1..c2eb0404 100644 --- a/iOS/PickerView/README.md +++ b/iOS/PickerView/README.md @@ -1,84 +1,50 @@ # Cordova PickerView Plugin # -by `Olivier Louvignes` +by [Olivier Louvignes](http://olouv.com) -## DESCRIPTION ## - -* This plugin provides a simple way to use the `UIPickerView` native component from IOS. It does comply with the latest (future-2.x) cordova standards. - -* There is a `Sencha Touch 2.0` plugin to easily leverage this plugin [here](https://github.com/mgcrea/sencha-touch-plugins/blob/master/CordovaPicker.js) - -## SETUP ## - -Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). - -1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) -2. Drag and drop the `PickerView` folder from Finder to your Plugins folder in XCode, using "Create groups for any added folders" -3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files as tags in your html file(s) - - - -4. Add new entry with key `PickerView` and value `PickerView` to `Plugins` in `Cordova.plist` +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-pickerview/tree/master) +--- -## JAVASCRIPT INTERFACE ## - - // After device ready, create a local alias - var pickerView = window.plugins.pickerView; - - // Basic with title & defaultValue selected - var slots = [ - {name: 'foo', value: 'baz', data: [ - {value: 'foo', text: 'Displayed Foo'}, - {value: 'bar', text: 'Displayed Bar'}, - {value: 'baz', text: 'Displayed Baz'} - ]} - ]; - /*pickerView.create('Title', slots, function(selectedValues, buttonIndex) { - console.warn('create(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - });*/ - - // Complex example with 2 slots - var slots = [ - {name : 'limit_speed', title: 'Speed', data : [ - {text: '50 KB/s', value: 50}, - {text: '100 KB/s', value: 100}, - {text: '200 KB/s', value: 200}, - {text: '300 KB/s', value: 300} - ]}, - {name : 'road_type', title: 'Road', data : [ - {text: 'Highway', value: 50}, - {text: 'Town', value: 100}, - {text: 'City', value: 200}, - {text: 'Depart', value: 300} - ]} - ]; - pickerView.create('', slots, function(selectedValues, buttonIndex) { - console.warn('create(), arguments=' + Array.prototype.slice.call(arguments).join(', ')); - }, {style: 'black-opaque', doneButtonLabel: 'OK', cancelButtonLabel: 'Annuler'}); - -* Check [source](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/PickerView/PickerView.js) for additional configuration. +## DESCRIPTION ## -## BUGS AND CONTRIBUTIONS ## +* This plugin provides a simple way to use the `UIPickerView` native component from iOS. -Patches welcome! Send a pull request. Since this is not a part of PhoneGap Core (which requires a CLA), this should be easier. +* This plugin is built for Cordova >= v2.1.0 with ARC. -Post issues on [Github](https://github.com/apache/incubator-cordova-ios/issues) +* There is a `Sencha Touch 2.0` plugin to easily leverage this plugin [here](https://github.com/mgcrea/sencha-touch-plugins/blob/master/CordovaPicker.js) -The latest code (my fork) will always be [here](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/PickerView) +[![Screenshot](https://raw.github.com/mgcrea/cordova-pickerview/master/samples/ios/sample.png)](https://github.com/mgcrea/cordova-pickerview/tree/master) ## LICENSE ## -Copyright 2011 Olivier Louvignes. All rights reserved. + The MIT License -The MIT License + Copyright (c) 2012 Olivier Louvignes -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. ## CREDITS ## +Contributors : + +* [Olivier Louvignes](http://olouv.com), author. + Inspired by : * [Ext.picker.Picker Sencha Touch 2.0 class](http://docs.sencha.com/touch/2-0/#!/api/Ext.picker.Picker) diff --git a/iOS/PushNotification/PushNotification.h b/iOS/PushNotification/PushNotification.h deleted file mode 100644 index 3a298ef6..00000000 --- a/iOS/PushNotification/PushNotification.h +++ /dev/null @@ -1,45 +0,0 @@ -// -// PushNotification.h -// -// Created by Olivier Louvignes on 06/05/12. -// Inspired by Urban Airship Inc orphaned PushNotification phonegap plugin. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import -#ifdef CORDOVA_FRAMEWORK - #import -#else - #import "CDVPlugin.h" -#endif - -@interface PushNotification : CDVPlugin { - - NSMutableDictionary* callbackIds; - NSMutableArray* pendingNotifications; - -} - -@property (nonatomic, retain) NSMutableDictionary* callbackIds; -@property (nonatomic, retain) NSMutableArray* pendingNotifications; - -- (void)registerDevice:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; -- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; -- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError*)error; -- (void)didReceiveRemoteNotification:(NSDictionary*)userInfo; -- (void)getPendingNotifications:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; -+ (NSMutableDictionary*)getRemoteNotificationStatus; -- (void)getRemoteNotificationStatus:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; -- (void)setApplicationIconBadgeNumber:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; -- (void)cancelAllLocalNotifications:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; -- (void)getDeviceUniqueIdentifier:(NSMutableArray *)arguments withDict:(NSMutableDictionary*)options; - -@end - -#ifdef DEBUG -# define DLog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); -#else -# define DLog(...) -#endif -#define ALog(fmt, ...) NSLog((@"%s [Line %d] " fmt), __PRETTY_FUNCTION__, __LINE__, ##__VA_ARGS__); diff --git a/iOS/PushNotification/PushNotification.js b/iOS/PushNotification/PushNotification.js deleted file mode 100644 index 15217834..00000000 --- a/iOS/PushNotification/PushNotification.js +++ /dev/null @@ -1,58 +0,0 @@ -// -// PushNotification.js -// -// Created by Olivier Louvignes on 06/05/12. -// Inspired by Urban Airship Inc orphaned PushNotification phonegap plugin. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -(function(cordova) { - - function PushNotification() {} - - // Call this to register for push notifications and retreive a deviceToken - PushNotification.prototype.registerDevice = function(config, callback) { - cordova.exec(callback, callback, "PushNotification", "registerDevice", config ? [config] : []); - }; - - // Call this to retreive pending notification received while the application is in background or at launch - PushNotification.prototype.getPendingNotifications = function(callback) { - cordova.exec(callback, callback, "PushNotification", "getPendingNotifications", []); - }; - - // Call this to get a detailed status of remoteNotifications - PushNotification.prototype.getRemoteNotificationStatus = function(callback) { - cordova.exec(callback, callback, "PushNotification", "getRemoteNotificationStatus", []); - }; - - // Call this to set the application icon badge - PushNotification.prototype.setApplicationIconBadgeNumber = function(badge, callback) { - cordova.exec(callback, callback, "PushNotification", "setApplicationIconBadgeNumber", [{badge: badge}]); - }; - - // Call this to clear all notifications from the notification center - PushNotification.prototype.cancelAllLocalNotifications = function(callback) { - cordova.exec(callback, callback, "PushNotification", "cancelAllLocalNotifications", []); - }; - - // Call this to retreive the original device unique id - // @warning As of today, usage is deprecated and requires explicit consent from the user - PushNotification.prototype.getDeviceUniqueIdentifier = function(callback) { - cordova.exec(callback, callback, "PushNotification", "getDeviceUniqueIdentifier", []); - }; - - // Event spawned when a notification is received while the application is active - PushNotification.prototype.notificationCallback = function(notification) { - var ev = document.createEvent('HTMLEvents'); - ev.notification = notification; - ev.initEvent('push-notification', true, true, arguments); - document.dispatchEvent(ev); - }; - - cordova.addConstructor(function() { - if(!window.plugins) window.plugins = {}; - window.plugins.pushNotification = new PushNotification(); - }); - -})(window.cordova || window.Cordova || window.PhoneGap); diff --git a/iOS/PushNotification/PushNotification.m b/iOS/PushNotification/PushNotification.m deleted file mode 100644 index 7a28bf5f..00000000 --- a/iOS/PushNotification/PushNotification.m +++ /dev/null @@ -1,224 +0,0 @@ -// -// PushNotification.m -// -// Created by Olivier Louvignes on 06/05/12. -// Inspired by Urban Airship Inc orphaned PushNotification phonegap plugin. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import "PushNotification.h" -#ifdef CORDOVA_FRAMEWORK - #import -#else - #import "JSONKit.h" -#endif - -@implementation PushNotification - -@synthesize callbackIds = _callbackIds; -@synthesize pendingNotifications = _pendingNotifications; - -- (NSMutableDictionary*)callbackIds { - if(_callbackIds == nil) { - _callbackIds = [[NSMutableDictionary alloc] init]; - } - return _callbackIds; -} -- (NSMutableArray*)pendingNotifications { - if(_pendingNotifications == nil) { - _pendingNotifications = [[NSMutableArray alloc] init]; - } - return _pendingNotifications; -} - -- (void)registerDevice:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"registerDevice:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"registerDevice"]; - - UIRemoteNotificationType notificationTypes = UIRemoteNotificationTypeNone; - if ([options objectForKey:@"badge"]) { - notificationTypes |= UIRemoteNotificationTypeBadge; - } - if ([options objectForKey:@"sound"]) { - notificationTypes |= UIRemoteNotificationTypeSound; - } - if ([options objectForKey:@"alert"]) { - notificationTypes |= UIRemoteNotificationTypeAlert; - } - - if (notificationTypes == UIRemoteNotificationTypeNone) - NSLog(@"PushNotification.registerDevice: Push notification type is set to none"); - - //[[UIApplication sharedApplication] unregisterForRemoteNotifications]; - [[UIApplication sharedApplication] registerForRemoteNotificationTypes:notificationTypes]; - -} - -- (void)didRegisterForRemoteNotificationsWithDeviceToken:(NSData *)deviceToken { - DLog(@"didRegisterForRemoteNotificationsWithDeviceToken:%@", deviceToken); - - NSString *token = [[[[deviceToken description] stringByReplacingOccurrencesOfString:@"<"withString:@""] - stringByReplacingOccurrencesOfString:@">" withString:@""] - stringByReplacingOccurrencesOfString: @" " withString: @""]; - - NSMutableDictionary *results = [PushNotification getRemoteNotificationStatus]; - [results setValue:token forKey:@"deviceToken"]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"registerDevice"]]]; -} - -- (void)didFailToRegisterForRemoteNotificationsWithError:(NSError*)error { - DLog(@"didFailToRegisterForRemoteNotificationsWithError:%@", error); - - NSMutableDictionary *results = [NSMutableDictionary dictionary]; - [results setValue:[NSString stringWithFormat:@"%@", error] forKey:@"error"]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_ERROR messageAsDictionary:results]; - [self writeJavascript:[pluginResult toErrorCallbackString:[self.callbackIds valueForKey:@"registerDevice"]]]; -} - -- (void)didReceiveRemoteNotification:(NSDictionary*)userInfo { - DLog(@"didReceiveRemoteNotification:%@", userInfo); - - NSString *jsStatement = [NSString stringWithFormat:@"window.plugins.pushNotification.notificationCallback(%@);", [userInfo JSONString]]; - [self writeJavascript:jsStatement]; -} - -- (void)getPendingNotifications:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"getPendingNotifications:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"getPendingNotifications"]; - - NSMutableDictionary *results = [NSMutableDictionary dictionary]; - [results setValue:self.pendingNotifications forKey:@"notifications"]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"getPendingNotifications"]]]; - - [self.pendingNotifications removeAllObjects]; -} - -+ (NSMutableDictionary*)getRemoteNotificationStatus { - - NSMutableDictionary *results = [NSMutableDictionary dictionary]; - - NSUInteger type = 0; - // Set the defaults to disabled unless we find otherwise... - NSString *pushBadge = @"0"; - NSString *pushAlert = @"0"; - NSString *pushSound = @"0"; - -#if !TARGET_IPHONE_SIMULATOR - - // Check what Notifications the user has turned on. We registered for all three, but they may have manually disabled some or all of them. - type = [[UIApplication sharedApplication] enabledRemoteNotificationTypes]; - - // Check what Registered Types are turned on. This is a bit tricky since if two are enabled, and one is off, it will return a number 2... not telling you which - // one is actually disabled. So we are literally checking to see if rnTypes matches what is turned on, instead of by number. The "tricky" part is that the - // single notification types will only match if they are the ONLY one enabled. Likewise, when we are checking for a pair of notifications, it will only be - // true if those two notifications are on. This is why the code is written this way - if(type == UIRemoteNotificationTypeBadge){ - pushBadge = @"1"; - } - else if(type == UIRemoteNotificationTypeAlert) { - pushAlert = @"1"; - } - else if(type == UIRemoteNotificationTypeSound) { - pushSound = @"1"; - } - else if(type == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert)) { - pushBadge = @"1"; - pushAlert = @"1"; - } - else if(type == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeSound)) { - pushBadge = @"1"; - pushSound = @"1"; - } - else if(type == ( UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)) { - pushAlert = @"1"; - pushSound = @"1"; - } - else if(type == ( UIRemoteNotificationTypeBadge | UIRemoteNotificationTypeAlert | UIRemoteNotificationTypeSound)) { - pushBadge = @"1"; - pushAlert = @"1"; - pushSound = @"1"; - } - -#endif - - // Affect results - [results setValue:[NSString stringWithFormat:@"%d", type] forKey:@"type"]; - [results setValue:[NSString stringWithFormat:@"%d", type != UIRemoteNotificationTypeNone] forKey:@"enabled"]; - [results setValue:pushBadge forKey:@"pushBadge"]; - [results setValue:pushAlert forKey:@"pushAlert"]; - [results setValue:pushSound forKey:@"pushSound"]; - - return results; - -} - -- (void)getRemoteNotificationStatus:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"getRemoteNotificationStatus:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"getRemoteNotificationStatus"]; - - NSMutableDictionary *results = [PushNotification getRemoteNotificationStatus]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"getRemoteNotificationStatus"]]]; -} - -- (void)setApplicationIconBadgeNumber:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"setApplicationIconBadgeNumber:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"setApplicationIconBadgeNumber"]; - - int badge = [[options objectForKey:@"badge"] intValue] ?: 0; - [[UIApplication sharedApplication] setApplicationIconBadgeNumber:badge]; - - NSMutableDictionary *results = [NSMutableDictionary dictionary]; - [results setValue:[NSNumber numberWithInt:badge] forKey:@"badge"]; - [results setValue:[NSNumber numberWithInt:1] forKey:@"success"]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:results]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"setApplicationIconBadgeNumber"]]]; -} - -- (void)cancelAllLocalNotifications:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"cancelAllLocalNotifications:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"cancelAllLocalNotifications"]; - - [[UIApplication sharedApplication] cancelAllLocalNotifications]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"cancelAllLocalNotifications"]]]; -} - -- (void)getDeviceUniqueIdentifier:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - DLog(@"getDeviceUniqueIdentifier:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - [self.callbackIds setValue:[arguments pop] forKey:@"getDeviceUniqueIdentifier"]; - - NSString* uuid = [[UIDevice currentDevice] uniqueIdentifier]; - - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:uuid]; - [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"getDeviceUniqueIdentifier"]]]; -} - -- (void) dealloc { - [_callbackIds dealloc]; - [_pendingNotifications dealloc]; - [super dealloc]; -} - -@end diff --git a/iOS/PushNotification/README.md b/iOS/PushNotification/README.md index f2cafc46..82e6cbf7 100644 --- a/iOS/PushNotification/README.md +++ b/iOS/PushNotification/README.md @@ -1,189 +1,45 @@ # Cordova PushNotification Plugin # -by `Olivier Louvignes` +by [Olivier Louvignes](http://olouv.com) -## DESCRIPTION ## - -* This plugin provides a simple way to use Apple Push Notifications (or Remote Notifications) from IOS. It does comply with the latest (future-2.x) cordova standards. - -* This was inspired by the now orphaned [ios-phonegap-plugin](https://github.com/urbanairship/ios-phonegap-plugin) build by Urban Airship. - -## PLUGIN SETUP ## - -Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). - -1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) -2. Drag and drop the `PushNotification` folder from Finder to your Plugins folder in XCode, using "Create groups for any added folders" -3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files using `` - - -4. Add new entry with key `PushNotification` and value `PushNotification` to `Plugins` in `Cordova.plist/Cordova.plist` - -## APPDELEGATE SETUP ## - -This plugin requires modifications to your `AppDelegate.m`. Append the block below at the end of your file, between your `dealloc` method and the implementation `@end`. - - - /* ... */ - - - (void) dealloc - { - [super dealloc]; - } - - /* START BLOCK */ - - #pragma PushNotification delegation - - - (void)application:(UIApplication*)app didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken - { - PushNotification* pushHandler = [self.viewController getCommandInstance:@"PushNotification"]; - [pushHandler didRegisterForRemoteNotificationsWithDeviceToken:deviceToken]; - } - - - (void)application:(UIApplication*)app didFailToRegisterForRemoteNotificationsWithError:(NSError*)error - { - PushNotification* pushHandler = [self.viewController getCommandInstance:@"PushNotification"]; - [pushHandler didFailToRegisterForRemoteNotificationsWithError:error]; - } - - - (void)application:(UIApplication*)application didReceiveRemoteNotification:(NSDictionary*)userInfo - { - PushNotification* pushHandler = [self.viewController getCommandInstance:@"PushNotification"]; - NSMutableDictionary* mutableUserInfo = [userInfo mutableCopy]; - - // Get application state for iOS4.x+ devices, otherwise assume active - UIApplicationState appState = UIApplicationStateActive; - if ([application respondsToSelector:@selector(applicationState)]) { - appState = application.applicationState; - } - - [mutableUserInfo setValue:@"0" forKey:@"applicationLaunchNotification"]; - if (appState == UIApplicationStateActive) { - [mutableUserInfo setValue:@"1" forKey:@"applicationStateActive"]; - [pushHandler didReceiveRemoteNotification:mutableUserInfo]; - } else { - [mutableUserInfo setValue:@"0" forKey:@"applicationStateActive"]; - [mutableUserInfo setValue:[NSNumber numberWithDouble: [[NSDate date] timeIntervalSince1970]] forKey:@"timestamp"]; - [pushHandler.pendingNotifications addObject:mutableUserInfo]; - } - } - - /* STOP BLOCK */ - - @end - -In order to support launch notifications (app starting from a remote notification), you have to add the following block inside `- (BOOL) application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions`, just before the return YES; - - - [self.window addSubview:self.viewController.view]; - [self.window makeKeyAndVisible]; - - /* START BLOCK */ - - // PushNotification - Handle launch from a push notification - NSDictionary* userInfo = [launchOptions objectForKey:UIApplicationLaunchOptionsRemoteNotificationKey]; - if(userInfo) { - PushNotification *pushHandler = [self.viewController getCommandInstance:@"PushNotification"]; - NSMutableDictionary* mutableUserInfo = [userInfo mutableCopy]; - [mutableUserInfo setValue:@"1" forKey:@"applicationLaunchNotification"]; - [mutableUserInfo setValue:@"0" forKey:@"applicationStateActive"]; - [pushHandler.pendingNotifications addObject:mutableUserInfo]; - } - - /* STOP BLOCK */ +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-push-notification/tree/master) +--- - return YES; - - -## JAVASCRIPT INTERFACE ## - - // After device ready, create a local alias - var pushNotification = window.plugins.pushNotification; - -`registerDevice()` does perform registration on Apple Push Notification servers (via user interaction) & retrieve the token that will be used to push remote notifications to this device. - - - pushNotification.registerDevice({alert:true, badge:true, sound:true}, function(status) { - console.warn('registerDevice:%o', status); - navigator.notification.alert(JSON.stringify(['registerDevice', status])); - }); - - -`getPendingNotifications()` should be used when your application starts or become active (from the background) to retrieve notifications that have been pushed while the application was inactive or offline. For now, it can only retrieve the notification that the user has interacted with while entering the app. Returned params `applicationStateActive` & `applicationLaunchNotification` enables you to filter notifications by type. - - - pushNotification.getPendingNotifications(function(notifications) { - console.warn('getPendingNotifications:%o', notifications); - navigator.notification.alert(JSON.stringify(['getPendingNotifications', notifications])); - }); - - -`getRemoteNotificationStatus()` does perform registration check for this device. - - - pushNotification.getRemoteNotificationStatus(function(status) { - console.warn('getRemoteNotificationStatus:%o', status); - navigator.notification.alert(JSON.stringify(['getRemoteNotificationStatus', status])); - }); - - -`setApplicationIconBadgeNumber()` can be used to set the application badge number (that can be updated by a remote push, for instance, resetting it to 0 after notifications have been processed). - - - pushNotification.setApplicationIconBadgeNumber(12, function(status) { - console.warn('setApplicationIconBadgeNumber:%o', status); - navigator.notification.alert(JSON.stringify(['setBadge', status])); - }); - -`cancelAllLocalNotifications()` can be used to clear all notifications from the notification center. - - - pushNotification.cancelAllLocalNotifications(function() { - console.warn('cancelAllLocalNotifications'); - navigator.notification.alert(JSON.stringify(['cancelAllLocalNotifications'])); - }); - -`getDeviceUniqueIdentifier()` can be used to retrieve the original device unique id. (@warning As of today, usage is deprecated and requires explicit consent from the user) - - pushNotification.getDeviceUniqueIdentifier(function(uuid) { - console.warn('getDeviceUniqueIdentifier:%s', uuid); - navigator.notification.alert(JSON.stringify(['getDeviceUniqueIdentifier', uuid])); - }); - -Finally, when a remote push notification is received while the application is active, an event will be triggered on the DOM `document`. - - document.addEventListener('push-notification', function(event) { - console.warn('push-notification!:%o', event); - navigator.notification.alert(JSON.stringify(['push-notification!', event])); - }); - -* Check [source](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/PushNotification/PushNotification.js) for additional configuration. - -## BUGS AND CONTRIBUTIONS ## +## DESCRIPTION ## -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires a CLA), this should be easier. +* This plugin provides a simple way to use Apple Push Notifications (or Remote Notifications) from IOS. -Post issues on [Github](https://github.com/phonegap/phonegap-plugins/issues) +* This plugin is built for Cordova >= v2.1.0 with ARC. -The latest code (my fork) will always be [here](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/PushNotification) +* This was inspired by the now orphaned [ios-phonegap-plugin](https://github.com/urbanairship/ios-phonegap-plugin) built by Urban Airship. ## LICENSE ## -Copyright 2012 Olivier Louvignes. All rights reserved. + The MIT License -The MIT License + Copyright (c) 2012 Olivier Louvignes -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. ## CREDITS ## -Inspired by : +Contributors : + +* [Olivier Louvignes](http://olouv.com), author. -* [ios-phonegap-plugin](https://github.com/urbanairship/ios-phonegap-plugin) build by Urban Airship. diff --git a/iOS/README.md b/iOS/README.md index 293b2303..81dab553 100644 --- a/iOS/README.md +++ b/iOS/README.md @@ -1,75 +1,144 @@ -#Cordova (iOS) plugins should be submitted here. - - -The [/iPhone](https://github.com/phonegap/phonegap-plugins/tree/master/iPhone) folder should be preserved for use with projects still using [PhoneGap 1.4.1](https://github.com/phonegap/phonegap/tags) and before. - -* Added ActionSheet (iOS) plugin with Cordova support. -* Added AdPlugin (iOS) plugin with Cordova support. -* Added AppBlade (iOS) plugin with Cordova support. -* Added AppiraterPlugin (iOS) plugin with Cordova support. -* Added ApplicationPreferences (iOS) plugin with Cordova support. -* Added AudioRecord (iOS) plugin with Cordova support. -* Added Badge (iOS) plugin with Cordova support. -* Added BarcodeScanner (iOS) plugin with Cordova support. -* Added CalendarPlugin (iOS) plugin with Cordova support. -* Added ChildBrowser (iOS) plugin with Cordova support. -* Added DatePicker (iOS) plugin with Cordova support. -* Added Diagnostic (iOS) plugin with Cordova support. -* Added EmailComposer (iOS) plugin with Cordova support. -* Added FileUploader (iOS) plugin with Cordova support. -* Added Globalization (iOS) plugin with Cordova support. -* Added GoogleAnalytics (iOS) plugin with Cordova support. -* Added InAppPurchaseManager (iOS) plugin with Cordova support. -* Added Keychain (iOS) plugin with Cordova support. -* Added LocalNotifications (iOS) plugin with Cordova support. -* Added LowLatencyAudio (iOS) plugin with Cordova support. -* Added MapKit (iOS) plugin with Cordova support. -* Added MessageBox (iOS) plugin with Cordova support. -* Added NativeControls (iOS) plugin with Cordova support. -* Added NavigationBar (iOS) plugin with Cordova support. -* Added NotificationEx (iOS) plugin with Cordova support. -* Added OCRPlugin (iOS) plugin with Cordova support. -* Added PayPalPlugin (iOS) plugin with Cordova support. -* Added PickerView (iOS) plugin with Cordova support. -* Added PowerManagement (iOS) plugin with Cordova support. -* Added PrintPlugin (iOS) plugin with Cordova support. -* Added ProgressHud (iOS) plugin with Cordova support. -* Added PushNotification (iOS) plugin with Cordova support. -* Added SMSComposer (iOS) plugin with Cordova support. -* Added Screenshot (iOS) plugin with Cordova support. -* Added SecureDeviceIdentifier (iOS) plugin with Cordova support. -* Added ShareKitPlugin (iOS) plugin with Cordova support. -* Added TabBar (iOS) plugin with Cordova support. -* Added Testflight (iOS) plugin with Cordova support. -* Added Twitter (iOS) plugin with Cordova support. -* Added UAPushNotifications (iOS) plugin with Cordova support. -* Added UniqueIdentifier (iOS) plugin with Cordova support. -* Added VolumeSlider (iOS) plugin with Cordova support. -* Added WebInspector (iOS) plugin with Cordova support. -* Added card.io (iOS) plugin with Cordova support. -* Added iCloudKV (iOS) plugin with Cordova support. -* More added regularly. - -Please refer to the Plugin Upgrade Guides distributed in the [download](http://phonegap.com/download/) for the most current version. - - -#Cordova Plugin Upgrade Guide - This document is for developers who need to upgrade their Cordova plugins to a newer Cordova version. Starting with Cordova 1.5.0, some classes have been renamed, which will require the plugin to be upgraded. Make sure your project itself has been upgraded using the "Cordova Upgrade Guide" document. Upgrading older Cordova plugins to 2.0.0 1. Install Cordova 2.0.0 2. Follow the "Upgrading older Cordova plugins to 1.9.0" section, if necessary 3. No changes in plugin structure from 1.9.x 4. Change in import header use: in 2.0.0, Cordova projects use the CordovaLib project as a subproject, it now uses the CORDOVA_FRAMEWORK styled import like this:
#import - instead of like this:
- #import "CDV.h" - So now in 2.0.0, Cordova import headers are unified. NOTE: The deprecated for 2.0.0 CDVPlugin methods verifyArguments and appViewController have been removed. - ##Upgrading older Cordova plugins to 1.9.0 1. Install Cordova 1.9.0 2. Follow the "Upgrading older Cordova plugins to 1.8.0" section, if necessary 3. No changes in plugin structure from 1.8.x - ##Upgrading older Cordova plugins to 1.8.0 1. Install Cordova 1.8.0 2. Follow the "Upgrading older Cordova plugins to 1.7.0" section, if necessary 3. No changes in plugin structure from 1.7.x ##Upgrading older Cordova plugins to 1.7.0 1. Install Cordova 1.7.0 2. Follow the "Upgrading older Cordova plugins to 1.6.0" section, if necessary 3. No changes in plugin structure from 1.6.x ##Upgrading older Cordova plugins to 1.6.x -1. Install Cordova 1.6.x 2. Follow the "Upgrading older Cordova plugins to 1.5.0" section, if necessary 3. See the 1.6.0 Plugin Notes section for new functionality available to plugins 4. The global "Cordova" (upper-case C) was renamed to "cordova" (lower-case c) to match the cordova-js Android implementation in 1.5.0 that is now common to Android, Blackberry and iOS. Please rename your calls to reflect the new lower-case c, or you can add a shim (which will support older versions) like so: 5. Wrap your plugin JavaScript in a temporary scope (self-executing function) - see "Temporary Scope" or this b. Inside your temporary scope, set a local var to the global PhoneGap/Cordova/cordova object, for the exec function var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks 6. Replace any PhoneGap or Cordova or cordova in your plugin JavaScript (within the temporary scope), with cordovaRef above. - ##Upgrading older Cordova plugins to 1.5.0 1. Install Cordova 1.5.0 2. Replacemacrooccurrencesof"PHONEGAP_FRAMEWORK"with"CORDOVA_FRAMEWORK" 3. Replace import occurrences of " + +#import + +instead of like this:
+ +#import "CDV.h" + + +So now in 2.0.0, Cordova import headers are unified. +NOTE: The deprecated for 2.0.0 CDVPlugin methods verifyArguments and appViewController have been removed. + + +##Upgrading older Cordova plugins to 1.9.0 +1. Install Cordova 1.9.0 +2. Follow the "Upgrading older Cordova plugins to 1.8.0" section, if necessary 3. No changes in plugin structure from 1.8.x + +##Upgrading older Cordova plugins to 1.8.0 +1. Install Cordova 1.8.0 +2. Follow the "Upgrading older Cordova plugins to 1.7.0" section, if necessary 3. No changes in plugin structure from 1.7.x + +##Upgrading older Cordova plugins to 1.7.0 +1. Install Cordova 1.7.0 +2. Follow the "Upgrading older Cordova plugins to 1.6.0" section, if necessary 3. No changes in plugin structure from 1.6.x + +##Upgrading older Cordova plugins to 1.6.x +1. Install Cordova 1.6.x +2. Follow the "Upgrading older Cordova plugins to 1.5.0" section, if necessary +3. See the 1.6.0 Plugin Notes section for new functionality available to plugins +4. The global "Cordova" (upper-case C) was renamed to "cordova" (lower-case c) to match the cordova-js Android implementation in 1.5.0 that is now common to Android, Blackberry and iOS. Please rename your calls to reflect the new lower-case c, or you can add a shim (which will support older versions) like so: +5. Wrap your plugin JavaScript in a temporary scope (self-executing function) - see "Temporary Scope" or this b. Inside your temporary scope, set a local var to the global PhoneGap/Cordova/cordova object, for the exec +function +var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks +6. Replace any PhoneGap or Cordova or cordova in your plugin JavaScript (within the temporary scope), with cordovaRef above. + + +##Upgrading older Cordova plugins to 1.5.0 +1. Install Cordova 1.5.0 +2. Replacemacrooccurrencesof"PHONEGAP_FRAMEWORK"with"CORDOVA_FRAMEWORK" 3. Replace import occurrences of " #import #import #import -@interface SMSComposer : CDVPlugin { -} +@interface SMSComposer : CDVPlugin {} -- (void)showSMSComposer:(NSArray*)arguments withDict:(NSDictionary*)options; +- (void)showSMSComposer:(NSArray *)arguments withDict:(NSDictionary *)options; @end diff --git a/iOS/SMSComposer/SMSComposer.js b/iOS/SMSComposer/SMSComposer.js index a8bc1d38..609b93a5 100644 --- a/iOS/SMSComposer/SMSComposer.js +++ b/iOS/SMSComposer/SMSComposer.js @@ -28,7 +28,7 @@ SMSComposer.prototype.showSMSComposer = function(toRecipients, body) if(body) args.body = body; - Cordova.exec("SMSComposer.showSMSComposer",args); + cordova.exec("SMSComposer.showSMSComposer",args); } SMSComposer.prototype.showSMSComposerWithCB = function(cbFunction,toRecipients,body) @@ -42,7 +42,7 @@ SMSComposer.prototype._didFinishWithResult = function(res) this.resultCallback(res); } -Cordova.addConstructor(function() { +cordova.addConstructor(function() { if(!window.plugins) { window.plugins = {}; diff --git a/iOS/SMSComposer/SMSComposer.m b/iOS/SMSComposer/SMSComposer.m index 9f0ba35b..d95ce698 100644 --- a/iOS/SMSComposer/SMSComposer.m +++ b/iOS/SMSComposer/SMSComposer.m @@ -9,83 +9,81 @@ @implementation SMSComposer --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView +- (CDVPlugin *)initWithWebView:(UIWebView *)theWebView { - self = (SMSComposer*)[super initWithWebView:theWebView]; - return self; + self = (SMSComposer *)[super initWithWebView:theWebView]; + return self; } -- (void)showSMSComposer:(NSArray*)arguments withDict:(NSDictionary*)options +- (void)showSMSComposer:(NSArray *)arguments withDict:(NSDictionary *)options { - Class messageClass = (NSClassFromString(@"MFMessageComposeViewController")); - if (messageClass != nil) { - - if (![messageClass canSendText]) { - - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Notice" message:@"SMS Text not available." - delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; + + if (messageClass != nil) { + if (![messageClass canSendText]) { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle :@"Notice" message:@"SMS Text not available." + delegate :self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; return; - } - - } else { - UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Notice" message:@"SMS Text not available." - delegate:self cancelButtonTitle:@"OK" otherButtonTitles: nil]; + } + } else { + UIAlertView *alert = [[UIAlertView alloc] initWithTitle :@"Notice" message:@"SMS Text not available." + delegate :self cancelButtonTitle:@"OK" otherButtonTitles:nil]; [alert show]; [alert release]; return; } - - - NSString* body = [options valueForKey:@"body"]; - NSString* toRecipientsString = [options valueForKey:@"toRecipients"]; - - MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init]; - - picker.messageComposeDelegate = self; - - if(body != nil) + + NSString *body = [options valueForKey:@"body"]; + NSString *toRecipientsString = [options valueForKey:@"toRecipients"]; + + MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init]; + + picker.messageComposeDelegate = self; + + if (body != nil) { picker.body = [options valueForKey:@"body"]; - - if(toRecipientsString != nil) - [picker setRecipients:[ toRecipientsString componentsSeparatedByString:@","]]; + } + + if (toRecipientsString != nil) { + [picker setRecipients:[toRecipientsString componentsSeparatedByString:@","]]; + } [self.viewController presentModalViewController:picker animated:YES]; - [[UIApplication sharedApplication] setStatusBarHidden:YES];///This hides the statusbar when the picker is presented -@RandyMcMillan + [[UIApplication sharedApplication] setStatusBarHidden:YES]; // /This hides the statusbar when the picker is presented -@RandyMcMillan [picker release]; - } // Dismisses the composition interface when users tap Cancel or Send. Proceeds to update the message field with the result of the operation. - (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result -{ - // Notifies users about errors associated with the interface +{ + // Notifies users about errors associated with the interface int webviewResult = 0; - - switch (result) - { + + switch (result) { case MessageComposeResultCancelled: webviewResult = 0; break; + case MessageComposeResultSent: webviewResult = 1; break; + case MessageComposeResultFailed: webviewResult = 2; break; + default: webviewResult = 3; break; } - - [self.viewController dismissModalViewControllerAnimated:YES]; - - NSString* jsString = [[NSString alloc] initWithFormat:@"window.plugins.smsComposer._didFinishWithResult(%d);",webviewResult]; + + [self.viewController dismissModalViewControllerAnimated:YES]; + + NSString *jsString = [[NSString alloc] initWithFormat:@"window.plugins.smsComposer._didFinishWithResult(%d);", webviewResult]; [self writeJavascript:jsString]; [jsString release]; - } -@end \ No newline at end of file +@end diff --git a/iOS/SMSComposer/index.html b/iOS/SMSComposer/index.html index 5d0c2c76..f17d9b67 100755 --- a/iOS/SMSComposer/index.html +++ b/iOS/SMSComposer/index.html @@ -1,60 +1,54 @@ + - - - + + - Hello Cordova + Hello World
-

Apache Cordovaâ„¢

-
- - +

Apache Cordova

+ + + >
-
- - - - - - + - var args; + - // cordova.exec(null,null, 'SMSComposer','showSMSComposer',[args]); - - - - - -
- - - - + diff --git a/iOS/ScreenOrientation/README.md b/iOS/ScreenOrientation/README.md new file mode 100644 index 00000000..d5e1e71a --- /dev/null +++ b/iOS/ScreenOrientation/README.md @@ -0,0 +1,50 @@ +# Cordova ScreenOrientation Plugin # +by `Simon Cruise` + +## DESCRIPTION ## + +The status bar and screen will be rotated with animation to the desired orientation 'portrait' or 'landscape'. + + +## SETUP ## + +To use the AppDelegate must have the main view controller that extends CDVViewController as a member variable called viewController. +This main view controller header file should have the below allowed orientations variable introduced. + + @interface MainViewController : CDVViewController { + NSMutableArray *allowedOrientations; + } + + @property (nonatomic, retain) NSMutableArray *allowedOrientations; + +Source file should have the allowedOrientations synthesized. + + @synthesize allowedOrientations; + +Then perform setup in viewDidLoad method. UIDeviceOrientationPortrait can be replaced with UIDeviceOrientationLandscapeRight depending on desired start up orientation. + + - (void) viewDidLoad + { + [super viewDidLoad]; + self.allowedOrientations = [NSMutableArray array]; + [self.allowedOrientations addObject:[NSNumber numberWithInt:UIDeviceOrientationPortrait]]; + } + +Finally implement shouldAutorotateToInterfaceOrientation method with +the following. + + - (BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation + { + return [allowedOrientations containsObject:[NSNumber numberWithInt:interfaceOrientation]]; + } +## LICENSE ## + +Copyright 2012 Simon Cruise. All rights reserved. + +The MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/iOS/ScreenOrientation/ScreenOrientation.h b/iOS/ScreenOrientation/ScreenOrientation.h new file mode 100644 index 00000000..d63b81a4 --- /dev/null +++ b/iOS/ScreenOrientation/ScreenOrientation.h @@ -0,0 +1,16 @@ +// +// ScreenOrientation.h +// +// Created by Simon Cruise on 30/08/2012. +// + +#import +#import "AppDelegate.h" + +#import + +@interface ScreenOrientation : CDVPlugin + +- (void) set:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +@end diff --git a/iOS/ScreenOrientation/ScreenOrientation.js b/iOS/ScreenOrientation/ScreenOrientation.js new file mode 100755 index 00000000..72406a23 --- /dev/null +++ b/iOS/ScreenOrientation/ScreenOrientation.js @@ -0,0 +1,8 @@ +var screenOrientation = function() {} + +screenOrientation.prototype.set = function(str, success, fail) { + var args = {}; + args.key = str; + PhoneGap.exec(success, fail, "ScreenOrientation", "set", [args]); +}; +navigator.screenOrientation = new screenOrientation(); diff --git a/iOS/ScreenOrientation/ScreenOrientation.m b/iOS/ScreenOrientation/ScreenOrientation.m new file mode 100644 index 00000000..660d97e9 --- /dev/null +++ b/iOS/ScreenOrientation/ScreenOrientation.m @@ -0,0 +1,44 @@ +// +// ScreenOrientation.m +// +// Created by Simon Cruise on 30/08/2012. +// + +#import "ScreenOrientation.h" + +@implementation ScreenOrientation + +- (void)set:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options +{ + AppDelegate* appDelegate = (AppDelegate*) [UIApplication sharedApplication].delegate; + + NSMutableArray *allowed = [NSMutableArray array]; + NSString *targetOrientation = [options objectForKey:@"key"]; + int statusBarHeight = [[UIApplication sharedApplication] statusBarFrame].size.height; + int statusBarWidth = [[UIApplication sharedApplication] statusBarFrame].size.width; + if([targetOrientation isEqualToString:@"landscape"]) { + [allowed addObject:[NSNumber numberWithInt:UIDeviceOrientationLandscapeRight]]; + appDelegate.viewController.allowedOrientations = allowed; + [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationLandscapeRight animated:YES]; + [appDelegate.viewController.view setTransform: CGAffineTransformMakeRotation(M_PI * 1.5)]; + [appDelegate.viewController.view setFrame:CGRectMake(statusBarHeight, 0, appDelegate.viewController.view.frame.size.height-statusBarHeight, appDelegate.viewController.view.frame.size.width+statusBarHeight)]; + + [UIView commitAnimations]; + } + if([targetOrientation isEqualToString:@"portrait"]) { + if (![appDelegate.viewController.allowedOrientations containsObject:[NSNumber numberWithInt:UIDeviceOrientationPortrait]]) { + [allowed addObject:[NSNumber numberWithInt:UIDeviceOrientationPortrait]]; + appDelegate.viewController.allowedOrientations = allowed; + [[UIApplication sharedApplication] setStatusBarOrientation:UIDeviceOrientationPortrait animated:YES]; + [appDelegate.viewController.view setTransform: CGAffineTransformMakeRotation(0)]; + [appDelegate.viewController.view setFrame:CGRectMake(0, statusBarWidth, appDelegate.viewController.view.frame.size.height+statusBarWidth, appDelegate.viewController.view.frame.size.width-statusBarWidth)]; + + [UIView commitAnimations]; + + } + } + +} + + +@end diff --git a/iOS/Screenshot/Screenshot.m b/iOS/Screenshot/Screenshot.m index 06879163..00934464 100644 --- a/iOS/Screenshot/Screenshot.m +++ b/iOS/Screenshot/Screenshot.m @@ -31,7 +31,12 @@ - (void)saveScreenshot:(NSArray*)arguments withDict:(NSDictionary*)options imageRect = CGRectMake(0, 0, CGRectGetWidth(screenRect), CGRectGetHeight(screenRect)); } - UIGraphicsBeginImageContext(imageRect.size); + // Adds support for Retina Display. Code reverts back to original if iOs 4 not detected. + if (NULL != UIGraphicsBeginImageContextWithOptions) + UIGraphicsBeginImageContextWithOptions(imageRect.size, NO, 0); + else + UIGraphicsBeginImageContext(imageRect.size); + CGContextRef ctx = UIGraphicsGetCurrentContext(); [[UIColor blackColor] set]; diff --git a/iOS/SecureDeviceIdentifier/README.md b/iOS/SecureDeviceIdentifier/README.md index 93dc225e..f0987005 100644 --- a/iOS/SecureDeviceIdentifier/README.md +++ b/iOS/SecureDeviceIdentifier/README.md @@ -1,60 +1,47 @@ # Cordova SecureDeviceIdentifier Plugin # by [Olivier Louvignes](http://olouv.com) -## DESCRIPTION ## - -* This plugin provides a simple way to retreive a secureUDID to replace Apple deprecated UDID. It does comply with the latest (future-2.x) cordova standards. - -* It relies on [SecureUDID](https://github.com/crashlytics/secureudid) to work (MIT license, included in ./libs). - -## SETUP ## - -Using this plugin requires [Cordova iOS](https://github.com/apache/incubator-cordova-ios). - -1. Make sure your Xcode project has been [updated for Cordova](https://github.com/apache/incubator-cordova-ios/blob/master/guides/Cordova%20Upgrade%20Guide.md) -2. Drag and drop the `SecureDeviceIdentifier` folder from Finder to your Plugins folder in XCode, using "Create groups for any added folders" -3. Add the .js files to your `www` folder on disk, and add reference(s) to the .js files using +--- +### [This plugin is hosted by the author](https://github.com/mgcrea/cordova-secureudid/tree/master) +--- -4. Add new entry with key `SecureDeviceIdentifier` and value `SecureDeviceIdentifier` to `Plugins` in `Cordova.plist/Cordova.plist` - -## JAVASCRIPT INTERFACE ## - - // After device ready, create a local alias - var secureDeviceIdentifier = window.plugins.secureDeviceIdentifier; - - secureDeviceIdentifier.get({ - domain: 'com.example.myapp', - key: 'difficult-to-guess-key' - }, function(udid) { - navigator.notification.alert("SecureUDID=" + udid); - }) - -* Check [source](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.js) for additional configuration. +## DESCRIPTION ## -## BUGS AND CONTRIBUTIONS ## +* This plugin provides a simple way to retreive a secureUDID to replace Apple deprecated UDID. -Patches welcome! Send a pull request. Since this is not a part of Cordova Core (which requires a CLA), this should be easier. +* This plugin is built for Cordova >= v2.1.0 with ARC. -Post issues on [Github](https://github.com/phonegap/phonegap-plugins/issues) +* It relies on [SecureUDID](https://github.com/mgcrea/secureudid) to work (MIT license, included in ./libs). -The latest code (my fork) will always be [here](http://github.com/mgcrea/phonegap-plugins/tree/master/iOS/SecureDeviceIdentifier) +[![Screenshot](http://www.crashlytics.com/blog/wp-content/uploads/2012/03/SecureUDID.png)](https://github.com/mgcrea/cordova-secureudid/tree/master) ## LICENSE ## -Copyright 2012 Olivier Louvignes. All rights reserved. + The MIT License -The MIT License + Copyright (c) 2012 Olivier Louvignes -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + Permission is hereby granted, free of charge, to any person obtaining a copy + of this software and associated documentation files (the "Software"), to deal + in the Software without restriction, including without limitation the rights + to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + The above copyright notice and this permission notice shall be included in + all copies or substantial portions of the Software. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN + THE SOFTWARE. ## CREDITS ## -Inspired by : +Contributors : + +* [Olivier Louvignes](http://olouv.com), author. -* [SecureUDID](https://github.com/crashlytics/secureudid) diff --git a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.h b/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.h deleted file mode 100644 index 0f20811a..00000000 --- a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// ProgressHud.m -// -// Created by Olivier Louvignes on 05/31/2012. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#ifdef CORDOVA_FRAMEWORK - #import -#else - #import "CDVPlugin.h" -#endif - -@interface SecureDeviceIdentifier : CDVPlugin { - - NSString* callbackID; - NSString* secureUDID; - -} - -@property (nonatomic, copy) NSString* callbackID; -@property (nonatomic, assign) NSString* secureUDID; - -//Instance Method -- (void) get:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.js b/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.js deleted file mode 100644 index 1442dd81..00000000 --- a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.js +++ /dev/null @@ -1,40 +0,0 @@ -// -// SecureDeviceIdentifier.js -// -// Created by Olivier Louvignes on 05/31/2012. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -(function(cordova) { - - function SecureDeviceIdentifier() {} - - SecureDeviceIdentifier.prototype.get = function(options, callback) { - if(!options) options = {}; - var scope = options.scope || null; - delete options.scope; - - var service = 'SecureDeviceIdentifier', - action = 'get', - callbackId = service + (cordova.callbackId + 1); - - var config = { - domain: options.domain || 'com.example.myapp', - key: options.key || 'difficult-to-guess-key' - }; - - var _callback = function(result) { - if(typeof callback == 'function') callback.apply(scope, arguments); - }; - - return cordova.exec(_callback, _callback, service, action, [config]); - - }; - - cordova.addConstructor(function() { - if(!window.plugins) window.plugins = {}; - window.plugins.secureDeviceIdentifier = new SecureDeviceIdentifier(); - }); - -})(window.cordova || window.Cordova); diff --git a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.m b/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.m deleted file mode 100644 index ebec4c86..00000000 --- a/iOS/SecureDeviceIdentifier/SecureDeviceIdentifier.m +++ /dev/null @@ -1,37 +0,0 @@ -// -// ProgressHud.m -// -// Created by Olivier Louvignes on 05/31/2012. -// -// Copyright 2012 Olivier Louvignes. All rights reserved. -// MIT Licensed - -#import "SecureDeviceIdentifier.h" -#import "SecureUDID.h" - -@implementation SecureDeviceIdentifier - -@synthesize callbackID = _callbackID; -@synthesize secureUDID = _secureUDID; - --(void)get:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options { - //NSLog(@"get:%@\n withDict:%@", arguments, options); - - // The first argument in the arguments parameter is the callbackID. - // We use this to send data back to the successCallback or failureCallback - // through PluginResult. - self.callbackID = [arguments pop]; - - // Compiling options with defaults - NSString *domain = [options objectForKey:@"domain"] ?: @""; - NSString *key = [options objectForKey:@"key"] ?: @""; - self.secureUDID = [SecureUDID UDIDForDomain:domain usingKey:key]; - - // Create Plugin Result - CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsString:self.secureUDID]; - //Call the Success Javascript function - [self writeJavascript: [pluginResult toSuccessCallbackString:self.callbackID]]; - -} - -@end diff --git a/iOS/SecureDeviceIdentifier/libs/SecureUDID.h b/iOS/SecureDeviceIdentifier/libs/SecureUDID.h deleted file mode 100755 index b3aa3603..00000000 --- a/iOS/SecureDeviceIdentifier/libs/SecureUDID.h +++ /dev/null @@ -1,75 +0,0 @@ -// -// SecureUDID.h -// SecureUDID -// -// Created by Crashlytics Team on 3/22/12. -// Copyright (c) 2012 Crashlytics, Inc. All rights reserved. -// http://www.crashlytics.com -// info@crashlytics.com -// - -/* - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -#import - -@interface SecureUDID : NSObject - -/* - Returns a unique id for the device, sandboxed to the domain and salt provided. This is a potentially - expensive call. You should not do this on the main thread, especially during launch. - - retrieveUDIDForDomain:usingKey:completion: is provided as an alternative for your 4.0+ coding convenience. - - Example usage: - #import "SecureUDID.h" - - NSString *udid = [SecureUDID UDIDForDomain:@"com.example.myapp" key:@"difficult-to-guess-key"]; - - */ -+ (NSString *)UDIDForDomain:(NSString *)domain usingKey:(NSString *)key; - -/* - Getting a SecureUDID can be very expensive. Use this call to derive an identifier in the background, - and invoke a block when ready. Use of this method implies a device running >= iOS 4.0. - - Example usage: - #import "SecureUDID.h" - - [SecureUDID retrieveUDIDForDomain:@"com.example.myapp" usingKey:@"difficult-to-guess-key" completion:^(NSString *identifier) { - // make use of identifier here - }]; - - */ -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 -+ (void)retrieveUDIDForDomain:(NSString *)domain usingKey:(NSString *)key completion:(void (^)(NSString* identifier))completion; -#endif - -/* - Indicates that the system has been disabled via the Opt-Out mechansim. - */ -+ (BOOL)isOptedOut; - -@end - -/* - This identifier is returned when Opt-Out is enabled. - */ -extern NSString *const SUUIDDefaultIdentifier; diff --git a/iOS/SecureDeviceIdentifier/libs/SecureUDID.m b/iOS/SecureDeviceIdentifier/libs/SecureUDID.m deleted file mode 100755 index 41497d9f..00000000 --- a/iOS/SecureDeviceIdentifier/libs/SecureUDID.m +++ /dev/null @@ -1,687 +0,0 @@ -// -// SecureUDID.m -// SecureUDID -// -// Created by Crashlytics Team on 3/22/12. -// Copyright (c) 2012 Crashlytics, Inc. All rights reserved. -// http://www.crashlytics.com -// info@crashlytics.com -// - -/* - Permission is hereby granted, free of charge, to any person obtaining a copy of - this software and associated documentation files (the "Software"), to deal in - the Software without restriction, including without limitation the rights to - use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies - of the Software, and to permit persons to whom the Software is furnished to do - so, subject to the following conditions: - - The above copyright notice and this permission notice shall be included in all - copies or substantial portions of the Software. - - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE - AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE - SOFTWARE. - */ - -#import "SecureUDID.h" -#import -#import -#import -#import - -#define SUUID_SCHEMA_VERSION (1) -#define SUUID_MAX_STORAGE_LOCATIONS (64) - -NSString *const SUUIDDefaultIdentifier = @"00000000-0000-0000-0000-000000000000"; - -NSString *const SUUIDTypeDataDictionary = @"public.secureudid"; -NSString *const SUUIDTimeStampKey = @"SUUIDTimeStampKey"; -NSString *const SUUIDOwnerKey = @"SUUIDOwnerKey"; -NSString *const SUUIDLastAccessedKey = @"SUUIDLastAccessedKey"; -NSString *const SUUIDIdentifierKey = @"SUUIDIdentifierKey"; -NSString *const SUUIDOptOutKey = @"SUUIDOptOutKey"; -NSString *const SUUIDModelHashKey = @"SUUIDModelHashKey"; -NSString *const SUUIDSchemaVersionKey = @"SUUIDSchemaVersionKey"; -NSString *const SUUIDPastboardFileFormat = @"org.secureudid-%d"; - -NSData *SUUIDCryptorToData(CCOperation operation, NSData *value, NSData *key); -NSString *SUUIDCryptorToString(CCOperation operation, NSData *value, NSData *key); -NSData *SUUIDHash(NSData* data); -NSData *SUUIDModelHash(void); - -void SUUIDMarkOptedOut(void); -void SUUIDMarkOptedIn(void); -void SUUIDRemoveAllSecureUDIDData(void); -NSString *SUUIDPasteboardNameForNumber(NSInteger number); -NSInteger SUUIDStorageLocationForOwnerKey(NSData *key, NSMutableDictionary** dictionary); -NSDictionary *SUUIDDictionaryForStorageLocation(NSInteger number); -NSDictionary *SUUIDMostRecentDictionary(void); -void SUUIDWriteDictionaryToStorageLocation(NSInteger number, NSDictionary* dictionary); -void SUUIDDeleteStorageLocation(NSInteger number); - -BOOL SUUIDValidTopLevelObject(id object); -BOOL SUUIDValidOwnerObject(id object); - -@implementation SecureUDID - -/* - Returns a unique id for the device, sandboxed to the domain and salt provided. - - Example usage: - #import "SecureUDID.h" - - NSString *udid = [SecureUDID UDIDForDomain:@"com.example.myapp" salt:@"superSecretCodeHere!@##%#$#%$^"]; - - */ -+ (NSString *)UDIDForDomain:(NSString *)domain usingKey:(NSString *)key { - NSString *identifier = SUUIDDefaultIdentifier; - - // Salt the domain to make the crypt keys affectively unguessable. - NSData *domainAndKey = [[NSString stringWithFormat:@"%@%@", domain, key] dataUsingEncoding:NSUTF8StringEncoding]; - NSData *ownerKey = SUUIDHash(domainAndKey); - - // Encrypt the salted domain key and load the pasteboard on which to store data - NSData *encryptedOwnerKey = SUUIDCryptorToData(kCCEncrypt, [domain dataUsingEncoding:NSUTF8StringEncoding], ownerKey); - - // @synchronized introduces an implicit @try-@finally, so care needs to be taken with the return value - @synchronized (self) { - NSMutableDictionary *topLevelDictionary = nil; - - // Retrieve an appropriate storage index for this owner - NSInteger ownerIndex = SUUIDStorageLocationForOwnerKey(encryptedOwnerKey, &topLevelDictionary); - - // If the model hash key is present, verify it, otherwise add it - NSData *storedModelHash = [topLevelDictionary objectForKey:SUUIDModelHashKey]; - NSData *modelHash = SUUIDModelHash(); - - if (storedModelHash) { - if (![modelHash isEqual:storedModelHash]) { - // The model hashes do not match - this structure is invalid - [topLevelDictionary removeAllObjects]; - } - } - - // store the current model hash - [topLevelDictionary setObject:modelHash forKey:SUUIDModelHashKey]; - - // check for the opt-out flag and return the default identifier if we find it - if ([[topLevelDictionary objectForKey:SUUIDOptOutKey] boolValue] == YES) { - return identifier; - } - - // If we encounter a schema version greater than we support, there is no simple alternative - // other than to simulate Opt Out. Any writes to the store risk corruption. - if ([[topLevelDictionary objectForKey:SUUIDSchemaVersionKey] intValue] > SUUID_SCHEMA_VERSION) { - return identifier; - } - - // Attempt to get the owner's dictionary. Should we get back nil from the encryptedDomain key, we'll still - // get a valid, empty mutable dictionary - NSMutableDictionary *ownerDictionary = [NSMutableDictionary dictionaryWithDictionary:[topLevelDictionary objectForKey:encryptedOwnerKey]]; - - // Set our last access time and claim ownership for this storage location. - NSDate* lastAccessDate = [NSDate date]; - - [ownerDictionary setObject:lastAccessDate forKey:SUUIDLastAccessedKey]; - [topLevelDictionary setObject:lastAccessDate forKey:SUUIDTimeStampKey]; - [topLevelDictionary setObject:encryptedOwnerKey forKey:SUUIDOwnerKey]; - - [topLevelDictionary setObject:[NSNumber numberWithInt:SUUID_SCHEMA_VERSION] forKey:SUUIDSchemaVersionKey]; - - // Make sure our owner dictionary is in the top level structure - [topLevelDictionary setObject:ownerDictionary forKey:encryptedOwnerKey]; - - - NSData *identifierData = [ownerDictionary objectForKey:SUUIDIdentifierKey]; - if (identifierData) { - identifier = SUUIDCryptorToString(kCCDecrypt, identifierData, ownerKey); - if (!identifier) { - // We've failed to decrypt our identifier. This is a sign of storage corruption. - SUUIDDeleteStorageLocation(ownerIndex); - - // return here - do not write values back to the store - return SUUIDDefaultIdentifier; - } - } else { - // Otherwise, create a new RFC-4122 Version 4 UUID - // http://en.wikipedia.org/wiki/Universally_unique_identifier - CFUUIDRef uuid = CFUUIDCreate(kCFAllocatorDefault); - identifier = [(NSString*)CFUUIDCreateString(kCFAllocatorDefault, uuid) autorelease]; - CFRelease(uuid); - - // Encrypt it for storage. - NSData *data = SUUIDCryptorToData(kCCEncrypt, [identifier dataUsingEncoding:NSUTF8StringEncoding], ownerKey); - - [ownerDictionary setObject:data forKey:SUUIDIdentifierKey]; - } - - SUUIDWriteDictionaryToStorageLocation(ownerIndex, topLevelDictionary); - } - - return identifier; -} - -#if __IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_4_0 -+ (void)retrieveUDIDForDomain:(NSString *)domain usingKey:(NSString *)key completion:(void (^)(NSString* identifier))completion { - // retreive the identifier on a low-priority thread - - dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0), ^{ - NSString* identifier; - - identifier = [SecureUDID UDIDForDomain:domain usingKey:key]; - - completion(identifier); - }); -} -#endif - -/* - API to determine if a device has opted out of SecureUDID. - */ -+ (BOOL)isOptedOut { - for (NSInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - NSDictionary* topLevelDictionary; - - topLevelDictionary = SUUIDDictionaryForStorageLocation(i); - if (!topLevelDictionary) { - continue; - } - - if ([[topLevelDictionary objectForKey:SUUIDOptOutKey] boolValue] == YES) { - return YES; - } - } - - return NO; -} - -/* - Applies the operation (encrypt or decrypt) to the NSData value with the provided NSData key - and returns the value as NSData. - */ -NSData *SUUIDCryptorToData(CCOperation operation, NSData *value, NSData *key) { - NSMutableData *output = [NSMutableData dataWithLength:value.length + kCCBlockSizeAES128]; - - size_t numBytes = 0; - CCCryptorStatus cryptStatus = CCCrypt(operation, - kCCAlgorithmAES128, - kCCOptionPKCS7Padding, - [key bytes], - kCCKeySizeAES128, - NULL, - value.bytes, - value.length, - output.mutableBytes, - output.length, - &numBytes); - - if (cryptStatus == kCCSuccess) { - return [[[NSData alloc] initWithBytes:output.bytes length:numBytes] autorelease]; - } - - return nil; -} - -/* - Applies the operation (encrypt or decrypt) to the NSData value with the provided NSData key - and returns the value as an NSString. - */ -NSString *SUUIDCryptorToString(CCOperation operation, NSData *value, NSData *key) { - NSData* data; - - data = SUUIDCryptorToData(operation, value, key); - if (!data) { - return nil; - } - - return [[[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding] autorelease]; -} - -/* - Compute a SHA1 of the input. - */ -NSData *SUUIDHash(NSData __unsafe_unretained * data) { - uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0}; - - CC_SHA1(data.bytes, data.length, digest); - - return [NSData dataWithBytes:digest length:CC_SHA1_DIGEST_LENGTH]; -} - -NSData* SUUIDModelHash(void) { - NSString* result; - - result = @"Unknown"; - - do { - size_t size; - char* value; - - value = NULL; - - // first get the size - if (sysctlbyname("hw.machine", NULL, &size, NULL, 0) != 0) { - break; - } - - value = malloc(size); - if (!value) { - break; - } - - // now get the value - if (sysctlbyname("hw.machine", value, &size, NULL, 0) != 0) { - break; - } - - // convert the value to an NSString - result = [NSString stringWithCString:value encoding:NSUTF8StringEncoding]; - if (!result) { - break; - } - - // free our buffer - free(value); - } while (0); - - return SUUIDHash([result dataUsingEncoding:NSUTF8StringEncoding]); -} - -/* - Finds the most recent structure, and adds the Opt-Out flag to it. Then writes that structure back - out to all used storage locations, making sure to preserve ownership. - */ -void SUUIDMarkOptedOut(void) { - NSMutableDictionary* mostRecentDictionary; - - mostRecentDictionary = [NSMutableDictionary dictionaryWithDictionary:SUUIDMostRecentDictionary()]; - - [mostRecentDictionary setObject:[NSDate date] forKey:SUUIDTimeStampKey]; - [mostRecentDictionary setObject:[NSNumber numberWithBool:YES] forKey:SUUIDOptOutKey]; - - for (NSInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - NSData* owner; - - // Inherit the owner, if it is present. This makes some schema assumptions. - owner = [SUUIDDictionaryForStorageLocation(i) objectForKey:SUUIDOwnerKey]; - if (owner) { - [mostRecentDictionary setObject:owner forKey:SUUIDOwnerKey]; - } - - // write the opt-out data even if the location was previously empty - SUUIDWriteDictionaryToStorageLocation(i, mostRecentDictionary); - } -} - -void SUUIDMarkOptedIn(void) { - NSDate* accessedDate; - - accessedDate = [NSDate date]; - - // Opting back in is trickier. We need to remove top-level Opt-Out markers. Also makes some - // schema assumptions. - for (NSInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - NSMutableDictionary* dictionary; - - dictionary = [NSMutableDictionary dictionaryWithDictionary:SUUIDDictionaryForStorageLocation(i)]; - if (!dictionary) { - // This is a possible indiction of storage corruption. However, SUUIDDictionaryForStorageLocation - // will have already cleaned it up for us, so there's not much to do here. - continue; - } - - [dictionary removeObjectForKey:SUUIDOptOutKey]; - - // quick check for the minimum set of keys. If the dictionary previously held just - // an Opt-Out marker + timestamp, dictionary is not invalid. Writing will fail in this - // case, leaving the data that was there. We need to delete. - if (!SUUIDValidTopLevelObject(dictionary)) { - SUUIDDeleteStorageLocation(i); - continue; - } - - [dictionary setObject:accessedDate forKey:SUUIDTimeStampKey]; - - SUUIDWriteDictionaryToStorageLocation(i, dictionary); - } -} - -/* - Removes all SecureUDID data from storage with the exception of Opt-Out flags, which - are never removed. Removing the Opt-Out flags would effectively opt a user back in. - */ -void SUUIDRemoveAllSecureUDIDData(void) { - NSDictionary* optOutPlaceholder = nil; - - if ([SecureUDID isOptedOut]) { - optOutPlaceholder = [NSDictionary dictionaryWithObject:[NSNumber numberWithBool:YES] forKey:SUUIDOptOutKey]; - } - - for (NSInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - if (optOutPlaceholder) { - SUUIDWriteDictionaryToStorageLocation(i, optOutPlaceholder); - continue; - } - - SUUIDDeleteStorageLocation(i); - } -} - -/* - Returns an NSString formatted with the supplied number. - */ -NSString *SUUIDPasteboardNameForNumber(NSInteger number) { - return [NSString stringWithFormat:SUUIDPastboardFileFormat, number]; -} - -/* - Reads a dictionary from a storage location. Validation occurs once data - is read, but before it is returned. If something fails, or if the read structure - is invalid, the location is cleared. - - Returns the data dictionary, or nil on failure. - */ -NSDictionary *SUUIDDictionaryForStorageLocation(NSInteger number) { - id decodedObject; - UIPasteboard* pasteboard; - NSData* data; - - // Don't even bother if the index is outside our limits - if (number < 0 || number >= SUUID_MAX_STORAGE_LOCATIONS) { - return nil; - } - - pasteboard = [UIPasteboard pasteboardWithName:SUUIDPasteboardNameForNumber(number) create:NO]; - if (!pasteboard) { - return nil; - } - - data = [pasteboard valueForPasteboardType:SUUIDTypeDataDictionary]; - if (!data) { - return nil; - } - - @try { - decodedObject = [NSKeyedUnarchiver unarchiveObjectWithData:data]; - } @catch (NSException* exception) { - // Catching an exception like this is risky. However, crashing here is - // not acceptable, and unarchiveObjectWithData can throw. - [pasteboard setData:nil forPasteboardType:SUUIDTypeDataDictionary]; - - return nil; - } - - if (!SUUIDValidTopLevelObject(decodedObject)) { - [pasteboard setData:nil forPasteboardType:SUUIDTypeDataDictionary]; - - return nil; - } - - return decodedObject; -} - -NSDictionary *SUUIDMostRecentDictionary(void) { - NSDictionary* mostRecentDictionary; - BOOL found; - - mostRecentDictionary = [NSDictionary dictionaryWithObject:[NSDate distantPast] forKey:SUUIDTimeStampKey]; - - // scan all locations looking for the most recent - for (NSUInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - NSDictionary* dictionary; - NSDate* date; - - dictionary = SUUIDDictionaryForStorageLocation(i); - if (!dictionary) { - continue; - } - - // Schema assumption - date = [dictionary objectForKey:SUUIDTimeStampKey]; - if ([date compare:[mostRecentDictionary objectForKey:SUUIDTimeStampKey]] == NSOrderedDescending) { - mostRecentDictionary = dictionary; - found = YES; - } - } - - if (!found) { - return nil; - } - - return mostRecentDictionary; -} - -/* - Writes out a dictionary to a storage location. That dictionary must be a 'valid' - SecureUDID structure, and the location must be within range. A new location is - created if is didn't already exist. - */ -void SUUIDWriteDictionaryToStorageLocation(NSInteger number, NSDictionary* dictionary) { - UIPasteboard* pasteboard; - - // be sure to respect our limits - if (number < 0 || number >= SUUID_MAX_STORAGE_LOCATIONS) { - return; - } - - // only write out valid structures - if (!SUUIDValidTopLevelObject(dictionary)) { - return; - } - - pasteboard = [UIPasteboard pasteboardWithName:SUUIDPasteboardNameForNumber(number) create:YES]; - if (!pasteboard) { - return; - } - - pasteboard.persistent = YES; - - [pasteboard setData:[NSKeyedArchiver archivedDataWithRootObject:dictionary] - forPasteboardType:SUUIDTypeDataDictionary]; -} - -/* - Clear a storage location, removing anything stored there. Useful for dealing with - potential corruption. Be careful with this function, as it can remove Opt-Out markers. - */ -void SUUIDDeleteStorageLocation(NSInteger number) { - UIPasteboard* pasteboard; - NSString* name; - - if (number < 0 || number >= SUUID_MAX_STORAGE_LOCATIONS) { - return; - } - - name = SUUIDPasteboardNameForNumber(number); - pasteboard = [UIPasteboard pasteboardWithName:name create:NO]; - if (!pasteboard) - return; - - // While setting pasteboard data to nil seems to always remove contents, the - // removePasteboardWithName: call doesn't appear to always work. Using both seems - // like the safest thing to do - [pasteboard setData:nil forPasteboardType:SUUIDTypeDataDictionary]; - [UIPasteboard removePasteboardWithName:name]; -} - -/* - SecureUDID leverages UIPasteboards to persistently store its data. - UIPasteboards marked as 'persistent' have the following attributes: - - They persist across application relaunches, device reboots, and OS upgrades. - - They are destroyed when the application that created them is deleted from the device. - - To protect against the latter case, SecureUDID leverages multiple pasteboards (up to - SUUID_MAX_STORAGE_LOCATIONS), creating one for each distinct domain/app that - leverages the system. The permanence of SecureUDIDs increases exponentially with the - number of apps that use it. - - This function searches for a suitable storage location for a SecureUDID structure. It - attempts to find the structure written by ownerKey. If no owner is found and there are - still open locations, the lowest numbered location is selected. If there are no - available locations, the last-written is selected. - - Once a spot is found, the most-recent data is re-written over this location. The location - is then, finally, returned. - */ -NSInteger SUUIDStorageLocationForOwnerKey(NSData *ownerKey, NSMutableDictionary** ownerDictionary) { - NSInteger ownerIndex; - NSInteger lowestUnusedIndex; - NSInteger oldestUsedIndex; - NSDate* mostRecentDate; - NSDate* oldestUsedDate; - NSDictionary* mostRecentDictionary; - BOOL optedOut; - - ownerIndex = -1; - lowestUnusedIndex = -1; - oldestUsedIndex = 0; // make sure this value is always in range - mostRecentDate = [NSDate distantPast]; - oldestUsedDate = [NSDate distantFuture]; - mostRecentDictionary = nil; - optedOut = NO; - - // The array of SecureUDID pasteboards can be sparse, since any number of - // apps may have been deleted. To find a pasteboard owned by the the current - // domain, iterate all of them. - for (NSInteger i = 0; i < SUUID_MAX_STORAGE_LOCATIONS; ++i) { - NSDate* modifiedDate; - NSDictionary* dictionary; - - dictionary = SUUIDDictionaryForStorageLocation(i); - if (!dictionary) { - if (lowestUnusedIndex == -1) { - lowestUnusedIndex = i; - } - - continue; - } - - // Check the 'modified' timestamp of this pasteboard - modifiedDate = [dictionary valueForKey:SUUIDTimeStampKey]; - optedOut = optedOut || [[dictionary valueForKey:SUUIDOptOutKey] boolValue]; - - // Hold a copy of the data if this is the newest we've found so far. - if ([modifiedDate compare:mostRecentDate] == NSOrderedDescending) { - mostRecentDate = modifiedDate; - mostRecentDictionary = dictionary; - } - - // Check for the oldest entry in the structure, used for eviction - if ([modifiedDate compare:oldestUsedDate] == NSOrderedAscending) { - oldestUsedDate = modifiedDate; - oldestUsedIndex = i; - } - - // Finally, check if this is the pasteboard owned by the requesting domain. - if ([[dictionary objectForKey:SUUIDOwnerKey] isEqual:ownerKey]) { - ownerIndex = i; - } - } - - // If no pasteboard is owned by this domain, establish a new one to increase the - // likelihood of permanence. - if (ownerIndex == -1) { - // Unless there are no available slots, then evict the oldest entry - if ((lowestUnusedIndex < 0) || (lowestUnusedIndex >= SUUID_MAX_STORAGE_LOCATIONS)) { - ownerIndex = oldestUsedIndex; - } else { - ownerIndex = lowestUnusedIndex; - } - } - - // pass back the dictionary, by reference - *ownerDictionary = [NSMutableDictionary dictionaryWithDictionary:mostRecentDictionary]; - - // make sure our Opt-Out flag is consistent - if (optedOut) { - [*ownerDictionary setObject:[NSNumber numberWithBool:YES] forKey:SUUIDOptOutKey]; - } - - // Make sure to write the most recent structure to the new location - SUUIDWriteDictionaryToStorageLocation(ownerIndex, mostRecentDictionary); - - return ownerIndex; -} - -/* - Attempts to validate the full SecureUDID structure. - */ -BOOL SUUIDValidTopLevelObject(id object) { - if (![object isKindOfClass:[NSDictionary class]]) { - return NO; - } - - // Now, we need to verify the current schema. There are a few possible valid states: - // - SUUIDTimeStampKey + SUUIDOwnerKey + at least one additional key that is not SUUIDOptOutKey - // - SUUIDTimeStampKey + SUUIDOwnerKey + SUUIDOptOutKey - - if ([object objectForKey:SUUIDTimeStampKey] && [object objectForKey:SUUIDOwnerKey]) { - NSMutableDictionary* ownersOnlyDictionary; - NSData* ownerField; - - if ([object objectForKey:SUUIDOptOutKey]) { - return YES; - } - - // We have to trust future schema versions. Note that the lack of a schema version key will - // always fail this check, since the first schema version was 1. - if ([[object objectForKey:SUUIDSchemaVersionKey] intValue] > SUUID_SCHEMA_VERSION) { - return YES; - } - - ownerField = [object objectForKey:SUUIDOwnerKey]; - if (![ownerField isKindOfClass:[NSData class]]) { - return NO; - } - - ownersOnlyDictionary = [NSMutableDictionary dictionaryWithDictionary:object]; - - [ownersOnlyDictionary removeObjectForKey:SUUIDTimeStampKey]; - [ownersOnlyDictionary removeObjectForKey:SUUIDOwnerKey]; - [ownersOnlyDictionary removeObjectForKey:SUUIDOptOutKey]; - [ownersOnlyDictionary removeObjectForKey:SUUIDModelHashKey]; - [ownersOnlyDictionary removeObjectForKey:SUUIDSchemaVersionKey]; - - // now, iterate through to verify each internal structure - for (id key in [ownersOnlyDictionary allKeys]) { - if ([key isEqual:SUUIDTimeStampKey] || [key isEqual:SUUIDOwnerKey] || [key isEqual:SUUIDOptOutKey]) - continue; - - if (![key isKindOfClass:[NSData class]]) { - return NO; - } - - if (!SUUIDValidOwnerObject([ownersOnlyDictionary objectForKey:key])) { - return NO; - } - } - - // if all these tests pass, this structure is valid - return YES; - } - - // Maybe just the SUUIDOptOutKey, on its own - if ([[object objectForKey:SUUIDOptOutKey] boolValue] == YES) { - return YES; - } - - return NO; -} - -/* - Attempts to validate the structure for an "owner dictionary". - */ -BOOL SUUIDValidOwnerObject(id object) { - if (![object isKindOfClass:[NSDictionary class]]) { - return NO; - } - - return [object valueForKey:SUUIDLastAccessedKey] && [object valueForKey:SUUIDIdentifierKey]; -} - -@end diff --git a/iOS/Social/REPO MOVED.txt b/iOS/Social/REPO MOVED.txt new file mode 100644 index 00000000..36411ecc --- /dev/null +++ b/iOS/Social/REPO MOVED.txt @@ -0,0 +1 @@ +This plugin is now located at https://github.com/bfcam/phonegap-ios-social-plugin diff --git a/iOS/StatusBarNotifier/FDStatusBarNotifierView.h b/iOS/StatusBarNotifier/FDStatusBarNotifierView.h new file mode 100644 index 00000000..9690ad84 --- /dev/null +++ b/iOS/StatusBarNotifier/FDStatusBarNotifierView.h @@ -0,0 +1,38 @@ +// +// StatusBarNotifierView.h +// StatusBarNotifier +// +// Created by Francesco Di Lorenzo on 05/09/12. +// Copyright (c) 2012 Francesco Di Lorenzo. All rights reserved. +// + +#import + + + +@interface FDStatusBarNotifierView : UIView + +@property (strong, nonatomic) NSString *message; +@property NSTimeInterval timeOnScreen; // seconds, default: 2s +@property id delegate; + + +- (id)initWithMessage:(NSString *)message; +- (id)initWithMessage:(NSString *)message delegate:(id /**/)delegate; + +- (void)showInWindow:(UIWindow *)window; + +@end + + +@protocol StatusBarNotifierViewDelegate +@optional + +- (void)willPresentNotifierView:(FDStatusBarNotifierView *)notifierView; // before animation and showing view +- (void)didPresentNotifierView:(FDStatusBarNotifierView *)notifierView; // after animation +- (void)willHideNotifierView:(FDStatusBarNotifierView *)notifierView; // before hiding animation +- (void)didHideNotifierView:(FDStatusBarNotifierView *)notifierView; // after animation + +- (void)notifierViewTapped:(FDStatusBarNotifierView *)notifierView; // user tap the status bar message + +@end \ No newline at end of file diff --git a/iOS/StatusBarNotifier/FDStatusBarNotifierView.m b/iOS/StatusBarNotifier/FDStatusBarNotifierView.m new file mode 100644 index 00000000..60dcfc02 --- /dev/null +++ b/iOS/StatusBarNotifier/FDStatusBarNotifierView.m @@ -0,0 +1,133 @@ +// +// StatusBarNotifierView.m +// StatusBarNotifier +// +// Created by Francesco Di Lorenzo on 05/09/12. +// Copyright (c) 2012 Francesco Di Lorenzo. All rights reserved. +// + +#import "FDStatusBarNotifierView.h" + +@interface FDStatusBarNotifierView () + +@property (strong) UILabel *messageLabel; + +@end + +@implementation FDStatusBarNotifierView + +#define kNotifierViewInitialFramePortrait CGRectMake(0, 20, 320, 20) +#define kNotifierViewFinalFramePortrait CGRectMake(0, 0, 320, 20) +//#define kNotifierViewInitialFrameLandscape CGRectMake(0, 20, 480, 20) +//#define kNotifierViewFinalFrameLandscape CGRectMake(0, 0, 480, 20) + +#define kMessageLabelInitialFramePortrait CGRectMake(10, 0, 300, 20) +#define kMessageLabelInitialFrameLandscape CGRectMake(10, 0, 460, 20) + +- (id)init { + self = [super init]; + if (self) { + self.frame = kNotifierViewInitialFramePortrait; + + self.messageLabel = [[UILabel alloc] initWithFrame:kMessageLabelInitialFramePortrait]; + self.messageLabel.textColor = [UIColor whiteColor]; + self.messageLabel.backgroundColor = [UIColor blackColor]; + self.messageLabel.textAlignment = UITextAlignmentCenter; + self.messageLabel.font = [UIFont boldSystemFontOfSize:12]; + [self addSubview:self.messageLabel]; + + self.timeOnScreen = 2.0; + } + return self; +} + +- (id)initWithMessage:(NSString *)message { + self = [super init]; + if (self) { + self.frame = kNotifierViewInitialFramePortrait; + self.message = message; + self.backgroundColor = [UIColor blackColor]; + + self.messageLabel = [[UILabel alloc] initWithFrame:kMessageLabelInitialFramePortrait]; + self.messageLabel.textColor = [UIColor whiteColor]; + self.messageLabel.text = message; + self.messageLabel.backgroundColor = [UIColor blackColor]; + self.messageLabel.textAlignment = UITextAlignmentCenter; + self.messageLabel.font = [UIFont boldSystemFontOfSize:12]; + [self addSubview:self.messageLabel]; + + self.timeOnScreen = 2.0; + } + return self; + +} + +- (id)initWithMessage:(NSString *)message delegate:(id /**/)delegate { + self = [super init]; + if (self) { + self.frame = kNotifierViewInitialFramePortrait; + self.delegate = delegate; + self.message = message; + self.backgroundColor = [UIColor blackColor]; + + self.messageLabel = [[UILabel alloc] initWithFrame:kMessageLabelInitialFramePortrait]; + self.messageLabel.textColor = [UIColor whiteColor]; + self.messageLabel.text = message; + self.messageLabel.backgroundColor = [UIColor blackColor]; + self.messageLabel.textAlignment = UITextAlignmentCenter; + self.messageLabel.font = [UIFont boldSystemFontOfSize:12]; + [self addSubview:self.messageLabel]; + + self.timeOnScreen = 2.0; + } + return self; +} + +- (void)showInWindow:(UIWindow *)window { + if (self.delegate && [self.delegate respondsToSelector:@selector(willPresentNotifierView:)]) + [self.delegate willPresentNotifierView:self]; + + [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide]; + [window insertSubview:self atIndex:0]; + + [UIView animateWithDuration:.4 animations:^{ + self.frame = kNotifierViewFinalFramePortrait; + } completion:^(BOOL finished){ + + if (self.delegate && [self.delegate respondsToSelector:@selector(didPresentNotifierView:)]) + [self.delegate didPresentNotifierView:self]; + + [NSTimer scheduledTimerWithTimeInterval:self.timeOnScreen target:self selector:@selector(hide) userInfo:nil repeats:NO]; + + }]; +} + +- (void)hide { + + if (self.delegate && [self.delegate respondsToSelector:@selector(willHideNotifierView:)]) + [self.delegate willHideNotifierView:self]; + + [UIView animateWithDuration:.4 animations:^{ + self.frame = kNotifierViewInitialFramePortrait; + [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide]; + } completion:^(BOOL finished){ + if (finished) { + + if (self.delegate && [self.delegate respondsToSelector:@selector(didHideNotifierView:)]) + [self.delegate didHideNotifierView:self]; + + [self removeFromSuperview]; + } + }]; +} + +- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event { + [self.delegate notifierViewTapped:self]; +} + +- (void)setMessage:(NSString *)message { + _message = message; + self.messageLabel.text = message; +} + +@end diff --git a/iOS/StatusBarNotifier/README.md b/iOS/StatusBarNotifier/README.md new file mode 100644 index 00000000..d0f0bfaa --- /dev/null +++ b/iOS/StatusBarNotifier/README.md @@ -0,0 +1,8 @@ +cordova status bar notifier plugin + +depends on this: http://github.com/frankdilo/FDStatusBarNotifierView + + window.plugins.statusBarNotifier.show('hello yes this is dog') + window.plugins.statusBarNotifier.show('this will display for 5 seconds', 5.0) + +ios6+ only (I think) diff --git a/iOS/StatusBarNotifier/StatusBarNotifier.h b/iOS/StatusBarNotifier/StatusBarNotifier.h new file mode 100644 index 00000000..6225a2d0 --- /dev/null +++ b/iOS/StatusBarNotifier/StatusBarNotifier.h @@ -0,0 +1,17 @@ +#import +#import "AppDelegate.h" +#import "FDStatusBarNotifierView.h" + +#import + +@interface StatusBarNotifier: CDVPlugin { + NSMutableDictionary* callbackIds; + NSString* messageField; +} + +@property (nonatomic, retain) NSMutableDictionary* callbackIds; +@property (nonatomic, retain) NSString* messageField; + +- (void) show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +@end diff --git a/iOS/StatusBarNotifier/StatusBarNotifier.js b/iOS/StatusBarNotifier/StatusBarNotifier.js new file mode 100755 index 00000000..32543674 --- /dev/null +++ b/iOS/StatusBarNotifier/StatusBarNotifier.js @@ -0,0 +1,14 @@ +;(function(cordova) { + + function StatusBarNotifier() {} + + StatusBarNotifier.prototype.show = function(text, timeOnScreen, callback) { + if (typeof timeOnScreen === "function") callback = timeOnScreen + if (!callback) callback = function() {} + cordova.exec(callback, callback, "StatusBarNotifier", "show", [{text: text, timeOnScreen: timeOnScreen}]) + } + + if (!window.plugins) window.plugins = {} + window.plugins.StatusBarNotifier = new StatusBarNotifier() + +})(window.cordova || window.Cordova || window.PhoneGap); diff --git a/iOS/StatusBarNotifier/StatusBarNotifier.m b/iOS/StatusBarNotifier/StatusBarNotifier.m new file mode 100644 index 00000000..ea866bce --- /dev/null +++ b/iOS/StatusBarNotifier/StatusBarNotifier.m @@ -0,0 +1,32 @@ +#import "StatusBarNotifier.h" + +@implementation StatusBarNotifier + +@synthesize callbackIds = _callbackIds; +@synthesize messageField; + +- (NSMutableDictionary*)callbackIds { + if(_callbackIds == nil) { + _callbackIds = [[NSMutableDictionary alloc] init]; + } + return _callbackIds; +} + +- (void)show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { + [self.callbackIds setValue:[arguments pop] forKey:@"show"]; + AppDelegate* appDelegate = (AppDelegate*) [UIApplication sharedApplication].delegate; + [self setMessageField:[options objectForKey:@"text"] ?: @""]; + float timeOnScreen = [[options objectForKey:@"timeOnScreen"] floatValue] ?: 3.0; + FDStatusBarNotifierView *notifierView = [[FDStatusBarNotifierView alloc] initWithMessage:self.messageField]; + notifierView.timeOnScreen = timeOnScreen; + [notifierView showInWindow:appDelegate.window]; + CDVPluginResult* pluginResult = [CDVPluginResult resultWithStatus:CDVCommandStatus_OK]; + [self writeJavascript:[pluginResult toSuccessCallbackString:[self.callbackIds valueForKey:@"show"]]]; +} + +- (void) dealloc { + [_callbackIds dealloc]; + [super dealloc]; +} + +@end diff --git a/iOS/TabBar/README.md b/iOS/TabBar/README.md deleted file mode 100644 index 4624d96a..00000000 --- a/iOS/TabBar/README.md +++ /dev/null @@ -1,95 +0,0 @@ -Tab bar for Cordova on iOS -========================== - -This plugin lets you create and control a native tab bar. - -License -------- - -[MIT license](http://www.opensource.org/licenses/mit-license.html) - -Contributors ------------- - -See TabBar.m for the history. - -Installing the plugin ---------------------- - -- Copy *.xib, *.m and *.h files to your project's "Plugins" folder (should already exist and contain a README file if you used the Cordova project template) -- They have to be added to the project as well, so drag them from the "Plugins" folder (in Finder) to the same folder (in Xcode) and select to create references -- Open "Supporting Files/Cordova.plist" and under "Plugins", add a key with the plugin name "TabBar" and a string value of "TabBar" - -Note regarding the tab bar --------------------------- - -Don't forget to add an event handler for orientation changes as follows: - - window.addEventListener("resize", function() { - plugins.tabBar.resize(); - ), false); - -Using the tab bar and navigation bar plugin together ----------------------------------------------------- - -In order to use the [tab bar plugin](https://github.com/AndiDog/phonegap-plugins/tree/master/iOS/TabBar) and [navigation bar plugin](https://github.com/AndiDog/phonegap-plugins/tree/master/iOS/NavigationBar) together, you must initialize both plugins before calling any of their methods, i.e. before creating a navigation/tab bar. For example right when your application starts: - - document.addEventListener("deviceready", function() { - console.log("Cordova ready") - - plugins.navigationBar.init() - plugins.tabBar.init() - - plugins.navigationBar.create() - plugins.tabBar.create() - - // ... - -This is because both plugins are aware of each other and resize Cordova's web view accordingly, but therefore they have to know the web view's initial dimensions. If for example you only initialize the tab bar plugin, create the tab bar and later decide to also create a navigation bar, the navigation bar plugin would think the original web view size is 320x411 instead of 320x460 (on iPhone). Layouting *could* be done using the screen size as well but it's currently implemented like this. - -Example -------- - -This example shows how to use the tab bar: - - document.addEventListener("deviceready", function() { - console.log("PhoneGap ready") - - plugins.tabBar.init() - - plugins.tabBar.create() - // or with an orange tint: - plugins.tabBar.create({selectedImageTintColorRgba: '255,40,0,255'}) - - plugins.tabBar.createItem("contacts", "Unused, iOS replaces this text by Contacts", "tabButton:Contacts") - plugins.tabBar.createItem("recents", "Unused, iOS replaces this text by Recents", "tabButton:Recents") - - // Example with selection callback - plugins.tabBar.createItem("another", "Some text", "/www/your-own-image.png", { - onSelect: function() { - alert("another tab selected") - } - }) - - plugins.tabBar.show() - // Or with custom style (defaults to 49px height, positioned at bottom): plugins.tabBar.show({height: 80, position: 'top'}) - plugins.tabBar.showItems("contacts", "recents", "another") - - window.addEventListener("resize", function() { plugins.tabBar.resize() }, false) - }, false) - -Retina images -------------- - -You can also have different images for the normal and retina quality like "image.png" and "image@2x.png". The code to assign the image would be: - - plugins.tabBar.createItem("home", "Home", "image.png", { - onSelect: function() { - alert("tab selected") - } - }) - -Reporting issues or requests for improvement --------------------------------------------- - -Please report problems on [my GitHub fork of phonegap-plugins](https://github.com/AndiDog/phonegap-plugins). \ No newline at end of file diff --git a/iOS/TabBar/REPO MOVED.txt b/iOS/TabBar/REPO MOVED.txt new file mode 100644 index 00000000..90a678b8 --- /dev/null +++ b/iOS/TabBar/REPO MOVED.txt @@ -0,0 +1 @@ +This plugin is now located at https://github.com/AndiDog/phonegap-ios-tabbar-plugin \ No newline at end of file diff --git a/iOS/TabBar/TabBar.h b/iOS/TabBar/TabBar.h deleted file mode 100644 index f0d894f2..00000000 --- a/iOS/TabBar/TabBar.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - TabBar.h - - Created by Jesse MacFadyen on 10-02-03. - MIT Licensed - - Originally this code was developed my Michael Nachbaur - Formerly -> PhoneGap :: UIControls.h - Created by Michael Nachbaur on 13/04/09. - Copyright 2009 Decaf Ninja Software. All rights reserved. - - API cleaned up and improved by Andreas Sommer (https://github.com/AndiDog/phonegap-plugins). - */ -#import -#import -#import - -// For older versions of Cordova, you may have to use: #import "CDVPlugin.h" -#import - -@interface TabBar : CDVPlugin { - UITabBar* tabBar; - - NSMutableDictionary* tabBarItems; - - CGRect originalWebViewBounds; - CGFloat navBarHeight; - CGFloat tabBarHeight; - bool tabBarAtBottom; -} - -- (void)create:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)show:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)resize:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)hide:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)init:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)showItems:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)createItem:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)updateItem:(NSArray*)arguments withDict:(NSDictionary*)options; -- (void)selectItem:(NSArray*)arguments withDict:(NSDictionary*)options; - -@end - -@interface UITabBar (NavBarCompat) -@property (nonatomic) bool tabBarAtBottom; -@end \ No newline at end of file diff --git a/iOS/TabBar/TabBar.js b/iOS/TabBar/TabBar.js deleted file mode 100644 index 4547f9ff..00000000 --- a/iOS/TabBar/TabBar.js +++ /dev/null @@ -1,159 +0,0 @@ -/* - This code is adapted from the work of: - Created by Michael Nachbaur on 13/04/09. - Copyright 2009 Decaf Ninja Software. All rights reserved. - MIT licensed - - API cleaned up and improved by Andreas Sommer (https://github.com/AndiDog/phonegap-plugins). -*/ - -function TabBar() { - this.tag = 0; - this.callbacks = {}; - this.selectedItem = null; -} - -/** - * Create a native tab bar that can have tab buttons added to it which can respond to events. - * - * @param options Additional options: - * - selectedImageTintColorRgba: Tint color for selected items (defaults to standard light blue), must define the - * color as string e.g. '255,0,0,128' for 50% transparent red. This is only supported on iOS 5 or newer. - */ -TabBar.prototype.create = function(options) { - cordova.exec("TabBar.create", options); -}; - -/** - * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. - * - * If the supplied image name is one of the labels listed below, then this method will construct a tab button - * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. - * - * Tab Buttons - * - tabButton:More - * - tabButton:Favorites - * - tabButton:Featured - * - tabButton:TopRated - * - tabButton:Recents - * - tabButton:Contacts - * - tabButton:History - * - tabButton:Bookmarks - * - tabButton:Search - * - tabButton:Downloads - * - tabButton:MostRecent - * - tabButton:MostViewed - * @param {String} name internal name to refer to this tab by - * @param {String} [title] title text to show on the tab, or null if no text should be shown - * @param {String} [image] image filename or internal identifier to show, or null if now image should be shown - * @param {Object} [options] Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -TabBar.prototype.createItem = function(name, label, image, options) { - - var tag = this.tag++; - if (options && 'onSelect' in options && typeof(options['onSelect']) == 'function') { - this.callbacks[tag] = {'onSelect':options.onSelect,'name':name}; - //delete options.onSelect; - } - - cordova.exec("TabBar.createItem", name, label, image, tag, options); -}; - -/** - * Function to detect currently selected tab bar item - * @see createItem - * @see showItems - */ -TabBar.prototype.getSelectedItem = function() { - return this.selectedItem; -}; - -/** - * Hide a tab bar. The tab bar has to be created first. - */ -TabBar.prototype.hide = function(animate) { - if (animate === undefined || animate === null) - animate = true; - cordova.exec("TabBar.hide", {animate: animate}); -}; - -/** - * Must be called before any other method in order to initialize the plugin. - */ -TabBar.prototype.init = function() -{ - cordova.exec("TabBar.init"); -}; - -/** - * Internal function called when a tab bar item has been selected. - * @param {Number} tag the tag number for the item that has been selected - */ -TabBar.prototype.onItemSelected = function(tag) -{ - this.selectedItem = tag; - if (typeof(this.callbacks[tag].onSelect) == 'function') - this.callbacks[tag].onSelect(this.callbacks[tag].name); -}; - -TabBar.prototype.resize = function() { - cordova.exec("TabBar.resize"); -}; - -/** - * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. - * @param {String} tabName the name of the tab to select, or null if all tabs should be deselected - * @see createItem - * @see showItems - */ -TabBar.prototype.selectItem = function(tab) { - cordova.exec("TabBar.selectItem", tab); -}; - -/** - * Show a tab bar. The tab bar has to be created first. - * @param {Object} [options] Options indicating how the tab bar should be shown: - * - \c height integer indicating the height of the tab bar (default: \c 49) - * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) - */ -TabBar.prototype.show = function(options) { - if(!options) - options = {position: 'bottom'}; - cordova.exec("TabBar.show", options); -}; - -/** - * Show previously created items on the tab bar - * @param {String} arguments... the item names to be shown - * @param {Object} [options] dictionary of options, notable options including: - * - \c animate indicates that the items should animate onto the tab bar - * @see createItem - * @see create - */ -TabBar.prototype.showItems = function() { - var parameters = [ "TabBar.showItems" ]; - for (var i = 0; i < arguments.length; i++) { - parameters.push(arguments[i]); - } - cordova.exec.apply(this, parameters); -}; - -/** - * Update an existing tab bar item to change its badge value. - * @param {String} name internal name used to represent this item when it was created - * @param {Object} options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if null or unspecified, the badge will be hidden - */ -TabBar.prototype.updateItem = function(name, options) { - if (!options) options = {}; - cordova.exec("TabBar.updateItem", name, options); -}; - -cordova.addConstructor(function() -{ - if(!window.plugins) - window.plugins = {}; - - window.plugins.tabBar = new TabBar(); -}); diff --git a/iOS/TabBar/TabBar.m b/iOS/TabBar/TabBar.m deleted file mode 100644 index c5cb788c..00000000 --- a/iOS/TabBar/TabBar.m +++ /dev/null @@ -1,379 +0,0 @@ -/* - TabBar.m - - Created by Jesse MacFadyen on 10-02-03. - MIT Licensed - - Originally this code was developed my Michael Nachbaur - Formerly -> PhoneGap :: UIControls.h - Created by Michael Nachbaur on 13/04/09. - Copyright 2009 Decaf Ninja Software. All rights reserved. - - API cleaned up and improved by Andreas Sommer (https://github.com/AndiDog/phonegap-plugins). - */ - -#import -#import "TabBar.h" -#import -#import - -// For older versions of Cordova, you may have to use: #import "CDVDebug.h" -#import - -@implementation TabBar -#ifndef __IPHONE_3_0 -@synthesize webView; -#endif - --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView -{ - self = (TabBar*)[super initWithWebView:theWebView]; - if (self) - { - // The original web view bounds must be retrieved here. On iPhone, it would be 0,0,320,460 for example. Since - // Cordova seems to initialize plugins on the first call, there is a plugin method init() that has to be called - // in order to make Cordova call *this* method. If someone forgets the init() call and uses the navigation bar - // and tab bar plugins together, these values won't be the original web view bounds and layout will be wrong. - tabBarItems = [[NSMutableDictionary alloc] initWithCapacity:5]; - originalWebViewBounds = theWebView.bounds; - tabBarHeight = 49.0f; - navBarHeight = 44.0f; - tabBarAtBottom = true; - } - return self; -} - -- (void)dealloc -{ - if (tabBar) - [tabBar release]; - - [super dealloc]; -} - --(void)correctWebViewBounds -{ - if(!tabBar) - return; - - const bool tabBarShown = !tabBar.hidden; - bool navBarShown = false; - - UIView *parent = [tabBar superview]; - for(UIView *view in parent.subviews) - if([view isMemberOfClass:[UINavigationBar class]]) - { - navBarShown = !view.hidden; - break; - } - - // IMPORTANT: Below code is the same in both the navigation and tab bar plugins! - - CGFloat left = originalWebViewBounds.origin.x; - CGFloat right = left + originalWebViewBounds.size.width; - CGFloat top = originalWebViewBounds.origin.y; - CGFloat bottom = top + originalWebViewBounds.size.height; - - UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation]; - switch (orientation) - { - case UIInterfaceOrientationPortrait: - case UIInterfaceOrientationPortraitUpsideDown: - // No need to change width/height from original bounds - break; - case UIInterfaceOrientationLandscapeLeft: - case UIInterfaceOrientationLandscapeRight: - right = left + originalWebViewBounds.size.height + 20.0f; - bottom = top + originalWebViewBounds.size.width - 20.0f; - break; - default: - NSLog(@"Unknown orientation: %d", orientation); - break; - } - - if(navBarShown) - top += navBarHeight; - - if(tabBarShown) - { - if(tabBarAtBottom) - bottom -= tabBarHeight; - else - top += tabBarHeight; - } - - CGRect webViewBounds = CGRectMake(left, top, right - left, bottom - top); - - [self.webView setFrame:webViewBounds]; - - // NOTE: Following part again for tab bar plugin only - - if(tabBarShown) - { - if(tabBarAtBottom) - [tabBar setFrame:CGRectMake(left, bottom, right - left, tabBarHeight)]; - else - [tabBar setFrame:CGRectMake(left, originalWebViewBounds.origin.y, right - left, tabBarHeight)]; - } -} - -/** - * Create a native tab bar at either the top or the bottom of the display. - * @brief creates a tab bar - * @param arguments unused - * @param options unused - */ -- (void)create:(NSArray*)arguments withDict:(NSDictionary*)options -{ - tabBar = [UITabBar new]; - [tabBar sizeToFit]; - tabBar.delegate = self; - tabBar.multipleTouchEnabled = NO; - tabBar.autoresizesSubviews = YES; - tabBar.hidden = YES; - tabBar.userInteractionEnabled = YES; - tabBar.opaque = YES; - - NSString *iconTint = [options valueForKey:@"selectedImageTintColorRgba"]; - - if(iconTint && [tabBar respondsToSelector:@selector(setSelectedImageTintColor:)]) - { - NSArray *rgba = [iconTint componentsSeparatedByString:@","]; - tabBar.selectedImageTintColor = [UIColor colorWithRed:[[rgba objectAtIndex:0] intValue]/255.0f - green:[[rgba objectAtIndex:1] intValue]/255.0f - blue:[[rgba objectAtIndex:2] intValue]/255.0f - alpha:[[rgba objectAtIndex:3] intValue]/255.0f]; - } - - self.webView.superview.autoresizesSubviews = YES; - - [self.webView.superview addSubview:tabBar]; -} - --(void) init:(NSMutableArray *)arguments withDict:(NSMutableDictionary *)options -{ - // Dummy function, see initWithWebView -} - -/** - * Show the tab bar after its been created. - * @brief show the tab bar - * @param arguments unused - * @param options used to indicate options for where and how the tab bar should be placed - * - \c height integer indicating the height of the tab bar (default: \c 49) - * - \c position specifies whether the tab bar will be placed at the \c top or \c bottom of the screen (default: \c bottom) - */ -- (void)show:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - // if we are calling this again when its shown, reset - if (!tabBar.hidden) - return; - - // CGRect offsetRect = [ [UIApplication sharedApplication] statusBarFrame]; - - if(options) - { - tabBarHeight = [[options objectForKey:@"height"] floatValue]; - tabBarAtBottom = [[options objectForKey:@"position"] isEqualToString:@"bottom"]; - } - - tabBar.tabBarAtBottom = tabBarAtBottom; - - if(tabBarHeight == 0) - tabBarHeight = 49.0f; - - tabBar.hidden = NO; - - [self correctWebViewBounds]; -} - -/** - * Resize the tab bar (this should be called on orientation change) - * @brief resize the tab bar on rotation - * @param arguments unused - * @param options unused - */ -- (void)resize:(NSArray*)arguments withDict:(NSDictionary*)options -{ - [self correctWebViewBounds]; -} - -/** - * Hide the tab bar - * @brief hide the tab bar - * @param arguments unused - * @param options unused - */ -- (void)hide:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - tabBar.hidden = YES; - - [self correctWebViewBounds]; -} - -/** - * Create a new tab bar item for use on a previously created tab bar. Use ::showTabBarItems to show the new item on the tab bar. - * - * If the supplied image name is one of the labels listed below, then this method will construct a tab button - * using the standard system buttons. Note that if you use one of the system images, that the \c title you supply will be ignored. - * - Tab Buttons - * - tabButton:More - * - tabButton:Favorites - * - tabButton:Featured - * - tabButton:TopRated - * - tabButton:Recents - * - tabButton:Contacts - * - tabButton:History - * - tabButton:Bookmarks - * - tabButton:Search - * - tabButton:Downloads - * - tabButton:MostRecent - * - tabButton:MostViewed - * @brief create a tab bar item - * @param arguments Parameters used to create the tab bar - * -# \c name internal name to refer to this tab by - * -# \c title title text to show on the tab, or null if no text should be shown - * -# \c image image filename or internal identifier to show, or null if now image should be shown - * -# \c tag unique number to be used as an internal reference to this button - * @param options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if nil or unspecified, the badge will be hidden - */ -- (void)createItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - NSString *name = [arguments objectAtIndex:0]; - NSString *title = [arguments objectAtIndex:1]; - NSString *imageName = [arguments objectAtIndex:2]; - int tag = [[arguments objectAtIndex:3] intValue]; - - UITabBarItem *item = nil; - if ([imageName length] > 0) - { - UITabBarSystemItem systemItem = -1; - if ([imageName isEqualToString:@"tabButton:More"]) systemItem = UITabBarSystemItemMore; - else if ([imageName isEqualToString:@"tabButton:Favorites"]) systemItem = UITabBarSystemItemFavorites; - else if ([imageName isEqualToString:@"tabButton:Featured"]) systemItem = UITabBarSystemItemFeatured; - else if ([imageName isEqualToString:@"tabButton:TopRated"]) systemItem = UITabBarSystemItemTopRated; - else if ([imageName isEqualToString:@"tabButton:Recents"]) systemItem = UITabBarSystemItemRecents; - else if ([imageName isEqualToString:@"tabButton:Contacts"]) systemItem = UITabBarSystemItemContacts; - else if ([imageName isEqualToString:@"tabButton:History"]) systemItem = UITabBarSystemItemHistory; - else if ([imageName isEqualToString:@"tabButton:Bookmarks"]) systemItem = UITabBarSystemItemBookmarks; - else if ([imageName isEqualToString:@"tabButton:Search"]) systemItem = UITabBarSystemItemSearch; - else if ([imageName isEqualToString:@"tabButton:Downloads"]) systemItem = UITabBarSystemItemDownloads; - else if ([imageName isEqualToString:@"tabButton:MostRecent"]) systemItem = UITabBarSystemItemMostRecent; - else if ([imageName isEqualToString:@"tabButton:MostViewed"]) systemItem = UITabBarSystemItemMostViewed; - if (systemItem != -1) - item = [[UITabBarItem alloc] initWithTabBarSystemItem:systemItem tag:tag]; - } - - if (item == nil) - item = [[UITabBarItem alloc] initWithTitle:title image:[UIImage imageNamed:imageName] tag:tag]; - - if ([options objectForKey:@"badge"]) - item.badgeValue = [options objectForKey:@"badge"]; - - [tabBarItems setObject:item forKey:name]; - [item release]; -} - - -/** - * Update an existing tab bar item to change its badge value. - * @brief update the badge value on an existing tab bar item - * @param arguments Parameters used to identify the tab bar item to update - * -# \c name internal name used to represent this item when it was created - * @param options Options for customizing the individual tab item - * - \c badge value to display in the optional circular badge on the item; if nil or unspecified, the badge will be hidden - */ -- (void)updateItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - NSString *name = [arguments objectAtIndex:0]; - UITabBarItem *item = [tabBarItems objectForKey:name]; - if (item) - item.badgeValue = [options objectForKey:@"badge"]; -} - - -/** - * Show previously created items on the tab bar - * @brief show a list of tab bar items - * @param arguments the item names to be shown - * @param options dictionary of options, notable options including: - * - \c animate indicates that the items should animate onto the tab bar - * @see createItem - * @see create - */ -- (void)showItems:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - int i, count = [arguments count]; - NSMutableArray *items = [[NSMutableArray alloc] initWithCapacity:count]; - for (i = 0; i < count; i++) { - NSString *itemName = [arguments objectAtIndex:i]; - UITabBarItem *item = [tabBarItems objectForKey:itemName]; - if (item) - [items addObject:item]; - } - - BOOL animateItems = NO; - if ([options objectForKey:@"animate"]) - animateItems = [(NSString*)[options objectForKey:@"animate"] boolValue]; - [tabBar setItems:items animated:animateItems]; - [items release]; -} - -/** - * Manually select an individual tab bar item, or nil for deselecting a currently selected tab bar item. - * @brief manually select a tab bar item - * @param arguments the name of the tab bar item to select - * @see createItem - * @see showItems - */ -- (void)selectItem:(NSArray*)arguments withDict:(NSDictionary*)options -{ - if (!tabBar) - [self create:nil withDict:nil]; - - NSString *itemName = [arguments objectAtIndex:0]; - UITabBarItem *item = [tabBarItems objectForKey:itemName]; - if (item) - tabBar.selectedItem = item; - else - tabBar.selectedItem = nil; -} - -- (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item -{ - NSString * jsCallBack = [NSString stringWithFormat:@"window.plugins.tabBar.onItemSelected(%d);", item.tag]; - [self.webView stringByEvaluatingJavaScriptFromString:jsCallBack]; -} - -@end - - -@implementation UIView (NavBarCompat) - -- (void)setTabBarAtBottom:(bool)tabBarAtBottom -{ - objc_setAssociatedObject(self, @"NavBarCompat_tabBarAtBottom", [NSNumber numberWithBool:tabBarAtBottom], OBJC_ASSOCIATION_COPY); -} - -- (bool)tabBarAtBottom -{ - return [(objc_getAssociatedObject(self, @"NavBarCompat_tabBarAtBottom")) boolValue]; -} - -@end diff --git a/iOS/TabBar/example.png b/iOS/TabBar/example.png deleted file mode 100644 index aa25acf5..00000000 Binary files a/iOS/TabBar/example.png and /dev/null differ diff --git a/iOS/Twitter/TwitterPlugin.m b/iOS/Twitter/TwitterPlugin.m index 5eb79373..5d562ba7 100755 --- a/iOS/Twitter/TwitterPlugin.m +++ b/iOS/Twitter/TwitterPlugin.m @@ -125,7 +125,7 @@ - (void) getPublicTimeline:(NSMutableArray*)arguments withDict:(NSMutableDiction if([urlResponse statusCode] == 200) { NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; - NSDictionary *dict = [dataString objectFromJSONString]; + NSDictionary *dict = [dataString cdvjk_objectFromJSONString]; jsResponse = [[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict] toSuccessCallbackString:callbackId]; [dataString release]; } @@ -181,7 +181,7 @@ - (void) getMentions:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)o NSString *jsResponse; if([urlResponse statusCode] == 200) { NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; - NSDictionary *dict = [dataString objectFromJSONString]; + NSDictionary *dict = [dataString cdvjk_objectFromJSONString]; jsResponse = [[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict] toSuccessCallbackString:callbackId]; [dataString release]; } @@ -258,7 +258,7 @@ - (void) getTWRequest:(NSMutableArray*)arguments withDict:(NSMutableDictionary*) NSString *jsResponse; if([urlResponse statusCode] == 200) { NSString *dataString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding]; - NSDictionary *dict = [dataString objectFromJSONString]; + NSDictionary *dict = [dataString cdvjk_objectFromJSONString]; jsResponse = [[CDVPluginResult resultWithStatus:CDVCommandStatus_OK messageAsDictionary:dict] toSuccessCallbackString:callbackId]; [dataString release]; } diff --git a/iOS/VolumeSlider/README.md b/iOS/VolumeSlider/README.md index 87831110..363ca248 100644 --- a/iOS/VolumeSlider/README.md +++ b/iOS/VolumeSlider/README.md @@ -1,44 +1,6 @@ VolumeSlider ============ -*Updated for Cordova 2.0* - -Installation ------------- - This plugin allows you to add a native volume slider (MPVolumeView) to your app. -Add the plugin much like any other: - -1. Add the VolumeSlider.h and VolumeSlider.m classes to your Plugins folder in Xcode -2. Add the VolumeSlider.js file to your www folder -3. Add the VolumeSlider.js to your html file. eg: `` -4. Add the plugin to the Cordova.plist under Plugins (key: "VolumeSlider" value: "VolumeSlider") - -### Example -```javascript -function onDeviceReady() -{ - var volumeSlider = window.plugins.volumeSlider; - volumeSlider.createVolumeSlider(10,350,300,30); // origin x, origin y, width, height - volumeSlider.showVolumeSlider(); -} -``` - -... now since this is a native control added more or less on top of your webView, you might have to show and hide it if you navigate away from the _page_ you want the VolumeSlider on: - -```javascript -volumeSlider.hideVolumeSlider(); -``` - -## License - -The MIT License - -Copyright (c) 2011 Tommy-Carlos Williams (github.com/devgeeks) - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +This plugin has been moved to [http://github.com/devgeeks/VolumeSlider](http://github.com/devgeeks/VolumeSlider) \ No newline at end of file diff --git a/iOS/VolumeSlider/VolumeSlider.h b/iOS/VolumeSlider/VolumeSlider.h deleted file mode 100644 index 995a246c..00000000 --- a/iOS/VolumeSlider/VolumeSlider.h +++ /dev/null @@ -1,28 +0,0 @@ -// -// VolumeSlider.h -// Volume Slider Cordova Plugin -// -// Created by Tommy-Carlos Williams on 20/07/11. -// Copyright 2011 Tommy-Carlos Williams. All rights reserved. -// MIT Licensed -// - -#import -#import - - -@interface VolumeSlider : CDVPlugin { - NSString* callbackId; - UIView* mpVolumeViewParentView; - MPVolumeView* myVolumeView; -} - -@property (nonatomic, copy) NSString* callbackId; -@property (nonatomic, retain) UIView* mpVolumeViewParentView; -@property (nonatomic, retain) MPVolumeView* myVolumeView; - -- (void)createVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)showVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void)hideVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iOS/VolumeSlider/VolumeSlider.js b/iOS/VolumeSlider/VolumeSlider.js deleted file mode 100644 index 260efedc..00000000 --- a/iOS/VolumeSlider/VolumeSlider.js +++ /dev/null @@ -1,42 +0,0 @@ -// -// VolumeSlider.js -// Volume Slider Cordova Plugin -// -// Created by Tommy-Carlos Williams on 20/07/11. -// Copyright 2011 Tommy-Carlos Williams. All rights reserved. -// MIT Licensed -// -(function(){ - var cordovaRef = window.PhoneGap || window.Cordova || window.cordova; // old to new fallbacks - var VolumeSlider = function(){ - }; - - /** - * Create a volume slider. - */ - VolumeSlider.prototype.createVolumeSlider = function(originx,originy,width,height) { - cordovaRef.exec(null, null, "VolumeSlider","createVolumeSlider", [originx, originy, width, height]); - }; - - /** - * Show the volume slider - */ - VolumeSlider.prototype.showVolumeSlider = function() { - cordovaRef.exec(null, null, "VolumeSlider","showVolumeSlider", []); - }; - /** - * Hide the volume slider - */ - VolumeSlider.prototype.hideVolumeSlider = function() { - cordovaRef.exec(null, null, "VolumeSlider","hideVolumeSlider", []); - }; - - - cordovaRef.addConstructor(function(){ - if(!window.plugins) - { - window.plugins = {}; - } - window.plugins.volumeSlider = new VolumeSlider(); - }); -})(); \ No newline at end of file diff --git a/iOS/VolumeSlider/VolumeSlider.m b/iOS/VolumeSlider/VolumeSlider.m deleted file mode 100644 index 174fc828..00000000 --- a/iOS/VolumeSlider/VolumeSlider.m +++ /dev/null @@ -1,87 +0,0 @@ -// -// VolumeSlider.m -// Volume Slider Cordova Plugin -// -// Created by Tommy-Carlos Williams on 20/07/11. -// Copyright 2011 Tommy-Carlos Williams. All rights reserved. -// MIT Licensed -// - -#import "VolumeSlider.h" -#import - -@implementation VolumeSlider - -@synthesize mpVolumeViewParentView, myVolumeView, callbackId; - -#ifndef __IPHONE_3_0 -@synthesize webView; -#endif - --(CDVPlugin*) initWithWebView:(UIWebView*)theWebView -{ - self = (VolumeSlider*)[super initWithWebView:theWebView]; - return self; -} - -- (void)dealloc -{ - [mpVolumeViewParentView release]; - [myVolumeView release]; - [super dealloc]; -} - - -#pragma mark - -#pragma mark VolumeSlider - -- (void) createVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - self.callbackId = arguments.pop; - NSUInteger argc = [arguments count]; - - if (argc < 3) { // at a minimum we need x origin, y origin and width... - return; - } - - CGFloat originx,originy,width; - CGFloat height = 30; - - originx = [[arguments objectAtIndex:0] floatValue]; - originy = [[arguments objectAtIndex:1] floatValue]; - width = [[arguments objectAtIndex:2] floatValue]; - if (argc < 4) { - height = [[arguments objectAtIndex:3] floatValue]; - } - - CGRect viewRect = CGRectMake( - originx, - originy, - width, - height - ); - self.mpVolumeViewParentView = [[[UIView alloc] initWithFrame:viewRect] autorelease]; - [self.webView.superview addSubview:mpVolumeViewParentView]; - - mpVolumeViewParentView.backgroundColor = [UIColor clearColor]; - self.myVolumeView = - [[MPVolumeView alloc] initWithFrame: mpVolumeViewParentView.bounds]; - [mpVolumeViewParentView addSubview: myVolumeView]; - self.myVolumeView.showsVolumeSlider = NO; -} - -- (void)showVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - self.myVolumeView.showsVolumeSlider = YES; - self.mpVolumeViewParentView.hidden = NO; -} - -- (void)hideVolumeSlider:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - self.mpVolumeViewParentView.hidden = YES; - self.myVolumeView.showsVolumeSlider = NO; -} - - - -@end diff --git a/iOS/WaitingDialog/README.md b/iOS/WaitingDialog/README.md new file mode 100644 index 00000000..049d6901 --- /dev/null +++ b/iOS/WaitingDialog/README.md @@ -0,0 +1,21 @@ +# Waiting dialog for iOS applications + +_Created by `Guido Sabatini`_ + +Creates a modal dialog to give a waiting feedback to users +You can only show and dismiss the dialog, it will block user interactions. You can set the text appearing in the dialog + +**NOTE:** this is not a progress dialog, you can not show progress + + // To SHOW a modal waiting dialog + window.plugins.waitingDialog.show("Your dialog text"); + + // To HIDE the dialog + window.plugins.waitingDialog.hide(); + +If you want to show a waiting dialog for a certain amount of time, you can use javascript setTimeout + + // show dialog + window.plugins.waitingDialog.show("Your dialog text"); + // automatically hide dialog after 5 seconds + setTimeout(function() {window.plugins.waitingDialog.hide();}, 5000); \ No newline at end of file diff --git a/iOS/WaitingDialog/WaitingDialog.h b/iOS/WaitingDialog/WaitingDialog.h new file mode 100755 index 00000000..b2566f0f --- /dev/null +++ b/iOS/WaitingDialog/WaitingDialog.h @@ -0,0 +1,23 @@ +// +// WaitingDialog.h +// +// +// Created by Guido Sabatini in 2012 +// + +#import +#import + + +@interface WaitingDialog : CDVPlugin { + +} + +// UNCOMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +//- (void) show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; + +// COMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +- (void) show:(CDVInvokedUrlCommand*)command; +- (void) hide:(CDVInvokedUrlCommand*)command; + +@end \ No newline at end of file diff --git a/iOS/WaitingDialog/WaitingDialog.js b/iOS/WaitingDialog/WaitingDialog.js new file mode 100755 index 00000000..3481f0ea --- /dev/null +++ b/iOS/WaitingDialog/WaitingDialog.js @@ -0,0 +1,25 @@ +// window.plugins.waitingDialog + +function WaitingDialog() { +} + +WaitingDialog.prototype.show = function(text) { + cordova.exec(null, null, "WaitingDialog", "show", [text]); +} + +WaitingDialog.prototype.hide = function() { + cordova.exec(null, null, "WaitingDialog", "hide", []); +} + +cordova.addConstructor(function() { + if(!window.plugins) { + window.plugins = {}; + } + + // shim to work in 1.5 and 1.6 + if (!window.Cordova) { + window.Cordova = cordova; + }; + + window.plugins.waitingDialog = new WaitingDialog(); +}); \ No newline at end of file diff --git a/iOS/WaitingDialog/WaitingDialog.m b/iOS/WaitingDialog/WaitingDialog.m new file mode 100755 index 00000000..c5a01c1d --- /dev/null +++ b/iOS/WaitingDialog/WaitingDialog.m @@ -0,0 +1,90 @@ +// +// WaitingDialog.m +// +// +// Created by Guido Sabatini in 2012 +// + +#import "WaitingDialog.h" + +@interface WaitingDialog () { + UIAlertView *waitingDialog; +} + +@property (nonatomic, retain) UIAlertView *waitingDialog; +-(void)showWaitingDialogWithText:(NSString*)text; +-(void)hideWaitingDialog; + +@end + +@implementation WaitingDialog + +@synthesize waitingDialog = _waitingDialog; + +-(UIAlertView *)waitingDialog { + if (!_waitingDialog) { + _waitingDialog = [[[UIAlertView alloc] initWithTitle:@"" message:nil delegate:self cancelButtonTitle:nil otherButtonTitles: nil] autorelease]; + } + return _waitingDialog; +} + +// UNCOMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +//- (void) show:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { +// NSString *text = @"Please wait..."; +// @try { +// text = [options valueForKey:@"text"]; +// } +// @catch (NSException *exception) { +// DLog(@"Cannot read text argument") +// } +// +// [self showWaitingDialogWithText:text]; +//} + +// COMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +- (void) show:(CDVInvokedUrlCommand*)command { + NSString *text = @"Please wait..."; + @try { + text = [command.arguments objectAtIndex:0]; + } + @catch (NSException *exception) { + DLog(@"Cannot read text argument") + } + + [self showWaitingDialogWithText:text]; +} + +// UNCOMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +//- (void) hide:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { +// [self hideWaitingDialog]; +//} + +// COMMENT THIS METHOD if you want to use the plugin with versions of cordova < 2.2.0 +- (void) hide:(CDVInvokedUrlCommand*)command { + [self hideWaitingDialog]; +} + +#pragma mark - PRIVATE METHODS + +-(void)showWaitingDialogWithText:(NSString *)text { + [self.waitingDialog setTitle:text]; + [self.waitingDialog show]; + UIActivityIndicatorView *indicator = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleWhiteLarge]; + + // Adjust the indicator so it is up a few pixels from the bottom of the alert + indicator.center = CGPointMake(self.waitingDialog.bounds.size.width / 2, self.waitingDialog.bounds.size.height - 50); + [indicator startAnimating]; + [self.waitingDialog addSubview:indicator]; + [indicator release]; +} + +-(void)hideWaitingDialog { + if (_waitingDialog) { + [self.waitingDialog dismissWithClickedButtonIndex:0 animated:YES]; + _waitingDialog = nil; + } +} + + + +@end \ No newline at end of file diff --git a/iOS/WizAnalytics/README.md b/iOS/WizAnalytics/README.md new file mode 100644 index 00000000..9418eed1 --- /dev/null +++ b/iOS/WizAnalytics/README.md @@ -0,0 +1,30 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Analytics Manager: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizAnalytics](https://github.com/Wizcorp/phonegap-plugin-wizAnalytics) + +-------------- + +# Description : + +PhoneGap plugin for; + +Access multiple native ad and event logging SDKs simultaneously through JavaScript.
+ +Currently supports (At time of publish); +- Adfonic +- Admob 6.2.1 +- ChartBoost v3.0.7 +- InMobi i251 (Build 2.5.1) +- JumpTapAppReport +- LeadBolt +- Localytics v2.6 +- Millenium Media 4.6.1 +- MdotM +- Smaato 1.4.1 +- Kontagent 1.3.3 + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizAssets/README.md b/iOS/WizAssets/README.md new file mode 100644 index 00000000..c6b71ad8 --- /dev/null +++ b/iOS/WizAssets/README.md @@ -0,0 +1,18 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Asset Manager: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizAssets](https://github.com/Wizcorp/phonegap-plugin-wizAssets) + +-------------- + +# Description : + +PhoneGap plugin for; + +Easily manage application assets from javascript using asset maps.
+Includes ( iOS background threaded) downloadFile, getFileURI, getFileURIs, deleteFile. + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizDevTools/README.md b/iOS/WizDevTools/README.md new file mode 100644 index 00000000..ce341284 --- /dev/null +++ b/iOS/WizDevTools/README.md @@ -0,0 +1,18 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Developer Toolkit: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizDevTools](https://github.com/Wizcorp/phonegap-plugin-wizDevTools) + +-------------- + +# Description : + +PhoneGap plugin for; + +View JavaScript stacktraces and line numbers in Xcode console (even with DOM injected scripts).
+The ultimate JavaScript debugger. + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizSpinner/README.md b/iOS/WizSpinner/README.md new file mode 100644 index 00000000..1352c128 --- /dev/null +++ b/iOS/WizSpinner/README.md @@ -0,0 +1,17 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Spinner / loader: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizSpinner](https://github.com/Wizcorp/phonegap-plugin-wizSpinner) + +-------------- + +# Description : + +PhoneGap plugin for; + +Creating and manipulating native loader/spinner above Cordova. + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizSplash/README.md b/iOS/WizSplash/README.md new file mode 100644 index 00000000..30c4bb2a --- /dev/null +++ b/iOS/WizSplash/README.md @@ -0,0 +1,17 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Splash: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizSplash](https://github.com/Wizcorp/phonegap-plugin-wizSplash) + +-------------- + +# Description : + +PhoneGap plugin for; + +Toggling auto-showing of the splash screen when the app moves from the background to the foreground. + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizUtils/README.md b/iOS/WizUtils/README.md new file mode 100644 index 00000000..a7833a24 --- /dev/null +++ b/iOS/WizUtils/README.md @@ -0,0 +1,18 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard Utility Belt: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizUtils](https://github.com/Wizcorp/phonegap-plugin-wizUtils) + +-------------- + +# Description : + +PhoneGap plugin for; + +General utility functions to access information from the native OS
+(project name, versions, bundleId, height, width, rebooting the app, copy & paste text). + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iOS/WizViewManager/README.md b/iOS/WizViewManager/README.md new file mode 100644 index 00000000..a532214d --- /dev/null +++ b/iOS/WizViewManager/README.md @@ -0,0 +1,25 @@ +![WIZCORP](http://www.wizcorp.jp/wp-content/themes/business-lite/images/all/wizcorp-logo.png) + +# The Wizard View Manager: + +This plugin lives in [https://github.com/Wizcorp/phonegap-plugin-wizViewManager](https://github.com/Wizcorp/phonegap-plugin-wizViewManager) + +-------------- + +# Description : + +PhoneGap plugin for; + +creating,
+removing,
+showing,
+hiding,
+post messaging,
+animating,
+resizing,
+loading source into webviews and/or canvas views. + + +-------------- + +# License : MIT \ No newline at end of file diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_left.png b/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_left.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_left@2x.png b/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_left@2x.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_right.png b/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_right.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_right@2x.png b/iPhone/ChildBrowser/ChildBrowser.bundle/arrow_right@2x.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/but_refresh.png b/iPhone/ChildBrowser/ChildBrowser.bundle/but_refresh.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/but_refresh@2x.png b/iPhone/ChildBrowser/ChildBrowser.bundle/but_refresh@2x.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/compass.png b/iPhone/ChildBrowser/ChildBrowser.bundle/compass.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.bundle/compass@2x.png b/iPhone/ChildBrowser/ChildBrowser.bundle/compass@2x.png old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/ChildBrowser.js b/iPhone/ChildBrowser/ChildBrowser.js old mode 100644 new mode 100755 index 30fe20a4..f03af557 --- a/iPhone/ChildBrowser/ChildBrowser.js +++ b/iPhone/ChildBrowser/ChildBrowser.js @@ -1,80 +1,73 @@ /* MIT licensed */ // (c) 2010 Jesse MacFadyen, Nitobi -/*global PhoneGap/Cordova */ +/*global PhoneGap */ -function ChildBrowser() -{ - // Does nothing +function ChildBrowser() { + // Does nothing } + // Callback when the location of the page changes // called from native ChildBrowser._onLocationChange = function(newLoc) { - window.plugins.childBrowser.onLocationChange(newLoc); + window.plugins.childBrowser.onLocationChange(newLoc); }; + // Callback when the user chooses the 'Done' button // called from native ChildBrowser._onClose = function() { - window.plugins.childBrowser.onClose(); + window.plugins.childBrowser.onClose(); }; + // Callback when the user chooses the 'open in Safari' button // called from native ChildBrowser._onOpenExternal = function() { - window.plugins.childBrowser.onOpenExternal(); + window.plugins.childBrowser.onOpenExternal(); }; + // Pages loaded into the ChildBrowser can execute callback scripts, so be careful to // check location, and make sure it is a location you trust. // Warning ... don't exec arbitrary code, it's risky and could fuck up your app. // called from native ChildBrowser._onJSCallback = function(js,loc) { - // Not Implemented - //window.plugins.childBrowser.onJSCallback(js,loc); + // Not Implemented + //window.plugins.childBrowser.onJSCallback(js,loc); }; + /* The interface that you will use to access functionality */ // Show a webpage, will result in a callback to onLocationChange ChildBrowser.prototype.showWebPage = function(loc) { - if (typeof PhoneGap !== "undefined") - { - PhoneGap.exec("ChildBrowserCommand.showWebPage", loc); - } - if (typeof Cordova !== "undefined") - { - Cordova.exec("ChildBrowserCommand.showWebPage", loc); - } + PhoneGap.exec("ChildBrowserCommand.showWebPage", loc); }; + // close the browser, will NOT result in close callback ChildBrowser.prototype.close = function() { - if (typeof PhoneGap !== "undefined") - { - PhoneGap.exec("ChildBrowserCommand.close"); - } - if (typeof Cordova !== "undefined") - { - Cordova.exec("ChildBrowserCommand.close"); - } + PhoneGap.exec("ChildBrowserCommand.close"); }; + // Not Implemented ChildBrowser.prototype.jsExec = function(jsString) { - // Not Implemented!! - //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString); + // Not Implemented!! + //PhoneGap.exec("ChildBrowserCommand.jsExec",jsString); }; + // Note: this plugin does NOT install itself, call this method some time after deviceready to install it // it will be returned, and also available globally from window.plugins.childBrowser ChildBrowser.install = function() { - if(!window.plugins) - { - window.plugins = { - }; - } - window.plugins.childBrowser = new ChildBrowser(); - return window.plugins.childBrowser; + if(!window.plugins) { + window.plugins = {}; + } + + window.plugins.childBrowser = new ChildBrowser(); + return window.plugins.childBrowser; }; + diff --git a/iPhone/ChildBrowser/ChildBrowserCommand.h b/iPhone/ChildBrowser/ChildBrowserCommand.h old mode 100644 new mode 100755 index ac9c71db..5e86a675 --- a/iPhone/ChildBrowser/ChildBrowserCommand.h +++ b/iPhone/ChildBrowser/ChildBrowserCommand.h @@ -1,25 +1,23 @@ +// +// PhoneGap ! ChildBrowserCommand +// +// // Created by Jesse MacFadyen on 10-05-29. // Copyright 2010 Nitobi. All rights reserved. -// Copyright 2012, Randy McMillan -// Continued maintainance @RandyMcMillan 2010/2011/2012 +// #import #ifdef PHONEGAP_FRAMEWORK -#import -#endif -//#else -#ifdef CORDOVA_FRAMEWORK -#import + #import +#else + #import "PGPlugin.h" #endif #import "ChildBrowserViewController.h" -#ifdef PHONEGAP_FRAMEWORK - @interface ChildBrowserCommand : PGPlugin { -#endif -#ifdef CORDOVA_FRAMEWORK - @interface ChildBrowserCommand : CDVPlugin { -#endif + +@interface ChildBrowserCommand : PGPlugin { + ChildBrowserViewController* childBrowser; } diff --git a/iPhone/ChildBrowser/ChildBrowserCommand.m b/iPhone/ChildBrowser/ChildBrowserCommand.m old mode 100644 new mode 100755 index 862cdd4e..dc174f45 --- a/iPhone/ChildBrowser/ChildBrowserCommand.m +++ b/iPhone/ChildBrowser/ChildBrowserCommand.m @@ -1,16 +1,18 @@ +// + +// +// // Created by Jesse MacFadyen on 10-05-29. // Copyright 2010 Nitobi. All rights reserved. -// Copyright 2012, Randy McMillan -// Continued maintainance @RandyMcMillan 2010/2011/2012 +// #import "ChildBrowserCommand.h" #ifdef PHONEGAP_FRAMEWORK #import -#endif -//#else -#ifdef CORDOVA_FRAMEWORK -#import + +#else + #import "PhoneGapViewController.h" #endif @@ -30,18 +32,11 @@ - (void) showWebPage:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)o NSString* strOrientations = [ options objectForKey:@"supportedOrientations"]; NSArray* supportedOrientations = [strOrientations componentsSeparatedByString:@","]; */ -#ifdef PHONEGAP_FRAMEWORK + PhoneGapViewController* cont = (PhoneGapViewController*)[ super appViewController ]; childBrowser.supportedOrientations = cont.supportedOrientations; [ cont presentModalViewController:childBrowser animated:YES ]; -#endif - -#ifdef CORDOVA_FRAMEWORK - CDVViewController* cont = (CDVViewController*)[ super viewController ]; - childBrowser.supportedOrientations = cont.supportedOrientations; - [ cont presentModalViewController:childBrowser animated:YES ]; -#endif - + NSString *url = (NSString*) [arguments objectAtIndex:0]; diff --git a/iPhone/ChildBrowser/ChildBrowserViewController.h b/iPhone/ChildBrowser/ChildBrowserViewController.h old mode 100644 new mode 100755 index c845553f..87676142 --- a/iPhone/ChildBrowser/ChildBrowserViewController.h +++ b/iPhone/ChildBrowser/ChildBrowserViewController.h @@ -1,7 +1,9 @@ -// Created by Jesse MacFadyen on 10-05-29. -// Copyright 2010 Nitobi. All rights reserved. -// Copyright 2012, Randy McMillan -// Continued maintainance @RandyMcMillan 2010/2011/2012 +// +// ChildBrowserViewController.h +// +// Created by Jesse MacFadyen on 21/07/09. +// Copyright 2009 Nitobi. All rights reserved. +// #import diff --git a/iPhone/ChildBrowser/ChildBrowserViewController.m b/iPhone/ChildBrowser/ChildBrowserViewController.m old mode 100644 new mode 100755 index a300ed11..6fc9cce4 --- a/iPhone/ChildBrowser/ChildBrowserViewController.m +++ b/iPhone/ChildBrowser/ChildBrowserViewController.m @@ -1,7 +1,9 @@ -/// Created by Jesse MacFadyen on 10-05-29. -// Copyright 2010 Nitobi. All rights reserved. -// Copyright 2012, Randy McMillan -// Continued maintainance @RandyMcMillan 2010/2011/2012 +// +// ChildBrowserViewController.m +// +// Created by Jesse MacFadyen on 21/07/09. +// Copyright 2009 Nitobi. All rights reserved. +// #import "ChildBrowserViewController.h" @@ -104,12 +106,8 @@ -(void)closeBrowser { [delegate onClose]; } - if ([self respondsToSelector:@selector(presentingViewController)]) { - //Reference UIViewController.h Line:179 for update to iOS 5 difference - @RandyMcMillan - [[self presentingViewController] dismissViewControllerAnimated:YES completion:nil]; - } else { - [[self parentViewController] dismissModalViewControllerAnimated:YES]; - } + + [ [super parentViewController] dismissModalViewControllerAnimated:YES]; } -(IBAction) onDoneButtonPress:(id)sender @@ -215,25 +213,5 @@ - (void)webViewDidFinishLoad:(UIWebView *)sender } -/* -- (void)webView:(UIWebView *)wv didFailLoadWithError:(NSError *)error { - NSLog (@"webView:didFailLoadWithError"); - [spinner stopAnimating]; - addressLabel.text = @"Failed"; - if (error != NULL) { - UIAlertView *errorAlert = [[UIAlertView alloc] - initWithTitle: [error localizedDescription] - message: [error localizedFailureReason] - delegate:nil - cancelButtonTitle:@"OK" - otherButtonTitles:nil]; - [errorAlert show]; - [errorAlert release]; - } -} - -*/ - - @end diff --git a/iPhone/ChildBrowser/ChildBrowserViewController.xib b/iPhone/ChildBrowser/ChildBrowserViewController.xib old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/FBConnectExample/FBConnect.js b/iPhone/ChildBrowser/FBConnectExample/FBConnect.js old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/FBConnectExample/README.txt b/iPhone/ChildBrowser/FBConnectExample/README.txt old mode 100644 new mode 100755 diff --git a/iPhone/ChildBrowser/README.md b/iPhone/ChildBrowser/README.txt old mode 100644 new mode 100755 similarity index 79% rename from iPhone/ChildBrowser/README.md rename to iPhone/ChildBrowser/README.txt index 71d0ff9e..11bc2911 --- a/iPhone/ChildBrowser/README.md +++ b/iPhone/ChildBrowser/README.txt @@ -1,13 +1,11 @@ -UPDATED March 2 2012 for Cordova 1.5 with limited backwards support for PhoneGap 1.4.1 (minor changes may be needed for anything earlier than 1.3) - @RandyMcMillan -================================= -The child browser allows you to display external webpages within your PhoneGap/Cordova application. + +The child browser allows you to display external webpages within your PhoneGap application. A simple use case would be: -- Users can follow links/buttons to view web content without leaving your app. -- Display web pages/images/videos/pdfs in the ChildBrowser. +- Users can post links, and you don't want your users to exit your app to view the link. This command creates a popup browser that is shown in front of your app, when the user presses the done button they are simply returned to your app ( actually they never left ) @@ -15,11 +13,9 @@ The ChildBrowser has buttons for refreshing, navigating back + forwards, as well Note, because this is open source, I could not include the graphics I usually use for the back/forward and safari buttons. I have changed the XIB file to use system buttons ( rewind / fast-forward + action ) Ideally you should modify the XIB to use your own look. -Here is a sample command to open google in a ChildBrowser : +Here is a sample command to open google in a childbrowser : PhoneGap.exec("ChildBrowserCommand.showWebPage", "http://www.google.com" ); -or -Cordova.exec("ChildBrowserCommand.showWebPage", "http://www.google.com" ); ================================= diff --git a/iPhone/LocalNotification/plugin/LocalNotification.m b/iPhone/LocalNotification/plugin/LocalNotification.m index 3fbd34e5..47fe6e11 100755 --- a/iPhone/LocalNotification/plugin/LocalNotification.m +++ b/iPhone/LocalNotification/plugin/LocalNotification.m @@ -65,6 +65,8 @@ - (void)cancelNotification:(NSMutableArray*)arguments withDict:(NSMutableDiction - (void)cancelAllNotifications:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options { NSLog(@"All Notifications cancelled"); + [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 1]; + [[UIApplication sharedApplication] setApplicationIconBadgeNumber: 0]; [[UIApplication sharedApplication] cancelAllLocalNotifications]; } diff --git a/iPhone/TestFlight/PGTestFlight.h b/iPhone/TestFlight/PGTestFlight.h deleted file mode 100644 index 6c7ffddb..00000000 --- a/iPhone/TestFlight/PGTestFlight.h +++ /dev/null @@ -1,25 +0,0 @@ -// -// PGTestFlight.h -// -// Created by Shazron Abdullah on 11-09-13. -// Copyright 2011 Nitobi Software Inc. All rights reserved. -// -#ifdef PHONEGAP_FRAMEWORK - #import -#else - #import "PGPlugin.h" -#endif - -@interface PGTestFlight : PGPlugin - -- (void)addCustomEnvironmentInformation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void)takeOff:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void)setOptions:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void)passCheckpoint:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -- (void)openFeedbackView:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options;; - -@end diff --git a/iPhone/TestFlight/PGTestFlight.m b/iPhone/TestFlight/PGTestFlight.m deleted file mode 100644 index ca63d5f0..00000000 --- a/iPhone/TestFlight/PGTestFlight.m +++ /dev/null @@ -1,104 +0,0 @@ -// -// PGTestFlight.m -// -// Created by Shazron Abdullah on 11-09-13. -// Copyright 2011 Nitobi Software Inc. All rights reserved. -// - -#import "PGTestFlight.h" -#import "TestFlight.h" - -#ifdef PHONEGAP_FRAMEWORK - #import -#else - #import "PluginResult.h" -#endif - -@implementation PGTestFlight - -- (id)init -{ - self = [super init]; - if (self) { - // Initialization code here. - } - - return self; -} - -- (void) addCustomEnvironmentInformation:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* callbackId = [arguments pop]; - PluginResult* result = nil; - - NSString* key = [options objectForKey:@"key"]; - NSString* information = [options objectForKey:@"information"]; - - if (key && information) { - [TestFlight addCustomEnvironmentInformation:information forKey:key]; - result = [PluginResult resultWithStatus:PGCommandStatus_OK]; - [super writeJavascript:[result toSuccessCallbackString:callbackId]]; - } else { - result = [PluginResult resultWithStatus:PGCommandStatus_ERROR messageAsString:@"information or key property is missing."]; - [super writeJavascript:[result toErrorCallbackString:callbackId]]; - } -} - -- (void) takeOff:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* callbackId = [arguments pop]; - PluginResult* result = nil; - - NSString* teamToken = [options objectForKey:@"teamToken"]; - if (teamToken) { - [TestFlight takeOff:teamToken]; - result = [PluginResult resultWithStatus:PGCommandStatus_OK]; - [super writeJavascript:[result toSuccessCallbackString:callbackId]]; - } else { - result = [PluginResult resultWithStatus:PGCommandStatus_ERROR messageAsString:@"teamToken property is missing."]; - [super writeJavascript:[result toErrorCallbackString:callbackId]]; - } -} - -- (void)setOptions:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* callbackId = [arguments pop]; - PluginResult* result = nil; - - if ([options count] > 0) { - [TestFlight setOptions:options]; - result = [PluginResult resultWithStatus:PGCommandStatus_OK]; - [super writeJavascript:[result toSuccessCallbackString:callbackId]]; - } else { - result = [PluginResult resultWithStatus:PGCommandStatus_ERROR messageAsString:@"options dictionary is empty."]; - [super writeJavascript:[result toErrorCallbackString:callbackId]]; - } -} - -- (void) passCheckpoint:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* callbackId = [arguments pop]; - PluginResult* result = nil; - - NSString* checkpointName = [options objectForKey:@"checkpointName"]; - if (checkpointName) { - [TestFlight passCheckpoint:checkpointName]; - result = [PluginResult resultWithStatus:PGCommandStatus_OK]; - [super writeJavascript:[result toSuccessCallbackString:callbackId]]; - } else { - result = [PluginResult resultWithStatus:PGCommandStatus_ERROR messageAsString:@"checkpointName property is missing."]; - [super writeJavascript:[result toErrorCallbackString:callbackId]]; - } -} - -- (void) openFeedbackView:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - NSString* callbackId = [arguments pop]; - - [TestFlight openFeedbackView]; - - PluginResult* result = [PluginResult resultWithStatus:PGCommandStatus_OK]; - [super writeJavascript:[result toSuccessCallbackString:callbackId]]; -} - -@end diff --git a/iPhone/TestFlight/README.md b/iPhone/TestFlight/README.md new file mode 100644 index 00000000..082f94ab --- /dev/null +++ b/iPhone/TestFlight/README.md @@ -0,0 +1 @@ +This plugin has been moved to [http://github.com/shazron/TestFlightPlugin](http://github.com/shazron/TestFlightPlugin) \ No newline at end of file diff --git a/iPhone/TestFlight/TestFlight.js b/iPhone/TestFlight/TestFlight.js deleted file mode 100644 index 49771f78..00000000 --- a/iPhone/TestFlight/TestFlight.js +++ /dev/null @@ -1,92 +0,0 @@ -/* - TestFlight Plugin for PhoneGap. - Created by Shazron Abdullah, Nitobi Software Inc. - - 1. Include the TestFlight SDK files in Xcode (follow their instructions) - 2. Add PGTestFlight.h and .m in Xcode - 3. Add TestFlight.js to your www folder, and reference it in a script tag after your phonegap.js - 4. In PhoneGap.plist, under the 'Plugins' key, add a new row: key is "com.phonegap.testflightsdk" and the value is "PGTestFlight" - 5. In PhoneGap.plist, under the 'ExternalHosts' key, add a new value "testflightapp.com" - - The plugin's JavaScript functions are under the global "window.plugins.TestFlight" object. - See the functions below (and the TestFlight SDK docs) for usage. Unfortunately all of TestFlight's SDK functions return void, - and errors can only be gleaned from the run console, so check that for errors. - */ - -if (!PhoneGap.hasResource("TestFlight")) { - PhoneGap.addResource("TestFlight"); - -TestFlight = function() { - this.serviceName = "com.phonegap.testflightsdk"; -}; - -/* - Add custom environment information - If you want to track a user name from your application you can add it here - - @param successCallback function - @param failureCallback function - @param key string - @param information string - */ -TestFlight.prototype.addCustomEnvironmentInformation = function(successCallback, failureCallback, key, information) { - PhoneGap.exec(successCallback, failureCallback, this.serviceName, "addCustomEnvironmentInformation", - [{ key: key, information: information }]); -}; - -/* - Starts a TestFlight session - - @param successCallback function - @param failureCallback function - @param teamToken string - */ -TestFlight.prototype.takeOff = function(successCallback, failureCallback, teamToken) { - PhoneGap.exec(successCallback, failureCallback, this.serviceName, "takeOff", [{ teamToken: teamToken }]); -}; - -/* - Sets custom options - - @param successCallback function - @param failureCallback function - @param options object i.e { reinstallCrashHandlers : true } - */ -TestFlight.prototype.setOptions = function(successCallback, failureCallback, options) { - if (!(null !== options && 'object' == typeof(options))) { - options = {}; - } - PhoneGap.exec(successCallback, failureCallback, this.serviceName, "setOptions", [ options ]); -}; - -/* - Track when a user has passed a checkpoint after the flight has taken off. Eg. passed level 1, posted high score - - @param successCallback function - @param failureCallback function - @param checkpointName string - */ -TestFlight.prototype.passCheckpoint = function(successCallback, failureCallback, checkpointName) { - PhoneGap.exec(successCallback, failureCallback, this.serviceName, "passCheckpoint", [{ checkpointName: checkpointName }]); -}; - -/* - Opens a feeback window that is not attached to a checkpoint - - @param successCallback function - @param failureCallback function - */ -TestFlight.prototype.openFeedbackView = function(successCallback, failureCallback) { - PhoneGap.exec(successCallback, failureCallback, this.serviceName, "openFeedbackView", []); -}; - - -TestFlight.install = function() -{ - if (typeof window.plugins == "undefined") window.plugins = {}; - if (typeof window.plugins.TestFlight == "undefined") window.plugins.TestFlight = new TestFlight(); -} - -PhoneGap.addConstructor(TestFlight.install); - -}; diff --git a/iPhone/Torch/README.md b/iPhone/Torch/README.md index 3cabbfb3..7905e444 100644 --- a/iPhone/Torch/README.md +++ b/iPhone/Torch/README.md @@ -1,53 +1 @@ -# PhoneGap Torch Plugin # -by Shazron Abdullah - -## Adding the Plugin to your project ## - -Using this plugin requires [iOS PhoneGap](http://github.com/phonegap/phonegap-iphone) and AVFoundation. AVFoundation requires the [iOS 4 SDK](http://developer.apple.com/ios). - -1. Add the "AVFoundation" framework to your project, and set it to be weak linked (see "Weak Linking the AVFoundation Framework" section below). -2. Add the .h and .m files to your Plugins folder in your project -3. Add the .js files to your "www" folder on disk, and add reference(s) to the .js files as tags in your html file(s) -4. See the sample code in "index.html" for an example use - -## Weak Linking the AVFoundation Framework ## - -**Xcode 3** - -1. In your project, under "Targets", double click on the Target item -2. Go to the "General" Tab, under "Linked Libraries" -3. For the AVFoundation Framework, change the value from "Required" to "Weak" - -**Xcode 4** - -1. In your project, select your blue project icon in the Project Navigator -2. On the right pane, select the "Build Phases" tab -3. Expand the "Link Binary with Libraries" item -4. For the AVFoundation Framework, change the value from "Required" to "Optional" - -## RELEASE NOTES ## - -### 20110527 ### -* Initial release -* iOS devices with no flash/torch support will just fail gracefully -* Based off code [here](http://stackoverflow.com/questions/3190034/turn-on-torch-flash-on-iphone-4) - -## BUGS ## - -Post issues in the [PhoneGap Google Groups](http://groups.google.com/group/phonegap), include in the subject heading - "TorchPlugin" or on [Github](http://github.com/phonegap/phonegap-plugins/issues) (preferred) - - -## LICENSE ## - -The MIT License - -Copyright (c) 2011 Shazron Abdullah - -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - - - +This plugin has been moved to [http://github.com/shazron/TorchPlugin](http://github.com/shazron/TorchPlugin) \ No newline at end of file diff --git a/iPhone/Torch/Torch.h b/iPhone/Torch/Torch.h deleted file mode 100644 index 23b137ce..00000000 --- a/iPhone/Torch/Torch.h +++ /dev/null @@ -1,34 +0,0 @@ -// -// Torch.h -// PhoneGap Plugin -// -// Created by Shazron Abdullah May 26th 2011 - -#import -#import - -#ifdef PHONEGAP_FRAMEWORK -#import -#endif - -#ifdef CORDOVA_FRAMEWORK -#import -#endif - -#ifdef PHONEGAP_FRAMEWORK -@interface Torch : PGPlugin { -#endif - -#ifdef CORDOVA_FRAMEWORK -@interface Torch : CDVPlugin { -#endif - - AVCaptureSession* session; -} - -@property (nonatomic, retain) AVCaptureSession* session; - -- (void) turnOn:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; -- (void) turnOff:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options; - -@end diff --git a/iPhone/Torch/Torch.js b/iPhone/Torch/Torch.js deleted file mode 100644 index 7a8dae21..00000000 --- a/iPhone/Torch/Torch.js +++ /dev/null @@ -1,36 +0,0 @@ -// -// Torch.js -// PhoneGap Plugin -// -// Only supported in iOS4, and flash capable device (currently iPhone 4 only) -// -// Created by Shazron Abdullah May 26th 2011 -// - -function Torch() -{ - this._isOn = false; - var self = this; - - this.__defineGetter__("isOn", function() { return self._isOn; }); -} - -Torch.prototype.turnOn = function() -{ - PhoneGap.exec("Torch.turnOn"); -}; - -Torch.prototype.turnOff = function() -{ - PhoneGap.exec("Torch.turnOff"); -}; - -Torch.install = function() -{ - if(!window.plugins) { - window.plugins = {}; - } - window.plugins.torch = new Torch(); -}; - -PhoneGap.addConstructor(Torch.install); \ No newline at end of file diff --git a/iPhone/Torch/Torch.m b/iPhone/Torch/Torch.m deleted file mode 100644 index a4ccfbe2..00000000 --- a/iPhone/Torch/Torch.m +++ /dev/null @@ -1,125 +0,0 @@ -// -// Torch.m -// PhoneGap Plugin -// -// Created by Shazron Abdullah May 26th 2011 -// - -#import "Torch.h" - -@interface Torch (PrivateMethods) - -- (void) setup; - -@end - - -@implementation Torch - -@synthesize session; - -#ifdef PHONEGAP_FRAMEWORK -- (PGPlugin*) initWithWebView:(UIWebView*)theWebView -#endif - -#ifdef CORDOVA_FRAMEWORK -- (CDVPlugin*) initWithWebView:(UIWebView*)theWebView -#endif - -{ - self = (Torch*)[super initWithWebView:theWebView]; - if (self) { - [self setup]; - } - return self; -} - -- (void) setup -{ - Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); - if (captureDeviceClass != nil) - { - AVCaptureDevice* captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; - if ([captureDevice hasTorch] && [captureDevice hasFlash] && captureDevice.torchMode == AVCaptureTorchModeOff) - { - AVCaptureDeviceInput* deviceInput = [AVCaptureDeviceInput deviceInputWithDevice:captureDevice error: nil]; - AVCaptureVideoDataOutput* videoDataOutput = [[AVCaptureVideoDataOutput alloc] init]; - - AVCaptureSession* captureSession = [[AVCaptureSession alloc] init]; - - [captureSession beginConfiguration]; - [captureDevice lockForConfiguration:nil]; - - [captureSession addInput:deviceInput]; - [captureSession addOutput:videoDataOutput]; - - [captureDevice unlockForConfiguration]; - - [videoDataOutput release]; - - [captureSession commitConfiguration]; - [captureSession startRunning]; - - self.session = captureSession; - [captureSession release]; - } - else { - NSLog(@"Torch not available, hasFlash: %d hasTorch: %d torchMode: %d", - captureDevice.hasFlash, - captureDevice.hasTorch, - captureDevice.torchMode - ); - } - - } - else { - NSLog(@"Torch not available, AVCaptureDevice class not found."); - } -} - -- (void) turnOn:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - // test if this class even exists to ensure flashlight is turned on ONLY for iOS 4 and above - Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); - if (captureDeviceClass != nil) { - - AVCaptureDevice* captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; - - [captureDevice lockForConfiguration:nil]; - - [captureDevice setTorchMode:AVCaptureTorchModeOn]; - [captureDevice setFlashMode:AVCaptureFlashModeOn]; - - [captureDevice unlockForConfiguration]; - - [super writeJavascript:@"window.plugins.torch._isOn = true;"]; - } -} - -- (void) turnOff:(NSMutableArray*)arguments withDict:(NSMutableDictionary*)options -{ - Class captureDeviceClass = NSClassFromString(@"AVCaptureDevice"); - if (captureDeviceClass != nil) - { - AVCaptureDevice* captureDevice = [AVCaptureDevice defaultDeviceWithMediaType:AVMediaTypeVideo]; - - [captureDevice lockForConfiguration:nil]; - - [captureDevice setTorchMode:AVCaptureTorchModeOff]; - [captureDevice setFlashMode:AVCaptureFlashModeOff]; - - [captureDevice unlockForConfiguration]; - - [super writeJavascript:@"window.plugins.torch._isOn = false;"]; - } -} - -- (void) dealloc -{ - [self turnOff:nil withDict:nil]; - self.session = nil; - - [super dealloc]; -} - -@end diff --git a/iPhone/Torch/index.html b/iPhone/Torch/index.html deleted file mode 100755 index 6d7a6157..00000000 --- a/iPhone/Torch/index.html +++ /dev/null @@ -1,33 +0,0 @@ - - - - - - - - - - - - - -

TORCH

-
torch is:
- - - -