control-freak-ide/dist/all/docs/Protocols/index.html
plastic-hub-dev-node-saturn 538369cff7 latest
2021-05-12 18:35:18 +02:00

564 lines
43 KiB
HTML

<!DOCTYPE html>
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<title>Protocols - Control-Freak</title>
<meta name="description" content="IDE for Automation & IoT" />
<meta name="author" content="Justin Walsh">
<meta charset="UTF-8">
<link rel="icon" href="../themes/mytheme/img/favicon-blue.png" type="image/x-icon">
<!-- Mobile -->
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="..//ext/easyXDM.js"></script>
<script type="text/javascript">
var pixlrEditor = null;
var xdmSocket = null;
var editorImage=null;
var imageUrl=null;
var editorArgs=null;
var saveUrl=null;
var title='';
var format = 'jpg';
function urlDecode (string, overwrite) {
if (!string || !string.length) {
return{}
}
var obj = {};
var pairs = string.split("&");
var pair, name, value;
for (var i = 0, len = pairs.length; i < len; i++) {
pair = pairs[i].split("=");
name = decodeURIComponent(pair[0]);
value = decodeURIComponent(pair[1]);
if(value!=null && value==='true'){
value=true;
}else if(value==='false'){
value=false;
}
if (overwrite !== true) {
if (typeof obj[name] == "undefined") {
obj[name] = value
} else {
if (typeof obj[name] == "string") {
obj[name] = [obj[name]];
obj[name].push(value)
} else {
obj[name].push(value)
}
}
} else {
obj[name] = value
}
}
return obj;
}
function onMessage(message){
var result = JSON.parse(message);
console.log('message :',message);
if(result && result.command && result.command==='edit')
{
if(editorImage==null){
img_create(result.url,'','');
}
imageUrl = result.url;
saveUrl = result.saveUrl;
title = result.title;
format = result.format;
}
}
function sendMessage(message)
{
xdmSocket.postMessage(JSON.stringify(message));
}
function init (){
return;
var inUrl = '' + window.location.href;
console.log('init url ' + inUrl);
//http://localhost/projects/x4mm/Code/xapp/xcf/?debug=true&run=run-release-debug&protocols=true&xideve=true&drivers=true&plugins=false&xblox=debug&files=true&dijit=debug&xdocker=debug&xfile=debug&davinci=debug&dgrid=debug&xgrid=debug&xace=debug&wcDocker=debug
if(!inUrl){
console.error('invalid');
//http://localhost/projects/x4mm/Code/xapp/xcf/?debug=true&run=run-release-debug&protocols=true&xideve=true&drivers=true&plugins=false&xblox=debug&files=true&dijit=debug&xdocker=debug&xfile=debug&davinci=debug&dgrid=debug&xgrid=debug&xace=debug&wcDocker=debug
}
var parameterString = '' ;
function base64_decode (encodedData) {
if (typeof window !== 'undefined') {
if (typeof window.atob !== 'undefined') {
return decodeURIComponent(escape(window.atob(encodedData)))
}
} else {
return new Buffer(encodedData, 'base64').toString('utf-8')
}
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/='
var o1
var o2
var o3
var h1
var h2
var h3
var h4
var bits
var i = 0
var ac = 0
var dec = ''
var tmpArr = []
if (!encodedData) {
return encodedData
}
encodedData += ''
do {
// unpack four hexets into three octets using index points in b64
h1 = b64.indexOf(encodedData.charAt(i++))
h2 = b64.indexOf(encodedData.charAt(i++))
h3 = b64.indexOf(encodedData.charAt(i++))
h4 = b64.indexOf(encodedData.charAt(i++))
bits = h1 << 18 | h2 << 12 | h3 << 6 | h4
o1 = bits >> 16 & 0xff
o2 = bits >> 8 & 0xff
o3 = bits & 0xff
if (h3 === 64) {
tmpArr[ac++] = String.fromCharCode(o1)
} else if (h4 === 64) {
tmpArr[ac++] = String.fromCharCode(o1, o2)
} else {
tmpArr[ac++] = String.fromCharCode(o1, o2, o3)
}
} while (i < encodedData.length)
dec = tmpArr.join('')
return decodeURIComponent(escape(dec.replace(/\0+$/, '')))
}
function base64_encode(data) {
// From: http://phpjs.org/functions
// + original by: Tyler Akins (http://rumkin.com)
// + improved by: Bayron Guevara
// + improved by: Thunder.m
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Pellentesque Malesuada
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Rafał Kukawski (http://kukawski.pl)
// * example 1: base64_encode('Kevin van Zonneveld');
// * returns 1: 'S2V2aW4gdmFuIFpvbm5ldmVsZA=='
// mozilla has this native
// - but breaks in 2.0.0.12!
//if (typeof this.window.btoa === 'function') {
// return btoa(data);
//}
var b64 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=';
var o1, o2, o3, h1, h2, h3, h4, bits, i = 0,
ac = 0,
enc = '',
tmp_arr = [];
if (!data) {
return data;
}
do { // pack three octets into four hexets
o1 = data.charCodeAt(i++);
o2 = data.charCodeAt(i++);
o3 = data.charCodeAt(i++);
bits = o1 << 16 | o2 << 8 | o3;
h1 = bits >> 18 & 0x3f;
h2 = bits >> 12 & 0x3f;
h3 = bits >> 6 & 0x3f;
h4 = bits & 0x3f;
// use hexets to index into b64, and append result to encoded string
tmp_arr[ac++] = b64.charAt(h1) + b64.charAt(h2) + b64.charAt(h3) + b64.charAt(h4);
} while (i < data.length);
enc = tmp_arr.join('');
var r = data.length % 3;
return (r ? enc.slice(0, r - 3) : enc) + '==='.slice(r || 3);
}
if(inUrl.lastIndexOf('?')){
parameterString = inUrl.substring(inUrl.lastIndexOf('?')+1,inUrl.length);
var urlParameters=urlDecode(parameterString);
var target =urlParameters.xdmTarget;
if(!target || target && target=='undefined'){
return;
}
if(target.indexOf('http:')==-1){
target = base64_decode(target);
}
target=decodeURIComponent(target);
//http://localhost/projects/x4mm/Control-Freak-Documentation/daux/Getting_Started?xdmTarget=http%3A%2F%2Flocalhost%2Fprojects%2Fx4mm%2FCode%2Fxapp%2Fxcf%2F%3Fdebug%3Dtrue%26run%3Drun-release-debug%26protocols%3Dtrue%26xideve%3Dtrue%26drivers%3Dtrue%26plugins%3Dfalse%26xblox%3Ddebug%26files%3Dtrue%26dijit%3Ddebug%26xdocker%3Ddebug%26xfile%3Ddebug%26davinci%3Ddebug%26dgrid%3Ddebug%26xgrid%3Ddebug%26xace%3Ddebug%26wcDocker%3Ddebug&xdm_e=http%3A%2F%2Flocalhost%2Fprojects%2Fx4mm%2FCode%2Fxapp%2Fxcf%2F&xdm_c=default9743&xdm_p=4
//console.error('creating socket to '+target);
xdmSocket = new easyXDM.Socket({
remote: "" + target,
onMessage:function (message, origin)
{
onMessage(message);
}
});
//console.error('xdmtarge = ' + target);
//var newUrl = + encodeURIComponent('' + window.location.href);
if(target && target!=='undefined' && target.length) {
$(function () {
$('a').each(function () {
var cUrl = $(this).attr('href');
var bindStr = '?';
if (cUrl && cUrl.indexOf('xdmTarget') == -1) {
if (cUrl.indexOf('?') != -1) {
bindStr = '&';
}
var newUrl = cUrl + bindStr + 'xdmTarget=' + base64_encode(target);
//console.log('new url ' + newUrl);
//$(this).attr('href', newUrl);
}
});
});
}
}
}
document.onreadystatechange = function () {
if(typeof easyXDM !=='undefined') {
var state = document.readyState;
if (state == 'interactive') {
} else if (state == 'complete') {
init();
}
}else{
console.error('easy xdm not defined');
}
}
</script>
<!-- Font -->
<!-- CSS -->
<link href='../themes/mytheme/css/theme-blue.min.css' rel='stylesheet' type='text/css'><link href='../admin-theme/bower_components/font-awesome/css/font-awesome.min.css' rel='stylesheet' type='text/css'><link href='../admin-theme/html-white/dist/css/application.css' rel='stylesheet' type='text/css'><link href='../themes/mytheme/css/bootstrap-override-white.css' rel='stylesheet' type='text/css'>
<!-- Tipue Search -->
<link href="../tipuesearch/tipuesearch.css" rel="stylesheet">
<!--[if lt IE 9]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class=" xTheme xTheme-white">
<header class="Navbar hidden-print">
<a class="Navbar__brand" href="../index.html">Control-Freak</a>
<div class="Search">
<svg class="Search__icon" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 451 451"><path d="M447.05 428l-109.6-109.6c29.4-33.8 47.2-77.9 47.2-126.1C384.65 86.2 298.35 0 192.35 0 86.25 0 .05 86.3.05 192.3s86.3 192.3 192.3 192.3c48.2 0 92.3-17.8 126.1-47.2L428.05 447c2.6 2.6 6.1 4 9.5 4s6.9-1.3 9.5-4c5.2-5.2 5.2-13.8 0-19zM26.95 192.3c0-91.2 74.2-165.3 165.3-165.3 91.2 0 165.3 74.2 165.3 165.3s-74.1 165.4-165.3 165.4c-91.1 0-165.3-74.2-165.3-165.4z"/></svg>
<input type="search" id="tipue_search_input" class="Search__field" placeholder="Search..." autocomplete="on" results=25 autosave=text_search>
</div>
</header>
<div class="Columns content">
<aside class="Columns__left Collapsible">
<div class="Collapsible__container">
<button type="button" class="Button Collapsible__trigger">
<span class="Collapsible__trigger--bar"></span>
<span class="Collapsible__trigger--bar"></span>
<span class="Collapsible__trigger--bar"></span>
</button>
</div>
<div class="Collapsible__content">
<!-- Navigation -->
<ul class='Nav'><li class='Nav__item '><a href="../Getting_Started.html">Getting Started</a></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Installation</a><ul class='Nav'><li class='Nav__item '><a href="../Installation/Windows.html">Windows</a></li><li class='Nav__item '><a href="../Installation/Linux.html">Linux</a></li><li class='Nav__item '><a href="../Installation/Raspberry-PI.html">Raspberry-PI</a></li><li class='Nav__item '><a href="../Installation/OSX.html">OSX</a></li><li class='Nav__item has-children'><a href="../Installation/WEB/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>WEB</a><ul class='Nav'><li class='Nav__item '><a href="../Installation/WEB/Requirements.html">Requirements</a></li></ul></li></ul></li><li class='Nav__item has-children'><a href="../Interface_Designer/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Interface Designer</a><ul class='Nav'><li class='Nav__item '><a href="../Interface_Designer/Guide.html">Guide</a></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Examples</a><ul class='Nav'><li class='Nav__item '><a href="../Interface_Designer/Examples/Button_Group.html">Button Group</a></li><li class='Nav__item '><a href="../Interface_Designer/Examples/States.html">States</a></li></ul></li><li class='Nav__item '><a href="../Interface_Designer/States.html">States</a></li><li class='Nav__item '><a href="../Interface_Designer/VariableStates.html">VariableStates</a></li><li class='Nav__item has-children'><a href="../Interface_Designer/Widgets/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Widgets</a><ul class='Nav'><li class='Nav__item '><a href="../Interface_Designer/Widgets/Accordion.html">deliteful/Accordion</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Button.html">deliteful/Button</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/channelBreakpoints.html">deliteful/channelBreakpoints</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Checkbox.html">deliteful/Checkbox</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Combobox.html">deliteful/Combobox</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/features.html">deliteful/features</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/LinearLayout.html">deliteful/LinearLayout</a></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>list</a><ul class='Nav'><li class='Nav__item '><a href="../Interface_Designer/Widgets/list/List.html">deliteful/list/List</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/list/PageableList.html">deliteful/list/PageableList</a></li></ul></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Panel.html">deliteful/Panel</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ProgressBar.html">deliteful/ProgressBar</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ProgressIndicator.html">deliteful/ProgressIndicator</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/RadioButton.html">deliteful/RadioButton</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ResponsiveColumns.html">deliteful/ResponsiveColumns</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ScrollableContainer.html">deliteful/ScrollableContainer</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Select.html">deliteful/Select</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/SidePane.html">deliteful/SidePane</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Slider.html">deliteful/Slider</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/StarRating.html">deliteful/StarRating</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/styling.html">styling</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/SwapView.html">deliteful/SwapView</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Switch.html">deliteful/Switch</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/Toaster.html">deliteful/Toaster</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ToggleButton.html">deliteful/ToggleButton</a></li><li class='Nav__item has-children'><a href="../Interface_Designer/Widgets/tutorial/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>tutorial</a><ul class='Nav'><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part1GettingStarted.html">Deliteful Tutorial Part 1</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part2QuickLook.html">Deliteful Tutorial Part 2</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part3PhotoFeedApp.html">Deliteful Tutorial Part 3</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part4ListView.html">Deliteful Tutorial Part 4</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part5CustomRenderer.html">Deliteful Tutorial Part 5</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part6DetailsView.html">Deliteful Tutorial Part 6</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part7SettingsView.html">Deliteful Tutorial Part 7</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/tutorial/Part8Build.html">Deliteful Tutorial Part 8</a></li></ul></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ViewIndicator.html">deliteful/ViewIndicator</a></li><li class='Nav__item '><a href="../Interface_Designer/Widgets/ViewStack.html">deliteful/ViewStack</a></li></ul></li></ul></li><li class='Nav__item has-children'><a href="../Driver/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Driver</a><ul class='Nav'><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Code Examples</a><ul class='Nav'><li class='Nav__item '><a href="../Driver/Code_Examples/Expressions.html">Expressions</a></li><li class='Nav__item '><a href="../Driver/Code_Examples/Variable_Changes.html">Variable Changes</a></li></ul></li><li class='Nav__item has-children'><a href="../Driver/Built-In/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Built-In</a><ul class='Nav'><li class='Nav__item '><a href="../Driver/Built-In/VLC.html">VLC</a></li></ul></li><li class='Nav__item '><a href="../Driver/Guide.html">Guide</a></li><li class='Nav__item '><a href="../Driver/API.html">API</a></li><li class='Nav__item '><a href="../Driver/Editors.html">Editors</a></li><li class='Nav__item '><a href="../Driver/Debugging.html">Debugging</a></li><li class='Nav__item '><a href="../Driver/Intern.html">Intern</a></li><li class='Nav__item has-children'><a href="../Driver/Fiddle/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Fiddle</a><ul class='Nav'><li class='Nav__item '><a href="../Driver/Fiddle/Blocks_Example.html">Blocks Example</a></li><li class='Nav__item '><a href="../Driver/Fiddle/Blocks_Template.html">Blocks Template</a></li></ul></li></ul></li><li class='Nav__item Nav__item--open'><a href="../Protocols/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Protocols</a><ul class='Nav'></ul></li><li class='Nav__item has-children'><a href="../Blocks/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Blocks</a><ul class='Nav'><li class='Nav__item '><a href="../Blocks/Command.html">Command</a></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Events</a><ul class='Nav'><li class='Nav__item '><a href="../Blocks/Events/OnEvent.html">OnEvent</a></li></ul></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>File</a><ul class='Nav'><li class='Nav__item '><a href="../Blocks/File/ReadJSON.html">ReadJSON</a></li></ul></li></ul></li><li class='Nav__item '><a href="../Exporter/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Exporter</a><ul class='Nav'></ul></li><li class='Nav__item '><a href="../Device_Server/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Device Server</a><ul class='Nav'></ul></li><li class='Nav__item '><a href="../Tutorials/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Tutorials</a><ul class='Nav'></ul></li><li class='Nav__item '><a href="../Raspberry_PI/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Raspberry PI</a><ul class='Nav'></ul></li><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Resources</a><ul class='Nav'><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>Software</a><ul class='Nav'><li class='Nav__item has-children'><a href="#" class="aj-nav folder"><i class="Nav__arrow">&nbsp;</i>MQTT</a><ul class='Nav'><li class='Nav__item '><a href="../Resources/Software/MQTT/Software.html">Software</a></li><li class='Nav__item '><a href="../Resources/Software/MQTT/Architecture.html">Architecture</a></li></ul></li><li class='Nav__item '><a href="../Resources/Software/Tools/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Tools</a><ul class='Nav'></ul></li></ul></li><li class='Nav__item '><a href="../Resources/Utils_API/index.html" class="folder"><i class="Nav__arrow">&nbsp;</i>Utils API</a><ul class='Nav'></ul></li></ul></li></ul>
<div class="Links">
</div>
</div>
</aside>
<div class="Columns__right ">
<div class="Columns__right__content">
<div class="doc_content">
<article class="Page">
<div class="Page__header">
<h1><a href="../Protocols/index.html">Protocols</a></h1>
<span style="float: right; font-size: 10px; color: gray;">
<a href="https://github.com/net-commander/net-commander-documentation/blob/master/docFiles/13_Protocols/_index.md" target="_blank">Edit on GitHub</a>
</span>
</div>
<div class="s-content">
<h3 id="page_Device_Protocols">Device Protocols</h3>
<h2 id="page_Index">Index</h2>
<p><a href="#tcp" name="source">1. TCP</a><br/>
<a href="#udp" name="source">2. UDP</a><br/>
<a href="#serial" name="source">3. Serial</a><br/>
<a href="#ssh" name="source">4. SSH</a><br/>
<a href="#driver" name="source">5. Driver</a><br/>
<a href="#mqtt" name="source">6. MQTT</a><br/></p>
<hr/>
<h2 id="page_1_TCP"><a href="#tcp">1. TCP</a></h2>
<p><strong>Device Network Options</strong></p>
<pre><code class="language-js">{
fd: null,
allowHalfOpen: false,
readable: false,
writable: false
}
</code></pre>
<p><code>fd</code> allows you to specify the existing file descriptor of socket.
Set <code>readable</code> and/or <code>writable</code> to <code>true</code> to allow reads and/or writes on this
socket (NOTE: Works only when <code>fd</code> is passed).
About <code>allowHalfOpen</code>, refer to <code>createServer()</code> and <code>'end'</code> event.</p>
<p><strong>Node-JS Module:</strong> <a href="https://nodejs.org/api/net.html#net_class_net_socket" class="external">net.Socket</a></p>
<p><strong>Node-JS Module - Documentation:</strong> <a href="https://raw.githubusercontent.com/nodejs/node/master/doc/api/net.markdown" class="external">here</a></p>
<p><strong>Node-JS Wrapper:</strong> nxapp/protocol/TCP</p>
<h2 id="page_2_UDP"><a href="#udp">2. UDP</a></h2>
<p><strong>Device Network Options</strong></p>
<ul>
<li>
<code>server</code>: <code>false</code> Set to true to create a server. It needs the following 2 options specified as well:</li>
<li>
<code>ip</code>: <code>129.168.1.1</code> The ip address to bind the server.</li>
<li>
<code>port</code>: <code>9999</code> The port to bind the server.</li>
</ul>
<p><strong>Node-JS Module:</strong> <a href="https://nodejs.org/api/dgram.html" class="external">net.Socket</a></p>
<p><strong>Node-JS Module - Documentation:</strong> <a href="https://github.com/nodejs/node/blob/master/doc/api/dgram.markdown" class="external">here</a></p>
<p><strong>Node-JS Wrapper:</strong> nxapp/protocol/UDP</p>
<p><strong>Client &amp; Server example:</strong> <a href="http://www.hacksparrow.com/node-js-udp-server-and-client-example.html" class="external">here</a></p>
<h2 id="page_3_Serial"><a href="#serial">3. Serial</a></h2>
<p><strong>Device Network Options</strong></p>
<ul>
<li>
<code>baudrate</code> Baud Rate, defaults to 9600. Should be one of: 115200, 57600, 38400, 19200, 9600, 4800, 2400, 1800, 1200, 600, 300, 200, 150, 134, 110, 75, or 50. Custom rates as allowed by hardware is supported.</li>
<li>
<code>databits</code> Data Bits, defaults to 8. Must be one of: 8, 7, 6, or 5.</li>
<li>
<code>stopbits</code> Stop Bits, defaults to 1. Must be one of: 1 or 2.</li>
<li>
<code>parity</code> Parity, defaults to 'none'. Must be one of: 'none', 'even', 'mark', 'odd', 'space'</li>
<li>
<code>rtscts</code> defaults to false</li>
<li>
<code>xon</code> defaults to false</li>
<li>
<code>xoff</code> defaults to false</li>
<li>
<code>xany</code> defaults to false</li>
<li>
<code>flowControl</code> <code>true</code> for <code>rtscts</code> or an array with one or more of the following strings to enable them <code>xon</code>, <code>xoff</code>, <code>xany</code>, <code>rtscts</code>. Overwrites any individual settings.</li>
<li>
<code>bufferSize</code> Size of read buffer, defaults to 65536. Must be an integer value.</li>
<li>
<code>parser</code> The parser engine to use with read data, defaults to rawPacket strategy which just emits the raw buffer as a &quot;data&quot; event. Can be any function that accepts EventEmitter as first parameter and the raw buffer as the second parameter. Defaults to &quot;raw&quot;.</li>
<li>
<code>platformOptions</code> - sets platform specific options, see below.</li>
</ul>
<p><strong>Node-JS Module:</strong> <a href="https://github.com/voodootikigod/node-serialport" class="external">serialport</a></p>
<p><strong>Node-JS Wrapper:</strong> nxapp/protocol/Serial</p>
<h2 id="page_4_SSH"><a href="#ssh">4. SSH</a></h2>
<p><strong>Device Network Options</strong></p>
<p><strong>host</strong> - <em>string</em> - Hostname or IP address of the server. <strong>Default:</strong> <code>'localhost'</code></p>
<p><strong>port</strong> - <em>integer</em> - Port number of the server. <strong>Default:</strong> <code>22</code></p>
<p><strong>forceIPv4</strong> - <em>boolean</em> - Only connect via resolved IPv4 address for <code>host</code>. <strong>Default:</strong> <code>false</code></p>
<p><strong>forceIPv6</strong> - <em>boolean</em> - Only connect via resolved IPv6 address for <code>host</code>. <strong>Default:</strong> <code>false</code></p>
<p><strong>hostHash</strong> - <em>string</em> - 'md5' or 'sha1'. The host's key is hashed using this method and passed to the <strong>hostVerifier</strong> function. <strong>Default:</strong> (none)</p>
<p><strong>hostVerifier</strong> - <em>function</em> - Function with parameters <code>(hashedKey[, callback])</code> where <code>hashedKey</code> is a string hex hash of the host's key for verification purposes. Return <code>true</code> to continue with the handshake or <code>false</code> to reject and disconnect, or call <code>callback()</code> with <code>true</code> or <code>false</code> if you need to perform asynchronous verification. <strong>Default:</strong> (auto-accept if <code>hostVerifier</code> is not set)</p>
<p><strong>username</strong> - <em>string</em> - Username for authentication. <strong>Default:</strong> (none)</p>
<p><strong>password</strong> - <em>string</em> - Password for password-based user authentication. <strong>Default:</strong> (none)</p>
<p><strong>agent</strong> - <em>string</em> - Path to ssh-agent's UNIX socket for ssh-agent-based user authentication. <strong>Windows users: set to 'pageant' for authenticating with Pageant or (actual) path to a cygwin &quot;UNIX socket.&quot;</strong> <strong>Default:</strong> (none)</p>
<p><strong>agentForward</strong> - <em>boolean</em> - Set to <code>true</code> to use OpenSSH agent forwarding (<code>auth-agent@openssh.com</code>) for the life of the connection. <code>agent</code> must also be set to use this feature. <strong>Default:</strong> <code>false</code></p>
<p><strong>privateKey</strong> - <em>mixed</em> - <em>Buffer</em> or <em>string</em> that contains a private key for either key-based or hostbased user authentication (OpenSSH format). <strong>Default:</strong> (none)</p>
<p><strong>passphrase</strong> - <em>string</em> - For an encrypted private key, this is the passphrase used to decrypt it. <strong>Default:</strong> (none)</p>
<p><strong>localHostname</strong> - <em>string</em> - Along with <strong>localUsername</strong> and <strong>privateKey</strong>, set this to a non-empty string for hostbased user authentication. <strong>Default:</strong> (none)</p>
<p><strong>localUsername</strong> - <em>string</em> - Along with <strong>localHostname</strong> and <strong>privateKey</strong>, set this to a non-empty string for hostbased user authentication. <strong>Default:</strong> (none)</p>
<p><strong>tryKeyboard</strong> - <em>boolean</em> - Try keyboard-interactive user authentication if primary user authentication method fails. If you set this to <code>true</code>, you need to handle the <code>keyboard-interactive</code> event. <strong>Default:</strong> <code>false</code></p>
<p><strong>keepaliveInterval</strong> - <em>integer</em> - How often (in milliseconds) to send SSH-level keepalive packets to the server (in a similar way as OpenSSH's ServerAliveInterval config option). Set to 0 to disable. <strong>Default:</strong> <code>0</code></p>
<p><strong>keepaliveCountMax</strong> - <em>integer</em> - How many consecutive, unanswered SSH-level keepalive packets that can be sent to the server before disconnection (similar to OpenSSH's ServerAliveCountMax config option). <strong>Default:</strong> <code>3</code></p>
<p><strong>readyTimeout</strong> - <em>integer</em> - How long (in milliseconds) to wait for the SSH handshake to complete. <strong>Default:</strong> <code>20000</code></p>
<p><strong>sock</strong> - <em>ReadableStream</em> - A <em>ReadableStream</em> to use for communicating with the server instead of creating and using a new TCP connection (useful for connection hopping).</p>
<p><strong>strictVendor</strong> - <em>boolean</em> - Performs a strict server vendor check before sending vendor-specific requests, etc. (e.g. check for OpenSSH server when using <code>openssh_noMoreSessions()</code>) <strong>Default:</strong> <code>true</code></p>
<p><strong>algorithms</strong> - <em>object</em> - This option allows you to explicitly override the default transport layer algorithms used for the connection. Each value must be an array of valid algorithms for that category. The order of the algorithms in the arrays are important, with the most favorable being first. For a list of valid and default algorithm names, please review the documentation for the version of <code>ssh2-streams</code> used by this module. Valid keys:</p>
<pre><code>**kex** - _array_ - Key exchange algorithms.
**cipher** - _array_ - Ciphers.
**serverHostKey** - _array_ - Server host key formats.
**hmac** - _array_ - (H)MAC algorithms.
**compress** - _array_ - Compression algorithms.
</code></pre>
<p><strong>compress</strong> - <em>mixed</em> - Set to <code>true</code> to enable compression if server supports it, <code>'force'</code> to force compression (disconnecting if server does not support it), or <code>false</code> to explicitly opt out of compression all of the time. Note: this setting is overridden when explicitly setting a compression algorithm in the <code>algorithms</code> configuration option. <strong>Default:</strong> (only use compression if that is only what the server supports)</p>
<p><strong>debug</strong> - <em>function</em> - Set this to a function that receives a single string argument to get detailed (local) debug information. <strong>Default:</strong> (none)</p>
<p><strong>Authentication method priorities:</strong> Password -&gt; Private Key -&gt; Agent (-&gt; keyboard-interactive if <code>tryKeyboard</code> is <code>true</code>) -&gt; Hostbased -&gt; None</p>
<p><strong>exec</strong>(&lt; <em>string</em> &gt;command[, &lt; <em>object</em> &gt;options], &lt; <em>function</em> &gt;callback) - <em>boolean</em> - Executes <code>command</code> on the server. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>Channel</em> &gt;stream. Valid <code>options</code> properties are:</p>
<p><strong>env</strong> - <em>object</em> - An environment to use for the execution of the command.</p>
<p><strong>pty</strong> - <em>mixed</em> - Set to <code>true</code> to allocate a pseudo-tty with defaults, or an object containing specific pseudo-tty settings (see 'Pseudo-TTY settings'). Setting up a pseudo-tty can be useful when working with remote processes that expect input from an actual terminal (e.g. sudo's password prompt).</p>
<p><strong>x11</strong> - <em>mixed</em> - Set to <code>true</code> to use defaults below, set to a number to specify a specific screen number, or an object with the following valid properties:</p>
<pre><code>**single** - _boolean_ - Allow just a single connection? **Default:** `false`
**screen** - _number_ - Screen number to use **Default:** `0`
</code></pre>
<p><strong>shell</strong>([[&lt; <em>mixed</em> &gt;window,] &lt; <em>object</em> &gt;options]&lt; <em>function</em> &gt;callback) - <em>boolean</em> - Starts an interactive shell session on the server, with an optional <code>window</code> object containing pseudo-tty settings (see 'Pseudo-TTY settings'). If <code>window === false</code>, then no pseudo-tty is allocated. <code>options</code> supports the <code>x11</code> option as described in exec(). <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>Channel</em> &gt;stream. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>forwardIn</strong>(&lt; <em>string</em> &gt;remoteAddr, &lt; <em>integer</em> &gt;remotePort, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - Bind to <code>remoteAddr</code> on <code>remotePort</code> on the server and forward incoming TCP connections. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>integer</em> &gt;port (<code>port</code> is the assigned port number if <code>remotePort</code> was 0). Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic. Here are some special values for <code>remoteAddr</code> and their associated binding behaviors:</p>
<p>'' - Connections are to be accepted on all protocol families supported by the server.</p>
<p>'0.0.0.0' - Listen on all IPv4 addresses.</p>
<p>'::' - Listen on all IPv6 addresses.</p>
<p>'localhost' - Listen on all protocol families supported by the server on loopback addresses only.</p>
<p>'127.0.0.1' and '::1' - Listen on the loopback interfaces for IPv4 and IPv6, respectively.</p>
<p><strong>unforwardIn</strong>(&lt; <em>string</em> &gt;remoteAddr, &lt; <em>integer</em> &gt;remotePort, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - Unbind from <code>remoteAddr</code> on <code>remotePort</code> on the server and stop forwarding incoming TCP connections. Until <code>callback</code> is called, more connections may still come in. <code>callback</code> has 1 parameter: &lt; <em>Error</em> &gt;err. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>forwardOut</strong>(&lt; <em>string</em> &gt;srcIP, &lt; <em>integer</em> &gt;srcPort, &lt; <em>string</em> &gt;dstIP, &lt; <em>integer</em> &gt;dstPort, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - Open a connection with <code>srcIP</code> and <code>srcPort</code> as the originating address and port and <code>dstIP</code> and <code>dstPort</code> as the remote destination address and port. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>Channel</em> &gt;stream. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>sftp</strong>(&lt; <em>function</em> &gt;callback) - <em>boolean</em> - Starts an SFTP session. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>SFTPStream</em> &gt;sftp. For methods available on <code>sftp</code>, see the <a href="https://github.com/mscdex/ssh2-streams/blob/master/SFTPStream.md" class="external"><code>SFTPStream</code> client documentation</a> (except <code>read()</code> and <code>write()</code> are used instead of <code>readData()</code> and <code>writeData()</code> respectively, for convenience). Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>subsys</strong>(&lt; <em>string</em> &gt;subsystem, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - Invokes <code>subsystem</code> on the server. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>Channel</em> &gt;stream. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>openssh_noMoreSessions</strong>(&lt; <em>function</em> &gt;callback) - <em>boolean</em> - OpenSSH extension that sends a request to reject any new sessions (e.g. exec, shell, sftp, subsys) for this connection. <code>callback</code> has 1 parameter: &lt; <em>Error</em> &gt;err. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>openssh_forwardInStreamLocal</strong>(&lt; <em>string</em> &gt;socketPath, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - OpenSSH extension that binds to a UNIX domain socket at <code>socketPath</code> on the server and forwards incoming connections. <code>callback</code> has 1 parameter: &lt; <em>Error</em> &gt;err. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>openssh_unforwardInStreamLocal</strong>(&lt; <em>string</em> &gt;socketPath, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - OpenSSH extension that unbinds from a UNIX domain socket at <code>socketPath</code> on the server and stops forwarding incoming connections. <code>callback</code> has 1 parameter: &lt; <em>Error</em> &gt;err. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>openssh_forwardOutStreamLocal</strong>(&lt; <em>string</em> &gt;socketPath, &lt; <em>function</em> &gt;callback) - <em>boolean</em> - OpenSSH extension that opens a connection to a UNIX domain socket at <code>socketPath</code> on the server. <code>callback</code> has 2 parameters: &lt; <em>Error</em> &gt;err, &lt; <em>Channel</em> &gt;stream. Returns <code>false</code> if you should wait for the <code>continue</code> event before sending any more traffic.</p>
<p><strong>Node-JS Module - Documentation:</strong> <a href="https://raw.githubusercontent.com/mscdex/ssh2/master/README.md" class="external">here</a></p>
<p><strong>Node-JS Module:</strong> <a href="https://github.com/mscdex/ssh2" class="external">ssh2</a></p>
<h2 id="page_5_Driver"><a href="#driver">5. Driver</a></h2>
<p>This protocol will simply re-route to the Javascript file created for the Driver. For instance, you created a Driver called
&quot;My Driver&quot;, then driver will run the node module : ./My Driver.js</p>
<p><strong>Device Network Options</strong> Custom</p>
<pre><code class="language-js">{
driver: './DriverName.js'
}
</code></pre>
<p><strong>driver</strong> Optional, this defaults to <em>DRIVER LOCATION / My Driver Name.js</em>. Otherwise, its relative to the driver's location.</p>
<p><strong>Node-JS Module:</strong> nxapp/protocols/Driver</p>
<p><strong>Example:</strong> <a href="https://github.com/net-commander/default-workspace/blob/master/system/drivers/Arduino/Arduino.js" class="external">Arduino - Johnny Five Driver File</a></p>
<h2 id="page_6_MQTT"><a href="#mqtt">6. MQTT</a></h2>
<p><strong>Device Network Options</strong></p>
<p>Defaults:</p>
<ul>
<li>
<code>keepalive</code>: <code>10</code> seconds, set to <code>0</code> to disable</li>
<li>
<code>reschedulePings</code>: reschedule ping messages after sending packets (default <code>true</code>)</li>
<li>
<code>clientId</code>: <code>'mqttjs_' + Math.random().toString(16).substr(2, 8)</code>
</li>
<li>
<code>protocolId</code>: <code>'MQTT'</code>
</li>
<li>
<code>protocolVersion</code>: <code>4</code>
</li>
<li>
<code>clean</code>: <code>true</code>, set to false to receive QoS 1 and 2 messages while offline</li>
<li>
<code>reconnectPeriod</code>: <code>1000</code> milliseconds, interval between two reconnections</li>
<li>
<code>connectTimeout</code>: <code>30 * 1000</code> milliseconds, time to wait before a CONNACK is received</li>
<li>
<code>username</code>: the username required by your broker, if any</li>
<li>
<code>password</code>: the password required by your broker, if any</li>
<li>
<code>incomingStore</code>: a <a href="#store">Store</a> for the incoming packets</li>
<li>
<code>outgoingStore</code>: a <a href="#store">Store</a> for the outgoing packets</li>
<li>
<code>will</code>: a message that will sent by the broker automatically when the client disconnect badly. The format is:
<ul>
<li>
<code>topic</code>: the topic to publish</li>
<li>
<code>payload</code>: the message to publish</li>
<li>
<code>qos</code>: the QoS</li>
<li>
<code>retain</code>: the retain flag</li>
</ul>
</li>
</ul>
<p><strong>Node-JS Module:</strong> <a href="https://github.com/mqttjs/MQTT.js" class="external">mqtt</a></p>
<p><strong>Node-JS Wrapper:</strong> nxapp/protocol/MQTT</p>
</div>
<nav>
<ul class="Pager">
<li class=Pager--prev><a href="../Driver/Fiddle/Blocks_Template.html">Previous</a></li> <li class=Pager--next><a href="../Blocks/index.html">Next</a></li> </ul>
</nav>
</article>
</div>
</div>
</div>
</div>
<!-- jQuery -->
<script src="../themes/daux/js/jquery-1.11.3.min.js"></script>
<!-- hightlight.js -->
<script src="../themes/daux/js/highlight.pack.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
<!-- JS -->
<script src="../admin-theme/bower_components/bootstrap-sass-official/assets/javascripts/bootstrap.js"></script>
<script src="../themes/daux/js/daux.js"></script>
<!-- Tipue Search -->
<script type="text/javascript" src="../tipuesearch/tipuesearch.js"></script>
<script>
window.onunload = function(){}; // force $(document).ready to be called on back/forward navigation in firefox
$(function() {
tipuesearch({
'base_url': '../'
});
});
</script>
</body>
</html>