Subversion Repositories f9daq

Compare Revisions

No changes between revisions

Ignore whitespace Rev 243 → Rev 244

/cvi/RedPitaya/sockserv/etc/systemd/system/redpitaya_tcpsocket.service
0,0 → 1,21
[Unit]
Description=TCP socket server for binary transfers of waveforms on Red Pitaya
After=network.target
 
[Service]
Type=simple
Restart=always
#PIDFile=/var/run/redpitaya_scpi.pid
# TODO: it should be possible to use EnvironmentFile, but it is not working properly
# complains about failing library path, or something else
#EnvironmentFile=/etc/sysconfig/redpitaya
Environment=PATH_REDPITAYA=/opt/redpitaya
Environment=LD_LIBRARY_PATH=/opt/redpitaya/lib PATH=/sbin:/usr/sbin:/bin:/usr/bin:/opt/redpitaya/sbin:/opt/redpitaya/bin
ExecStartPre=/bin/sh -c "cat /opt/redpitaya/fpga/fpga_0.94.bit > /dev/xdevcfg"
#ExecStart =/opt/redpitaya/bin/socket-server
ExecStart =/root/sockserv/sockserv
#ExecReload=
ExecStop =/bin/kill -15 $MAINPID
 
[Install]
WantedBy=multi-user.target
/cvi/RedPitaya/sockserv/www/apps/assets/desktop.js
0,0 → 1,260
//-------------------------------------------------
// Redpitaya desktop
// Created by Alexey Kaygorodov
//-------------------------------------------------
 
;
(function(Desktop, $) {
 
var applications = [];
 
var groups = [{
name: "System",
description: "System tools for configuring your Red Pitaya",
image: "../assets/images/system.png",
applications: ["updater", "wifi", "licmngr"]
}, {
name: "Development",
description: "Documentation, tutorials and a lot of interesting stuff",
image: "../assets/images/development.png",
applications: ["visualprogramming", "scpi", "tcpsocket", "tutorials", "fpga", "apis", "capps", "cmd", "hardwaredoc", "instructions", "github","activelearning"]
}];
var currentGroup = undefined;
 
Desktop.init = function() {
// Here's should be loading from custom user groups from Cookies
}
Desktop.save = function() {
// Here's should be saveing from custom user groups from Cookies
}
 
Desktop.getCurrentGroup = function() {
return currentGroup;
}
 
Desktop.setApplications = function(listOfapplications) {
applications = [];
$.extend(true, applications, listOfapplications);
var url_arr = window.location.href.split("/");
var url = url_arr[0] + '//' + url_arr[2] + '/';
 
for (var i = 0; i < default_applications.length; i++) {
if (default_applications[i].id == "marketplace")
default_applications[i].url = url + 'bazaar'
if (default_applications[i].url[0] == "/")
default_applications[i].url = window.location.origin + default_applications[i].url;
applications.push(default_applications[i]);
}
 
for (var i = 0; i < applications.length; i++) {
applications[i].group = checkApplicationInGroup(applications[i].id);
applications[i].is_group = false;
}
 
for (var i = 0; i < groups.length; i++) {
var gr = {
id: "",
name: groups[i].name,
description: groups[i].description,
url: "#",
image: groups[i].image,
check_online: false,
licensable: false,
callback: openGroup,
type: 'run',
group: "",
is_group: true
};
applications.push(gr);
}
applications.unshift(backButton);
Desktop.selectGroup();
}
 
var checkApplicationInGroup = function(app_id) {
for (var i = 0; i < groups.length; i++)
if (groups[i].applications.indexOf(app_id) != -1)
return groups[i].name;
return "";
}
 
var openGroup = function(key) {
Desktop.selectGroup(applications[+key].name);
}
 
var onBackButton = function() {
Desktop.selectGroup();
}
 
var placeElements = function() {
var elemWidth = $('.app-item').outerWidth(true);
var containerWidth = $('#list-container').width();
var elemsInRow = Math.floor(containerWidth / elemWidth);
elemsInRow = (elemsInRow == 0) ? 1 : elemsInRow;
 
var elemHeight = $('.app-item').outerHeight(true);
var containerHeight = $('#main-container').height();
var elemsInCol = Math.floor(containerHeight / elemHeight);
elemsInCol = (elemsInCol == 0) ? 1 : elemsInCol;
 
$("ul.paging").quickPager({
pageSize: elemsInRow * elemsInCol
});
}
 
var refillList = function() {
$('.app-item').unbind('click');
$('.app-item').unbind('mouseenter');
$('.app-item').unbind('mouseleave');
$('#main-container').empty();
$('#main-container').append('<ul class="paging" id="list-container"></ul>');
 
$('#list-container').empty();
for (var i = 0; i < applications.length; i++) {
if ((currentGroup === undefined && (applications[i].group == "" || applications[i].group === undefined)) || applications[i].group == currentGroup || i==0) {
var txt = '<li class="app-item" key="' + i + '" group="' + applications[i].group + '" style="display: none;">';
txt += '<a href="#" class="app-link"><div class="img-container"><img class="app-icon" src="' + applications[i]['image'] + '"></div><span class="app-name">' + applications[i]['name'] + '</span></a>';
txt += '</li>';
$('#list-container').append(txt);
}
}
 
$('.app-item').click(clickApp);
$('.app-item').mouseenter(overApp);
$('.app-item').mouseleave(leaveApp);
}
 
Desktop.selectGroup = function(group) {
currentGroup = group;
refillList();
placeElements();
 
if (currentGroup === undefined)
$('.app-item[key=0]').hide();
else
$('.app-item[key=0]').show();
}
 
var clickApp = function(e) {
var key = parseInt($(this).attr('key')) * 1;
e.preventDefault();
if (applications[key].check_online) {
OnlineChecker.checkAsync(function() {
if (!OnlineChecker.isOnline()) {
if (applications[key].licensable) {
$('#ignore_link').text('Ignore');
$('#ignore_link').attr('href', applications[key].url);
$('#lic_failed').show();
} else {
$('#ignore_link').text('Close');
$('#ignore_link').attr('href', "#");
$('#lic_failed').hide();
}
 
$('#ic_missing').modal('show');
return;
}
if (applications[key].url != "")
window.location = applications[key].url;
if (applications[key].callback !== undefined)
applications[key].callback(key);
});
} else {
if (applications[key].url != "")
window.location = applications[key].url;
if (applications[key].callback !== undefined)
applications[key].callback(key);
}
}
 
var showFeedBack = function() {
mail = "support@redpitaya.com";
subject = "Feedback Red Pitaya OS " + RedPitayaOS.getVersion();
var body = "%0D%0A%0D%0A------------------------------------%0D%0A" + "DEBUG INFO, DO NOT EDIT!%0D%0A" + "------------------------------------%0D%0A%0D%0A";
body += "Browser:" + "%0D%0A" + JSON.stringify({ parameters: $.browser }) + "%0D%0A";
document.location.href = "mailto:" + mail + "?subject=" + subject + "&body=" + body;
}
 
var overApp = function(e) {
var key = parseInt($(this).attr('key')) * 1;
$('#description').html(applications[key].description);
}
 
var leaveApp = function(e) {
$('#description').html("");
}
 
 
var onSwipe = function(ev) {
if ($('.simplePagerNav').length == 0)
return;
var rel = 1;
if (ev.direction == Hammer.DIRECTION_LEFT)
rel = parseInt($('.active-dot').parent().attr('rel')) * 1 + 1;
else if (ev.direction == Hammer.DIRECTION_RIGHT) {
var crel = parseInt($('.active-dot').parent().attr('rel')) * 1;
if (crel == 1) return;
rel = crel - 1;
}
var obj = $('.simplePageNav' + rel).find('a');
if (obj.length == 0)
return;
else obj.click();
}
 
var default_applications = [
{ id: "github", name: "Sources", description: "Access to open source code and programming instructions", url: "https://github.com/redpitaya", image: "../assets/images/github.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "applicationstore", name: "Red Pitaya Store", description: "Access to Red Pitaya official store", url: "http://store.redpitaya.com/", image: "../assets/images/shop.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "marketplace", name: "Application marketplace", description: "Access to open source and contributed applications", url: "http://bazaar.redpitaya.com/", image: "images/download_icon.png", check_online: true, licensable: false, callback: undefined, type: 'run' },
{ id: "feedback", name: "Feedback", description: "Tell us what you like or dislike and what you would like to see improved", url: "", image: "../assets/images/feedback.png", check_online: true, licensable: false, callback: showFeedBack, type: 'run' },
{ id: "instructions", name: "Instructions", description: "Quick start instructions, user manuals, specifications, examples & more.", url: "http://redpitaya.readthedocs.io/en/latest/index.html", image: "../assets/images/instr.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "tutorials", name: "Create own WEB application", description: "RedPitaya tutorials.", url: "http://redpitaya.readthedocs.io/en/latest/doc/developerGuide/software/webApps.html?highlight=own%20web%20application", image: "../assets/images/tutors.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "wifi", name: "Network manager", description: "Simple way to establish wireless connection with the Red Pitaya", url: "/network_manager/", image: "../network_manager/info/icon.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "scpi", name: "SCPI server", description: "Remote access to all Red Pitaya inputs/outputs from MATLAB/LabVIEW/Scilab/Python", url: "/scpi_manager/", image: "../scpi_manager/info/icon.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "tcpsocket", name: "TCP socket server", description: "Remote access to all Red Pitaya inputs/outputs through binary multievent socket", url: "/tcpsocket_manager/", image: "../tcpsocket_manager/info/icon.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "updater", name: "Red Pitaya OS Update", description: "Red Pitaya ecosystem updater", url: "/updater/", image: "../assets/images/updater.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "activelearning", name: "Active Learning", description: "Active Learning with Red Pitaya", url: "http://red-pitaya-active-learning.readthedocs.io/en/latest/", image: "../assets/images/active-learning.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
{ id: "jupyter", name: "Jupyter server", description: "Jupyter notebook server for running Python applications in a browser tab", url: "/jupyter/", image: "../jupyter_manager/info/icon.png", check_online: false, licensable: false, callback: undefined, type: 'run' },
];
 
var backButton = {
id: "back",
name: "Back",
description: "Return to the desktop",
url: "#",
image: "../assets/images/back_button.png",
check_online: false,
licensable: false,
callback: onBackButton,
type: 'run',
group: "",
is_group: false
 
};
 
 
$(window).resize(function($) {
refillList();
placeElements();
 
Desktop.selectGroup();
});
 
$(document).load(function($) {
Desktop.init();
});
 
$(document).ready(function($) {
var myElement = document.getElementById('main-container');
var mc = new Hammer(myElement);
mc.on('swipe', onSwipe);
$("#reboot").click(function(event) {
$('#reboot_dialog').modal("show");
});
$("#reboot_confirm").click(function(event) {
$.get('/reboot');
setTimeout(function(){ window.close(); }, 1000);
});
});
 
})(window.Desktop = window.Desktop || {}, jQuery);
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/css/style.css
0,0 → 1,278
html, body {
width: 100%;
height: 100%;
}
 
body {
color: #cdcccc;
overflow: auto;
padding-right: 0 !important;
}
 
* {
-webkit-touch-callout: none;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}
 
.clear:before, .clear:after {
content: "";
display: table;
}
 
.clear:after {
clear: both;
}
 
.modal {
 
}
 
.left-content-tcpsocket > p {
color: #48b3d2;
}
 
.left-content-tcpsocket > ul > li {
list-style-type: none;
color: #cccccc;
}
 
 
.left-content-tcpsocket > ul > li:before
{
content: "- ";
}
 
input, #info div, #info span, .selectable {
-webkit-touch-callout: text;
-webkit-user-select: text;
-khtml-user-select: text;
-moz-user-select: text;
-ms-user-select: text;
user-select: text;
}
 
input {
-webkit-user-modify: read-write-plaintext-only;
-webkit-tap-highlight-color: transparent;
}
 
button:focus, button:active, select:focus, input:focus, option:focus {
outline: 0 !important;
-webkit-appearance: none !important;
}
 
area:hover {
cursor: pointer;
}
 
.full-content {
/*min-width: 1024px;*/
margin: 0 auto;
position: relative;
}
 
.container-fluid {
margin-top: 20px;
}
 
.container {
width: 100%;
padding-left: 0px;
padding-right: 0px;
}
 
.navbar-collapse {
padding-left: 0px;
padding-right: 0px;
}
 
.navbar-collapse {
float: right;
}
 
.navbar-nav li {
width: 131px;
text-align: center;
}
 
.nav > li > a {
position: relative;
display: block;
padding: 10px 30px;
border-left: 1px solid #999;
 
}
 
.navbar-inverse .navbar-nav > li > a {
color: #cdcccc;
outline: none;
}
 
.nav > li > a:hover {
background-color: #444 !important;
color: #E5D5D5;
}
 
.navbar {
border-radius: 0px;
background-color: #343433;
background-image: linear-gradient(to bottom, #343433 0, #343433 100%);
border: 1px solid #999;
min-height: 42px;
border-left: 1px solid #999;
}
 
.back-btn {
height: 22px;
float: left;
margin: -6px 0px 0px 11px;
}
 
.logo {
margin: 5px 0px 0px 15px;
float: left;
}
 
.navbar-collapse collapse in {
width: 100%;
overflow: hidden;
}
 
.navbar-brand {
height: 40px;
}
 
.close {
color: #CAB7B7;
opacity: 1;
text-shadow: 0 0 0 !important;
}
 
.modal-content {
background-color: #343433;
border: 1px solid #999;
border-radius: 0px;
outline: 0;
}
 
#main {
margin-right: 188px;
}
 
.dialog {
margin-right: 0px;
display: none;
}
 
.close:hover, .close:focus {
color: #fff !important;
text-decoration: none;
cursor: pointer;
opacity: 1;
}
 
.btn {
background-image: none;
border: 0 solid transparent;
white-space: nowrap;
padding: 6px 12px;
line-height: 1.42857143;
border-radius: 0;
width: 100%;
background-color: transparent;
text-shadow: 0px 0px;
/* box-shadow: 0 0 0 1px #777; */
color:#cdcccc !important;
}
 
.btn:hover, btn:active {
color: #fff !important;
background-image: none;
}
 
.btn.focus {
color: #777;
border: 0px solid transparent;
}
 
.btn:active, .btn.active {
background-image: none;
background-color: #999;
color: #111 !important;
}
 
.left-tcpsocket {
float:left;
width:100%;
}
 
.left-content-tcpsocket {
margin-right:120px;
}
 
.right-tcpsocket {
float:right;
width: 120px;
margin-left: -120px;
}
 
#header {
background-color: black;
color: #CCC;
text-align: center;
padding: 6px;
overflow: hidden;
height: 30px;
width: 100%;
white-space: nowrap;
}
 
.example_button
{
margin-top: 20px;
width: 131px;
text-align: center;
list-style: none;
height: 40px;
padding-top:10px;
border: 1px solid;
}
 
.example_button:hover
{
background: gray;
cursor: pointer;
}
 
.example_button span {
color: #337ab7;
}
 
.run_buttons {
display: inline-block;
text-align: center;
border: 1px solid;
border-color: #cccccc;;
background-color: #47b2d1;
color: #000000;
margin: 0 auto;
margin-top: 15px;
margin-bottom: 15px;
font-size: 16pt;
padding: 6px 20px 6px 20px;
width: 120px;
}
 
.run_buttons:hover {
background-color: #69d4d1;
cursor: pointer;
}
 
.run_buttons a {
color: #000000;
text-decoration: none;
}
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/fpga.conf
0,0 → 1,0
/opt/redpitaya/fpga/fpga_0.94.bit
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/img/apps.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/img/dummy.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/index.html
0,0 → 1,168
<!-- $Id$
*
* Red Pitaya TCPSOCKET service manager
*
* Author: Dakus <info@eskala.eu>
*
* (c) Red Pitaya http://www.redpitaya.com
*
-->
<!DOCTYPE html>
<html lang="en">
 
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8"></meta>
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<title>Red Pitaya</title>
<link rel="stylesheet" href="../assets/bootstrap/css/bootstrap.min.css">
<link rel="stylesheet" href="../assets/popupstack.css" type="text/css" />
<link rel="stylesheet" href="../assets/help-system/help-system.css" type="text/css" />
<link rel="stylesheet" href="css/style.css?2">
<script src="../assets/jquery/jquery-2.1.3.min.js"></script>
<script src="../assets/jquery/jquery-ui.min.js"></script>
<script src="../assets/jquery/jquery.ui.touch-punch.min.js"></script>
<script src="../assets/jquery/jquery.cookie.js?3"></script>
<script src="../assets/jquery/jquery.browser.js"></script>
<script src="../assets/bootstrap/js/bootstrap.min.js"></script>
<script src="../assets/browsercheck.js?1"></script>
<script src="../assets/analytics-core.js"></script>
<script src="../assets/popupstack.js?1"></script>
<script src="../assets/help-system/help-system.js"></script>
<script src="js/help-tcpsocket.js"></script>
<script src="js/manager.js?3"></script>
<script src="js/analytics-main.js?1"></script>
</head>
 
<body>
<div id="loader-wrapper">
<div id="loader"></div>
</div>
<div id="header">
<div id="description">&nbsp;</div>
</div>
<div class="full-content">
<div class="container-fluid">
<div class="navbar navbar-inverse" role="navigation">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">T</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="navbar-brand" href="/">
<img class="back-btn" src="../assets/images/navigation_arrow_left.png">
</a>
<img class="logo" width=110 src="../assets/images/navigation_logo.png">
</div>
<div class="collapse navbar-collapse">
<ul class="nav navbar-nav">
</ul>
</div>
</div>
</div>
<div id="global_container" style="position: relative;">
<div id="main">
<div class="left-tcpsocket">
<div class="left-content-tcpsocket" style="font-size: 18pt; color: gray;">
<p>TCPSOCKET server application</p>
<ul>
<li>Enables remote control of Red Pitaya using multievent binary buffer</li>
<li>Provides access to Red Pitaya waveform sampler (fast ADC).</li>
<li>Supports WIFI or LAN remote interface</li>
</ul>
</div>
</div>
<div class="right-tcpsocket">
<br>
<br>
<br>
<img src="img/apps.png" width="200%">
</div>
<div>
<div id="label-is-runnung" align=center style="font-size: 16pt; color: red;">
TCPSOCKET server is not running, press RUN button to start it
</div>
<div id="label-is-not-runnung" align=center style="font-size: 16pt; color: green; display: none;">
TCPSOCKET server is running... (IP="<span id="ip-addr">127.0.0.1</span>", port="9930")
</div>
<div align="center">
<ul class="">
<li class="run_buttons" id="TCPSOCKET_RUN">
<a href="#" id="a_run" style="">RUN</a>
</li>
<li class="run_buttons" id="TCPSOCKET_STOP" style="display:none;">
<a href="#" id="a_stop">STOP</a>
</li>
</ul>
</div>
<div align=center>
Example about how to Control your Red Pitaya using MATLAB/Python/LabVIEW/Scilab.
Are available on link below
<div align="center">
<ul class="">
<li class="example_button" id="TCPSOCKET_EXAMPLES">
<span>Examples</span>
</li>
</ul>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div>
<div id="sys_info_view" style="display:none; position:fixed; bottom:0; left: 0; background-color: rgba(0, 0, 0, 0.2); text-align:left; padding: 5px; font-size:12px; color:white; ">
FPS:<span id="fps_view">0</span> Throughput:<span id="throughput_view">0</span> CPU Load:<span id="cpu_load">0</span>
<br/> Memory total:<span id="totalmem_view">0</span> Free:<span id="freemem_view">0</span> Usage:<span id="usagemem_view">0</span>
</div>
</div>
<div class="modal fade" id="feedback_error" tabindex="-1" role="dialog" aria-labelledby="bazaar_naLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="oops_label">Oops, something went wrong</h4>
</div>
<div class="modal-body" style="text-align: center; font-size: 18px;">
<p>Please send us the report and help us to fix this issue</p>
<p>Thank you!</p>
</div>
<div class="modal-footer">
<div class="bazaar-link" style="float: left; width: 50%;">
<a href="#" style="border: 1px solid; width: 100%" id="send_report_btn" data-dismiss="modal" class="list-group-item btn">Send report</a>
</div>
<div class="bazaar-link" style="float: left; width: 50%;">
<a href="#" style="border: 1px solid; width: 100%" id="restart_app_btn" data-dismiss="modal" class="list-group-item btn">Restart Application</a>
</div>
</div>
</div>
</div>
</div>
<div class="modal fade" id="analytics_dialog" tabindex="-1" role="dialog" aria-labelledby="bazaar_naLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title" id="bazaar_naLabel">Diagnostic & Usage</h4>
</div>
<div class="modal-body">
<p>Would you like to help Red Pitaya team to improve its product and services by occasionally providing anonymous diagnostic and usage information?</p>
</div>
<div class="modal-footer">
<div class="bazaar-link" style="float: left; width: 50%;">
<a href="#" data-dismiss="modal" id="enable_analytics" class="list-group-item btn">Yes</a>
</div>
<div class="bazaar-link" style="float: left; width: 50%;">
<a href="#" data-dismiss="modal" id="disable_analytics" class="list-group-item btn">No</a>
</div>
</div>
</div>
</div>
</div>
</body>
 
</html>
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/info/icon.png
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Added: svn:executable
+*
\ No newline at end of property
Added: svn:mime-type
+application/octet-stream
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/info/info.json
0,0 → 1,6
{
"name": "TcpSocket",
"version": "0.96-336",
"revision": "4506f6e",
"description": "Remote access and binary multievent transfer of waveforms"
}
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/js/analytics-main.js
0,0 → 1,21
//-------------------------------------------------
// Redpitaya analytics system
// Created by Alexey Kaygorodov
//-------------------------------------------------
 
(function($) {
var startUsing = 0;
$(document).ready(function($) {
AnalyticsCore.init(function(){
AnalyticsCore.sendExecTime('/tcpsocket_manager', 'tcpsocket_manager');
AnalyticsCore.sendScreenView('/tcpsocket_manager', 'Redpitaya', 'Remote control');
AnalyticsCore.sendSysInfo('/tcpsocket_manager');
startUsing = performance.now();
});
});
 
$(window).on('beforeunload', function(){
$.cookie('tcpsocket_manager-run', performance.now() - startUsing);
});
 
})(jQuery);
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/js/help-tcpsocket.js
0,0 → 1,27
var helpListTCPSOCKET =
{
idle: [
{
Text: "How to control your Red Pitaya remotely?",
URL: "http://redpitaya.com/control/",
Img: "pool"
},
{
Text: "Red Pitaya's Forum",
URL: "http://forum.redpitaya.com/",
Img: "star"
}
],
loaded: [
{
Text: "Description3",
URL: "http://redpitaya.com",
Img: "star"
},
{
Text: "Description4",
URL: "http://redpitaya.com",
Img: "pool"
}
]
};
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/js/manager.js
0,0 → 1,120
/*
* Red Pitaya TCPSOCKET service manager
*
* Author: Artem Kokos <a.kokos@integrasources.eu>
*
* (c) Red Pitaya http://www.redpitaya.com
*
*/
 
(function(TCPSOCKET, $, undefined) {
TCPSOCKET.CheckServerStatus = function() {
$.ajax({
url: '/get_tcpsocket_status',
type: 'GET',
timeout: 1500
})
.fail(function(msg) {
if (msg.responseText.split('\n')[0] == "active") {
$('#TCPSOCKET_RUN').hide();
$('#TCPSOCKET_STOP').css('display', 'block');
$('#label-is-runnung').hide();
$('#label-is-not-runnung').show();
} else {
$('#TCPSOCKET_STOP').hide();
$('#TCPSOCKET_RUN').css('display', 'block');
$('#label-is-not-runnung').hide();
$('#label-is-runnung').show();
}
})
}
 
TCPSOCKET.StartServer = function() {
$.ajax({
url: '/start_tcpsocket_manager',
type: 'GET',
timeout: 1500
})
.fail(function(msg) {
if (msg.responseText) {} else {}
})
}
 
TCPSOCKET.StopServer = function() {
$.ajax({
url: '/stop_tcpsocket_manager',
type: 'GET',
timeout: 1500
})
.fail(function(msg) {
if (msg.responseText) {} else {}
})
}
 
TCPSOCKET.GetIP = function() {
$.ajax({
url: '/get_rpip',
type: 'GET',
}).fail(function(msg) {
 
var res = msg.responseText.split(";");
 
var ethIP = res[0].match(/inet\s+\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/2[0-90]\b/);
var wlanIP = res[1].match(/inet\s+\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/2[0-90]\b/);
 
if (ethIP != null){
ethIP = ethIP[0].split(" ")[1].split("/")[0];
$('#ip-addr').text(ethIP);
}
else if (wlanIP != null){
wlanIP = wlanIP[0].split(" ")[1].split("/")[0];
$('#ip-addr').text(wlanIP);
}
else $('#ip-addr').text("None");
 
 
}).done(function(msg) {
 
var res = msg.responseText.split(";");
 
var ethIP = res[0].match(/inet\s+\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/2[0-90]\b/);
var wlanIP = res[1].match(/inet\s+\b(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\/2[0-90]\b/);
 
if (ethIP != null){
ethIP = ethIP[0].split(" ")[1].split("/")[0];
$('#ip-addr').text(ethIP);
}
else if (wlanIP != null){
wlanIP = wlanIP[0].split(" ")[1].split("/")[0];
$('#ip-addr').text(wlanIP);
}
else $('#ip-addr').text("None");
 
});
}
 
}(window.TCPSOCKET = window.TCPSOCKET || {}, jQuery));
 
 
 
 
// Page onload event handler
$(function() {
 
// Init help
Help.init(helpListTCPSOCKET);
Help.setState("idle");
 
TCPSOCKET.CheckServerStatus();
setInterval(TCPSOCKET.GetIP, 1000);
setInterval(TCPSOCKET.CheckServerStatus, 3000);
 
$('#TCPSOCKET_RUN').click(TCPSOCKET.StartServer);
 
$('#TCPSOCKET_STOP').click(TCPSOCKET.StopServer);
 
$('#TCPSOCKET_EXAMPLES').click(function(){
window.open('http://redpitaya.com/examples-new/','_blank');
});
});
Property changes:
Added: svn:executable
+*
\ No newline at end of property
/cvi/RedPitaya/sockserv/www/apps/tcpsocket_manager/nginx.conf
0,0 → 1,68
location /get_tcpsocket_status {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
default_type application/json;
 
content_by_lua '
local f = io.popen("systemctl is-active redpitaya_tcpsocket.service")
local content = f:read("*all")
f:close()
ngx.say(content)
';
}
 
location /start_tcpsocket_manager {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
default_type application/json;
 
content_by_lua '
local f = io.popen("systemctl start redpitaya_tcpsocket.service")
f:close()
ngx.say("OK")
';
}
 
location /stop_tcpsocket_manager {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
default_type application/json;
 
content_by_lua '
local f = io.popen("systemctl stop redpitaya_tcpsocket.service")
f:close()
ngx.say("OK")
';
}
 
 
 
 
 
location /get_rpip {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Credentials' 'true';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type';
default_type application/json;
 
content_by_lua '
local eth = io.popen("ip -4 addr list eth0")
local wlan = io.popen("ip addr list wlan0wext")
local eth_content = eth:read("*all")
local wlan_content = wlan:read("*all")
eth:close()
wlan:close()
ngx.say(eth_content..";"..wlan_content)
';
}
Property changes:
Added: svn:executable
+*
\ No newline at end of property