Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: oldheating gps motorhome heating
base/net/web-net-script.inc
- Committer:
- andrewboyson
- Date:
- 2020-03-11
- Revision:
- 132:5b2df69a4f17
- Child:
- 133:98c6bf14bc37
File content as of revision 132:5b2df69a4f17:
"//Net script\n" "'use strict';\n" "\n" "let mac = '';\n" "let tcp = '';\n" "\n" "function parseTcpLine(line)\n" "{\n" " if (line.length == 0) return;\n" " let fields = line.split('\\t');\n" " let minutes = parseInt(fields[0], 16) / 1000 / 60;\n" " let ipType = parseInt(fields[1], 16);\n" " let arIndex = parseInt(fields[2], 16);\n" " let locPort = parseInt(fields[3], 16);\n" " \n" " \n" " tcp += Math.floor(minutes).toString().padStart(4, ' ');\n" " tcp += ' ';\n" " \n" " if (ipType == 0x0800) tcp += \"IPv4\"; \n" " else if (ipType == 0x86DD) tcp += \"IPv6\";\n" " else tcp += fields[1];\n" " tcp += ' ';\n" " \n" " tcp += arIndex.toString(); \n" " tcp += ' ';\n" " \n" " tcp += locPort.toString(); \n" " tcp += '\\r\\n';\n" "}\n" "function parseTcpLines(text)\n" "{\n" " tcp = '';\n" " text.split('\\n').forEach(parseTcpLine);\n" "}\n" "function parseGenLines(text)\n" "{\n" " let lines = text.split('\\n');\n" " mac = Net.makeMac(lines[ 0]);\n" "}\n" "function parse()\n" "{\n" " let topics = Ajax.response.split('\\f');\n" " parseGenLines(topics[0]);\n" " parseTcpLines(topics[1]);\n" "}\n" "function display()\n" "{\n" " let elem;\n" "\n" " elem = Ajax.getElementOrNull('ajax-tcp' ); if (elem) elem.textContent = tcp;\n" " elem = Ajax.getElementOrNull('ajax-mac' ); if (elem) elem.textContent = mac;\n" "}\n" "\n" "Ajax.server = '/net-ajax';\n" "Ajax.onResponse = function() { parse(); display(); };\n" "Ajax.init();\n" ""