1
0
mirror of https://github.com/DigitalDevices/octonet.git synced 2023-10-10 13:36:52 +02:00

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 return t
end 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) upnp:SetDebug(true)
local port = 8080 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 uuid,sernbr,myip = upnp:SystemParameters("f0287290-e1e1-11e2-9a21-000000000000")
local friendlyname = GetBoxName().." DMS"
local Desc = LoadFile("dms.xml") 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 if DisableDLNA then
Desc = string.gsub(Desc,"(%<dlna:.+DOC%>)","") Desc = string.gsub(Desc,"(%<dlna:.+DOC%>)","")

View File

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

View File

@ -51,6 +51,7 @@ function OnLoad()
var infotable = document.getElementById("infotable"); var infotable = document.getElementById("infotable");
var tunertable = document.getElementById("tunertable"); var tunertable = document.getElementById("tunertable");
AddRow(infotable, new Array("FW Date",FWVersion(fwdate)) ); AddRow(infotable, new Array("FW Date",FWVersion(fwdate)) );
AddRow(infotable, new Array("MAC",Octoserve.MAC) ); AddRow(infotable, new Array("MAC",Octoserve.MAC) );
AddRow(infotable, new Array("Linux",linuxver) ); AddRow(infotable, new Array("Linux",linuxver) );
@ -106,6 +107,11 @@ function OnLoad()
document.write(" " + suffix); document.write(" " + suffix);
</script> </script>
</h1> </h1>
<h2 align="center">
<script type="text/javascript">
document.write(boxname);
</script>
</h2>
</td></tr> </td></tr>
<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> <html>
<head> <head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
@ -6,65 +6,163 @@
<link rel="stylesheet" type="text/css" href="/style.css"> <link rel="stylesheet" type="text/css" href="/style.css">
<script type="text/javascript" src="/menu.js"></script> <script type="text/javascript" src="/menu.js"></script>
<!-- Add included scripts here --> <!-- Add included scripts here -->
<script type="text/javascript" src="/systemsettings.lua"></script>
<!-- Add page scripts here --> <!-- Add page scripts here -->
<script type="text/javascript"> <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() function SaveSettings()
{ {
param = ""; if( NewSettings )
param += "telnet=" + (telnetEnabled?"1":"0"); {
param += "&"; var param = "";
param += "vlan=" + (vlanEnabled?"1":"0"); if( OldSettings.BoxName != NewSettings.BoxName )
param += "&"; {
param += "nodms=" + (nodmsEnabled?"1":"0"); if( param != "" ) param += "&";
param += "&"; param += "boxname=" + encodeURIComponent(NewSettings.BoxName);
param += "nodvbt=" + (nodvbtEnabled?"1":"0"); }
param += "&";
param += "noswitch=" + (noswitchEnabled?"1":"0"); if( OldSettings.telnetEnabled != NewSettings.telnetEnabled )
param += "&"; {
param += "strict=" + (strictEnabled?"1":"0"); 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); location.replace('/systemsettings.lua?'+param);
} }
}
function ClearSettings() function ClearSettings()
{ {
telnetEnabled = false; if( NewSettings )
vlanEnabled = false; {
nodmsEnabled = false; NewSettings.boxname = "";
nodvbtEnabled = false; NewSettings.telnetEnabled = false;
noswitchEnabled = false; NewSettings.vlanEnabled = false;
strictEnabled = false; NewSettings.nodmsEnabled = false;
NewSettings.nodvbtEnabled = false;
NewSettings.strictEnabled = false;
NewSettings.MSMode = "quad";
SaveSettings(); SaveSettings();
} }
}
function OnLoad() function OnLoad()
{ {
document.getElementById("QOSButton").checked = vlanEnabled; xmlhttp.open("GET", url, true);
document.getElementById("TelnetButton").checked = telnetEnabled; xmlhttp.send();
document.getElementById("NODMSButton").checked = nodmsEnabled;
document.getElementById("NODVBTButton").checked = nodvbtEnabled;
document.getElementById("NOSwitchButton").checked = noswitchEnabled;
document.getElementById("STRICTButton").checked = strictEnabled;
} }
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() function Change()
{ {
vlanEnabled = document.getElementById("QOSButton").checked; if( NewSettings )
telnetEnabled = document.getElementById("TelnetButton").checked; {
nodmsEnabled = document.getElementById("NODMSButton").checked; NewSettings.MSMode = document.getElementById("MSMode").value;
nodvbtEnabled = document.getElementById("NODVBTButton").checked; NewSettings.vlanEnabled = document.getElementById("QOSButton").checked;
noswitchEnabled = document.getElementById("NOSwitchButton").checked; NewSettings.telnetEnabled = document.getElementById("TelnetButton").checked;
strictEnabled = document.getElementById("STRICTButton").checked; NewSettings.nodmsEnabled = document.getElementById("NODMSButton").checked;
NewSettings.nodvbtEnabled = document.getElementById("NODVBTButton").checked;
NewSettings.strictEnabled = document.getElementById("STRICTButton").checked;
document.getElementById("SetButton").disabled = false; document.getElementById("SetButton").disabled = false;
} }
}
function SetPassword() function SetPassword()
{ {
pwd1 = document.getElementById("pwd1").value; var pwd1 = document.getElementById("pwd1").value;
pwd2 = document.getElementById("pwd2").value; var pwd2 = document.getElementById("pwd2").value;
if( pwd1 != pwd2 ) if( pwd1 != pwd2 )
{ {
document.getElementById("pwd1").value = ""; document.getElementById("pwd1").value = "";
@ -106,10 +204,18 @@ function ToggleHelp(id)
<div> <div>
<table class="tableleft" align="center" cellspacing="2px"> <table class="tableleft" align="center" cellspacing="2px">
<tr> <tr>
<td>Layer 2 Quality of Service</td> <td>Server name</td>
<td> <td style="text-align:left" colspan="2">
<form action=""> <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> </form>
</td> </td>
<td>See note: <td>See note:
@ -120,9 +226,9 @@ function ToggleHelp(id)
<tr> <tr>
<td>Telnet</td> <td>Telnet</td>
<td> <td style="text-align:right">
<form action=""> <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> </form>
</td> </td>
<td>Enable it at your own risk</td> <td>Enable it at your own risk</td>
@ -130,9 +236,9 @@ function ToggleHelp(id)
<tr> <tr>
<td>Disable DMS announcement</td> <td>Disable DMS announcement</td>
<td> <td style="text-align:right">
<form action=""> <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> </form>
</td> </td>
<td></td> <td></td>
@ -140,9 +246,9 @@ function ToggleHelp(id)
<tr> <tr>
<td>Disable DVBT announcement</td> <td>Disable DVBT announcement</td>
<td> <td style="text-align:right">
<form action=""> <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> </form>
</td> </td>
<td></td> <td></td>
@ -150,9 +256,9 @@ function ToggleHelp(id)
<tr> <tr>
<td>Enforce strict SAT>IP</td> <td>Enforce strict SAT>IP</td>
<td> <td style="text-align:right">
<form action=""> <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> </form>
</td> </td>
<td>See note: <td>See note:
@ -161,11 +267,15 @@ function ToggleHelp(id)
</td> </td>
</tr> </tr>
<tr> <tr id="trMSMode" style="display:none">
<td>Disable multiswitch emulation</td> <td>Multiswitch emulation</td>
<td> <td style="text-align:right">
<form action=""> <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> </form>
</td> </td>
<td>See note: <td>See note:
@ -251,7 +361,13 @@ function ToggleHelp(id)
<div style="position: relative; margin:20px; clear:both"> <div style="position: relative; margin:20px; clear:both">
<h3>Multiswitch emulation on OctopusNet S8</h3> <h3>Multiswitch emulation on OctopusNet S8</h3>
Multiswitch emulation allows to connect directly a Quad/Quattro LNB to the 4 inputs on the S8. 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> </div>
<div id="nosw_hlpD" onclick="ToggleHelp('nosw_hlpD')" <div id="nosw_hlpD" onclick="ToggleHelp('nosw_hlpD')"
@ -259,7 +375,13 @@ function ToggleHelp(id)
<div style="position: relative; margin:20px; clear:both"> <div style="position: relative; margin:20px; clear:both">
<h3>Multischalter-Emulation OctopusNet S8</h3> <h3>Multischalter-Emulation OctopusNet S8</h3>
Multischalter-Emulation erlaubt den direkten Anschlu&szlig; eines Quad/Quattro LNB an die S8 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> </div>
<div id="strict_hlpE" onclick="ToggleHelp('strict_hlpE')" <div id="strict_hlpE" onclick="ToggleHelp('strict_hlpE')"

View File

@ -36,6 +36,17 @@ function readattr(attr)
return value return value
end 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("HTTP/1.1 200")
http_print("Pragma: no-cache") http_print("Pragma: no-cache")
http_print("Cache-Control: 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 fwdate = \"%s\";",fwdate))
http_print(string.format("var host = \"%s\";",host)) http_print(string.format("var host = \"%s\";",host))
http_print(string.format("var suffix = \"%s\";",suffix)) 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 #!/usr/bin/lua
local url = require("socket.url")
function SaveOctoserveConf(Section,Values) function SaveOctoserveConf(Section,Values)
local ConfStart local ConfStart
local ConfEnd local ConfEnd
@ -25,10 +27,11 @@ function SaveOctoserveConf(Section,Values)
end end
function ReadSetting(name) function ReadSetting(name)
local enabled = false local enabled = "false"
local tmp = io.open("/config/"..name..".enabled","r") local tmp = io.open("/config/"..name..".enabled","r")
if tmp then if tmp then
enabled = true enabled = "true"
tmp:close()
end end
return(enabled) return(enabled)
end end
@ -46,6 +49,50 @@ function WriteSetting(name,enabled)
return enabled ~= wasenabled return enabled ~= wasenabled
end 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 host = os.getenv("HTTP_HOST")
local proto = os.getenv("SERVER_PROTOCOL") local proto = os.getenv("SERVER_PROTOCOL")
@ -79,30 +126,50 @@ if arg[1] then
end end
if query ~= "" then if query ~= "" then
query = url.unescape(query)
os.execute("echo \""..query.."\" >/tmp/query") os.execute("echo \""..query.."\" >/tmp/query")
local params = {} 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) table.insert(params,w)
os.execute("echo \""..w.."\" >>/tmp/query")
end end
-- TODO: More validation -- TODO: More validation
local nextloc = "index.html" local nextloc = "index.html"
local restart = 0; local restart = 0;
local restartdms = 0;
for _,v in ipairs(params) do for _,v in ipairs(params) do
name,value = string.match(v,"(%w+)%=(%d+)") name,value = string.match(v,"(%w+)%=(.+)")
if( WriteSetting(name,value == "1") ) then 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 if name == "telnet" then
os.execute("/etc/init.d/S91telnet restart") os.execute("/etc/init.d/S91telnet restart")
end end
if name == "vlan" then restart = 1 end if name == "vlan" then restart = 1 end
if name == "nodms" then restart = 1 end if name == "nodms" then restart = 1 end
if name == "nodvbt" 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 if name == "strict" then restart = 1 end
end
end
if restart == 1 then
os.execute("/etc/init.d/S99octo restartoctonet > /dev/null 2>&1 &")
nextloc = "wait.html?10" nextloc = "wait.html?10"
end end
if restartdms == 1 then
os.execute("/etc/init.d/S92dms restart > /dev/null 2>&1 &")
nextloc = "wait.html?10"
end end
if restart == 1 then os.execute("/etc/init.d/S99octo restartoctonet > /dev/null 2>&1 &") end
print(proto.." 303") print(proto.." 303")
print("Location: http://"..host.."/"..nextloc) print("Location: http://"..host.."/"..nextloc)
print("") print("")
@ -111,44 +178,21 @@ else
http_print(proto.." 200") http_print(proto.." 200")
http_print("Pragma: no-cache") http_print("Pragma: no-cache")
http_print("Cache-Control: 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() http_print()
if ReadSetting("telnet") then http_print('{')
http_print("telnetEnabled = true;")
else
http_print("telnetEnabled = false;")
end
if ReadSetting("vlan") then http_print(' "BoxName":"' .. GetBoxName() .. '",')
http_print("vlanEnabled = true;") http_print(' "isMaxS8":' .. CheckMaxS8() .. ',')
else http_print(' "telnetEnabled":' .. ReadSetting('telnet') .. ',')
http_print("vlanEnabled = false;") http_print(' "vlanEnabled":' .. ReadSetting('vlan') .. ',')
end http_print(' "nodmsEnabled":' .. ReadSetting('nodms') .. ',')
http_print(' "nodvbtEnabled":' .. ReadSetting('nodvbt') .. ',')
http_print(' "MSMode":"' .. GetMSMode() .. '",')
http_print(' "strictEnabled":' .. ReadSetting('strict'))
if ReadSetting("nodms") then http_print('}')
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
end end

View File

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