cordova-plugin-mas-core
Version:
Cordova MAS Foundation Plugin
1,856 lines (433 loc) • 24.5 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Class: MASPluginDevice</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">Class: MASPluginDevice</h1>
<section>
<header>
<h2><span class="attribs"><span class="type-signature"></span></span>MASPluginDevice</h2>
<div class="class-description">The main class containing the functions for MAS Device Management.
<table>
<tr bgcolor="#D3D3D3"><th>MASPluginDevice Construtor</th></tr>
<tr><td><i>var MASDevice = new MASPlugin.MASDevice();</i></td></tr>
</table></div>
</header>
<article>
<div class="container-overview">
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line8">line 8</a>
</li></ul></dd>
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<h4 class="name" id="addAttribute"><span class="type-signature"></span>addAttribute<span class="signature">(successHandler, errorHandler, attributeName, attributeValue)</span><span class="type-signature"></span></h4>
<div class="description">
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
<tr>
<td class="name"><code>attributeName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Key of the attribute to be associated with the device. Key's value should not be null or empty.</td>
</tr>
<tr>
<td class="name"><code>attributeValue</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Value of the attribute to be associated with the device.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line78">line 78</a>
</li></ul></dd>
</dl>
<h4 class="name" id="deregister"><span class="type-signature"></span>deregister<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Deregisters a device from MAG server i.e. removes all the registration information of this device from the MAG server.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line54">line 54</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getAttribute"><span class="type-signature"></span>getAttribute<span class="signature">(successHandler, errorHandler, attributeName)</span><span class="type-signature"></span></h4>
<div class="description">
Gets attribute by name, returns empty JSONObject if no attribute is found.<br> <b> Sample: If k1 key exists, then the response will be : {"k1":"v1"}</b>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
<tr>
<td class="name"><code>attributeName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Key of the attribute to be associated with the device. Key should not be null or empty.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line117">line 117</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getAttributes"><span class="type-signature"></span>getAttributes<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Gets all the attributes for the device, returns empty JSONArray if no attributes found.<br> <b>Sample: if multiple attribute pair exists then the response will be : [{"k1":"v1"},{"k2":"v2"}] </b>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line130">line 130</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getCurrentDevice"><span class="type-signature"></span>getCurrentDevice<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Fetches the device's details i.e. its registration state and identifier. The response is in a form of JSON string.<br> <b> Sample : {"isRegistered":true,"identifier":"cb89kkfhhsj...jjjdj"}</b>
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line42">line 42</a>
</li></ul></dd>
</dl>
<h4 class="name" id="getDeviceIdentifier"><span class="type-signature"></span>getDeviceIdentifier<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Fetches the device identifier registered in MAG server. The value is a string in Base64 format.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line30">line 30</a>
</li></ul></dd>
</dl>
<h4 class="name" id="isDeviceRegistered"><span class="type-signature"></span>isDeviceRegistered<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Verifies whether the current device is registered on MAG server
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line18">line 18</a>
</li></ul></dd>
</dl>
<h4 class="name" id="removeAllAttributes"><span class="type-signature"></span>removeAllAttributes<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
Remove all attributes for the current device. The response is SUCCESS if all attributes removed successfully, else an error specifying the reason.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line105">line 105</a>
</li></ul></dd>
</dl>
<h4 class="name" id="removeAttribute"><span class="type-signature"></span>removeAttribute<span class="signature">(successHandler, errorHandler, attributeName)</span><span class="type-signature"></span></h4>
<div class="description">
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
<tr>
<td class="name"><code>attributeName</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">Key of the attribute to be associated with the device. Key's value should not be null or empty.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line92">line 92</a>
</li></ul></dd>
</dl>
<h4 class="name" id="resetLocally"><span class="type-signature"></span>resetLocally<span class="signature">(successHandler, errorHandler)</span><span class="type-signature"></span></h4>
<div class="description">
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>successHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#successCallbackFunction">successCallbackFunction</a></span>
</td>
<td class="description last">user defined success callback that is invoked on success scenario.</td>
</tr>
<tr>
<td class="name"><code>errorHandler</code></td>
<td class="type">
<span class="param-type"><a href="global.html#errorCallbackFunction">errorCallbackFunction</a></span>
</td>
<td class="description last">user defined error callback that is invoked on failure scenario.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
<a href="MASPluginDevice.js.html">MASPluginDevice.js</a>, <a href="MASPluginDevice.js.html#line66">line 66</a>
</li></ul></dd>
</dl>
</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>