UNPKG

cordova-plugin-mas-core

Version:
194 lines (164 loc) 9.68 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>JSDoc: Source: MASPluginDevice.js</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> </head> <body> <div id="main"> <h1 class="page-title">Source: MASPluginDevice.js</h1> <section> <article> <pre class="prettyprint source linenums"><code>/* * Copyright (c) 2016 CA, Inc. All rights reserved. * This software may be modified and distributed under the terms * of the MIT license. See the LICENSE file for details. * */ /** * @class MASPluginDevice * @hideconstructor * @classdesc The main class containing the functions for MAS Device Management. * &lt;table> * &lt;tr bgcolor="#D3D3D3">&lt;th>MASPluginDevice Construtor&lt;/th>&lt;/tr> * &lt;tr>&lt;td>&lt;i>var MASDevice = new MASPlugin.MASDevice();&lt;/i>&lt;/td>&lt;/tr> * &lt;/table> */ var MASPluginDevice = function() { /** * Verifies whether the current device is registered on MAG server * @memberOf MASPluginDevice * @function isDeviceRegistered * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.isDeviceRegistered = function(successHandler, errorHandler) { return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "isDeviceRegistered", []); }; /** * Fetches the device identifier registered in MAG server. The value is a string in Base64 format. * @memberOf MASPluginDevice * @function getDeviceIdentifier * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.getDeviceIdentifier = function(successHandler, errorHandler) { return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "getDeviceIdentifier", []); }; /** * Fetches the device's details i.e. its registration state and identifier. The response is in a form of JSON string.&lt;br> &lt;b> Sample : {"isRegistered":true,"identifier":"cb89kkfhhsj...jjjdj"}&lt;/b> * @memberOf MASPluginDevice * @function getCurrentDevice * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.getCurrentDevice = function(successHandler, errorHandler) { return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "getCurrentDevice", []); }; /** * Deregisters a device from MAG server i.e. removes all the registration information of this device from the MAG server. * @memberOf MASPluginDevice * @function deregister * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.deregister = function(successHandler, errorHandler) { return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "deregister", []); }; /** * Resets all the local cache of the device for the app i.e. all tokens, credentials, states are flushed. Do not expose this API in a production app. * @memberOf MASPluginDevice * @function resetLocally * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.resetLocally = function(successHandler, errorHandler) { return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "resetLocally", []); }; /** * Creates or updates a new attribute for the current device. The response is SUCCESS if attribute is added successfully, else an error occurs that specifies the reason. * @memberOf MASPluginDevice * @function addAttribute * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. * @param {string} attributeName Key of the attribute to be associated with the device. Key's value should not be null or empty. * @param {string} attributeValue Value of the attribute to be associated with the device. */ this.addAttribute = function(successHandler,errorHandler,attributeName,attributeValue){ return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "addAttribute", [attributeName,attributeValue]); }; /** * Remove attribute by name, succeed even if device attribute does not exists. The response is SUCCESS if attribute removed successfully, else an error specifying the reason. * @memberOf MASPluginDevice * @function removeAttribute * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. * @param {string} attributeName Key of the attribute to be associated with the device. Key's value should not be null or empty. */ this.removeAttribute = function(successHandler,errorHandler,attributeName){ return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "removeAttribute", [attributeName]); }; /** * Remove all attributes for the current device. The response is SUCCESS if all attributes removed successfully, else an error specifying the reason. * @memberOf MASPluginDevice * @function removeAllAttributes * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.removeAllAttributes = function(successHandler,errorHandler){ return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "removeAllAttributes", []); }; /** * Gets attribute by name, returns empty JSONObject if no attribute is found.&lt;br> &lt;b> Sample: If k1 key exists, then the response will be : {"k1":"v1"}&lt;/b> * @memberOf MASPluginDevice * @function getAttribute * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. * @param {string} attributeName Key of the attribute to be associated with the device. Key should not be null or empty. */ this.getAttribute = function(successHandler,errorHandler,attributeName){ return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "getAttribute", [attributeName]); }; /** * Gets all the attributes for the device, returns empty JSONArray if no attributes found.&lt;br> &lt;b>Sample: if multiple attribute pair exists then the response will be : [{"k1":"v1"},{"k2":"v2"}] &lt;/b> * @memberOf MASPluginDevice * @function getAttributes * @instance * @param {successCallbackFunction} successHandler user defined success callback that is invoked on success scenario. * @param {errorCallbackFunction} errorHandler user defined error callback that is invoked on failure scenario. */ this.getAttributes = function(successHandler,errorHandler){ return Cordova.exec(successHandler, errorHandler, "MASPluginDevice", "getAttributes", []); }; } module.exports = MASPluginDevice;</code></pre> </article> </section> </div> <nav> <h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="MASPlugin.html">MASPlugin</a></li><li><a href="MASPluginApplication.html">MASPluginApplication</a></li><li><a href="MASPluginAuthProviders.html">MASPluginAuthProviders</a></li><li><a href="MASPluginConstants.html">MASPluginConstants</a></li><li><a href="MASPluginDevice.html">MASPluginDevice</a></li><li><a href="MASPluginMAS.html">MASPluginMAS</a></li><li><a href="MASPluginMultipartForm.html">MASPluginMultipartForm</a></li><li><a href="MASPluginSecurityConfiguration.html">MASPluginSecurityConfiguration</a></li><li><a href="MASPluginUser.html">MASPluginUser</a></li><li><a href="MASPluginUtils.html">MASPluginUtils</a></li></ul><h3><a href="global.html">Global</a></h3> </nav> <br class="clear"> <footer> Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.3</a> on Tue Feb 18 2020 21:13:36 GMT+0530 (India Standard Time) </footer> <script> prettyPrint(); </script> <script src="scripts/linenumber.js"> </script> </body> </html>