Setting Friendlyname for DMS and SAT>IP, define Quad,Quattro settings

This commit is contained in:
mvoelkel 2016-06-16 13:26:38 +02:00
parent 80ae9dab69
commit 33277bb1f2
7 changed files with 299 additions and 102 deletions

View File

@ -80,15 +80,25 @@ function LoadFile(fname)
return t
end
function GetBoxName()
local boxname = "OctopusNet"
local tmp = io.open("/config/boxname")
if tmp then
boxname = tmp:read("*l")
tmp:close()
end
return boxname
end
upnp:SetDebug(true)
local port = 8080
-- local RootLocation = "http://10.0.4.31:8080/dms.xml"
local uuid,sernbr,myip = upnp:SystemParameters("f0287290-e1e1-11e2-9a21-000000000000")
local friendlyname = GetBoxName().." DMS"
local Desc = LoadFile("dms.xml")
Desc = string.gsub(Desc,"##(%a+)##",{ UUID = uuid, SERNBR = sernbr, HOST = myip })
Desc = string.gsub(Desc,"##(%a+)##",{ UUID = uuid, SERNBR = sernbr, HOST = myip, FRIENDLYNAME = friendlyname })
if DisableDLNA then
Desc = string.gsub(Desc,"(%<dlna:.+DOC%>)","")

View File

@ -6,7 +6,7 @@
</specVersion>
<device>
<deviceType>urn:schemas-upnp-org:device:MediaServer:1</deviceType>
<friendlyName>OctopusNet DMS</friendlyName>
<friendlyName>##FRIENDLYNAME##</friendlyName>
<manufacturer>Digital Devices GmbH</manufacturer>
<manufacturerURL>http://www.digitaldevices.de</manufacturerURL>
<modelDescription>OctopusNet</modelDescription>

View File

@ -50,6 +50,7 @@ function OnLoad()
{
var infotable = document.getElementById("infotable");
var tunertable = document.getElementById("tunertable");
AddRow(infotable, new Array("FW Date",FWVersion(fwdate)) );
AddRow(infotable, new Array("MAC",Octoserve.MAC) );
@ -106,6 +107,11 @@ function OnLoad()
document.write(" " + suffix);
</script>
</h1>
<h2 align="center">
<script type="text/javascript">
document.write(boxname);
</script>
</h2>
</td></tr>
<tr>

View File

@ -1,4 +1,4 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ -6,65 +6,163 @@
<link rel="stylesheet" type="text/css" href="/style.css">
<script type="text/javascript" src="/menu.js"></script>
<!-- Add included scripts here -->
<script type="text/javascript" src="/systemsettings.lua"></script>
<!-- Add page scripts here -->
<script type="text/javascript">
var NewSettings = null;
var OldSettings = null;
var xmlhttp = new XMLHttpRequest();
var url = "/systemsettings.lua";
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState == 4 )
{
if( xmlhttp.status == 200 )
myFunction(xmlhttp.responseText);
}
}
function myFunction(response)
{
var settings = JSON.parse(response);
if( settings.isMaxS8 )
{
document.getElementById("trMSMode").style.display = "table-row";
if( settings.MSMode == "none" )
document.getElementById("MSMode").selectedIndex = 0;
else if( settings.MSMode == "quattro" )
document.getElementById("MSMode").selectedIndex = 2;
else
document.getElementById("MSMode").selectedIndex = 1;
}
document.getElementById("BoxName").value = settings.BoxName;
document.getElementById("QOSButton").checked = settings.vlanEnabled;
document.getElementById("TelnetButton").checked = settings.telnetEnabled;
document.getElementById("NODMSButton").checked = settings.nodmsEnabled;
document.getElementById("NODVBTButton").checked = settings.nodvbtEnabled;
document.getElementById("STRICTButton").checked = settings.strictEnabled;
document.getElementById("QOSButton").disabled = false;
document.getElementById("TelnetButton").disabled = false;
document.getElementById("NODMSButton").disabled = false;
document.getElementById("NODVBTButton").disabled = false;
document.getElementById("STRICTButton").disabled = false;
document.getElementById("BoxName").disabled = false;
document.getElementById("MSMode").disabled = false;
OldSettings = settings;
NewSettings = JSON.parse(response);
}
function SaveSettings()
{
param = "";
param += "telnet=" + (telnetEnabled?"1":"0");
param += "&";
param += "vlan=" + (vlanEnabled?"1":"0");
param += "&";
param += "nodms=" + (nodmsEnabled?"1":"0");
param += "&";
param += "nodvbt=" + (nodvbtEnabled?"1":"0");
param += "&";
param += "noswitch=" + (noswitchEnabled?"1":"0");
param += "&";
param += "strict=" + (strictEnabled?"1":"0");
location.replace('/systemsettings.lua?'+param);
if( NewSettings )
{
var param = "";
if( OldSettings.BoxName != NewSettings.BoxName )
{
if( param != "" ) param += "&";
param += "boxname=" + encodeURIComponent(NewSettings.BoxName);
}
if( OldSettings.telnetEnabled != NewSettings.telnetEnabled )
{
if( param != "" ) param += "&";
param += "telnet=" + (NewSettings.telnetEnabled?"1":"0");
}
if( OldSettings.vlanEnabled != NewSettings.vlanEnabled )
{
if( param != "" ) param += "&";
param += "vlan=" + (NewSettings.vlanEnabled?"1":"0");
}
if( OldSettings.nodmsEnabled != NewSettings.nodmsEnabled )
{
if( param != "" ) param += "&";
param += "nodms=" + (NewSettings.nodmsEnabled?"1":"0");
}
if( OldSettings.nodvbtEnabled != NewSettings.nodvbtEnabled )
{
if( param != "" ) param += "&";
param += "nodvbt=" + (NewSettings.nodvbtEnabled?"1":"0");
}
if( OldSettings.MSMode != NewSettings.MSMode )
{
if( param != "" ) param += "&";
param += "msmode=" + NewSettings.MSMode;
}
if( OldSettings.strictEnabled != NewSettings.strictEnabled )
{
if( param != "" ) param += "&";
param += "strict=" + (NewSettings.strictEnabled?"1":"0");
}
location.replace('/systemsettings.lua?'+param);
}
}
function ClearSettings()
{
telnetEnabled = false;
vlanEnabled = false;
nodmsEnabled = false;
nodvbtEnabled = false;
noswitchEnabled = false;
strictEnabled = false;
SaveSettings();
if( NewSettings )
{
NewSettings.boxname = "";
NewSettings.telnetEnabled = false;
NewSettings.vlanEnabled = false;
NewSettings.nodmsEnabled = false;
NewSettings.nodvbtEnabled = false;
NewSettings.strictEnabled = false;
NewSettings.MSMode = "quad";
SaveSettings();
}
}
function OnLoad()
{
document.getElementById("QOSButton").checked = vlanEnabled;
document.getElementById("TelnetButton").checked = telnetEnabled;
document.getElementById("NODMSButton").checked = nodmsEnabled;
document.getElementById("NODVBTButton").checked = nodvbtEnabled;
document.getElementById("NOSwitchButton").checked = noswitchEnabled;
document.getElementById("STRICTButton").checked = strictEnabled;
xmlhttp.open("GET", url, true);
xmlhttp.send();
}
function ChangeBoxName()
{
if( NewSettings )
{
var s = document.getElementById("BoxName").value;
s = s.replace(/[^a-zA-Z0-9@ ()-\/]/g,"");
document.getElementById("BoxName").value = s;
NewSettings.BoxName = document.getElementById("BoxName").value;
document.getElementById("SetButton").disabled = false;
}
}
function Change()
{
vlanEnabled = document.getElementById("QOSButton").checked;
telnetEnabled = document.getElementById("TelnetButton").checked;
nodmsEnabled = document.getElementById("NODMSButton").checked;
nodvbtEnabled = document.getElementById("NODVBTButton").checked;
noswitchEnabled = document.getElementById("NOSwitchButton").checked;
strictEnabled = document.getElementById("STRICTButton").checked;
document.getElementById("SetButton").disabled = false;
if( NewSettings )
{
NewSettings.MSMode = document.getElementById("MSMode").value;
NewSettings.vlanEnabled = document.getElementById("QOSButton").checked;
NewSettings.telnetEnabled = document.getElementById("TelnetButton").checked;
NewSettings.nodmsEnabled = document.getElementById("NODMSButton").checked;
NewSettings.nodvbtEnabled = document.getElementById("NODVBTButton").checked;
NewSettings.strictEnabled = document.getElementById("STRICTButton").checked;
document.getElementById("SetButton").disabled = false;
}
}
function SetPassword()
{
pwd1 = document.getElementById("pwd1").value;
pwd2 = document.getElementById("pwd2").value;
var pwd1 = document.getElementById("pwd1").value;
var pwd2 = document.getElementById("pwd2").value;
if( pwd1 != pwd2 )
{
document.getElementById("pwd1").value = "";
@ -106,10 +204,18 @@ function ToggleHelp(id)
<div>
<table class="tableleft" align="center" cellspacing="2px">
<tr>
<td>Layer 2 Quality of Service</td>
<td>
<td>Server name</td>
<td style="text-align:left" colspan="2">
<form action="">
<input id="QOSButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<input id="BoxName" type="text" value="" style="width: 300px" maxlength="20"
pattern="[a-zA-Z0-9@ ()-]" disabled="true" oninput="ChangeBoxName()" />
</form>
</td>
<tr>
<td>Layer 2 Quality of Service</td>
<td style="text-align:right">
<form action="">
<input id="QOSButton" type="checkbox" value="Check" disabled="true" checked="false" onclick="Change()" />
</form>
</td>
<td>See note:
@ -120,9 +226,9 @@ function ToggleHelp(id)
<tr>
<td>Telnet</td>
<td>
<td style="text-align:right">
<form action="">
<input id="TelnetButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<input id="TelnetButton" type="checkbox" value="Check" disabled="true" checked="false" onclick="Change()" />
</form>
</td>
<td>Enable it at your own risk</td>
@ -130,9 +236,9 @@ function ToggleHelp(id)
<tr>
<td>Disable DMS announcement</td>
<td>
<td style="text-align:right">
<form action="">
<input id="NODMSButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<input id="NODMSButton" type="checkbox" value="Check" disabled="true" checked="false" onclick="Change()" />
</form>
</td>
<td></td>
@ -140,9 +246,9 @@ function ToggleHelp(id)
<tr>
<td>Disable DVBT announcement</td>
<td>
<td style="text-align:right">
<form action="">
<input id="NODVBTButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<input id="NODVBTButton" type="checkbox" value="Check" disabled="true" checked="false" onclick="Change()" />
</form>
</td>
<td></td>
@ -150,9 +256,9 @@ function ToggleHelp(id)
<tr>
<td>Enforce strict SAT>IP</td>
<td>
<td style="text-align:right">
<form action="">
<input id="STRICTButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<input id="STRICTButton" type="checkbox" value="Check" disabled="true" checked="false" onclick="Change()" />
</form>
</td>
<td>See note:
@ -160,12 +266,16 @@ function ToggleHelp(id)
<a href="javascript:ToggleHelp('strict_hlpD')">Deutsch</a>
</td>
</tr>
<tr>
<td>Disable multiswitch emulation</td>
<td>
<tr id="trMSMode" style="display:none">
<td>Multiswitch emulation</td>
<td style="text-align:right">
<form action="">
<input id="NOSwitchButton" type="checkbox" value="Check" checked="false" onclick="Change()" />
<select id="MSMode" style="width: 70px" onchange="Change()" >
<option value="none">Off</option>
<option value="quad">Quad</option>
<option value="quattro">Quattro</option>
</select>
</form>
</td>
<td>See note:
@ -251,7 +361,13 @@ function ToggleHelp(id)
<div style="position: relative; margin:20px; clear:both">
<h3>Multiswitch emulation on OctopusNet S8</h3>
Multiswitch emulation allows to connect directly a Quad/Quattro LNB to the 4 inputs on the S8.
Disabling configures the S8 to a standard 4 input system
Disabling configures the S8 to a standard 4 input system.
<br/>
Use quad setting for connection to a quad LNB or to 4 outputs from a multiswitch.
<br/>
Use quattro setting for connection to a quattro LNB or to the trunk outputs from a multiswitch. Ensure to connect the VL/VH/HL/HH cables correctly.
<p/>
With the quad/quattro settings only the reception of a single satellite is supported. For full flexibility an EN50607 LNB or switch is recommended.
</div>
</div>
<div id="nosw_hlpD" onclick="ToggleHelp('nosw_hlpD')"
@ -259,7 +375,13 @@ function ToggleHelp(id)
<div style="position: relative; margin:20px; clear:both">
<h3>Multischalter-Emulation OctopusNet S8</h3>
Multischalter-Emulation erlaubt den direkten Anschlu&szlig; eines Quad/Quattro LNB an die S8
Abschalten konfiguriert die S8 als ein Standard System mit 4 Eing&auml;ngen
Abschalten konfiguriert die S8 als ein Standardsystem mit 4 Eing&auml;ngen.
<br/>
Für einen Quad LNB oder für 4 Ausg&auml;nge von einem Multiswitch Quad Einstellung ausw&auml;hlen.
<br/>
Für einen Quattro LNB oder für den Stammausgang eines Multiswitches Quattro Einstellung ausw&auml;hlen.
<p/>
In der Quad oder Quattro Einstellung wird nur der Empfang eines Satelliten unterst&uuml;tzt. Für volle Flexibilit&auml; wird der Einsatz eines EN50607 LNB bzw Switch empfohlen.
</div>
</div>
<div id="strict_hlpE" onclick="ToggleHelp('strict_hlpE')"

View File

@ -36,6 +36,17 @@ function readattr(attr)
return value
end
function GetBoxName()
local boxname = ""
local tmp = io.open("/config/boxname")
if tmp then
boxname = tmp:read("*l")
boxname = boxname:gsub("OctopusNet:","",1);
tmp:close()
end
return boxname
end
http_print("HTTP/1.1 200")
http_print("Pragma: no-cache")
http_print("Cache-Control: no-cache")
@ -83,3 +94,4 @@ http_print(string.format("var fpgatype = \"%0X\";",dev0 / 65536))
http_print(string.format("var fwdate = \"%s\";",fwdate))
http_print(string.format("var host = \"%s\";",host))
http_print(string.format("var suffix = \"%s\";",suffix))
http_print(string.format("var boxname = \"%s\";",GetBoxName()))

View File

@ -1,5 +1,7 @@
#!/usr/bin/lua
local url = require("socket.url")
function SaveOctoserveConf(Section,Values)
local ConfStart
local ConfEnd
@ -25,10 +27,11 @@ function SaveOctoserveConf(Section,Values)
end
function ReadSetting(name)
local enabled = false
local enabled = "false"
local tmp = io.open("/config/"..name..".enabled","r")
if tmp then
enabled = true
enabled = "true"
tmp:close()
end
return(enabled)
end
@ -46,6 +49,50 @@ function WriteSetting(name,enabled)
return enabled ~= wasenabled
end
function WriteConfigFile(name,value)
local f = io.open("/config/"..name,"w")
if f then
f:write(value)
f:close()
end
end
function CheckMaxS8()
local isMaxS8 = "false"
local tmp = io.open("/sys/class/ddbridge/ddbridge0/devid1")
if tmp then
devid = tmp:read("*l")
tmp:close()
if devid == "0007dd01" then
isMaxS8 = "true"
end
end
return isMaxS8
end
function GetBoxName()
local boxname = ""
local tmp = io.open("/config/boxname")
if tmp then
boxname = tmp:read("*l")
boxname = boxname:gsub("OctopusNet:","",1);
tmp:close()
end
return boxname
end
function GetMSMode()
local msmode = "quad"
local tmp = io.open("/config/msmode")
if tmp then
msmode = tmp:read("*l")
tmp:close()
elseif ReadSetting('noswitch') then
msmode = "none"
end
return msmode
end
local host = os.getenv("HTTP_HOST")
local proto = os.getenv("SERVER_PROTOCOL")
@ -79,30 +126,50 @@ if arg[1] then
end
if query ~= "" then
query = url.unescape(query)
os.execute("echo \""..query.."\" >/tmp/query")
local params = {}
for w in string.gmatch(query,"(%a%w+%=%d+%,?%d*%,?%d*)") do
for w in string.gmatch(query,"(%a%w*%=[%w %(%)%-@/]*)") do
table.insert(params,w)
os.execute("echo \""..w.."\" >>/tmp/query")
end
-- TODO: More validation
local nextloc = "index.html"
local restart = 0;
local restartdms = 0;
for _,v in ipairs(params) do
name,value = string.match(v,"(%w+)%=(%d+)")
if( WriteSetting(name,value == "1") ) then
name,value = string.match(v,"(%w+)%=(.+)")
if name == "msmode" then
os.remove("/config/noswitch.enabled")
WriteConfigFile("msmode",value);
restart = 1;
elseif name == "boxname" then
if value ~= "" then
WriteConfigFile("boxname","OctopusNet:"..value);
else
os.remove("/config/boxname")
end
restart = 1;
restartdms = 1;
elseif( WriteSetting(name,value == "1") ) then
if name == "telnet" then
os.execute("/etc/init.d/S91telnet restart")
end
if name == "vlan" then restart = 1 end
if name == "nodms" then restart = 1 end
if name == "nodvbt" then restart = 1 end
if name == "noswitch" then restart = 1 end
if name == "strict" then restart = 1 end
nextloc = "wait.html?10"
end
end
if restart == 1 then os.execute("/etc/init.d/S99octo restartoctonet > /dev/null 2>&1 &") end
if restart == 1 then
os.execute("/etc/init.d/S99octo restartoctonet > /dev/null 2>&1 &")
nextloc = "wait.html?10"
end
if restartdms == 1 then
os.execute("/etc/init.d/S92dms restart > /dev/null 2>&1 &")
nextloc = "wait.html?10"
end
print(proto.." 303")
print("Location: http://"..host.."/"..nextloc)
print("")
@ -111,44 +178,21 @@ else
http_print(proto.." 200")
http_print("Pragma: no-cache")
http_print("Cache-Control: no-cache")
http_print("Content-Type: application/x-javascript")
http_print("Content-Type: application/json; charset=utf-8")
http_print()
if ReadSetting("telnet") then
http_print("telnetEnabled = true;")
else
http_print("telnetEnabled = false;")
end
if ReadSetting("vlan") then
http_print("vlanEnabled = true;")
else
http_print("vlanEnabled = false;")
end
if ReadSetting("nodms") then
http_print("nodmsEnabled = true;")
else
http_print("nodmsEnabled = false;")
end
if ReadSetting("nodvbt") then
http_print("nodvbtEnabled = true;")
else
http_print("nodvbtEnabled = false;")
end
if ReadSetting("noswitch") then
http_print("noswitchEnabled = true;")
else
http_print("noswitchEnabled = false;")
end
if ReadSetting("strict") then
http_print("strictEnabled = true;")
else
http_print("strictEnabled = false;")
end
http_print('{')
http_print(' "BoxName":"' .. GetBoxName() .. '",')
http_print(' "isMaxS8":' .. CheckMaxS8() .. ',')
http_print(' "telnetEnabled":' .. ReadSetting('telnet') .. ',')
http_print(' "vlanEnabled":' .. ReadSetting('vlan') .. ',')
http_print(' "nodmsEnabled":' .. ReadSetting('nodms') .. ',')
http_print(' "nodvbtEnabled":' .. ReadSetting('nodvbt') .. ',')
http_print(' "MSMode":"' .. GetMSMode() .. '",')
http_print(' "strictEnabled":' .. ReadSetting('strict'))
http_print('}')
end

View File

@ -24,7 +24,10 @@ function Wait()
function OnLoad()
{
var param = document.baseURI.match(/\d+$/);
WaitCounter = 5;
if( param ) WaitCounter = parseInt(param);
document.getElementById("waitcounter").firstChild.nodeValue = WaitCounter;
window.setTimeout(Wait,1000);
}