-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
59 changed files
with
40,408 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions
1,830
docs/wirelesstags/0.7.0/fonts/OpenSans-Bold-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions
1,830
docs/wirelesstags/0.7.0/fonts/OpenSans-BoldItalic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,830 changes: 1,830 additions & 0 deletions
1,830
docs/wirelesstags/0.7.0/fonts/OpenSans-Italic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,831 changes: 1,831 additions & 0 deletions
1,831
docs/wirelesstags/0.7.0/fonts/OpenSans-Light-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,835 changes: 1,835 additions & 0 deletions
1,835
docs/wirelesstags/0.7.0/fonts/OpenSans-LightItalic-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
1,831 changes: 1,831 additions & 0 deletions
1,831
docs/wirelesstags/0.7.0/fonts/OpenSans-Regular-webfont.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,172 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<title>JSDoc: Source: index.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: index.js</h1> | ||
|
||
|
||
|
||
|
||
|
||
|
||
<section> | ||
<article> | ||
<pre class="prettyprint source linenums"><code>"use strict"; | ||
|
||
/* eslint-disable no-process-env, no-sync */ | ||
|
||
/** | ||
* The cloud platform interface to the Wireless Tag platform. This | ||
* module exports the constructor for the {@link WirelessTagPlatform} | ||
* class. | ||
* | ||
* See README for further documentation. | ||
* | ||
* @module wirelesstags | ||
*/ | ||
var WirelessTagPlatform = require('./lib/platform'); | ||
|
||
const path = require('path'); | ||
const os = require('os'); | ||
const fs = require('fs'); | ||
|
||
/** | ||
* @const {string} - The name of the default configuration file in the | ||
* executing user's home directory. | ||
* Used by {@link WirelessTagPlatform.loadConfig}. | ||
* @default | ||
*/ | ||
const CONFIG_NAME = ".wirelesstags"; | ||
|
||
/** | ||
* @const {string} - The environment variable containing the Wireless | ||
* Tag API user name. | ||
* Used by {@link WirelessTagPlatform.loadConfig}. | ||
* @default | ||
*/ | ||
const ENV_USERNAME = "WIRELESSTAG_API_USER"; | ||
|
||
/** | ||
* @const {string} - The environment variable containing the Wireless | ||
* Tag API password. | ||
* Used by {@link WirelessTagPlatform.loadConfig}. | ||
* @default | ||
*/ | ||
const ENV_PASSWORD = "WIRELESSTAG_API_PASSWORD"; | ||
|
||
const ENV_TOKEN = "WIRELESSTAG_API_TOKEN"; | ||
|
||
/** | ||
* Loads config information, which presently consists primarily of | ||
* connection options. | ||
* | ||
* The algorithm will attempt to read the file [CONFIG_NAME]{@link | ||
* module:wirelesstags~CONFIG_NAME} (in JSON format) in the executing | ||
* user's home directory if the file exists. It will then take | ||
* username and password from the environment ([ENV_USERNAME]{@link | ||
* module:wirelesstags~ENV_USERNAME} and [ENV_PASSWORD]{@link | ||
* module:wirelesstags~ENV_PASSWORD}), which allows to use the | ||
* environment to override settings in the configuration file. | ||
* | ||
* @returns {Object} | ||
* @memberof WirelessTagPlatform | ||
*/ | ||
WirelessTagPlatform.loadConfig = function() { | ||
let config = {}; | ||
let confPath = path.join(os.homedir ? os.homedir() : process.env.HOME, | ||
CONFIG_NAME); | ||
try { | ||
let confContent = fs.readFileSync(confPath, 'utf8'); | ||
config = JSON.parse(confContent); | ||
} catch (err) { | ||
if (err.code !== "ENOENT") throw err; | ||
} | ||
if (process.env[ENV_USERNAME]) { | ||
config.username = process.env[ENV_USERNAME]; | ||
} | ||
if (process.env[ENV_PASSWORD]) { | ||
config.password = process.env[ENV_PASSWORD]; | ||
} | ||
if (process.env[ENV_TOKEN]) { | ||
config.bearer = process.env[ENV_TOKEN]; | ||
} | ||
return config; | ||
}; | ||
|
||
/** | ||
* Creates a {@link WirelessTagPlatform} instance, using the given | ||
* options for initializing. In contrast to the constructor, this | ||
* method will first attempt to load default configuration using | ||
* {@link WirelessTagPlatform.loadConfig}. | ||
* | ||
* @param {Object} [options] - overrides options found in the default | ||
* configuration loaded using {@link WirelessTagPlatform.loadConfig}. | ||
* @param {String} [options.log] - a custom log function. | ||
* @param {String} [options.errorHandler] - a function returning a custom | ||
* error handler, will be passed a callback function. | ||
* @param {String} [options.apiBaseURI] - the base URI of the API server | ||
* if hosted on a different server than the default | ||
* | ||
* @returns {WirelessTagPlatform} | ||
* @memberof WirelessTagPlatform | ||
*/ | ||
WirelessTagPlatform.create = function(options) { | ||
let config = WirelessTagPlatform.loadConfig(); | ||
for (let key in options) { | ||
config[key] = options[key]; | ||
} | ||
return new WirelessTagPlatform(config); | ||
}; | ||
|
||
/** | ||
* Callback accepted by most API-querying methods. | ||
* | ||
* @callback module:wirelesstags~apiCallback | ||
* @param {Error} error - the error instance if one occurred | ||
* @param {Object} [result] - the result if success | ||
* @param {Object} result.object - the object for which the value was returned | ||
* @param {} [result.value] - the value returned by the API-querying | ||
* method; unless noted otherwise, this will be the same as | ||
* what the Promise resolves to that the method returns, | ||
* provided it is different from the object itself | ||
*/ | ||
|
||
module.exports = WirelessTagPlatform; | ||
</code></pre> | ||
</article> | ||
</section> | ||
|
||
|
||
|
||
|
||
</div> | ||
|
||
<nav> | ||
<h2><a href="index.html">Home</a></h2><h3>Modules</h3><ul><li><a href="module-lib_kumostat.html">lib/kumostat</a></li><li><a href="module-lib_platform.html">lib/platform</a></li><li><a href="module-lib_sensor.html">lib/sensor</a></li><li><a href="module-lib_sensorconfig.html">lib/sensorconfig</a></li><li><a href="module-lib_tag.html">lib/tag</a></li><li><a href="module-lib_util.html">lib/util</a></li><li><a href="module-lib_xforms.html">lib/xforms</a></li><li><a href="module-plugins_interval-updater.html">plugins/interval-updater</a></li><li><a href="module-plugins_polling-updater.html">plugins/polling-updater</a></li><li><a href="module-wirelesstags.html">wirelesstags</a></li></ul><h3>Classes</h3><ul><li><a href="module-plugins_interval-updater-TimedTagUpdater.html">TimedTagUpdater</a></li><li><a href="module-plugins_polling-updater-PollingTagUpdater.html">PollingTagUpdater</a></li><li><a href="MonitoringConfig.html">MonitoringConfig</a></li><li><a href="WirelessTag.html">WirelessTag</a></li><li><a href="WirelessTagManager.html">WirelessTagManager</a></li><li><a href="WirelessTagPlatform.html">WirelessTagPlatform</a></li><li><a href="WirelessTagSensor.html">WirelessTagSensor</a></li></ul><h3>Events</h3><ul><li><a href="WirelessTagManager.html#event:data">data</a></li><li><a href="WirelessTagManager.html#event:discover">discover</a></li><li><a href="WirelessTagPlatform.html#event:connect">connect</a></li><li><a href="WirelessTagPlatform.html#event:discover">discover</a></li></ul><h3>Mixins</h3><ul><li><a href="module-lib_kumostat-kumostat.html">kumostat</a></li></ul><h3>Tutorials</h3><ul><li><a href="tutorial-auto-discover.js.html">auto-discover.js</a></li><li><a href="tutorial-auto-update-polling.js.html">auto-update-polling.js</a></li><li><a href="tutorial-motion-reset.js.html">motion-reset.js</a></li><li><a href="tutorial-read-sensors.js.html">read-sensors.js</a></li></ul> | ||
</nav> | ||
|
||
<br class="clear"> | ||
|
||
<footer> | ||
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.5.5</a> | ||
</footer> | ||
|
||
<script> prettyPrint(); </script> | ||
<script src="scripts/linenumber.js"> </script> | ||
</body> | ||
</html> |
Oops, something went wrong.