onvif
Version:
Client to ONVIF NVT devices Profile S: cameras
123 lines (99 loc) • 4.27 kB
HTML
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: device.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: device.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @namespace cam
* @description Device section for Cam class
* @author Andrew D.Laptev <a.d.laptev@gmail.com>
* @licence MIT
*/
const Cam = require('./cam').Cam
, linerase = require('./utils').linerase
;
/**
* @typedef {object} Cam~NTPInformation
* @property {boolean} fromDHCP Indicates if NTP information is to be retrieved by using DHCP
* @property {object} [NTPFromDHCP] List of NTP addresses retrieved by using DHCP
* @property {object} [NTPManual] List of manually entered NTP addresses
*/
/**
* @callback Cam~NTPCallback
* @property {?Error} error
* @property {Cam~NTPInformation} NTP information object of current device's NTP manual
* @property {string} xml Raw SOAP response
*/
/**
* Receive NTP information from cam
* @param {Cam~NTPCallback} callback
*/
Cam.prototype.getNTP = function(callback) {
this._request({
service: 'device'
, body: this._envelopeHeader() +
'<GetNTP xmlns="http://www.onvif.org/ver10/device/wsdl"/>' +
'</s:Body>' +
'</s:Envelope>'
}, function(err, data, xml) {
if (!err) {
this.NTP = linerase(data[0]['getNTPResponse'][0]['NTPInformation'][0]);
}
callback.call(this, err, err ? null : this.NTP, xml);
});
};
/**
* Set the NTP settings on a device
* @param {object} options
* @param {boolean} options.fromDHCP Indicate if NTP address information is to be retrieved using DHCP
* @param {string} [options.type] Network host type: IPv4, IPv6 or DNS.
* @param {string} [options.ipv4Address] IPv4 address
* @param {string} [options.ipv6Address] IPv6 address
* @param {string} [options.dnsName] DNS name
* @param {string} [options.extension]
* @param {Cam~RequestCallback} [callback]
*/
Cam.prototype.setNTP = function(options, callback) {
this._request({
service: 'device'
, body: this._envelopeHeader() +
'<SetNTP xmlns="http://www.onvif.org/ver10/device/wsdl">' +
'<FromDHCP>' + options.fromDHCP + '</FromDHCP>' +
( options.type ? '<NTPManual>' +
'<Type>' + options.type + '</Type>' +
( options.ipv4Address ? '<IPv4Address>' + options.ipv4Address + '</IPv4Address>' : '' ) +
( options.ipv6Address ? '<IPv6Address>' + options.ipv6Address + '</IPv6Address>' : '' ) +
( options.dnsName ? '<DNSname>' + options.dnsName + '</DNSname>' : '' ) +
( options.extension ? '<Extension>' + options.extension + '</Extension>' : '' ) +
'</NTPManual>' : '') +
'</SetNTP>' +
this._envelopeFooter()
}, callback.bind(this));
};</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Classes</h3><ul><li><a href="Cam_.html">Cam</a></li><li><a href="Discovery_.html">Discovery</a></li></ul><h3>Events</h3><ul><li><a href="Cam_.html#event:event">event</a></li><li><a href="Cam_.html#event:rawResponse">rawResponse</a></li><li><a href="Discovery_.html#event:device">device</a></li><li><a href="Discovery_.html#event:error">error</a></li></ul><h3>Namespaces</h3><ul><li><a href="cam.html">cam</a></li><li><a href="discovery.html">discovery</a></li><li><a href="utils.html">utils</a></li></ul><h3>Global</h3><ul><li><a href="global.html#guid">guid</a></li><li><a href="global.html#linerase">linerase</a></li><li><a href="global.html#parseSOAPString">parseSOAPString</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.0</a> on Mon Jun 20 2016 15:42:17 GMT+0300 (MSK)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>