Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unify behaviour regarding virtual remotes and add query parameter #11

Merged
merged 4 commits into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 13 additions & 5 deletions xmlapi/devicelist.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,27 @@ puts -nonewline "<?xml version='1.0' encoding='ISO-8859-1' ?><deviceList>"

if {[info exists sid] && [check_session $sid]} {

set show_internal ""
set show_internal 0
set show_remote 0
catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
foreach pair $pairs {
if {0 != [regexp "^show_internal=(.*)$" $pair dummy val]} {
set show_internal $val
break
continue
}
if {0 != [regexp "^show_remote=(.*)$" $pair dummy val]} {
set show_remote $val
continue
}
}
}

array set res [rega_script {

string show_internal = "} $show_internal {";
integer show_internal = "} $show_internal {";
integer show_remote = "} $show_remote {";

integer DIR_SENDER = 1;
integer DIR_RECEIVER = 2;
Expand All @@ -35,7 +41,9 @@ if {[info exists sid] && [check_session $sid]} {
{
object oDevice = dom.GetObject(sDevId);
boolean bDevReady = oDevice.ReadyConfig();
if( (true == bDevReady) && ("HMW-RCV-50" != oDevice.HssType()) && ("HM-RCV-50" != oDevice.HssType()) )
boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) );

if( (true == bDevReady) && ( ( isRemote == false ) || ( show_remote == 1 ) ) )
{
string sDevInterfaceId = oDevice.Interface();
string sDevInterface = dom.GetObject(sDevInterfaceId).Name();
Expand All @@ -60,7 +68,7 @@ if {[info exists sid] && [check_session $sid]} {
show = true;
}

if ( show_internal == "1"){
if ( show_internal == 1){
show = true;
}

Expand Down
6 changes: 4 additions & 2 deletions xmlapi/index.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ if {[info exists sid] && [check_session $sid]} {
<tr><td><a href=./checkuptodate.cgi?sid=$sid>checkuptodate.cgi</a></td><td>????</td></tr>
<tr><td><a href=./devicelist.cgi?sid=$sid>devicelist.cgi</a></td><td><b>Lists all devices with channels. Contain names, serial number, device type and ids.</b><br/>
<i>sid=string</i> - security access token id<br/>
<i>show_internal=0/1</i> - adds internal channels also (default=0)
<i>show_internal=0/1</i> - adds internal channels also (default=0)<br/>
<i>show_remote=0/1</i> - adds output of virtual remote channels (default=0)
</td></tr>
<tr><td><a href=./devicetypelist.cgi?sid=$sid>devicetypelist.cgi</a></td><td><b>Lists all possible device types with their possible meta data.</b><br/>
<i>sid=string</i> - security access token id<br/>
Expand Down Expand Up @@ -101,7 +102,8 @@ if {[info exists sid] && [check_session $sid]} {
<tr><td><a href=./statelist.cgi?sid=$sid>statelist.cgi</a></td><td><b>Outputs all devices with channels and their current values.</b><br/>
<i>sid=string</i> - security access token id<br/>
<i>ise_id=int</i> - output only channels and values of device with specified id (e.g. "1234")<br/>
<i>show_internal=0/1</i> - adds internal channels also (default=0)
<i>show_internal=0/1</i> - adds internal channels also (default=0)<br/>
<i>show_remote=0/1</i> - adds output of virtual remote channels (default=0)
</td></tr>
<tr><td><a href=./systemNotification.cgi?sid=$sid>systemNotification.cgi</a></td><td><b>Outputs the currently existing system notifications.</b><br/>
<i>sid=string</i> - security access token id<br/>
Expand Down
10 changes: 9 additions & 1 deletion xmlapi/statelist.cgi
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ if {[info exists sid] && [check_session $sid]} {

set ise_id 0
set show_internal 0
set show_remote 0
catch {
set input $env(QUERY_STRING)
set pairs [split $input &]
Expand All @@ -21,11 +22,16 @@ if {[info exists sid] && [check_session $sid]} {
set show_internal $val
continue
}
if {0 != [regexp "^show_remote=(.*)$" $pair dummy val]} {
set show_remote $val
continue
}
}
}

set comm "var ise_id=$ise_id;\n"
append comm "var show_internal=$show_internal;\n"
append comm "var show_remote=$show_remote;\n"

if { $ise_id != 0 } then {

Expand Down Expand Up @@ -64,7 +70,9 @@ if {[info exists sid] && [check_session $sid]} {
{
object oDevice = dom.GetObject(sDevId);

if( oDevice.ReadyConfig() && (oDevice.Name() != "Zentrale") && (oDevice.Name() != "HMW-RCV-50 BidCoS-Wir") )
boolean isRemote = ( ("HMW-RCV-50" == oDevice.HssType()) || ("HM-RCV-50" == oDevice.HssType() ) );

if( oDevice.ReadyConfig() && ( ( isRemote == false ) || ( show_remote == 1 ) ) )
{
Write("<device");
Write(" name='" # oDevice.Name() # "'");
Expand Down